973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1 | <script lang="ts"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2 | import MediaAttachmentView from './MediaAttachmentView.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3 | import MxcAvatar from './MxcAvatar.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import type { SendState, TimelineContent, TimelineEvent } from './types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import { senderLabel } from './types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 6 | import { formatClock, formatDay, initialsOf, senderHue } from './format'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 7 | import { findUrls } from './urls'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 8 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 9 | export let itemId: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 10 | export let event: TimelineEvent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 11 | export let showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 12 | export let reacting: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | export let onReact: (eventId: string, key: string) => void; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 14 | export let senderAvatar: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | const QUICK_KEYS = ['๐', 'โค๏ธ', '๐', '๐', '๐ฎ', '๐ข']; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | const MEMBERSHIP_LABELS: Record<string, string> = { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | Joined: 'joined the room', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | Left: 'left the room', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | Banned: 'was banned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | Unbanned: 'was unbanned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | Kicked: 'was kicked', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | KickedAndBanned: 'was kicked and banned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | Invited: 'was invited', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | InvitationAccepted: 'accepted the invite', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | InvitationRejected: 'rejected the invite', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | InvitationRevoked: 'had the invite revoked', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | Knocked: 'requested to join', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 30 | KnockAccepted: 'was let in', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 31 | KnockRetracted: 'withdrew the request to join', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 32 | KnockDenied: 'had the request to join denied' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 34 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 35 | $: name = senderLabel(event.sender); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 36 | $: displayName = event.sender.name_ambiguous ? `${name} (${event.sender.user_id})` : name; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 37 | $: interactive = event.content.kind === 'Message' || event.content.kind === 'Sticker' || event.content.kind === 'Poll'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 38 | $: previews = event.content.kind === 'Message' ? findUrls(event.content.message.body) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | function sendLabel(state: SendState): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | if (state.kind === 'Failed') return state.will_retry ? 'failed โ will retry' : 'failed โ not delivered'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | if (state.kind === 'Sending') return 'sendingโฆ'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | if (event.own && state.kind === 'Sent' && event.event_id) return 'โ sent'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | return ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 46 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 47 | function actorLabel(userId: string, name: string | null): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 48 | return name ?? userId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 50 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | function replyPreview(content: TimelineContent): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | if (content.kind === 'Message') return content.message.body; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | if (content.kind === 'Sticker') return content.body || 'Sticker'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | if (content.kind === 'Poll') return `Poll: ${content.question}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | if (content.kind === 'Redacted') return 'Message deleted'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | if (content.kind === 'UnableToDecrypt') return 'Unable to decrypt'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | return systemLine(content); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | function systemLine(content: TimelineContent): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | switch (content.kind) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | case 'Redacted': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | return 'Message deleted'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | case 'UnableToDecrypt': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | return `Message from ${displayName} could not be decrypted`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | case 'Membership': { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 67 | const who = actorLabel(content.user_id, content.display_name); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | return `${who} ${MEMBERSHIP_LABELS[content.change] ?? 'updated their membership'}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | case 'Profile': { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | const who = actorLabel(content.user_id, null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 72 | const parts: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 73 | if (content.display_name) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 74 | parts.push( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | content.display_name.new |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 76 | ? `changed their display name to "${content.display_name.new}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 77 | : 'removed their display name' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 78 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | if (content.avatar) parts.push('changed their avatar'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 81 | return `${who} ${parts.length > 0 ? parts.join(' and ') : 'updated their profile'}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 82 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 83 | case 'RoomName': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | return content.name |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | ? `${displayName} changed the room name to "${content.name}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 86 | : `${displayName} removed the room name`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 87 | case 'RoomTopic': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 88 | return content.topic |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 89 | ? `${displayName} changed the topic to "${content.topic}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 90 | : `${displayName} removed the topic`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 91 | case 'RoomAvatar': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 92 | return content.avatar ? `${displayName} changed the room avatar` : `${displayName} removed the room avatar`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 93 | case 'EncryptionEnabled': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 94 | return `${displayName} enabled encryption in this room`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 95 | case 'RoomCreated': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | return `${displayName} created the room`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | case 'RoomUpgraded': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 98 | return `${displayName} upgraded the room to a new version`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 99 | case 'OtherState': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 100 | return `${displayName} sent a state event (${content.event_type})`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | case 'Other': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | return `${displayName} sent an event (${content.event_type})`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 103 | default: |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 104 | return displayName; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 105 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 106 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 107 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 108 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 109 | <div class="msg" class:own={event.own} class:system={!interactive} data-item={itemId}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 110 | {#if showSender} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 111 | {#if senderAvatar} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 112 | <MxcAvatar mxc={senderAvatar} label={name} size={34} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 113 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 114 | <div |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 115 | class="avatar" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 116 | aria-hidden="true" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | style={`background:hsl(${senderHue(event.sender.user_id)} 35% 32%)`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | {initialsOf(name)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | <div class="avatar-spacer" aria-hidden="true"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 124 | <span class="hover-time">{formatClock(event.timestamp_ms)}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 125 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 126 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 127 | <div class="msg-body"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | {#if showSender} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | <div class="msg-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | <span class="sender" style={`color:hsl(${senderHue(event.sender.user_id)} 70% 72%)`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 131 | {displayName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 132 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 133 | <time class="time" datetime={new Date(event.timestamp_ms).toISOString()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 134 | {formatDay(event.timestamp_ms)} {formatClock(event.timestamp_ms)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 135 | </time> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 136 | {#if event.content.kind === 'Message' && event.content.message.edited} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 137 | <span class="edited" title="Edited">(edited)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 138 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 139 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 140 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 141 | {#if event.reply_to} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 142 | <div class="reply-quote"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 143 | {#if event.reply_to.details.kind === 'Ready'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 144 | Replying to {senderLabel(event.reply_to.details.sender)}: {replyPreview(event.reply_to.details.content)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 145 | {:else if event.reply_to.details.kind === 'Pending'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 146 | Loading replyโฆ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 147 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 148 | Reply unavailable |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 149 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 150 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 151 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 153 | {#if event.content.kind === 'Message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | {@const m = event.content.message} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | <p class="text" class:emote={m.kind === 'Emote'} class:notice={m.kind === 'Notice' || m.kind === 'ServerNotice'}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | {#if m.kind === 'Emote'}* {displayName} {/if}{m.body} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 157 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | {#if m.media} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 159 | <MediaAttachmentView attachment={m.media} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 161 | {#if previews.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | <div class="link-previews"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 163 | {#each previews as preview (preview.href)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 164 | <a class="link-card" href={preview.href} target="_blank" rel="noopener noreferrer"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 165 | <span class="link-host">{preview.hostname}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 166 | {#if preview.path}<span class="link-path">{preview.path}</span>{/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 167 | <span class="link-url">{preview.display}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 168 | </a> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | {:else if event.content.kind === 'Sticker'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 173 | {#if event.content.body}<p class="text">{event.content.body}</p>{/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | {#if event.content.media} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 175 | <MediaAttachmentView attachment={event.content.media} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | {:else if event.content.kind === 'Poll'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | <p class="text">๐ {event.content.question}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | <p class="system-line">{systemLine(event.content)}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | {#if interactive && event.reactions.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | <div class="reactions" aria-label="Reactions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | {#each event.reactions as r (r.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | class="reaction" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | class:mine={r.own} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | title={r.own ? 'You reacted โ activate to remove' : `${r.count} reaction${r.count === 1 ? '' : 's'}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | disabled={!event.event_id || reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | on:click={() => event.event_id && onReact(event.event_id, r.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | <span aria-hidden="true">{r.key}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 195 | <span class="count">{r.count}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | {#if interactive} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | <div class="msg-foot"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | {#if sendLabel(event.send_state)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | <span class="sendstate" class:failed={event.send_state.kind === 'Failed'}>{sendLabel(event.send_state)}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | {#if event.read_by.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | <span class="readby" title={event.read_by.join(', ')}>โโ {event.read_by.length}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | {#if event.event_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | <span class="quick-react" role="group" aria-label={`React to message from ${displayName}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | {#each QUICK_KEYS as key (key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 211 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 213 | title={`React ${key}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | aria-label={`React ${key} to message from ${displayName}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 215 | disabled={reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | on:click={() => onReact(event.event_id ?? '', key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | {key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | <style> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | .msg { display: flex; gap: 10px; padding: 3px 0; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 230 | .msg:hover { background: rgba(255, 255, 255, 0.018); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 231 | .msg:hover .hover-time { opacity: 1; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 232 | .msg-foot { display: flex; align-items: center; gap: 8px; min-height: 18px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 233 | .sendstate { font-size: 11px; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 234 | .sendstate.failed { color: var(--danger); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 235 | .link-previews { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 236 | .link-card { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 237 | display: flex; flex-direction: column; gap: 1px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | border: 1px solid var(--border); border-radius: 8px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | background: var(--bg-soft); padding: 8px 10px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | text-decoration: none; color: var(--text); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | .link-card:hover { border-color: var(--accent); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | .link-host { font-size: 12.5px; font-weight: 650; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | .link-path { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | .link-url { font-size: 11.5px; color: var(--accent); overflow-wrap: anywhere; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | .avatar { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | flex: none; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | width: 34px; height: 34px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | border-radius: 50%; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 250 | display: grid; place-items: center; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | font-size: 12px; font-weight: 700; color: #fff; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 252 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | .avatar-spacer { flex: none; width: 34px; padding-top: 2px; text-align: center; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | .hover-time { opacity: 0; font-size: 10.5px; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | .msg-body { min-width: 0; flex: 1; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | .msg-head { display: flex; align-items: baseline; gap: 8px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | .sender { font-weight: 650; font-size: 13.5px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | .time, .edited { color: var(--muted); font-size: 11.5px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | .reply-quote { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | border-left: 2px solid var(--accent); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 261 | padding: 2px 8px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 262 | margin: 2px 0 4px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 263 | color: var(--muted); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | font-size: 12.5px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | background: var(--bg-soft); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | border-radius: 0 6px 6px 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 267 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 268 | .text { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 269 | margin: 1px 0 2px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 270 | font-size: 14px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 271 | line-height: 1.5; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 272 | white-space: pre-wrap; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 273 | overflow-wrap: anywhere; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 274 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | .text.emote { font-style: italic; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | .text.notice { color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | .system-line { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 1px 0; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | .msg.system { opacity: 0.85; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | .reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | .reaction { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 281 | display: inline-flex; align-items: center; gap: 4px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 282 | background: var(--bg-soft); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 283 | border: 1px solid var(--border); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 284 | border-radius: 999px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | padding: 1px 8px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | font-size: 13px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | color: var(--text); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | cursor: pointer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | .reaction.mine { border-color: var(--accent); background: rgba(88, 101, 242, 0.16); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | .reaction:disabled { cursor: default; opacity: 0.85; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | .msg-foot { display: flex; align-items: center; gap: 8px; min-height: 18px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | .readby { font-size: 11px; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | .msg:hover .quick-react, .msg:focus-within .quick-react { display: inline-flex; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | .quick-react button { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | background: transparent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | border: 1px solid transparent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | border-radius: 6px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | cursor: pointer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 300 | font-size: 13px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 301 | padding: 0 3px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 302 | opacity: 0.75; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 303 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 304 | .quick-react button:hover:not(:disabled) { opacity: 1; border-color: var(--border); background: var(--bg-soft); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 305 | .quick-react button:disabled { opacity: 0.4; cursor: default; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 306 | </style> |