about summary refs log tree commit diff
path: root/MatrixUtils.Web/Shared/TimelineComponents/TimelineMessageItem.razor
blob: 98b5a6d29e9cc9fb20acbabec40c45128bfe147b (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
@using ArcaneLibs.Extensions
@using LibMatrix.EventTypes.Spec
@inherits BaseTimelineItem

<span>
    @if (!HasPreviousMessage) {
        <span><InlineUserItem User="@CurrentSenderProfile" Homeserver="@Homeserver" UserId="@Event.StateKey"></InlineUserItem>:</span><br/>
    }
    @switch (currentEventContent.MessageType) {
        case "m.text": {
            @foreach (var line in currentEventContent.Body.Split('\n')) {
                <span>@line</span><br/>
            }
            break;
        }
        case "m.image": {
            <i>@currentEventContent.Body</i><br/>
            @* <img src="@Homeserver.ResolveMediaUri(currentEventContent.Url)"> *@
            break;
        }
        default: {
            <pre>
               @Event.RawContent?.ToJson(indent: false)
            </pre>
            break;
        }
    }
</span>

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

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