diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-30 03:36:58 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-06-30 03:36:58 +0200 |
commit | bb8c2637af3b7982e7a4b2fd15e2fbec613d0848 (patch) | |
tree | b8075ba7e507aad3f96f354712ad920ac421e474 /MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor | |
parent | Update stuff (diff) | |
download | MatrixUtils-bb8c2637af3b7982e7a4b2fd15e2fbec613d0848.tar.xz |
Todays progress
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor')
-rw-r--r-- | MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor b/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor deleted file mode 100644 index 975da43..0000000 --- a/MatrixRoomUtils.Web/Shared/IndexComponents/IndexUserItem.razor +++ /dev/null @@ -1,54 +0,0 @@ -@using MatrixRoomUtils.Core.Extensions -@inject ILocalStorageService LocalStorage -@inject NavigationManager NavigationManager - -<div style="margin-bottom: 1em;"> - <img style="border-radius: 50%; height: 3em; width: 3em;" src="@_avatarUrl"/> - <p style="margin-left: 1em; margin-top: -0.5em; display: inline-block;"> - <input type="radio" name="csa" checked="@(RuntimeCache.LastUsedToken == User.AccessToken)" onclick="@SetCurrent" style="text-decoration-line: unset;"/> - <b>@User.Profile.DisplayName</b> on <b>@User.LoginResponse.HomeServer</b> - <a href="#" onclick="@RemoveUser">Remove</a> - </p> - <p style="margin-top: -1.5em; margin-left: 4em;">Member of @_roomCount rooms</p> - -</div> - -@code { - - [Parameter] - public UserInfo User { get; set; } = null!; - - private string? _avatarUrl { get; set; } - private int _roomCount { get; set; } = 0; - - protected override async Task OnInitializedAsync() { - await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage); - - if (User.Profile.AvatarUrl != null && User.Profile.AvatarUrl != "") - _avatarUrl = RuntimeCache.CurrentHomeServer.ResolveMediaUri(User.Profile.AvatarUrl); - else _avatarUrl = "https://api.dicebear.com/6.x/identicon/svg?seed=" + User.LoginResponse.UserId; - try { - _roomCount = (await RuntimeCache.CurrentHomeServer.GetJoinedRooms()).Count; - } - catch { - _roomCount = -1; - } - await base.OnInitializedAsync(); - } - - private async Task RemoveUser() { - Console.WriteLine(User.ToJson()); - RuntimeCache.LoginSessions.Remove(User.AccessToken); - - StateHasChanged(); - } - - private async Task SetCurrent() { - RuntimeCache.LastUsedToken = User.AccessToken; - //RuntimeCache.CurrentHomeserver = await MatrixAuth.ResolveHomeserverFromWellKnown(LocalStorageWrapper.LoginSessions[Token].LoginResponse.HomeServer); - await LocalStorageWrapper.SaveToLocalStorage(LocalStorage); - await LocalStorageWrapper.InitialiseRuntimeVariables(LocalStorage); - StateHasChanged(); - } - -} \ No newline at end of file |