about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
diff options
context:
space:
mode:
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor')
-rw-r--r--MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor42
1 files changed, 42 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