From f6956dfaa03f1409c29329d45e58284963ed5a17 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Fri, 26 May 2023 04:23:26 +0200 Subject: [PATCH] Added chatting --- Otakians/App.razor | 13 +++++++- Otakians/MainLayout.razor | 13 ++++---- Otakians/Pages/Chatting.razor | 49 ++++++++++++++++++++++------- Otakians/Program.cs | 2 ++ Otakians/Services/MessageService.cs | 48 ++++++++++++++++++++++++++++ Otakians/_Imports.razor | 2 +- Otakians/wwwroot/index.html | 2 -- 7 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 Otakians/Services/MessageService.cs diff --git a/Otakians/App.razor b/Otakians/App.razor index cd766ec..cfd595f 100644 --- a/Otakians/App.razor +++ b/Otakians/App.razor @@ -11,11 +11,22 @@ +@**@ @code { - private MudTheme _theme = new(); + //public static MudTheme MyCustomTheme = new MudTheme() + // { + // PaletteDark = new PaletteDark() + // { + // Dark = Colors.Pink.Lighten3, + // Background = Colors.Pink.Lighten1, + // AppbarBackground = Colors.Pink.Darken4, + // DrawerBackground = Colors.Pink.Darken4, + // Surface = Colors.Pink.Lighten2, + // } + //}; private bool _isDarkMode = true; } \ No newline at end of file diff --git a/Otakians/MainLayout.razor b/Otakians/MainLayout.razor index 9f465e6..5faed85 100644 --- a/Otakians/MainLayout.razor +++ b/Otakians/MainLayout.razor @@ -8,7 +8,7 @@ - Clear cookies + Debug button @if (!isLoggedIn) { @@ -28,7 +28,6 @@ Posts Chat - Community @@ -37,7 +36,7 @@ { - Logout + Logout } @@ -45,8 +44,8 @@ { - Sign-in - Sign-up + Sign-in + Sign-up } @@ -245,6 +244,7 @@ protected override async Task OnInitializedAsync() { + StateHasChanged(); CheckLoggedin(); } @@ -253,10 +253,9 @@ string? name = await localStorage.GetItemAsStringAsync("User"); if (name == null) return; - Snackbar.Add("Successfully logged in!", Severity.Success); - Program.LoggedInName = name; isLoggedIn = true; + Snackbar.Add($"Successfully logged in as: {Program.LoggedInName}.", Severity.Success); StateHasChanged(); } diff --git a/Otakians/Pages/Chatting.razor b/Otakians/Pages/Chatting.razor index 3ab1971..7de093c 100644 --- a/Otakians/Pages/Chatting.razor +++ b/Otakians/Pages/Chatting.razor @@ -3,6 +3,8 @@ @inject NavigationManager NavManager @inject HttpClient Http @inject IJSRuntime JSRuntime +@inject ISnackbar Snackbar +@inject MessageService messageService