about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/TimelineComponents/TimelineRoomTopicItem.razor
blob: 7ef17a8b81868ec7242e4519aa6b93a125e0086d (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
@using ArcaneLibs.Extensions
@using LibMatrix.EventTypes.Spec.State
@using LibMatrix.Responses
@inherits BaseTimelineItem

@if (currentEventContent is not null) {
    @if (previousEventContent is null) {
        <i><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> set the room topic to</i><br/>
        <pre>
            @currentEventContent.Topic
        </pre>
    }
    else {
        <i><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem> changed the room topic from</i><br/>
        <pre>
            @previousEventContent.Topic
        </pre><br/>
        <i>to</i><br/>
        <pre>
            @currentEventContent.Topic
        </pre>
    }
}
else {
    <details>
        <summary>Unknown event @Event.Type (@Event.StateKey)</summary>
        <pre>
            @Event.ToJson()
        </pre>
    </details>
}

@code {
    private RoomTopicEventContent? previousEventContent => PreviousState?.TypedContent as RoomTopicEventContent;

    private RoomTopicEventContent? currentEventContent => Event.TypedContent as RoomTopicEventContent;
}