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'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 4 | import Emoji from './Emoji.svelte'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 5 | import EmojiText from './EmojiText.svelte'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 6 | import MessageText from './MessageText.svelte'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 7 | import ReactionPicker from './ReactionPicker.svelte'; |
b8ab00377c20 | atagen | 2026-10-22 05:13 UTC | 8 | import LinkCard from './LinkCard.svelte'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 9 | import { mediaUrl, messageMediaUrl } from './api'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 10 | import type { ImagePack, LinkPreview, Person, QuickReaction, ReplyReference, SendState, TimelineContent, TimelineEvent } from './types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 11 | import { senderLabel } from './types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 12 | import { formatClock, formatDay, initialsOf, senderHue } from './format'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | import { findUrls } from './urls'; |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 14 | import { mentionsFromHtml, resolveMentions, stripMarkdownPills } from './mentions'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | export let itemId: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | export let event: TimelineEvent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | export let showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | export let reacting: boolean; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 20 | export let onReact: (eventId: string, key: string, shortcode?: string) => void; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | export let senderAvatar: string | null = null; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 22 | export let quickReactions: QuickReaction[] = []; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 23 | export let packs: ImagePack[] = []; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 24 | export let onQuickChange: (list: QuickReaction[]) => void = () => {}; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 25 | export let linkPreviews: Record<string, LinkPreview | null> = {}; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 26 | export let loadPreview: ((url: string) => void) | null = null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 27 | export let people: Record<string, Person> = {}; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 28 | export let onReply: ((target: ReplyReference) => void) | null = null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 29 | export let onJump: ((eventId: string) => void) | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 30 | export let onEdit: ((eventId: string, body: string) => void) | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 31 | export let editing = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 32 | export let showSent = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 33 | export let self: string | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 34 | export let onUser: ((userId: string, x: number, y: number, menu: boolean) => void) | null = null; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 35 | export let onCloneSticker: ((eventId: string, body: string, x: number, y: number) => void) | null = null; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 36 | export let onMore: ((event: TimelineEvent, x: number, y: number) => void) | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 37 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 38 | function openUser(ev: MouseEvent, menu: boolean): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 39 | if (!onUser) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 40 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 41 | onUser(event.sender.user_id, menu ? ev.clientX : rect.left, menu ? ev.clientY : rect.bottom + 4, menu); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 42 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 44 | const PICKER_WIDTH = 320; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 45 | const PICKER_HEIGHT = 380; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 46 | const PICKER_MARGIN = 8; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 47 | const MAX_READERS = 3; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 48 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 49 | let row: HTMLDivElement; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 50 | let pickerPop: HTMLDivElement | undefined; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 51 | let selected = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 52 | let pickerOpen = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 53 | let pickerStyle = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | const MEMBERSHIP_LABELS: Record<string, string> = { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | Joined: 'joined the room', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | Left: 'left the room', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | Banned: 'was banned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | Unbanned: 'was unbanned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | Kicked: 'was kicked', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | KickedAndBanned: 'was kicked and banned', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | Invited: 'was invited', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | InvitationAccepted: 'accepted the invite', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | InvitationRejected: 'rejected the invite', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | InvitationRevoked: 'had the invite revoked', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | Knocked: 'requested to join', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 67 | KnockAccepted: 'was let in', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | KnockRetracted: 'withdrew the request to join', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | KnockDenied: 'had the request to join denied' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 72 | $: name = senderLabel(event.sender); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 73 | $: displayName = event.sender.name_ambiguous ? `${name} (${event.sender.user_id})` : name; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 74 | $: readers = event.read_by.map((id) => people[id] ?? { user_id: id, name: id, avatar: null }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | $: interactive = event.content.kind === 'Message' || event.content.kind === 'Sticker' || event.content.kind === 'Poll'; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 76 | $: message = event.content.kind === 'Message' ? event.content.message : null; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 77 | $: stripped = stripMarkdownPills(message ? (message.media ? message.media.caption : message.body) ?? '' : ''); |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 78 | $: linked = message ? [...mentionsFromHtml(message.formatted_body), ...stripped.mentions] : []; |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 79 | $: mentions = resolveMentions(stripped.text, linked); |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 80 | $: mentionsMe = self !== null && [...linked, ...mentions].some((m) => m.user_id === self); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 81 | $: previews = findUrls(stripped.text); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 82 | $: bundled = message ? message.link_previews : []; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 83 | $: cards = previews |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 84 | .map((link) => ({ link, preview: bundled.find((b) => b.url === link.href) ?? linkPreviews[link.href] ?? null })) |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 85 | .filter((c) => c.preview && (c.preview.title || c.preview.description || c.preview.image)); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 86 | $: if (loadPreview) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 87 | for (const link of previews) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 88 | if (!bundled.some((b) => b.url === link.href) && !(link.href in linkPreviews)) loadPreview(link.href); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 89 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 90 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 91 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 92 | function sendLabel(state: SendState): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 93 | if (state.kind === 'Failed') return state.will_retry ? 'failed — will retry' : 'failed — not delivered'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 94 | if (state.kind === 'Sending') return 'sending…'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 95 | if (showSent && event.own && state.kind === 'Sent' && event.event_id) return '✓ sent'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | return ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 98 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 99 | function toggleSelected(e: MouseEvent) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 100 | if (!interactive || (e.target as Element).closest('a, button, input, video, audio, .picker-pop')) return; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 101 | selected = !selected; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 102 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 103 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 104 | function deselectOutside(e: PointerEvent) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 105 | if (selected && !pickerOpen && !row.contains(e.target as Node)) selected = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 106 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 107 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 108 | function openPicker(e: MouseEvent) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 109 | if (pickerOpen) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 110 | pickerOpen = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 111 | return; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 112 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 113 | const rect = (e.currentTarget as HTMLElement).getBoundingClientRect(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 114 | const height = Math.min(PICKER_HEIGHT, window.innerHeight - 2 * PICKER_MARGIN); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 115 | const below = window.innerHeight - rect.bottom - PICKER_MARGIN >= height; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 116 | const top = below ? rect.bottom + 4 : Math.max(PICKER_MARGIN, rect.top - height - 4); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 117 | const maxLeft = window.innerWidth - PICKER_WIDTH - PICKER_MARGIN; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 118 | const left = Math.max(PICKER_MARGIN, Math.min(rect.right - PICKER_WIDTH, maxLeft)); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 119 | pickerStyle = `top:${top}px;left:${left}px;height:${height}px`; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 120 | selected = true; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 121 | pickerOpen = true; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 122 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 123 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 124 | function closePicker() { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 125 | pickerOpen = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 126 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 127 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 128 | function isImageKey(key: string): boolean { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 129 | return key.startsWith('mxc://') || packs.some((p) => p.images.some((i) => i.reaction_key === key)); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 130 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 131 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 132 | function react(key: string, shortcode: string | null) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 133 | if (shortcode && isImageKey(key)) onReact(event.event_id ?? '', key, shortcode); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 134 | else onReact(event.event_id ?? '', key); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 135 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 136 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 137 | function reply() { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 138 | if (!event.event_id || !onReply) return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 139 | onReply({ |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 140 | event_id: event.event_id, |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 141 | details: { kind: 'Ready', sender: event.sender, content: event.content, timestamp_ms: event.timestamp_ms } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 142 | }); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 143 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 144 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 145 | $: editableBody = |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 146 | event.own && event.editable && event.event_id && event.content.kind === 'Message' && event.content.message.kind === 'Text' |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 147 | ? event.content.message.body |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 148 | : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 149 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 150 | function edit() { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 151 | if (!event.event_id || editableBody === null || !onEdit) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 152 | onEdit(event.event_id, editableBody); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 153 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 154 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 155 | function reactorNames(senders: string[]): string { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 156 | const names = senders.map((id) => people[id]?.name ?? id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 157 | if (names.length <= 12) return names.join(', '); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 158 | return `${names.slice(0, 12).join(', ')} and ${names.length - 12} more`; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 159 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 160 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 161 | function pick(key: string, shortcode: string | null) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 162 | pickerOpen = false; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 163 | react(key, shortcode); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 164 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 165 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 166 | function closeOnScroll(e: Event) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 167 | if (pickerOpen && !pickerPop?.contains(e.target as Node)) pickerOpen = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 168 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 169 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | function actorLabel(userId: string, name: string | null): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | return name ?? userId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 173 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | function replyPreview(content: TimelineContent): string { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 175 | if (content.kind === 'Message') return stripMarkdownPills(content.message.body).text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | if (content.kind === 'Sticker') return content.body || 'Sticker'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | if (content.kind === 'Poll') return `Poll: ${content.question}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | if (content.kind === 'Redacted') return 'Message deleted'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | if (content.kind === 'UnableToDecrypt') return 'Unable to decrypt'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | return systemLine(content); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | function systemLine(content: TimelineContent): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | switch (content.kind) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | case 'Redacted': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | return 'Message deleted'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | case 'UnableToDecrypt': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | return `Message from ${displayName} could not be decrypted`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | case 'Membership': { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | const who = actorLabel(content.user_id, content.display_name); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | return `${who} ${MEMBERSHIP_LABELS[content.change] ?? 'updated their membership'}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | case 'Profile': { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | const who = actorLabel(content.user_id, null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 195 | const parts: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | if (content.display_name) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | parts.push( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | content.display_name.new |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | ? `changed their display name to "${content.display_name.new}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | : 'removed their display name' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | if (content.avatar) parts.push('changed their avatar'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | return `${who} ${parts.length > 0 ? parts.join(' and ') : 'updated their profile'}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | case 'RoomName': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | return content.name |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | ? `${displayName} changed the room name to "${content.name}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | : `${displayName} removed the room name`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | case 'RoomTopic': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 211 | return content.topic |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | ? `${displayName} changed the topic to "${content.topic}"` |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 213 | : `${displayName} removed the topic`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | case 'RoomAvatar': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 215 | return content.avatar ? `${displayName} changed the room avatar` : `${displayName} removed the room avatar`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | case 'EncryptionEnabled': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | return `${displayName} enabled encryption in this room`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | case 'RoomCreated': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | return `${displayName} created the room`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | case 'RoomUpgraded': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | return `${displayName} upgraded the room to a new version`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | case 'OtherState': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | return `${displayName} sent a state event (${content.event_type})`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | case 'Other': |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | return `${displayName} sent an event (${content.event_type})`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | default: |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | return displayName; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 230 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 231 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 232 | <svelte:window |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 233 | on:pointerdown={deselectOutside} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 234 | on:keydown={(e) => e.key === 'Escape' && (selected = false)} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 235 | on:scroll|capture={closeOnScroll} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 236 | on:resize={closePicker} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 237 | /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 238 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 239 | <!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions --> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 240 | <div |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 241 | class="msg" |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 242 | class:own={event.own} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 243 | class:editing |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 244 | class:mentioned={mentionsMe} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 245 | class:system={!interactive} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 246 | class:has-readers={interactive && readers.length > 0} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 247 | class:selected |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 248 | data-item={itemId} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 249 | data-event={event.event_id} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 250 | bind:this={row} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 251 | on:click={toggleSelected} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 252 | > |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 253 | {#if interactive && event.event_id} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 254 | <div class="actions" role="toolbar" aria-label={`Actions for message from ${displayName}`}> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 255 | {#each quickReactions as r (r.key)} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 256 | {@const label = r.shortcode ? `:${r.shortcode}:` : r.key} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 257 | <button |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 258 | type="button" |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 259 | title={`React ${label}`} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 260 | aria-label={`React ${label} to message from ${displayName}`} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 261 | disabled={reacting} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 262 | on:click={() => react(r.key, r.shortcode)} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 263 | > |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 264 | {#if r.key.startsWith('mxc://')} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 265 | <img class="emote" src={mediaUrl(r.key) ?? ''} alt="" /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 266 | {:else} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 267 | <Emoji emoji={r.key} size={18} /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 268 | {/if} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 269 | </button> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 270 | {/each} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 271 | <button |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 272 | type="button" |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 273 | title="Add reaction" |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 274 | aria-label={`Add reaction to message from ${displayName}`} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 275 | aria-haspopup="dialog" |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 276 | aria-expanded={pickerOpen} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 277 | on:pointerdown|stopPropagation |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 278 | on:click={openPicker} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 279 | > |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 280 | ☺+ |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 281 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 282 | {#if onCloneSticker && event.content.kind === 'Sticker'} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 283 | {@const stickerBody = event.content.body} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 284 | {@const stickerId = event.event_id} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 285 | <button |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 286 | type="button" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 287 | title="Clone sticker" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 288 | aria-label="Clone sticker to one of your packs" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 289 | on:click|stopPropagation={(ev) => onCloneSticker?.(stickerId, stickerBody, ev.clientX, ev.clientY)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 290 | > |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 291 | ⧉ |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 292 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 293 | {/if} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 294 | {#if onReply} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 295 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 296 | type="button" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 297 | title="Reply" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 298 | aria-label={`Reply to message from ${displayName}`} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 299 | on:click|stopPropagation={reply} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 300 | > |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 301 | ↩ |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 302 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 303 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 304 | {#if onEdit && editableBody !== null} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 305 | <button type="button" title="Edit" aria-label="Edit your message" on:click|stopPropagation={edit}> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 306 | ✎ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 307 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 308 | {/if} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 309 | {#if onMore} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 310 | <button |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 311 | type="button" |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 312 | title="More" |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 313 | aria-label={`More actions for message from ${displayName}`} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 314 | aria-haspopup="menu" |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 315 | on:click|stopPropagation={(ev) => onMore?.(event, ev.clientX, ev.clientY)} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 316 | > |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 317 | ⋯ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 318 | </button> |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 319 | {/if} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 320 | </div> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 321 | {#if pickerOpen} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 322 | <div class="picker-pop" style={pickerStyle} bind:this={pickerPop}> |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 323 | <ReactionPicker {packs} quick={quickReactions} onPick={pick} {onQuickChange} onClose={closePicker} /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 324 | </div> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 325 | {/if} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 326 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | {#if showSender} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 328 | <button |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 329 | type="button" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 330 | class="user-hit" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 331 | tabindex="-1" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 332 | aria-hidden="true" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 333 | on:click|stopPropagation={(ev) => openUser(ev, false)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 334 | on:contextmenu|preventDefault|stopPropagation={(ev) => openUser(ev, true)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 335 | > |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 336 | {#if senderAvatar} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 337 | <MxcAvatar mxc={senderAvatar} label={name} size={34} /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 338 | {:else} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 339 | <span class="avatar" style={`background:hsl(${senderHue(event.sender.user_id)} 35% 32%)`}> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 340 | {initialsOf(name)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 341 | </span> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 342 | {/if} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 343 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | <div class="avatar-spacer" aria-hidden="true"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | <span class="hover-time">{formatClock(event.timestamp_ms)}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | <div class="msg-body"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | {#if showSender} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | <div class="msg-head"> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 352 | <button |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 353 | type="button" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 354 | class="sender" |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 355 | style={`color:hsl(${senderHue(event.sender.user_id)} 70% var(--name-lightness))`} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 356 | on:click|stopPropagation={(ev) => openUser(ev, false)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 357 | on:contextmenu|preventDefault|stopPropagation={(ev) => openUser(ev, true)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 358 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | {displayName} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 360 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | <time class="time" datetime={new Date(event.timestamp_ms).toISOString()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | {formatDay(event.timestamp_ms)} {formatClock(event.timestamp_ms)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | </time> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | {#if event.content.kind === 'Message' && event.content.message.edited} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | <span class="edited" title="Edited">(edited)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 369 | {#if event.reply_to} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 370 | {@const target = event.reply_to.event_id} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 371 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 372 | type="button" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 373 | class="reply-quote" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 374 | disabled={!onJump} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 375 | title="Jump to the original message" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 376 | on:click|stopPropagation={() => onJump?.(target)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 377 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 378 | {#if event.reply_to.details.kind === 'Ready'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 379 | <span class="reply-sender">{senderLabel(event.reply_to.details.sender)}</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 380 | <span class="reply-text"><EmojiText text={replyPreview(event.reply_to.details.content)} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 381 | {:else if event.reply_to.details.kind === 'Pending'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 382 | Loading reply… |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 383 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 384 | Reply unavailable |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 385 | {/if} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 386 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 387 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 388 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 389 | {#if event.content.kind === 'Message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 390 | {@const m = event.content.message} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 391 | {#if stripped.text} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 392 | <div class="text" class:emote={m.kind === 'Emote'} class:notice={m.kind === 'Notice' || m.kind === 'ServerNotice'}> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 393 | {#if m.kind === 'Emote'}* {displayName} {/if}<MessageText text={stripped.text} html={m.formatted_body} jumbo={m.kind === 'Text'} {mentions} {self} nameOf={(id) => people[id]?.name ?? null} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 394 | {#if m.edited && !showSender}<span class="edited" title="Edited">(edited)</span>{/if} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 395 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 396 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 397 | {#if m.media} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 398 | <MediaAttachmentView attachment={m.media} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 399 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 400 | {#if cards.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 401 | <div class="link-previews"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 402 | {#each cards as card (card.link.href)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 403 | <LinkCard link={card.link} preview={card.preview} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 404 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 405 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 406 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 407 | {:else if event.content.kind === 'Sticker'} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 408 | {#if event.content.body}<p class="text"><EmojiText text={event.content.body} /></p>{/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | {#if event.content.media} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | <MediaAttachmentView attachment={event.content.media} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | {:else if event.content.kind === 'Poll'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | <p class="text">📊 {event.content.question}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 415 | <p class="system-line">{systemLine(event.content)}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 416 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | {#if interactive && event.reactions.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | <div class="reactions" aria-label="Reactions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | {#each event.reactions as r (r.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | class="reaction" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | class:mine={r.own} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 425 | aria-describedby={`${itemId}-reactors-${r.key}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | disabled={!event.event_id || reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | on:click={() => event.event_id && onReact(event.event_id, r.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | > |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 429 | {#if r.image} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 430 | <img class="emote" src={messageMediaUrl(r.image, 'Thumbnail')} alt={r.shortcode ?? ''} title={r.shortcode ?? ''} /> |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 431 | {:else if r.key.startsWith('mxc://')} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 432 | <img class="emote" src={mediaUrl(r.key) ?? ''} alt="" /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 433 | {:else} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 434 | <Emoji emoji={r.key} size={16} /> |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 435 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 436 | <span class="count">{r.count}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 437 | <span class="reactors" role="tooltip" id={`${itemId}-reactors-${r.key}`}> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 438 | <span class="reactors-key">{r.shortcode ? `:${r.shortcode}:` : r.key.startsWith('mxc://') ? 'custom emote' : r.key}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 439 | {reactorNames(r.senders)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 440 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 441 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 442 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 443 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 444 | {/if} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 445 | {#if interactive && sendLabel(event.send_state)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 446 | <div class="msg-foot"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 447 | <span class="sendstate" class:failed={event.send_state.kind === 'Failed'}>{sendLabel(event.send_state)}</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 448 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 449 | {/if} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 450 | {#if interactive && readers.length > 0} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 451 | {@const seenBy = `Seen by ${readers.map((r) => r.name).join(', ')}`} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 452 | <div class="readby" title={seenBy} aria-label={seenBy} role="img"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 453 | {#each readers.slice(0, MAX_READERS) as r (r.user_id)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 454 | <MxcAvatar mxc={r.avatar} label={r.name} size={16} /> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 455 | {/each} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 456 | {#if readers.length > MAX_READERS}<span class="more">+{readers.length - MAX_READERS}</span>{/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 457 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 458 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 459 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 460 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 461 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 462 | <style> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 463 | .msg { position: relative; display: flex; gap: 10px; padding: var(--msg-gap, 3px) 0; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 464 | .msg:hover, .msg.selected { background: var(--hover-faint); } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 465 | .msg:hover .hover-time, .msg.selected .hover-time { opacity: 1; } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 466 | .msg-foot { display: flex; align-items: center; gap: 8px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 467 | .sendstate { font-size: 11px; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 468 | .sendstate.failed { color: var(--danger); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 469 | .link-previews { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 470 | .avatar { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 471 | flex: none; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 472 | width: 34px; height: 34px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 473 | border-radius: 50%; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 474 | display: grid; place-items: center; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 475 | font-size: 12px; font-weight: 700; color: #fff; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 476 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 477 | .avatar-spacer { flex: none; width: 34px; padding-top: 2px; text-align: center; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 478 | .hover-time { opacity: 0; font-size: 10.5px; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 479 | .msg-body { min-width: 0; flex: 1; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 480 | .msg-head { display: flex; align-items: baseline; gap: 8px; } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 481 | .sender { font-weight: 650; font-size: 13.5px; padding: 0; border: none; background: none; font-family: inherit; cursor: pointer; } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 482 | .sender:hover { text-decoration: underline; } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 483 | .user-hit { flex: none; align-self: flex-start; padding: 0; border: none; background: none; border-radius: 50%; cursor: pointer; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | .time, .edited { color: var(--muted); font-size: 11.5px; } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 485 | .text .edited { margin-left: 6px; } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 486 | .msg.editing { background: color-mix(in srgb, var(--accent) 10%, transparent); } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 487 | .msg.mentioned { background: color-mix(in srgb, var(--warn) 8%, transparent); box-shadow: inset 2px 0 0 var(--warn); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | .reply-quote { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 489 | display: flex; gap: 6px; align-items: baseline; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 490 | max-width: min(100%, 520px); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 491 | border: none; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | border-left: 2px solid var(--accent); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | padding: 2px 8px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | margin: 2px 0 4px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | color: var(--muted); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | font-size: 12.5px; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 497 | text-align: left; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | background: var(--bg-soft); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | border-radius: 0 6px 6px 0; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 500 | cursor: pointer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 502 | .reply-quote:disabled { cursor: default; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 503 | .reply-quote:hover:not(:disabled) { color: var(--text); } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 504 | .reply-sender { flex: none; font-weight: 650; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 505 | .reply-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 506 | :global(.msg.flash) { animation: reply-flash 1.2s ease-out; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 507 | @keyframes -global-reply-flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 508 | .text { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 509 | margin: 1px 0 2px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 510 | font-size: 14px; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 511 | line-height: var(--msg-line-height, 1.5); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 512 | white-space: pre-wrap; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 513 | overflow-wrap: anywhere; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 514 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 515 | .text.emote { font-style: italic; color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 516 | .text.notice { color: var(--muted); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 517 | .system-line { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 1px 0; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 518 | .msg.system { opacity: 0.85; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 519 | .reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 520 | .reaction { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 521 | display: inline-flex; align-items: center; gap: 4px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | background: var(--bg-soft); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | border: 1px solid var(--border); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 524 | border-radius: 999px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 525 | padding: 1px 8px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 526 | font-size: 13px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 527 | color: var(--text); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 528 | cursor: pointer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 529 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 530 | .reaction { position: relative; } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 531 | .reactors { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 532 | position: absolute; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 533 | left: 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 534 | bottom: calc(100% + 6px); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 535 | z-index: 15; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 536 | display: none; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 537 | width: max-content; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 538 | max-width: 260px; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 539 | padding: 6px 9px; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 540 | border: 1px solid var(--border); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 541 | border-radius: 8px; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 542 | background: var(--panel-2); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 543 | box-shadow: 0 6px 18px rgb(0 0 0 / 0.3); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 544 | color: var(--text); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 545 | font-size: 12px; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 546 | line-height: 1.35; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 547 | text-align: left; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 548 | white-space: normal; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 549 | pointer-events: none; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 550 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 551 | .reactors-key { display: block; color: var(--muted); font-size: 11px; } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 552 | .reaction:hover .reactors, .reaction:focus-visible .reactors { display: block; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 553 | .reaction.mine { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | .reaction:disabled { cursor: default; opacity: 0.85; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 555 | .msg.has-readers .msg-body { padding-right: 72px; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 556 | .readby { position: absolute; right: 12px; bottom: 4px; display: flex; align-items: center; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 557 | .readby > :global(* + *) { margin-left: -4px; } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 558 | .readby :global(.mxc-avatar), .readby :global(.mxc-fallback) { box-shadow: 0 0 0 1.5px var(--bg); } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 559 | .readby .more { margin-left: 3px; font-size: 10.5px; color: var(--muted); } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 560 | .actions { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 561 | position: absolute; top: -14px; right: 12px; z-index: 2; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 562 | display: flex; gap: 2px; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 563 | padding: 2px; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 564 | background: var(--bg-soft); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 565 | border: 1px solid var(--border); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 566 | border-radius: 8px; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 567 | box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 568 | opacity: 0; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 569 | pointer-events: none; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 570 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 571 | .msg:hover .actions, .msg:focus-within .actions, .msg.selected .actions { opacity: 1; pointer-events: auto; } |
82a50971a50b | atagen | 2026-10-24 09:07 UTC | 572 | :global(.timeline-inner:has(.msg.selected)) .msg:not(.selected) .actions { opacity: 0; pointer-events: none; } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 573 | .actions button { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | background: transparent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | border: 1px solid transparent; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | border-radius: 6px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 577 | cursor: pointer; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 578 | font-size: 14px; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 579 | padding: 1px 5px; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 581 | .actions button:hover:not(:disabled) { border-color: var(--border); background: var(--hover); } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 582 | .actions button:disabled { opacity: 0.4; cursor: default; } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 583 | .emote { width: 1.3em; height: 1.3em; object-fit: contain; vertical-align: middle; } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 584 | .picker-pop { position: fixed; z-index: 60; width: 320px; max-width: calc(100vw - 16px); } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | </style> |