973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1 | <script lang="ts"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2 | import { onMount, tick } from 'svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3 | import LoginPanel from './lib/LoginPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import MessageRow from './lib/MessageRow.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import MxcAvatar from './lib/MxcAvatar.svelte'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 6 | import PinButton from './lib/PinButton.svelte'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 7 | import { moveBefore, pinnedFirst, sortSpaces } from './lib/rail-order'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 8 | import ImageLightbox from './lib/ImageLightbox.svelte'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 9 | import { lightbox } from './lib/lightbox'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 10 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 11 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 12 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 14 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | getSpaceChildren, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | reactToMessage, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 27 | runCommand, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 28 | sendMessage, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 29 | uploadAttachment, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 30 | uploadAvatar, |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 31 | uploadRoomAvatar, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 32 | editMessage |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | } from './lib/api'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 34 | import { isKnownCommand, parseCommand, splitTarget, unescapeCommand } from './lib/commands'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 35 | import type { ParsedCommand } from './lib/commands'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 36 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 37 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 38 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | membersLoading, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 46 | pushBanner, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 47 | imagePacks, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 48 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 50 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | timelines, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 54 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | import type { PendingMessage } from './lib/pending'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 58 | import { insideOpenFence } from './lib/markdown'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 59 | import { mentionQueryAt, mentionsFromHtml, rankPeople, resolveMentions } from './lib/mentions'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 60 | import type { Mention, MentionQuery } from './lib/mentions'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 61 | import { loadQuickReactions, quickReactions, saveQuickReactions } from './lib/quick-reactions'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 62 | import { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 63 | linkPreviews, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 64 | loadUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 65 | requestLinkPreview, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 66 | saveUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 67 | urlPreviewSettings |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 68 | } from './lib/link-previews'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | import { formatDay } from './lib/format'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 71 | import { lastSpaceRooms, lineHeight, markdownEnabled, messageSpacing, navFolded, railFolded } from './lib/appearance'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 72 | import SettingsPanel from './lib/SettingsPanel.svelte'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 73 | import { packsForRoom, parseEncryptionState, parseOwnProfile, parseVerificationState, contentPreview, senderLabel } from './lib/types'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 74 | import type { MemberSummary, OwnProfile, Person, QuickReaction, ReplyReference, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 76 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 77 | let booted = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 78 | let wasOnline = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 81 | let membersOpen = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 82 | let replyingTo: ReplyReference | null = null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 83 | let dialog: 'join' | 'create' | 'security' | 'settings' | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 86 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 87 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 88 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 89 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 90 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 91 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 92 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 93 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 94 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 95 | let timelineEl: HTMLElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | let composerEl: HTMLTextAreaElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | let fileInput: HTMLInputElement | null = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 98 | let avatarInput: HTMLInputElement | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 99 | let avatarRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 100 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | let uploadName: string | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 102 | interface StagedAttachment { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 103 | id: number; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 104 | file: File; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 105 | previewUrl: string | null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 106 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 107 | let staged: Record<string, StagedAttachment[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 108 | let editing: { roomId: string; eventId: string; original: string; stash: string } | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 109 | /** Everyone picked from the finder per room; only those whose name is still in the text get linked on send. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 110 | let pickedMentions: Record<string, Mention[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 111 | let mentionQuery: MentionQuery | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 112 | let mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 113 | let nextStagedId = 1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 114 | const WARM_ROOM_LIMIT = 8; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 115 | /** Rooms left open after switching away so coming back is instant, least recently viewed first. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 116 | let warmRooms: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 124 | let selectedSpaceId: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 125 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 126 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 127 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | let avatarByUser: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 130 | // account data is read from the local cache, which is empty on a fresh device until the first sync lands |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 131 | $: { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 132 | const online = $connection === 'online'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 133 | if (online && !wasOnline) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 134 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 135 | void loadUrlPreviewSettings(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 136 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 137 | wasOnline = online; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 138 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 139 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 140 | $: roomPacks = packsForRoom($imagePacks, $selectedRoomId); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 141 | $: previewsAllowed = selectedRoom !== null && (!selectedRoom.encrypted || $urlPreviewSettings.encrypted_rooms); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 142 | $: loadPreview = previewsAllowed && $selectedRoomId ? previewLoader($selectedRoomId) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 143 | $: spaceRooms = $rooms.filter((r) => r.space); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 144 | $: spaceParents = parentSpaceMap(spaceRooms); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 145 | $: railSpaces = spaceRooms.filter((s) => !spaceParents.has(s.room_id)); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 146 | let railOverride: string[] | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 147 | $: if (railOverride && sortSpaces(railSpaces, null).map((s) => s.room_id).join() === railOverride.join()) railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 148 | $: orderedRail = sortSpaces(railSpaces, railOverride); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 149 | $: pinnedRail = orderedRail.filter((s) => s.favourite); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 150 | $: otherRail = orderedRail.filter((s) => !s.favourite); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 151 | $: railSelected = selectedSpaceId ? topSpaceOf(selectedSpaceId, spaceParents) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 153 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | // full list — listing everything would falsely imply it belongs to the space. |
f12c7de2a3ab | atagen | 2026-10-23 08:10 UTC | 157 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds?.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 159 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 161 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 163 | : baseRooms; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 164 | $: directRooms = pinnedFirst(visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 165 | $: groupRooms = pinnedFirst(visibleRooms.filter((r) => !r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 166 | $: spaceList = pinnedFirst(visibleRooms.filter((r) => r.space && r.membership !== 'Invited')); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 167 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 168 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 171 | $: currentStaged = $selectedRoomId ? (staged[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 173 | $: people = peopleIn(items, members); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 174 | $: mentionCandidates = mentionQuery ? rankPeople(Object.values(people), mentionQuery.query, $sessionUser ?? null) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 175 | $: if (mentionIndex >= mentionCandidates.length) mentionIndex = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | $: grouped = buildGroups(items); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 178 | $: lastSentId = lastOwnSent(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 195 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | kind: 'Message', |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 211 | message: { kind: 'Text', body: p.body, geo_uri: null, formatted_body: p.formatted, edited: false, media: null, link_previews: [] } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | }, |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 213 | reply_to: p.replyTo, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 215 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 228 | function lastOwnSent(list: TimelineItem[]): string | null { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 229 | for (let i = list.length - 1; i >= 0; i--) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 230 | const item = list[i]; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 231 | if (item.kind === 'event' && item.event.own && item.event.send_state.kind === 'Sent') return item.event.item_id; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 232 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 233 | return null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 234 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 235 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 236 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 237 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 250 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 252 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 261 | onMount(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 262 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 263 | return () => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 267 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 268 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 269 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 270 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 271 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 272 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 273 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 274 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 281 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 282 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 283 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 284 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 300 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 301 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 302 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 303 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 304 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 305 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 306 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 307 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 308 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 309 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 310 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 311 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 312 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 313 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 314 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 315 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 316 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 317 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 318 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 319 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 320 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 321 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 322 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 323 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 324 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 325 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 326 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 328 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 329 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 330 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 331 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 332 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 333 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 334 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 335 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 336 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 337 | void loadQuickReactions(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 338 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 339 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 340 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 342 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 343 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | sessionUser.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 354 | lightbox.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 355 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 356 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 360 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | profileMxc = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | openFailed = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 367 | warmRooms = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 368 | pickedMentions = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 369 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 370 | clearAllStaged(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 371 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 372 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 375 | /** Joined spaces that sit inside another joined space, keyed to one such parent. Either side of the link counts. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 376 | function parentSpaceMap(spaces: RoomSummary[]): Map<string, string> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 377 | const ids = new Set(spaces.map((s) => s.room_id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 378 | const parents = new Map<string, string>(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 379 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 380 | for (const child of space.children) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 381 | if (child !== space.room_id && ids.has(child) && !parents.has(child)) parents.set(child, space.room_id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 382 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 383 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 384 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 385 | const parent = space.parent_spaces.find((id) => id !== space.room_id && ids.has(id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 386 | if (parent && !parents.has(space.room_id)) parents.set(space.room_id, parent); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 387 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 388 | for (const id of [...parents.keys()]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 389 | const seen = new Set<string>([id]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 390 | let at = parents.get(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 391 | while (at && !seen.has(at)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 392 | seen.add(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 393 | at = parents.get(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 394 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 395 | if (at) parents.delete(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 396 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 397 | return parents; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 398 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 399 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 400 | function topSpaceOf(id: string, parents: Map<string, string>): string { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 401 | let at = id; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 402 | while (parents.has(at)) at = parents.get(at)!; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 403 | return at; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 404 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 405 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 406 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 407 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 408 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 415 | async function selectHome(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 416 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | sidebarOpen = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | async function selectSpace(spaceId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | spaceChildrenLoading = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 429 | const last = $lastSpaceRooms[spaceId]; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 430 | const resume = last && $rooms.some((r) => r.room_id === last && !r.space) ? last : null; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 431 | if (resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 432 | void selectRoom(resume); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 433 | } else { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 434 | sidebarOpen = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 435 | // A space is navigation, not a message timeline. |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 436 | selectedRoomId.set(null); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 437 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 438 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 439 | const res = await getSpaceChildren(spaceId); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 440 | if (selectedSpaceId === spaceId) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 441 | spaceChildIds = res.room_ids ?? []; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 442 | if (resume && !spaceChildIds.includes(resume) && $selectedRoomId === resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 443 | sidebarOpen = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 444 | selectedRoomId.set(null); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 445 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 446 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 447 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 448 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 449 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 450 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 451 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 452 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 453 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 454 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 455 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 456 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 457 | async function selectRoom(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 458 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 459 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 460 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 461 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 462 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 463 | stopTyping(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 464 | const spaceId = selectedSpaceId; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 465 | if (spaceId) lastSpaceRooms.update((all) => ({ ...all, [spaceId]: roomId })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 466 | selectedRoomId.set(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 467 | composer = drafts[roomId] ?? ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 468 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 469 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 470 | mentionQuery = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 471 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 472 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 473 | sidebarOpen = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 474 | touchWarmRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 475 | if (openReady[roomId]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 476 | if (membersOpen) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 477 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 478 | scrollToBottom(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 479 | queueReadReceipt(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 480 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 481 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 482 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 483 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 485 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | await openRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 490 | if (warmRooms.includes(roomId)) openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 497 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 502 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 503 | function touchWarmRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 504 | warmRooms = [...warmRooms.filter((id) => id !== roomId), roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 505 | while (warmRooms.length > WARM_ROOM_LIMIT) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 506 | const evicted = warmRooms[0]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 507 | warmRooms = warmRooms.slice(1); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 508 | forgetOpenRoom(evicted); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 509 | closeRoom(evicted).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 510 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 511 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 512 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 513 | function forgetOpenRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 514 | warmRooms = warmRooms.filter((id) => id !== roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 515 | const nextReady = { ...openReady }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 516 | delete nextReady[roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 517 | openReady = nextReady; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 518 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 519 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 520 | function scrollToBottom(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 521 | if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 524 | let userScrollUntil = 0; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 525 | let draggingScrollbar = false; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 526 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 527 | function noteUserScroll(): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 528 | userScrollUntil = performance.now() + 300; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 529 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 530 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 531 | function onTimelineKey(e: KeyboardEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 532 | if (['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '].includes(e.key)) noteUserScroll(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 533 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 534 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 535 | function onTimelinePointer(e: PointerEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 536 | if (e.target === timelineEl) draggingScrollbar = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 537 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 538 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 539 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 540 | if (!timelineEl) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 541 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 542 | if (gap < 80) stickToBottom = true; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 543 | else if (draggingScrollbar || performance.now() < userScrollUntil) stickToBottom = false; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 544 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 545 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 546 | function pinTimeline(node: HTMLElement) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 547 | const observer = new ResizeObserver(() => { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 548 | if (stickToBottom) scrollToBottom(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 549 | }); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 550 | observer.observe(node); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 551 | if (node.parentElement) observer.observe(node.parentElement); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 552 | return { destroy: () => observer.disconnect() }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 553 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 555 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 556 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 557 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 561 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 562 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 563 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 564 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 565 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 566 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 567 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 568 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 569 | }, 800); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | async function sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 573 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | if (!roomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 577 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 578 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 584 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 586 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 587 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 590 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 591 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 592 | function send(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 593 | if (editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 594 | submitEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 595 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 596 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 597 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 598 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 599 | const attachments = roomId ? (staged[roomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 600 | if (!roomId || (!body && attachments.length === 0)) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 601 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 602 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 603 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 604 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 605 | if (attachments.length > 0 && uploadBusy) return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 606 | const command = attachments.length === 0 ? parseCommand(body) : null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 607 | if (command && !isKnownCommand(command.name)) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 608 | pushBanner(`Unknown command /${command.name}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 609 | return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 610 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 611 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 612 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 613 | stickToBottom = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 614 | const reply = replyingTo; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 615 | replyingTo = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 616 | const text = unescapeCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 617 | const mentions = resolveMentions(text, pickedMentions[roomId] ?? []); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 618 | pickedMentions = { ...pickedMentions, [roomId]: [] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 619 | mentionQuery = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 620 | if (command) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 621 | void execute(roomId, command, reply, mentions); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 622 | } else if (attachments.length === 0) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 623 | queueSend(roomId, text, reply, mentions, $markdownEnabled); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 624 | } else { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 625 | const { [roomId]: _sent, ...rest } = staged; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 626 | staged = rest; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 627 | void sendAttachments(roomId, text, reply, mentions, attachments); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 628 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 629 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 630 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 631 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 632 | function lastOwnEventId(): string | null { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 633 | for (let i = items.length - 1; i >= 0; i -= 1) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 634 | const entry = items[i]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 635 | if (entry.kind === 'event' && entry.event.own && entry.event.event_id && entry.event.content.kind !== 'Redacted') { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 636 | return entry.event.event_id; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 637 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 638 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 639 | return null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 640 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 641 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 642 | async function execute(roomId: string, command: ParsedCommand, reply: ReplyReference | null, mentions: Mention[]): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 643 | const { name, args } = command; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 644 | const target = () => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 645 | const found = splitTarget(args, Object.values(people)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 646 | if ('error' in found) throw new Error(found.error); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 647 | return found; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 648 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 649 | const required = (what: string) => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 650 | if (!args) throw new Error(`/${name} needs ${what}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 651 | return args; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 652 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 653 | try { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 654 | switch (name) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 655 | case 'me': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 656 | case 'notice': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 657 | await sendMessage(roomId, required('something to say'), null, mentions, $markdownEnabled, name === 'me' ? 'emote' : 'notice'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 658 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 659 | case 'msg': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 660 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 661 | const res = (await runCommand({ op: 'direct', user_id })) as { room_id: string }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 662 | await refreshRooms(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 663 | await selectRoom(res.room_id); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 664 | if (rest) queueSend(res.room_id, rest, null, [], $markdownEnabled); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 665 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 666 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 667 | case 'join': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 668 | await join(required('a room id or alias')); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 669 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 670 | case 'leave': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 671 | await leave(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 672 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 673 | case 'invite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 674 | await runCommand({ op: 'invite', room_id: roomId, user_id: target().user_id }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 675 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 676 | case 'disinvite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 677 | case 'kick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 678 | case 'ban': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 679 | case 'unban': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 680 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 681 | const op = name === 'disinvite' ? 'kick' : name; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 682 | await runCommand({ op, room_id: roomId, user_id, reason: rest || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 683 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 684 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 685 | case 'powerlevel': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 686 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 687 | const level = Number(rest); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 688 | if (!rest || !Number.isInteger(level)) throw new Error('/powerlevel needs a whole number after the name'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 689 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id, level }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 690 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 691 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 692 | case 'mute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 693 | case 'unmute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 694 | await runCommand({ op: 'mute', room_id: roomId, user_id: target().user_id, muted: name === 'mute' }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 695 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 696 | case 'ignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 697 | case 'unignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 698 | await runCommand({ op: name, user_id: target().user_id }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 699 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 700 | case 'roomnick': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 701 | await runCommand({ op: 'set_room_display_name', room_id: roomId, name: args || null }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 702 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 703 | case 'roomavatar': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 704 | if (!args) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 705 | avatarRoom = roomId; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 706 | avatarInput?.click(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 707 | } else if (args.startsWith('mxc://')) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 708 | await runCommand({ op: 'set_room_avatar', room_id: roomId, mxc: args }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 709 | } else { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 710 | throw new Error('/roomavatar takes an mxc:// link, or nothing to pick a file'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 711 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 712 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 713 | case 'delete': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 714 | const eventId = reply?.event_id ?? lastOwnEventId(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 715 | if (!eventId) throw new Error('Nothing of yours to delete here'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 716 | await runCommand({ op: 'redact', room_id: roomId, event_id: eventId, reason: args || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 717 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 718 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 719 | case 'globalnick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 720 | await runCommand({ op: 'set_display_name', name: required('a name') }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 721 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 722 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 723 | case 'globalavatar': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 724 | if (!args) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 725 | avatarRoom = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 726 | avatarInput?.click(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 727 | } else if (args.startsWith('mxc://')) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 728 | await runCommand({ op: 'set_avatar', mxc: args }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 729 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 730 | } else { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 731 | throw new Error('/globalavatar takes an mxc:// link, or nothing to pick a file'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 732 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 733 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 734 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 735 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 736 | pushBanner(e instanceof Error ? e.message : `/${name} failed`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 737 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 738 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 739 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 740 | async function onAvatarChosen(): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 741 | const file = avatarInput?.files?.[0]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 742 | if (avatarInput) avatarInput.value = ''; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 743 | if (!file) return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 744 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 745 | if (avatarRoom) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 746 | await uploadRoomAvatar(avatarRoom, file); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 747 | } else { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 748 | await uploadAvatar(file); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 749 | await loadProfile(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 750 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 751 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 752 | pushBanner(e instanceof Error ? e.message : 'Avatar upload failed'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 753 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 754 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 755 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 756 | async function sendAttachments( |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 757 | roomId: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 758 | body: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 759 | reply: ReplyReference | null, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 760 | mentions: Mention[], |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 761 | attachments: StagedAttachment[] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 762 | ): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 763 | let first = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 764 | uploadBusy = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 765 | try { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 766 | for (const attachment of attachments) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 767 | uploadName = attachment.file.name || 'attachment'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 768 | try { |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 769 | if (first) await uploadAttachment(roomId, attachment.file, body || null, reply?.event_id ?? null, mentions, $markdownEnabled); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 770 | else await uploadAttachment(roomId, attachment.file); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 771 | first = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 772 | } catch (e) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 773 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 774 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 775 | if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 776 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 777 | } finally { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 778 | uploadBusy = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 779 | uploadName = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 780 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 781 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 782 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 783 | function stageFiles(files: File[]): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 784 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 785 | if (!roomId || !openReady[roomId]) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 786 | const accepted: StagedAttachment[] = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 787 | for (const file of files) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 788 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 789 | pushBanner(`${file.name || 'File'} must be between 1 byte and 20 MiB.`); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 790 | continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 791 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 792 | const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 793 | accepted.push({ id: nextStagedId++, file, previewUrl }); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 794 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 795 | if (accepted.length === 0) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 796 | staged = { ...staged, [roomId]: [...(staged[roomId] ?? []), ...accepted] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 797 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 798 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 799 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 800 | function unstage(roomId: string, id: number): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 801 | const list = staged[roomId] ?? []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 802 | const removed = list.find((a) => a.id === id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 803 | if (removed?.previewUrl) URL.revokeObjectURL(removed.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 804 | staged = { ...staged, [roomId]: list.filter((a) => a.id !== id) }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 805 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 806 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 807 | function clearAllStaged(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 808 | for (const list of Object.values(staged)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 809 | for (const attachment of list) if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 810 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 811 | staged = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 812 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 813 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 814 | function startEdit(eventId: string, body: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 815 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 816 | if (!roomId) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 817 | const stash = editing ? editing.stash : composer; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 818 | editing = { roomId, eventId, original: body, stash }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 819 | const entry = items.find((i) => i.kind === 'event' && i.event.event_id === eventId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 820 | if (entry?.kind === 'event' && entry.event.content.kind === 'Message') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 821 | const existing = mentionsFromHtml(entry.event.content.message.formatted_body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 822 | pickedMentions = { ...pickedMentions, [roomId]: [...(pickedMentions[roomId] ?? []), ...existing] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 823 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 824 | composer = body; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 825 | replyingTo = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 826 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 827 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 828 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 829 | function cancelEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 830 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 831 | composer = editing.stash; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 832 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 833 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 834 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 835 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 836 | function submitEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 837 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 838 | const { roomId, eventId, original } = editing; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 839 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 840 | cancelEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 841 | if (!body || body === original.trim()) return; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 842 | editMessage(roomId, eventId, body, resolveMentions(body, pickedMentions[roomId] ?? []), $markdownEnabled).catch((e) => pushBanner(e instanceof Error ? e.message : 'Edit failed')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 843 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 844 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 845 | function editLastOwn(): boolean { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 846 | for (let i = items.length - 1; i >= 0; i -= 1) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 847 | const entry = items[i]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 848 | if (entry.kind !== 'event' || !entry.event.own) continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 849 | const ev = entry.event; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 850 | if (!ev.editable || !ev.event_id || ev.content.kind !== 'Message' || ev.content.message.kind !== 'Text') return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 851 | startEdit(ev.event_id, ev.content.message.body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 852 | return true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 853 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 854 | return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 855 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 856 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 857 | function startReply(target: ReplyReference): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 858 | if (editing) cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 859 | replyingTo = target; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 860 | composerEl?.focus(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 861 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 862 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 863 | function jumpTo(eventId: string): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 864 | const el = timelineEl?.querySelector<HTMLElement>(`[data-event="${CSS.escape(eventId)}"]`); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 865 | if (!el) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 866 | pushBanner('The original message is not loaded. Scroll up to load older messages.'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 867 | return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 868 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 869 | stickToBottom = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 870 | el.scrollIntoView({ block: 'center', behavior: 'smooth' }); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 871 | el.classList.remove('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 872 | void el.offsetWidth; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 873 | el.classList.add('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 874 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 875 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 876 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 877 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 878 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 879 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 880 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 881 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 882 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 883 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 884 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 885 | } else if (edited) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 886 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 887 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 888 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 889 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 890 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 891 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 892 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 893 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 894 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 895 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 896 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 897 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 898 | function updateMentionQuery(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 899 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 900 | const next = composerEl && roomId ? mentionQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 901 | if (next && !mentionQuery && roomId && !$membersByRoom[roomId]) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 902 | if (next?.start !== mentionQuery?.start) mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 903 | mentionQuery = next; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 904 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 905 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 906 | async function pickMention(person: Person): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 907 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 908 | if (!mentionQuery || !roomId || !composerEl) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 909 | const caret = composerEl.selectionStart ?? composer.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 910 | const inserted = `${person.name} `; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 911 | composer = composer.slice(0, mentionQuery.start) + inserted + composer.slice(caret); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 912 | const at = mentionQuery.start + inserted.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 913 | pickedMentions = { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 914 | ...pickedMentions, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 915 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 916 | }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 917 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 918 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 919 | composerEl.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 920 | composerEl.setSelectionRange(at, at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 921 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 922 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 923 | function onComposerKey(ev: KeyboardEvent): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 924 | if (mentionQuery && mentionCandidates.length > 0) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 925 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 926 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 927 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 928 | mentionIndex = (mentionIndex + step + mentionCandidates.length) % mentionCandidates.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 929 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 930 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 931 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 932 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 933 | void pickMention(mentionCandidates[mentionIndex]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 934 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 935 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 936 | if (ev.key === 'Escape') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 937 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 938 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 939 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 940 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 941 | } |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 942 | if (ev.key === 'Enter' && !ev.shiftKey && !insideOpenFence(composer, composerEl?.selectionStart ?? composer.length)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 943 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 944 | send(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 945 | } else if (ev.key === 'Escape' && editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 946 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 947 | cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 948 | } else if (ev.key === 'Escape' && replyingTo) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 949 | ev.stopPropagation(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 950 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 951 | } else if (ev.key === 'ArrowUp' && !composer && !editing && editLastOwn()) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 952 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 953 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 954 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 955 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 956 | function pickFiles(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 957 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 958 | if (!roomId || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 959 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 960 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 961 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 962 | function onFileChosen(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 963 | stageFiles(Array.from(fileInput?.files ?? [])); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 964 | if (fileInput) fileInput.value = ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 965 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 966 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 967 | function onComposerPaste(ev: ClipboardEvent): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 968 | const data = ev.clipboardData; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 969 | // Office apps put a rendered image next to the copied text, so only take the image when there is no plain text. |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 970 | if (!data || data.types.includes('text/plain')) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 971 | const images = Array.from(data.files).filter((f) => f.type.startsWith('image/')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 972 | if (images.length === 0) return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 973 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 974 | stageFiles(images); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 975 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 976 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 977 | async function react(eventId: string, key: string, shortcode?: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 978 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 979 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 980 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 981 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 982 | await reactToMessage(roomId, eventId, key, shortcode); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 983 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 984 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 985 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 986 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 987 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 988 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 989 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 990 | function previewLoader(roomId: string): (url: string) => void { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 991 | return (url) => requestLinkPreview(roomId, url); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 992 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 993 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 994 | async function changeEncryptedPreviews(enabled: boolean): Promise<void> { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 995 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 996 | await saveUrlPreviewSettings({ encrypted_rooms: enabled }); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 997 | } catch (e) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 998 | pushBanner(e instanceof Error ? e.message : 'Could not save link preview setting'); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 999 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1000 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1001 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1002 | async function changeQuickReactions(list: QuickReaction[]): Promise<void> { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1003 | try { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1004 | await saveQuickReactions(list); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1005 | } catch (e) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1006 | pushBanner(e instanceof Error ? e.message : 'Could not save quick reactions'); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1007 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1008 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1009 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1010 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1011 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1012 | if (!roomId || paginateBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1013 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1014 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1015 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1016 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1017 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1018 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1019 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1020 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1021 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1022 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1023 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1024 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1025 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1026 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1027 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1028 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1029 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1030 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1031 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1032 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1033 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1034 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1035 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1036 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1037 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1038 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1039 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1040 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1041 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1042 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1043 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1044 | function peopleIn(list: TimelineItem[], roster: MemberSummary[]): Record<string, Person> { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1045 | const out: Record<string, Person> = {}; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1046 | for (const item of list) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1047 | if (item.kind !== 'event') continue; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1048 | const s = item.event.sender; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1049 | out[s.user_id] = { user_id: s.user_id, name: senderLabel(s), avatar: s.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1050 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1051 | for (const m of roster) out[m.user_id] = { user_id: m.user_id, name: m.name, avatar: m.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1052 | return out; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1053 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1054 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1055 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1056 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1057 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1058 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1059 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1060 | membersOpen = !membersOpen; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1061 | if (membersOpen && $selectedRoomId) void loadMembers($selectedRoomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1062 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1063 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1064 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1065 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1066 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1067 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1068 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1069 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1070 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1071 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1072 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1073 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1074 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1075 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1076 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1077 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1078 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1079 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1080 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1081 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1082 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1083 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1084 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1085 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1086 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1087 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1088 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1089 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1090 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1091 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1092 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1093 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1094 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1095 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1096 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1097 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1098 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1099 | async function leave(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1100 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1101 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1102 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1103 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1104 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1105 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1106 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1107 | if (warmRooms.includes(roomId)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1108 | forgetOpenRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1109 | closeRoom(roomId).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1110 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1111 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1112 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1113 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1114 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1115 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1116 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1117 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1118 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1119 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1120 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1121 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1122 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1123 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1124 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1125 | let dragSpaceId: string | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1126 | let dropTarget: { id: string; after: boolean } | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1127 | let railMenu: { room: RoomSummary; x: number; y: number } | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1128 | let railMenuEl: HTMLDivElement | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1129 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1130 | async function togglePin(room: RoomSummary): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1131 | railMenu = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1132 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1133 | await runCommand({ op: 'set_favourite', room_id: room.room_id, favourite: !room.favourite }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1134 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1135 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1136 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1137 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1138 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1139 | function startRailDrag(ev: DragEvent, id: string): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1140 | dragSpaceId = id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1141 | if (ev.dataTransfer) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1142 | ev.dataTransfer.effectAllowed = 'move'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1143 | ev.dataTransfer.setData('text/plain', id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1144 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1145 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1146 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1147 | function overRailSpace(ev: DragEvent, space: RoomSummary): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1148 | const dragged = orderedRail.find((s) => s.room_id === dragSpaceId); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1149 | if (!dragged || dragged.room_id === space.room_id || dragged.favourite !== space.favourite) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1150 | ev.preventDefault(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1151 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1152 | dropTarget = { id: space.room_id, after: ev.clientY > rect.top + rect.height / 2 }; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1153 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1154 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1155 | async function dropRailSpace(): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1156 | const moved = dragSpaceId; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1157 | const target = dropTarget; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1158 | dragSpaceId = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1159 | dropTarget = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1160 | if (!moved || !target) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1161 | const ids = orderedRail.map((s) => s.room_id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1162 | const before = target.after ? (ids[ids.indexOf(target.id) + 1] ?? null) : target.id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1163 | const order = moveBefore(ids, moved, before === moved ? null : before); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1164 | if (order.join() === ids.join()) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1165 | railOverride = order; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1166 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1167 | await runCommand({ op: 'reorder_spaces', order }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1168 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1169 | railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1170 | pushBanner(e instanceof Error ? e.message : 'Could not reorder spaces'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1171 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1172 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1173 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1174 | let roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1175 | let roomMenuEl: HTMLDivElement | null = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1176 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1177 | function roomMenuAction(action: () => void): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1178 | roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1179 | action(); |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1180 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1181 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1182 | function closeRoomMenuOutside(ev: PointerEvent): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1183 | if (roomMenuOpen && !roomMenuEl?.contains(ev.target as Node)) roomMenuOpen = false; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1184 | if (railMenu && !railMenuEl?.contains(ev.target as Node)) railMenu = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1185 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1186 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1187 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1188 | if (ev.key === 'Escape') { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1189 | if (roomMenuOpen) roomMenuOpen = false; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1190 | else if (railMenu) railMenu = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1191 | else if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1192 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1193 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1194 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1195 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1196 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1197 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1198 | <svelte:window |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1199 | on:keydown={onKeydown} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1200 | on:pointerdown={closeRoomMenuOutside} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1201 | on:pointerup={() => (draggingScrollbar = false)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1202 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1203 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1204 | {#if !booted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1205 | <div class="splash" role="status" aria-label="Loading Malice"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1206 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1207 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1208 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1209 | {:else if $blocked} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1210 | <div class="splash" role="status" aria-label="Malice is open in another tab"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1211 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1212 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1213 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1214 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1215 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1216 | {:else} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1217 | <div |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1218 | class="app" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1219 | class:nav-folded={$navFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1220 | class:rail-folded={$railFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1221 | class:members-open={selectedRoom && membersOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1222 | style:--msg-gap={`${$messageSpacing}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1223 | style:--msg-line-height={$lineHeight} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1224 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1225 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1226 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1227 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1228 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1229 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1230 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1231 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1232 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1233 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1234 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1235 | <span aria-hidden="true">⌂</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1236 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1237 | {#each [pinnedRail, otherRail] as group} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1238 | {#if group.length > 0} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1239 | <div class="rail-sep" aria-hidden="true"></div> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1240 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1241 | {#each group as space (space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1242 | <button |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1243 | type="button" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1244 | class="rail-btn rail-space" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1245 | class:active={railSelected === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1246 | class:drop-before={dropTarget?.id === space.room_id && !dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1247 | class:drop-after={dropTarget?.id === space.room_id && dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1248 | class:pinned={space.favourite} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1249 | title={space.name} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1250 | aria-label={`Show channels in space ${space.name}`} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1251 | aria-pressed={selectedSpaceId === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1252 | draggable="true" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1253 | on:click={() => void selectSpace(space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1254 | on:contextmenu|preventDefault={(ev) => (railMenu = { room: space, x: ev.clientX, y: ev.clientY })} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1255 | on:dragstart={(ev) => startRailDrag(ev, space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1256 | on:dragover={(ev) => overRailSpace(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1257 | on:dragleave={() => dropTarget?.id === space.room_id && (dropTarget = null)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1258 | on:drop|preventDefault={() => void dropRailSpace()} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1259 | on:dragend={() => ((dragSpaceId = null), (dropTarget = null))} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1260 | > |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1261 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1262 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1263 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1264 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1265 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1266 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1267 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1268 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1269 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1270 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1271 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1272 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1273 | <span aria-hidden="true">+</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1274 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1275 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1276 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1277 | {#if railMenu} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1278 | {@const menuRoom = railMenu.room} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1279 | <div class="room-menu rail-menu" role="menu" style={`left:${railMenu.x}px;top:${railMenu.y}px`} bind:this={railMenuEl}> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1280 | <button type="button" role="menuitem" on:click={() => void togglePin(menuRoom)}> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1281 | {menuRoom.favourite ? 'Unpin' : 'Pin to top'} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1282 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1283 | </div> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1284 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1285 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1286 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1287 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1288 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1289 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1290 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1291 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1292 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1293 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1294 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1295 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1296 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1297 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1298 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1299 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1300 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1301 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1302 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1303 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1304 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1305 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1306 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1307 | <div class="side-scroll"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1308 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1309 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1310 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={28} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1311 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1312 | <strong>{selectedSpace.name}</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1313 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1314 | {#if spaceParents.has(selectedSpace.room_id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1315 | {@const parentId = spaceParents.get(selectedSpace.room_id) ?? ''} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1316 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1317 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1318 | class="icon-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1319 | title="Up to the parent space" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1320 | aria-label="Up to the parent space" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1321 | on:click={() => void selectSpace(parentId)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1322 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1323 | <span aria-hidden="true">↑</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1324 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1325 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1326 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1327 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1328 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1329 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1330 | <strong>Home</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1331 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1332 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1333 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1334 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1335 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1336 | {:else if $rooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1337 | <p class="side-note">No rooms yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1338 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1339 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1340 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1341 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1342 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1343 | {#if selectedSpaceId && spaceChildrenLoading} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1344 | <p class="side-note">Loading channels…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1345 | {:else if selectedSpaceId && spaceChildrenError} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1346 | <p class="side-note" role="alert">{spaceChildrenError}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1347 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1348 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1349 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1350 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1351 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1352 | <p class="side-note">No channels</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1353 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1354 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1355 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1356 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1357 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1358 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1359 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1360 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1361 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1362 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1363 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1364 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1365 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1366 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1367 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1368 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1369 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1370 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1371 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1372 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1373 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1374 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1375 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1376 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1377 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1378 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1379 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1380 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1381 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1382 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1383 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1384 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1385 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1386 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1387 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1388 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1389 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1390 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1391 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1392 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1393 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1394 | {#each directRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1395 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1396 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1397 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1398 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1399 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1400 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1401 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1402 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1403 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1404 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1405 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1406 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1407 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1408 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1409 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1410 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1411 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1412 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1413 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1414 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1415 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1416 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1417 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1418 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1419 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1420 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1421 | {#if groupRooms.length > 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1422 | <h2 class="side-h">{selectedSpace ? 'Channels' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1423 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1424 | {#each groupRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1425 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1426 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1427 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1428 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1429 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1430 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1431 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1432 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1433 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1434 | <span class="room-hash" aria-hidden="true">#</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1435 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1436 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1437 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1438 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1439 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1440 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1441 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1442 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1443 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1444 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1445 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1446 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1447 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1448 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1449 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1450 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1451 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1452 | {#if spaceList.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1453 | <h2 class="side-h">{selectedSpace ? 'Subspaces' : 'Spaces'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1454 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1455 | {#each spaceList as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1456 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1457 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1458 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1459 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1460 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1461 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1462 | on:click={() => void selectSpace(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1463 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1464 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1465 | <span class="room-hash" aria-hidden="true">◇</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1466 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1467 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1468 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1469 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1470 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1471 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1472 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1473 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1474 | {#if query && visibleRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1475 | <p class="side-note">No rooms match “{search.trim()}”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1476 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1477 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1478 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1479 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1480 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1481 | <div class="side-footer"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1482 | <div class="me" title={$sessionUser}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1483 | {#if profileMxc} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1484 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1485 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1486 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1487 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1488 | <span class="me-id">{profile?.display_name && profile.display_name !== $sessionUser ? `${profile.display_name} (${$sessionUser})` : $sessionUser}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1489 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1490 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1491 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1492 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1493 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1494 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1495 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1496 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1497 | <span aria-hidden="true">🛡</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1498 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1499 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1500 | type="button" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1501 | class="icon-btn" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1502 | title="Settings" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1503 | aria-label="Settings" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1504 | on:click={() => (dialog = 'settings')} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1505 | > |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1506 | <span aria-hidden="true">⚙</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1507 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1508 | <button type="button" class="icon-btn" title="Log out" aria-label="Log out" on:click={() => void doLogout()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1509 | <span aria-hidden="true">⏻</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1510 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1511 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1512 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1513 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1514 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1515 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1516 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1517 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1518 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1519 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1520 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1521 | <div class="banner" role="alert"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1522 | <span>{banner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1523 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1524 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1525 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1526 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1527 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1528 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1529 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1530 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1531 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1532 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1533 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1534 | {#if !selectedRoom} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1535 | <div class="empty"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1536 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1537 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1538 | <h1>{selectedSpace.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1539 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1540 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1541 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1542 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1543 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1544 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1545 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1546 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1547 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1548 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1549 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1550 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1551 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1552 | <header class="chat-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1553 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1554 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1555 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1556 | aria-label="Open room list" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1557 | on:click={() => (sidebarOpen = true)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1558 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1559 | <span aria-hidden="true">☰</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1560 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1561 | <button |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1562 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1563 | class="icon-btn only-desktop pane-toggle" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1564 | aria-pressed={!$railFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1565 | aria-label={$railFolded ? 'Show spaces' : 'Hide spaces'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1566 | title={$railFolded ? 'Show spaces' : 'Hide spaces'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1567 | on:click={() => railFolded.update((v) => !v)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1568 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1569 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1570 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1571 | <circle cx="7" cy="9" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1572 | <circle cx="7" cy="13" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1573 | <circle cx="7" cy="17" r="1.4" fill="currentColor" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1574 | </svg> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1575 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1576 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1577 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1578 | class="icon-btn only-desktop pane-toggle" |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1579 | aria-pressed={!$navFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1580 | aria-label={$navFolded ? 'Show channels' : 'Hide channels'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1581 | title={$navFolded ? 'Show channels' : 'Hide channels'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1582 | on:click={() => navFolded.update((v) => !v)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1583 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1584 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1585 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1586 | <path d="M10 4v16" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1587 | </svg> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1588 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1589 | <div class="head-title"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1590 | <div class="head-room"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1591 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape={selectedRoom.space ? 'rounded' : 'circle'} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1592 | <div class="head-room-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1593 | <h1>{selectedRoom.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1594 | <div class="head-meta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1595 | {#if selectedRoom.space} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1596 | <span class="pill">space</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1597 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1598 | {#if selectedRoom.encrypted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1599 | <span class="pill" title="End-to-end encrypted">🔒 encrypted</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1600 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1601 | {#if selectedRoom.direct} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1602 | <span class="pill">direct</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1603 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1604 | <span class="conn" title={`Sync state: ${$connection}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1605 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1606 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1607 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1608 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1609 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1610 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1611 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1612 | <div class="head-actions"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1613 | {#if selectedRoom.membership !== 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1614 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1615 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1616 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1617 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1618 | on:click={() => void join(selectedRoom.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1619 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1620 | {joinBusy ? 'Joining…' : 'Join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1621 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1622 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1623 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1624 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1625 | class="icon-btn" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1626 | aria-pressed={membersOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1627 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1628 | title="Members" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1629 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1630 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1631 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1632 | <circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1633 | <path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1634 | </svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1635 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1636 | <div class="room-menu-wrap" bind:this={roomMenuEl}> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1637 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1638 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1639 | class="icon-btn" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1640 | aria-haspopup="menu" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1641 | aria-expanded={roomMenuOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1642 | aria-label="Room options" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1643 | title="Room options" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1644 | on:click={() => (roomMenuOpen = !roomMenuOpen)} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1645 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1646 | <span aria-hidden="true">⋯</span> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1647 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1648 | {#if roomMenuOpen} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1649 | <div class="room-menu" role="menu"> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1650 | <button type="button" role="menuitem" on:click={() => roomMenuAction(() => (dialog = 'security'))}> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1651 | Security |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1652 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1653 | {#if selectedRoom.membership === 'Joined'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1654 | <button |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1655 | type="button" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1656 | role="menuitem" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1657 | class="danger" |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1658 | disabled={leaveBusy} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1659 | on:click={() => roomMenuAction(() => void leave())} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1660 | > |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1661 | {leaveBusy ? 'Leaving…' : 'Leave room'} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1662 | </button> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1663 | {/if} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1664 | </div> |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1665 | {/if} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1666 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1667 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1668 | </header> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1669 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1670 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1671 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1672 | <div class="sec-banner warn" role="status"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1673 | <span>Message history is locked</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1674 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1675 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1676 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1677 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1678 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1679 | {#if verificationBanner.kind === 'Incoming'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1680 | <span>A device wants to verify this session</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1681 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1682 | {:else if verificationBanner.kind === 'Comparison'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1683 | <span>Verification codes ready</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1684 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1685 | {:else if verificationBanner.kind === 'Waiting'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1686 | <span>Verification started</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1687 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1688 | {:else if verificationBanner.kind === 'Failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1689 | <span>Verification failed: {verificationBanner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1690 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1691 | {:else if verificationBanner.kind === 'Cancelled'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1692 | <span>Verification cancelled: {verificationBanner.reason}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1693 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1694 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1695 | <span>Verification in progress</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1696 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1697 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1698 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1699 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1700 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1701 | <p class="conn-banner error" role="alert">{openFailed[$selectedRoomId]}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1702 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1703 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1704 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1705 | <div |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1706 | class="timeline" |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1707 | bind:this={timelineEl} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1708 | on:scroll={onTimelineScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1709 | on:wheel={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1710 | on:touchmove={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1711 | on:keydown={onTimelineKey} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1712 | on:pointerdown={onTimelinePointer} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1713 | aria-label={`Messages in ${selectedRoom.name}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1714 | > |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1715 | <div class="timeline-inner" use:pinTimeline> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1716 | <div class="timeline-top"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1717 | {#if hasStart} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1718 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1719 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1720 | <button type="button" class="ghost-btn" disabled={paginateBusy} on:click={() => void paginate()}> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1721 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1722 | </button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1723 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1724 | </div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1725 | {#if grouped.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1726 | <p class="side-note timeline-empty">No messages yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1727 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1728 | {#each grouped as g (g.key)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1729 | {#if g.item.kind === 'day'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1730 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1731 | {:else if g.item.kind === 'readMarker'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1732 | <div class="new-row"><span>New</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1733 | {:else if g.item.kind === 'start'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1734 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1735 | {:else if g.item.kind === 'unknown'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1736 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1737 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1738 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1739 | itemId={g.key} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1740 | event={g.item.event} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1741 | showSender={g.showSender} |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 1742 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id) ?? g.item.event.sender.avatar} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1743 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1744 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1745 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1746 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1747 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1748 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1749 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1750 | {people} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1751 | self={$sessionUser ?? null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1752 | onReply={selectedRoom.membership === 'Joined' ? startReply : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1753 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1754 | onEdit={selectedRoom.membership === 'Joined' ? startEdit : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1755 | editing={editing !== null && editing.eventId === g.item.event.event_id} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1756 | showSent={g.item.event.item_id === lastSentId && pendingItems.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1757 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1758 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1759 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1760 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1761 | {#each pendingItems as p, i (p.id)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1762 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1763 | itemId={`pending-${p.id}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1764 | event={pendingToEvent(p)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1765 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1766 | showSender={pendingShowSender(i)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1767 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1768 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1769 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1770 | quickReactions={$quickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1771 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1772 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1773 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1774 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1775 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1776 | {#if p.status === 'failed'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1777 | <div class="pending-actions"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1778 | <span class="pending-error" role="alert">{p.error}</span> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1779 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1780 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1781 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1782 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1783 | {/each} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 1784 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1785 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1786 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1787 | {#if selectedRoom.membership === 'Joined'} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1788 | {#if editing} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1789 | <div class="reply-bar" role="status"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1790 | <span class="reply-bar-label"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1791 | Editing message |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1792 | <span class="reply-bar-text">{editing.original}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1793 | </span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1794 | <button type="button" class="icon-btn" aria-label="Cancel edit" title="Cancel edit (Esc)" on:click={cancelEdit}> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1795 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1796 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1797 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1798 | {:else if replyingTo && replyingTo.details.kind === 'Ready'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1799 | <div class="reply-bar" role="status"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1800 | <span class="reply-bar-label"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1801 | Replying to <strong>{senderLabel(replyingTo.details.sender)}</strong> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1802 | <span class="reply-bar-text">{contentPreview(replyingTo.details.content)}</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1803 | </span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1804 | <button type="button" class="icon-btn" aria-label="Cancel reply" title="Cancel reply (Esc)" on:click={() => (replyingTo = null)}> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1805 | <span aria-hidden="true">✕</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1806 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1807 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1808 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1809 | {#if $selectedRoomId && currentStaged.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1810 | {@const stagedRoom = $selectedRoomId} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1811 | <ul class="staged" aria-label="Attachments to send"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1812 | {#each currentStaged as attachment (attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1813 | <li class="staged-item"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1814 | {#if attachment.previewUrl} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1815 | <img src={attachment.previewUrl} alt={attachment.file.name || 'Pasted image'} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1816 | {:else} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1817 | <span class="staged-name">{attachment.file.name || 'attachment'}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1818 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1819 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1820 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1821 | class="icon-btn staged-remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1822 | aria-label={`Remove ${attachment.file.name || 'attachment'}`} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1823 | title="Remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1824 | on:click={() => unstage(stagedRoom, attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1825 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1826 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1827 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1828 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1829 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1830 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1831 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1832 | <form class="composer" class:replying={replyingTo || editing} class:staging={currentStaged.length > 0} on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1833 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1834 | {#if mentionQuery && mentionCandidates.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1835 | <ul class="mention-finder" role="listbox" aria-label="Mention someone"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1836 | {#each mentionCandidates as person, i (person.user_id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1837 | <li |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1838 | role="option" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1839 | aria-selected={i === mentionIndex} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1840 | class:active={i === mentionIndex} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1841 | on:pointerdown|preventDefault={() => void pickMention(person)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1842 | on:pointerenter={() => (mentionIndex = i)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1843 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1844 | <MxcAvatar mxc={person.avatar} label={person.name} size={22} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1845 | <span class="mention-name">{person.name}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1846 | <span class="mention-id">{person.user_id}</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1847 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1848 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1849 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1850 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1851 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1852 | type="file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1853 | multiple |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1854 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1855 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1856 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1857 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1858 | /> |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1859 | <input |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1860 | type="file" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1861 | accept="image/*" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1862 | bind:this={avatarInput} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1863 | class="visually-hidden" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1864 | aria-label="Choose a new avatar" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1865 | on:change={() => void onAvatarChosen()} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1866 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1867 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1868 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1869 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1870 | title="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1871 | aria-label="Attach an image or file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1872 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1873 | on:click={pickFiles} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1874 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1875 | {uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : '📎'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1876 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1877 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1878 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1879 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1880 | bind:value={composer} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1881 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1882 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1883 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1884 | on:keydown={onComposerKey} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1885 | on:input={updateMentionQuery} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1886 | on:click={updateMentionQuery} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1887 | on:keyup={(e) => (e.key.startsWith('Arrow') && e.key !== 'ArrowUp' && e.key !== 'ArrowDown') || e.key === 'Home' || e.key === 'End' ? updateMentionQuery() : undefined} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1888 | on:blur={() => (mentionQuery = null)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1889 | on:paste={onComposerPaste} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1890 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1891 | ></textarea> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1892 | <button |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1893 | type="button" |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1894 | class="icon-btn md-toggle" |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1895 | aria-pressed={$markdownEnabled} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1896 | aria-label={$markdownEnabled ? 'Turn markdown off' : 'Turn markdown on'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1897 | title={$markdownEnabled ? 'Markdown on' : 'Markdown off'} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1898 | on:click={() => markdownEnabled.update((v) => !v)} |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1899 | > |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1900 | <svg viewBox="0 0 24 16" width="22" height="15" aria-hidden="true"> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1901 | <rect x="1" y="1" width="22" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.6" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1902 | <path d="M4.5 11.5v-7l2.75 3 2.75-3v7M15.5 4.5v6.5M13 8.5l2.5 2.75L18 8.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" /> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1903 | </svg> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1904 | </button> |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1905 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1906 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1907 | class="primary-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1908 | disabled={(!composer.trim() && currentStaged.length === 0) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1909 | !($selectedRoomId && openReady[$selectedRoomId]) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1910 | (currentStaged.length > 0 && uploadBusy)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1911 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1912 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1913 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1914 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1915 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1916 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1917 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1918 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1919 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1920 | {joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1921 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1922 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1923 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1924 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1925 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1926 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1927 | {#if selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1928 | <aside class="members" aria-hidden={!membersOpen} aria-label={`Members of ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1929 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1930 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1931 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1932 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1933 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1934 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1935 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1936 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1937 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1938 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1939 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1940 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1941 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1942 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1943 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1944 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1945 | <ul class="member-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1946 | {#each members as member (member.user_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1947 | <li class="member"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1948 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1949 | <span class="member-names"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1950 | <span class="member-name">{member.display_name || member.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1951 | <span class="member-id">{member.user_id}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1952 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1953 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1954 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1955 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1956 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1957 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1958 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1959 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1960 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1961 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1962 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1963 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1964 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1965 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1966 | onAction={() => void loadEncryption()} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1967 | encryptedPreviews={$urlPreviewSettings.encrypted_rooms} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1968 | onEncryptedPreviews={(enabled) => void changeEncryptedPreviews(enabled)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1969 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1970 | /> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1971 | {:else if dialog === 'settings'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1972 | <SettingsPanel |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1973 | quick={$quickReactions} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1974 | packs={roomPacks} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1975 | onQuickChange={(list) => void changeQuickReactions(list)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1976 | on:close={() => (dialog = null)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1977 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1978 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1979 | <div class="modal" role="dialog" aria-modal="true" aria-label={dialog === 'join' ? 'Join a room' : 'Create a room'}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1980 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1981 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1982 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1983 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1984 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1985 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1986 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1987 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1988 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1989 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1990 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1991 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1992 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1993 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1994 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1995 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1996 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1997 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1998 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1999 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2000 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2001 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2002 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2003 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2004 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2005 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2006 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2007 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2008 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2009 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2010 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2011 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2012 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2013 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2014 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2015 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2016 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2017 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2018 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2019 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2020 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2021 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2022 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2023 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2024 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2025 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2026 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2027 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2028 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2029 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2030 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2031 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2032 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2033 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2034 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2035 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2036 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2037 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2038 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2039 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2040 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2041 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2042 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2043 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2044 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2045 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2046 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2047 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2048 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2049 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2050 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2051 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2052 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2053 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2054 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2055 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2056 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2057 | <ImageLightbox /> |