about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared
diff options
context:
space:
mode:
authorEmma@Rory& <root@rory.gay>2023-09-15 09:55:36 +0200
committerEmma@Rory& <root@rory.gay>2023-09-15 09:55:36 +0200
commite10fa389ce3c4d42deadfec8bf08c2fbb1a88d79 (patch)
tree1e2f8d8de07c6037ac4aa20be3b54ac43c2d7f2e /MatrixRoomUtils.Web/Shared
parentCode cleanup (diff)
downloadMatrixUtils-e10fa389ce3c4d42deadfec8bf08c2fbb1a88d79.tar.xz
Refactors
Diffstat (limited to 'MatrixRoomUtils.Web/Shared')
-rw-r--r--MatrixRoomUtils.Web/Shared/InlineUserItem.razor9
-rw-r--r--MatrixRoomUtils.Web/Shared/ModalWindow.razor86
-rw-r--r--MatrixRoomUtils.Web/Shared/ModalWindow.razor.css70
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomList.razor5
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor15
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor2
-rw-r--r--MatrixRoomUtils.Web/Shared/RoomListItem.razor15
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor38
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor29
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css5
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor20
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor29
-rw-r--r--MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor72
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor3
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor10
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomCreateItem.razor5
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor1
-rw-r--r--MatrixRoomUtils.Web/Shared/UserListItem.razor2
19 files changed, 38 insertions, 379 deletions
diff --git a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor

index db66309..af2fa29 100644 --- a/MatrixRoomUtils.Web/Shared/InlineUserItem.razor +++ b/MatrixRoomUtils.Web/Shared/InlineUserItem.razor
@@ -2,6 +2,7 @@ @using LibMatrix.StateEventTypes.Spec @using LibMatrix @using LibMatrix.Helpers +@using LibMatrix.Homeservers <div style="background-color: #ffffff11; border-radius: 0.5em; height: 1em; display: inline-block; vertical-align: middle;" alt="@UserId"> <img style="@(ChildContent is not null ? "vertical-align: baseline;" : "vertical-align: top;") width: 1em; height: 1em; border-radius: 50%;" src="@ProfileAvatar"/> <span style="position: relative; top: -5px;">@ProfileName</span> @@ -20,10 +21,10 @@ public RenderFragment? ChildContent { get; set; } [Parameter] - public ProfileResponseEventData User { get; set; } + public ProfileResponseEventContent User { get; set; } [Parameter] - public ProfileResponseEventData MemberEvent { get; set; } + public ProfileResponseEventContent MemberEvent { get; set; } [Parameter] public string? UserId { get; set; } @@ -35,7 +36,7 @@ public string? ProfileName { get; set; } = null; [Parameter] - public AuthenticatedHomeServer? HomeServer { get; set; } + public AuthenticatedHomeserverGeneric? HomeServer { get; set; } private static SemaphoreSlim _semaphoreSlim = new(128); @@ -50,7 +51,7 @@ throw new ArgumentNullException(nameof(UserId)); if (MemberEvent != null) { - User = new ProfileResponseEventData { + User = new ProfileResponseEventContent { AvatarUrl = MemberEvent.AvatarUrl, DisplayName = MemberEvent.DisplayName }; diff --git a/MatrixRoomUtils.Web/Shared/ModalWindow.razor b/MatrixRoomUtils.Web/Shared/ModalWindow.razor deleted file mode 100644
index beb7198..0000000 --- a/MatrixRoomUtils.Web/Shared/ModalWindow.razor +++ /dev/null
@@ -1,86 +0,0 @@ -@using LibMatrix.Extensions -<div class="r-modal" style="top: @(_y)px; left: @(_x)px;"> - <div class="titlebar" @onmousedown="MouseDown" @onmouseup="MouseUp" @onmousemove="MouseMove" @onmouseleave="MouseMove"> - <b class="title" @ref="_titleRef">@Title</b> - <button class="btnclose" @onclick="OnCloseClicked">X</button> - <button class="btncollapse" @onclick="@(() => Collapsed = !Collapsed)">_</button> - </div> - <div class="r-modal-content" style="@((Collapsed ? "height: 0px;" : "") + $"min-width: {MinWidth}px;")"> - @ChildContent - </div> -</div> - -@code { - - [Parameter] - public RenderFragment? ChildContent { get; set; } - - [Parameter] - public string Title { get; set; } = "Untitled window"; - - [Parameter] - public double X { get; set; } = 60; - - [Parameter] - public double Y { get; set; } = 60; - - [Parameter] - public double MinWidth { get; set; } = 100; - - [Parameter] - public Action OnCloseClicked { get; set; } - - [Parameter] - public bool Collapsed { get; set; } = false; - - private ElementReference _titleRef; - - private double _x = 60; - private double _y = 60; - - protected override async Task OnInitializedAsync() { - _x = X; - _y = Y; - await base.OnInitializedAsync(); - } - - protected override async Task OnAfterRenderAsync(bool firstRender) { - //set minwidth to title width - MinWidth = await JSRuntime.InvokeAsync<int>("getWidth", _titleRef) + 75; - await base.OnAfterRenderAsync(firstRender); - } - - private void WindowDrag(DragEventArgs obj) { - Console.WriteLine("Drag: " + obj.ToJson()); - - _x += obj.MovementX; - _y += obj.MovementY; - - StateHasChanged(); - } - - private bool isDragging = false; - private double dragX = 0; - private double dragY = 0; - - private void MouseDown(MouseEventArgs obj) { - isDragging = true; - dragX = obj.ClientX; - dragY = obj.ClientY; - } - - private void MouseUp(MouseEventArgs obj) { - isDragging = false; - } - - private void MouseMove(MouseEventArgs obj) { - if (!isDragging) return; - - _x += obj.ClientX - dragX; - _y += obj.ClientY - dragY; - dragX = obj.ClientX; - dragY = obj.ClientY; - StateHasChanged(); - } - -} diff --git a/MatrixRoomUtils.Web/Shared/ModalWindow.razor.css b/MatrixRoomUtils.Web/Shared/ModalWindow.razor.css deleted file mode 100644
index 6d08114..0000000 --- a/MatrixRoomUtils.Web/Shared/ModalWindow.razor.css +++ /dev/null
@@ -1,70 +0,0 @@ -.r-modal { - position: absolute; - width: fit-content; - height: fit-content; - z-index: 1000; -} -.r-modal:hover { - z-index: 1001; -} - -.r-modal > .titlebar { - position: absolute; - display: block; - top: 0; - left: 0; - width: 100%; - height: 25px; - background-color: #000; - user-select: none; -} - -.r-modal > .titlebar > .title { - position: relative; - top: 0; - left: 0; - width: fit-content; - text-wrap: nowrap; - height: 100%; - line-height: 25px; - padding-left: 10px; - color: #fff; -} - -.r-modal > .titlebar > .btnclose { - position: absolute; - top: 0; - right: 0; - width: 25px; - height: 100%; - line-height: 25px; - text-align: center; - color: #fff; - background-color: #111; - cursor: pointer; -} -.r-modal > .titlebar > .btncollapse { - position: absolute; - top: 0; - right: 25px; - width: 25px; - height: 100%; - line-height: 25px; - text-align: center; - color: #fff; - background-color: #111; - cursor: pointer; -} - -.r-modal > .r-modal-content { - position: relative; - top: 25px; - left: 0; - width: fit-content; - height: fit-content; - min-width: 150px; - max-width: 75vw; - max-height: 75vh; - overflow: auto; - background-color: #111; -} diff --git a/MatrixRoomUtils.Web/Shared/RoomList.razor b/MatrixRoomUtils.Web/Shared/RoomList.razor
index 3b057a4..b0548cb 100644 --- a/MatrixRoomUtils.Web/Shared/RoomList.razor +++ b/MatrixRoomUtils.Web/Shared/RoomList.razor
@@ -3,6 +3,7 @@ @using LibMatrix.StateEventTypes.Spec @using LibMatrix @using LibMatrix.Extensions +@using ArcaneLibs.Extensions @if(Rooms.Count != RoomsWithTypes.Sum(x=>x.Value.Count)) { <p>Fetching room details... @RoomsWithTypes.Sum(x=>x.Value.Count) out of @Rooms.Count done!</p> @foreach (var category in RoomsWithTypes.OrderBy(x => x.Value.Count)) { @@ -20,7 +21,7 @@ else { [Parameter] public List<RoomInfo> Rooms { get; set; } [Parameter] - public ProfileResponseEventData? GlobalProfile { get; set; } + public ProfileResponseEventContent? GlobalProfile { get; set; } Dictionary<string, List<RoomInfo>> RoomsWithTypes = new(); @@ -51,7 +52,7 @@ else { await _semaphoreSlim.WaitAsync(); string roomType; try { - var createEvent = (await room.GetStateEvent("m.room.create")).TypedContent as RoomCreateEventData; + var createEvent = (await room.GetStateEvent("m.room.create")).TypedContent as RoomCreateEventContent; roomType = GetRoomTypeName(createEvent.Type); if (roomType == "Room") { diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
index 381ecd1..d717186 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListCategory.razor
@@ -2,18 +2,19 @@ @using MatrixRoomUtils.Web.Classes.Constants @using LibMatrix.StateEventTypes.Spec @using LibMatrix +@using LibMatrix.Homeservers <details> <summary>@roomType (@rooms.Count)</summary> @foreach (var room in rooms) { <div class="room-list-item"> <RoomListItem RoomInfo="@room" ShowOwnProfile="@(roomType == "Room")"></RoomListItem> @* @if (RoomVersionDangerLevel(room) != 0 && *@ - @* (room.StateEvents.FirstOrDefault(x=>x.Type == "m.room.power_levels")?.TypedContent is RoomPowerLevelEventData powerLevels && powerLevels.UserHasPermission(HomeServer.UserId, "m.room.tombstone"))) { *@ + @* (room.StateEvents.FirstOrDefault(x=>x.Type == "m.room.power_levels")?.TypedContent is RoomPowerLevelEventContent powerLevels && powerLevels.UserHasPermission(HomeServer.UserId, "m.room.tombstone"))) { *@ @* <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton Color="@(RoomVersionDangerLevel(room) == 2 ? "#ff0000" : "#ff8800")" href="@($"/Rooms/Create?Import={room.Room.RoomId}")">Upgrade room</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton> *@ @* } *@ - <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/Timeline")">View timeline</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton> - <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/View")">View state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton> - <MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/Edit")">Edit state</MatrixRoomUtils.Web.Shared.SimpleComponents.LinkButton> + <LinkButton href="@($"/Rooms/{room.Room.RoomId}/Timeline")">View timeline</LinkButton> + <LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/View")">View state</LinkButton> + <LinkButton href="@($"/Rooms/{room.Room.RoomId}/State/Edit")">Edit state</LinkButton> @if (roomType == "Space") { <RoomListSpace Space="@room"></RoomListSpace> @@ -29,10 +30,10 @@ public KeyValuePair<string, List<RoomInfo>> Category { get; set; } [Parameter] - public ProfileResponseEventData? GlobalProfile { get; set; } + public ProfileResponseEventContent? GlobalProfile { get; set; } [CascadingParameter] - public AuthenticatedHomeServer HomeServer { get; set; } = null!; + public AuthenticatedHomeserverGeneric Homeserver { get; set; } = null!; private string roomType => Category.Key; private List<RoomInfo> rooms => Category.Value; @@ -40,7 +41,7 @@ private int RoomVersionDangerLevel(RoomInfo room) { var roomVersion = room.StateEvents.FirstOrDefault(x => x.Type == "m.room.create"); if (roomVersion is null) return 0; - return roomVersion.TypedContent is not RoomCreateEventData roomVersionContent ? 0 + return roomVersion.TypedContent is not RoomCreateEventContent roomVersionContent ? 0 : RoomConstants.DangerousRoomVersions.Contains(roomVersionContent.RoomVersion) ? 2 : roomVersionContent.RoomVersion != RoomConstants.RecommendedRoomVersion ? 1 : 0; } diff --git a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
index 0867b48..1b54577 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListComponents/RoomListSpace.razor
@@ -30,7 +30,7 @@ protected override async Task OnInitializedAsync() { if (Breadcrumbs == null) throw new ArgumentNullException(nameof(Breadcrumbs)); await Task.Delay(Random.Shared.Next(1000, 10000)); - var rooms = Space.Room.AsSpace.GetRoomsAsync(); + var rooms = Space.Room.AsSpace.GetChildrenAsync(); await foreach (var room in rooms) { if (Breadcrumbs.Contains(room.RoomId)) continue; var roomInfo = KnownRooms.FirstOrDefault(x => x.Room.RoomId == room.RoomId); diff --git a/MatrixRoomUtils.Web/Shared/RoomListItem.razor b/MatrixRoomUtils.Web/Shared/RoomListItem.razor
index 79844ef..b74643b 100644 --- a/MatrixRoomUtils.Web/Shared/RoomListItem.razor +++ b/MatrixRoomUtils.Web/Shared/RoomListItem.razor
@@ -1,6 +1,7 @@ @using System.Text.Json @using LibMatrix @using LibMatrix.Helpers +@using LibMatrix.Homeservers @using LibMatrix.RoomTypes @using LibMatrix.StateEventTypes.Spec @using LibMatrix.StateEventTypes @@ -44,10 +45,10 @@ public bool ShowOwnProfile { get; set; } = false; [Parameter] - public RoomMemberEventData? OwnMemberState { get; set; } + public RoomMemberEventContent? OwnMemberState { get; set; } [CascadingParameter] - public ProfileResponseEventData? GlobalProfile { get; set; } + public ProfileResponseEventContent? GlobalProfile { get; set; } private string? roomName { get; set; } @@ -57,7 +58,7 @@ private bool hasDangerousRoomVersion { get; set; } = false; private static SemaphoreSlim _semaphoreSlim = new(8); - private static AuthenticatedHomeServer? hs { get; set; } + private static AuthenticatedHomeserverGeneric? hs { get; set; } protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); @@ -102,7 +103,7 @@ private async Task LoadOwnProfile() { if (!ShowOwnProfile) return; try { - OwnMemberState ??= (await RoomInfo.GetStateEvent("m.room.member", hs.UserId)).TypedContent as RoomMemberEventData; + OwnMemberState ??= (await RoomInfo.GetStateEvent("m.room.member", hs.UserId)).TypedContent as RoomMemberEventContent; GlobalProfile ??= await hs.GetProfile(hs.UserId); } catch (MatrixException e) { @@ -117,7 +118,7 @@ } private async Task CheckRoomVersion() { - var ce = (await RoomInfo.GetStateEvent("m.room.create")).TypedContent as RoomCreateEventData; + var ce = (await RoomInfo.GetStateEvent("m.room.create")).TypedContent as RoomCreateEventContent; if (int.TryParse(ce.RoomVersion, out var rv)) { if (rv < 10) hasOldRoomVersion = true; @@ -133,9 +134,9 @@ private async Task GetRoomInfo() { try { - roomName ??= ((await RoomInfo.GetStateEvent("m.room.name"))?.TypedContent as RoomNameEventData)?.Name ?? RoomId; + roomName ??= ((await RoomInfo.GetStateEvent("m.room.name"))?.TypedContent as RoomNameEventContent)?.Name ?? RoomId; - var state = (await RoomInfo.GetStateEvent("m.room.avatar")).TypedContent as RoomAvatarEventData; + var state = (await RoomInfo.GetStateEvent("m.room.avatar")).TypedContent as RoomAvatarEventContent; if (state?.Url is { } url) { roomIcon = MediaResolver.ResolveMediaUri(hs.FullHomeServerDomain, url); // Console.WriteLine($"Got avatar for room {RoomId}: {roomIcon} ({url})"); diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor deleted file mode 100644
index afd1fdc..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/DictionaryEditor.razor +++ /dev/null
@@ -1,38 +0,0 @@ -@using LibMatrix.Extensions -<table> - @foreach (var i in Items.Keys) { - var key = i; - <input value="@Items[key]" @oninput="obj => inputChanged(obj, key)"> - <button @onclick="() => { Items.Remove(key); ItemsChanged.InvokeAsync(); }">Remove</button> - <br/> - } -</table> -<button @onclick="() => { Items.Add(string.Empty, default); ItemsChanged.InvokeAsync(); }">Add</button> - -@code { - - [Parameter] - public Dictionary<string, object> Items { get; set; } = new(); - - [Parameter] - [EditorRequired] - public EventCallback ItemsChanged { get; set; } - - [Parameter] - public Func<string, string>? KeyFormatter { get; set; } - - [Parameter] - public Action? OnFocusLost { get; set; } - - protected override Task OnInitializedAsync() { - Console.WriteLine($"DictionaryEditor initialized with {Items.Count} items: {Items.ToJson()}"); - return base.OnInitializedAsync(); - } - - private void inputChanged(ChangeEventArgs obj, string key) { - Console.WriteLine($"StringListEditor inputChanged {key} {obj.Value}"); - Items[key] = obj.Value.ToString(); - ItemsChanged.InvokeAsync(); - } - -} diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor deleted file mode 100644
index 966c44d..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor +++ /dev/null
@@ -1,29 +0,0 @@ -@inject IJSRuntime JsRuntime -@if (isVisible) { - <input autofocus type="@(IsPassword ? "password" : "text")" @bind="Value" @onfocusout="() => { isVisible = false; ValueChanged.InvokeAsync(Value); }" @ref="elementToFocus"/> -} -else { - <span class="fancy-textbox-inline" tabindex="0" style="@(string.IsNullOrEmpty(Value) ? "min-width: 50px;" : "")" @onfocusin="() => isVisible = true">@(Formatter?.Invoke(Value) ?? (IsPassword ? string.Join("", Value.Select(x => '*')) : Value))</span> -} - -@code { - - [Parameter] - public string Value { get; set; } - - [Parameter] - public bool IsPassword { get; set; } = false; - - [Parameter] - public EventCallback<string> ValueChanged { get; set; } - - [Parameter] - public Func<string?, string>? Formatter { get; set; } - - private bool isVisible { get; set; } = false; - - private ElementReference elementToFocus; - - protected override async Task OnAfterRenderAsync(bool firstRender) => await JsRuntime.InvokeVoidAsync("BlazorFocusElement", elementToFocus); - -} \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css b/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css deleted file mode 100644
index 01b2c6f..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/FancyTextBox.razor.css +++ /dev/null
@@ -1,5 +0,0 @@ -.fancy-textbox-inline { - border-bottom: #ccc solid 1px; - height: 1.4em; - display: inline-block; -} \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor deleted file mode 100644
index b800989..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/LinkButton.razor +++ /dev/null
@@ -1,20 +0,0 @@ -<a href="@href" class="btn btn-primary" @onclick="@(() => OnClick?.Invoke())" - style="background-color: @(Color ?? "#1b6ec2");"> - @ChildContent -</a> - -@code { - - [Parameter] - public string? href { get; set; } - - [Parameter] - public RenderFragment ChildContent { get; set; } - - [Parameter] - public string? Color { get; set; } - - [Parameter] - public Func<Task>? OnClick { get; set; } - -} diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor deleted file mode 100644
index 2bd6ed5..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/StringListEditor.razor +++ /dev/null
@@ -1,29 +0,0 @@ -@for (var i = 0; i < Items.Count; i++) { - var self = i; - <button @onclick="() => { Items.RemoveAt(self); ItemsChanged.InvokeAsync(); }">Remove</button> - <FancyTextBox Value="@Items[self]" ValueChanged="@(obj => inputChanged(obj, self))"/> - <br/> -} -<button @onclick="() => { Items.Add(string.Empty); ItemsChanged.InvokeAsync(); }">Add</button> - -@code { - - [Parameter] - public List<string> Items { get; set; } = new(); - - [Parameter] - [EditorRequired] - public EventCallback ItemsChanged { get; set; } - - protected override Task OnInitializedAsync() { - Console.WriteLine($"StringListEditor initialized with {Items.Count} items: {string.Join(",", Items)}"); - return base.OnInitializedAsync(); - } - - private void inputChanged(string obj, int i) { - Console.WriteLine($"StringListEditor inputChanged {i} {obj}"); - Items[i] = obj; - ItemsChanged.InvokeAsync(); - } - -} \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor b/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor deleted file mode 100644
index 1a38e26..0000000 --- a/MatrixRoomUtils.Web/Shared/SimpleComponents/ToggleSlider.razor +++ /dev/null
@@ -1,72 +0,0 @@ -<input type="checkbox"/><span>@ChildContent</span> - -<div class="container"> - <label class="switch" for="checkbox"> - <input type="checkbox" id="checkbox" @bind="Value"/> - <div class="slider round"></div> - </label> -</div> - -<style> - .switch { - display: inline-block; - height: 16px; - position: relative; - width: 32px; - } - - .switch input { - display:none; - } - - .slider { - background-color: #ccc; - bottom: 0; - cursor: pointer; - left: 0; - position: absolute; - right: 0; - top: 0; - transition: .4s; - } - - .slider:before { - background-color: #fff; - bottom: -5px; - content: ""; - height: 26px; - left: -8px; - position: absolute; - transition: .4s; - width: 26px; - } - - input:checked + .slider { - background-color: #66bb6a; - } - - input:checked + .slider:before { - transform: translateX(24px); - } - - .slider.round { - border-radius: 24px; - } - - .slider.round:before { - border-radius: 50%; - } -</style> - -@code { - - [Parameter] - public RenderFragment? ChildContent { get; set; } - - [Parameter] - public bool Value { get; set; } - - [Parameter] - public EventCallback<bool> ValueChanged { get; set; } - -} \ No newline at end of file diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor
index 5172fa4..e4ee873 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/BaseTimelineItem.razor
@@ -1,5 +1,6 @@ @using LibMatrix.Responses @using LibMatrix +@using LibMatrix.Homeservers <h3>BaseTimelineItem</h3> @code { @@ -11,6 +12,6 @@ public List<StateEventResponse> Events { get; set; } [Parameter] - public AuthenticatedHomeServer HomeServer { get; set; } + public AuthenticatedHomeserverGeneric Homeserver { get; set; } } diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
index d67fdab..c450211 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
@@ -1,6 +1,6 @@ -@using LibMatrix.StateEventTypes @using LibMatrix.StateEventTypes.Spec @using LibMatrix.Extensions +@using ArcaneLibs.Extensions @inherits BaseTimelineItem @if (roomMemberData is not null) { @@ -15,7 +15,7 @@ <i>@Event.StateKey changed their display name to @(roomMemberData.Displayname ?? Event.Sender)</i> break; case "join": - <i><InlineUserItem User="@(new ProfileResponseEventData())" HomeServer="@HomeServer" UserId="@Event.StateKey"></InlineUserItem> joined</i> + <i><InlineUserItem User="@(new ProfileResponseEventContent())" HomeServer="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> joined</i> break; case "leave": <i>@Event.StateKey left</i> @@ -26,8 +26,8 @@ default: <i>@Event.StateKey has an unknown state:</i> <pre> - @Event.ToJson() - </pre> + @Event.ToJson() + </pre> break; } } @@ -42,6 +42,6 @@ else { @code { - private RoomMemberEventData? roomMemberData => Event.TypedContent as RoomMemberEventData; + private RoomMemberEventContent? roomMemberData => Event.TypedContent as RoomMemberEventContent; } diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
index 13cce88..5dd87e0 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
@@ -1,4 +1,5 @@ @using LibMatrix.Extensions +@using ArcaneLibs.Extensions @inherits BaseTimelineItem <pre> diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomCreateItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomCreateItem.razor
index 8053a47..9c48455 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomCreateItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomCreateItem.razor
@@ -1,10 +1,11 @@ @using LibMatrix.StateEventTypes.Spec @using LibMatrix.Extensions +@using ArcaneLibs.Extensions @inherits BaseTimelineItem <p> @Event.Sender created the room with room version @CreationEventContent.RoomVersion - @CreationEventContent.Federate ? "and" : "without" federating with other servers.<br/> + @(CreationEventContent.Federate ?? false ? "and" : "without") federating with other servers.<br/> This room is of type @(CreationEventContent.Type ?? "Untyped room (usually a chat room)") </p> <pre> @@ -13,6 +14,6 @@ @code { - private RoomCreateEventData CreationEventContent => Event.TypedContent as RoomCreateEventData; + private RoomCreateEventContent CreationEventContent => Event.TypedContent as RoomCreateEventContent; } diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
index 8166f8a..69845d9 100644 --- a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor +++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
@@ -1,4 +1,5 @@ @using LibMatrix.Extensions +@using ArcaneLibs.Extensions @inherits BaseTimelineItem <div> diff --git a/MatrixRoomUtils.Web/Shared/UserListItem.razor b/MatrixRoomUtils.Web/Shared/UserListItem.razor
index a85a68d..7a55380 100644 --- a/MatrixRoomUtils.Web/Shared/UserListItem.razor +++ b/MatrixRoomUtils.Web/Shared/UserListItem.razor
@@ -19,7 +19,7 @@ public RenderFragment? ChildContent { get; set; } [Parameter] - public ProfileResponseEventData User { get; set; } + public ProfileResponseEventContent User { get; set; } [Parameter] public string UserId { get; set; }