From 41c5a84dacfd036b8d8f01f72226ac5a519995e3 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 14 May 2024 17:49:09 +0200 Subject: Organise tools somewhat, set proper icons for nav menu --- .../Client/ClientComponents/ClientRoomList.razor | 15 -------- .../Client/ClientComponents/ClientStatusList.razor | 35 ------------------ .../Client/ClientComponents/ClientSyncWrapper.cs | 41 ---------------------- .../Client/ClientComponents/MatrixClient.razor | 31 ---------------- 4 files changed, 122 deletions(-) delete mode 100644 MatrixUtils.Web/Pages/Client/ClientComponents/ClientRoomList.razor delete mode 100644 MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor delete mode 100644 MatrixUtils.Web/Pages/Client/ClientComponents/ClientSyncWrapper.cs delete mode 100644 MatrixUtils.Web/Pages/Client/ClientComponents/MatrixClient.razor (limited to 'MatrixUtils.Web/Pages/Client/ClientComponents') diff --git a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientRoomList.razor b/MatrixUtils.Web/Pages/Client/ClientComponents/ClientRoomList.razor deleted file mode 100644 index 845f30d..0000000 --- a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientRoomList.razor +++ /dev/null @@ -1,15 +0,0 @@ -@using ClientContext = MatrixUtils.Web.Pages.Client.Index.ClientContext -@* user header and room list *@ -@foreach (var room in Data.SyncWrapper.Rooms) { - - @room.RoomName - -
-} - -@code { - - [Parameter] - public ClientContext Data { get; set; } = null!; - -} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor b/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor deleted file mode 100644 index 1100c98..0000000 --- a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor +++ /dev/null @@ -1,35 +0,0 @@ -@using ClientContext = MatrixUtils.Web.Pages.Client.Index.ClientContext; -@using System.Collections.ObjectModel - -@foreach (var ctx in Data) { -
-        @ctx.Homeserver.UserId - @ctx.SyncWrapper.Status
-    
-} - -@code { - - [Parameter] - public ObservableCollection Data { get; set; } = null!; - - protected override void OnInitialized() { - Data.CollectionChanged += (_, e) => { - foreach (var item in e.NewItems?.Cast() ?? []) { - item.SyncWrapper.PropertyChanged += (_, pe) => { - if (pe.PropertyName == nameof(item.SyncWrapper.Status)) - StateHasChanged(); - }; - } - - StateHasChanged(); - }; - - Data.ToList().ForEach(ctx => { - ctx.SyncWrapper.PropertyChanged += (_, pe) => { - if (pe.PropertyName == nameof(ctx.SyncWrapper.Status)) - StateHasChanged(); - }; - }); - } - -} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientSyncWrapper.cs b/MatrixUtils.Web/Pages/Client/ClientComponents/ClientSyncWrapper.cs deleted file mode 100644 index 16051b8..0000000 --- a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientSyncWrapper.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.ObjectModel; -using ArcaneLibs; -using LibMatrix; -using LibMatrix.Helpers; -using LibMatrix.Homeservers; -using LibMatrix.Responses; -using MatrixUtils.Abstractions; - -namespace MatrixUtils.Web.Pages.Client.ClientComponents; - -public class ClientSyncWrapper(AuthenticatedHomeserverGeneric homeserver) : NotifyPropertyChanged { - private SyncHelper _syncHelper = new SyncHelper(homeserver) { - MinimumDelay = TimeSpan.FromMilliseconds(2000), - IsInitialSync = false - }; - private string _status = "Loading..."; - - public ObservableCollection AccountData { get; set; } = new(); - public ObservableCollection Rooms { get; set; } = new(); - - public string Status { - get => _status; - set => SetField(ref _status, value); - } - - public async Task Start() { - Task.Yield(); - var resp = _syncHelper.EnumerateSyncAsync(); - Status = $"[{DateTime.Now:s}] Syncing..."; - await foreach (var response in resp) { - Task.Yield(); - Status = $"[{DateTime.Now:s}] {response.Rooms?.Join?.Count ?? 0 + response.Rooms?.Invite?.Count ?? 0 + response.Rooms?.Leave?.Count ?? 0} rooms, {response.AccountData?.Events?.Count ?? 0} account data, {response.ToDevice?.Events?.Count ?? 0} to-device, {response.DeviceLists?.Changed?.Count ?? 0} device lists, {response.Presence?.Events?.Count ?? 0} presence updates"; - await HandleSyncResponse(response); - await Task.Yield(); - } - } - - private async Task HandleSyncResponse(SyncResponse resp) { - - } -} \ No newline at end of file diff --git a/MatrixUtils.Web/Pages/Client/ClientComponents/MatrixClient.razor b/MatrixUtils.Web/Pages/Client/ClientComponents/MatrixClient.razor deleted file mode 100644 index b4a81f7..0000000 --- a/MatrixUtils.Web/Pages/Client/ClientComponents/MatrixClient.razor +++ /dev/null @@ -1,31 +0,0 @@ -@using Index = MatrixUtils.Web.Pages.Client.Index -@using MatrixUtils.Web.Pages.Client.ClientComponents - -
-
-
- -
-
- @if (Data.SelectedRoom != null) { - - - } - else { -

No room selected

- } -
- @if (Data.SelectedRoom != null) { -
- -
- } -
-
- -@code { - - [Parameter] - public Index.ClientContext Data { get; set; } = null!; - -} \ No newline at end of file -- cgit 1.5.1