about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/TimelineComponents
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/TimelineComponents')
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor42
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor11
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor21
3 files changed, 74 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
new file mode 100644
index 0000000..3803d38
--- /dev/null
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
@@ -0,0 +1,42 @@
+@using MatrixRoomUtils.Core.Extensions
+@if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "ban")
+{
+    <i>@Event.StateKey was banned</i>
+}
+else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "invite")
+{
+    <i>@Event.StateKey was invited</i>
+}
+else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "join")
+{
+    @if (Event.ReplacesState != null)
+    {
+        <i>@Event.StateKey changed their display name to @(Event.ContentAsJsonNode["displayname"]!.GetValue<string>())</i>
+    }
+    else
+    {
+        <i><InlineUserItem UserId="@Event.StateKey"></InlineUserItem> joined</i>
+    }
+}
+else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "leave")
+{
+    <i>@Event.StateKey left</i>
+}
+else if (Event.ContentAsJsonNode["membership"]!.GetValue<string>() == "knock")
+{
+    <i>@Event.StateKey knocked</i>
+}
+else
+{
+    <i>@Event.StateKey has an unknown state:</i>
+    <pre>
+        @Event.ToJson()
+    </pre>
+}
+
+@code {
+
+    [Parameter]
+    public StateEvent Event { get; set; }
+
+}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
new file mode 100644
index 0000000..8d688ea
--- /dev/null
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
@@ -0,0 +1,11 @@
+@using MatrixRoomUtils.Core.Extensions
+<pre>
+    @ObjectExtensions.ToJson(Event.Content, indent: false)
+</pre>
+
+@code {
+
+    [Parameter]
+    public StateEventResponse Event { get; set; }
+
+}
\ No newline at end of file
diff --git a/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
new file mode 100644
index 0000000..f78bdc9
--- /dev/null
+++ b/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineUnknownItem.razor
@@ -0,0 +1,21 @@
+@using MatrixRoomUtils.Core.Extensions
+<div>
+
+    <details style="display: inline;">
+        <summary>
+            <i style="color: red;">
+                Unknown event type: <pre style="display: inline;">@Event.Type</pre>
+            </i>
+        </summary>
+        <pre>
+           @Event.ToJson()
+        </pre>
+    </details>
+</div>
+
+@code {
+
+    [Parameter]
+    public StateEvent Event { get; set; }
+
+}
\ No newline at end of file