about summary refs log tree commit diff
path: root/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor')
-rw-r--r--MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor35
1 files changed, 35 insertions, 0 deletions
diff --git a/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor b/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor
new file mode 100644
index 0000000..1100c98
--- /dev/null
+++ b/MatrixUtils.Web/Pages/Client/ClientComponents/ClientStatusList.razor
@@ -0,0 +1,35 @@
+@using ClientContext = MatrixUtils.Web.Pages.Client.Index.ClientContext;
+@using System.Collections.ObjectModel
+
+@foreach (var ctx in Data) {
+    <pre>
+        @ctx.Homeserver.UserId - @ctx.SyncWrapper.Status
+    </pre>
+}
+
+@code {
+
+    [Parameter]
+    public ObservableCollection<ClientContext> Data { get; set; } = null!;
+
+    protected override void OnInitialized() {
+        Data.CollectionChanged += (_, e) => {
+            foreach (var item in e.NewItems?.Cast<ClientContext>() ?? []) {
+                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