about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineMemberItem.razor
blob: 3803d389733c92c301b2edb489587fd9c74b4b6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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; }

}