| | | 1 | | @using Chronicis.Client.Services |
| | | 2 | | |
| | 0 | 3 | | @if (_isLoading) |
| | | 4 | | { |
| | | 5 | | <div class="d-flex justify-center pa-4"> |
| | | 6 | | <MudProgressCircular Indeterminate="true" Size="Size.Medium" Color="Color.Primary" /> |
| | | 7 | | </div> |
| | | 8 | | } |
| | 0 | 9 | | else if (_user != null) |
| | | 10 | | { |
| | | 11 | | <div class="d-flex flex-column flex-sm-row gap-4 align-start mb-4"> |
| | 0 | 12 | | @if (!string.IsNullOrEmpty(_user.AvatarUrl)) |
| | | 13 | | { |
| | | 14 | | <MudAvatar Size="Size.Large" Class="profile-avatar"> |
| | | 15 | | <MudImage Src="@_user.AvatarUrl" Alt="@_user.DisplayName" /> |
| | | 16 | | </MudAvatar> |
| | | 17 | | } |
| | | 18 | | else |
| | | 19 | | { |
| | | 20 | | <MudAvatar Size="Size.Large" Color="Color.Primary" Class="profile-avatar profile-avatar--initials"> |
| | 0 | 21 | | @(_user.DisplayName?.FirstOrDefault()) |
| | | 22 | | </MudAvatar> |
| | | 23 | | } |
| | | 24 | | |
| | | 25 | | <div class="flex-grow-1"> |
| | | 26 | | <MudText Typo="Typo.h5" Color="Color.Primary" Style="font-weight: 600;"> |
| | 0 | 27 | | @_user.DisplayName |
| | | 28 | | </MudText> |
| | | 29 | | <MudText Typo="Typo.body1" Class="mud-text-secondary mt-1"> |
| | 0 | 30 | | @_user.Email |
| | | 31 | | </MudText> |
| | | 32 | | </div> |
| | | 33 | | </div> |
| | | 34 | | |
| | | 35 | | <MudDivider Class="my-4" /> |
| | | 36 | | |
| | | 37 | | <MudText Typo="Typo.subtitle2" Color="Color.Primary" Class="mb-2" Style="font-weight: 600;"> |
| | | 38 | | Account Information |
| | | 39 | | </MudText> |
| | | 40 | | |
| | | 41 | | <MudText Typo="Typo.body2" Class="mud-text-secondary"> |
| | | 42 | | Your profile information is managed through your authentication provider. |
| | | 43 | | To update your display name or avatar, please update it in your |
| | | 44 | | connected account (Google, Discord, etc.) and sign in again. |
| | | 45 | | </MudText> |
| | | 46 | | } |
| | | 47 | | else |
| | | 48 | | { |
| | | 49 | | <MudAlert Severity="Severity.Warning"> |
| | | 50 | | Unable to load profile information. Please try refreshing the page. |
| | | 51 | | </MudAlert> |
| | | 52 | | } |
| | | 53 | | |
| | | 54 | | @code { |
| | 0 | 55 | | [Inject] private IAuthService AuthService { get; set; } = default!; |
| | | 56 | | |
| | | 57 | | private UserInfo? _user; |
| | 0 | 58 | | private bool _isLoading = true; |
| | | 59 | | |
| | | 60 | | protected override async Task OnInitializedAsync() |
| | | 61 | | { |
| | 0 | 62 | | _isLoading = true; |
| | | 63 | | try |
| | | 64 | | { |
| | 0 | 65 | | _user = await AuthService.GetCurrentUserAsync(); |
| | 0 | 66 | | } |
| | | 67 | | finally |
| | | 68 | | { |
| | 0 | 69 | | _isLoading = false; |
| | | 70 | | } |
| | 0 | 71 | | } |
| | | 72 | | } |