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'; |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 3 | import { fade, fly } from 'svelte/transition'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import LoginPanel from './lib/LoginPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import MessageRow from './lib/MessageRow.svelte'; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 6 | import MentionsInbox from './lib/MentionsInbox.svelte'; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 7 | import HistoryRepairPanel from './lib/HistoryRepairPanel.svelte'; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 8 | import type { HistoryRepairPolicy, HistoryRepairReport } from './lib/repair-model'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 9 | import MxcAvatar from './lib/MxcAvatar.svelte'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 10 | import PinButton from './lib/PinButton.svelte'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 11 | import ContextMenu, { type MenuItem } from './lib/ContextMenu.svelte'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 12 | import StickerPicker from './lib/StickerPicker.svelte'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 13 | import PackManager from './lib/PackManager.svelte'; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 14 | import PackCloneDialog from './lib/PackCloneDialog.svelte'; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 15 | import type { CloneSource } from './lib/pack-clone'; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 16 | import { allPacks, findSticker, reactionShortcode } from './lib/packs'; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 17 | import { disabledPackImages, loadPackPreferences } from './lib/pack-preferences'; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 18 | import { enabledPacks, enabledQuickReactions } from './lib/pack-preferences-model'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 19 | import type { CommandRequest } from './lib/transport'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 20 | import UserCard, { type UserAction } from './lib/UserCard.svelte'; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 21 | import { allowed, canRedact, groupMembers, isMuted, parsePowerLevels, type PowerLevels } from './lib/permissions'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 22 | import { moveBefore, pinnedFirst, sortSpaces } from './lib/rail-order'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 23 | import ImageLightbox from './lib/ImageLightbox.svelte'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 24 | import { lightbox } from './lib/lightbox'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 30 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 31 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 32 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 34 | getSpaceChildren, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 35 | historyRepair, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 36 | continueHistoryRepair, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 37 | cancelHistoryRepair, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 38 | startRecentHistory, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | reactToMessage, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 46 | runCommand, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 47 | sendMessage, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 48 | uploadAttachment, |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 49 | uploadAvatar, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 50 | uploadRoomAvatar, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 51 | editMessage, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 52 | mediaUrl |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | } from './lib/api'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 54 | import EmojiText from './lib/EmojiText.svelte'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 55 | import { loadEmoji, type EmojiEntry } from './lib/emoji'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 56 | import { completeShortcode, customEmotes, emoteQueryAt, rankEmotes, resolveEmotes, type EmoteCandidate, type EmoteQuery } from './lib/emotes'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 57 | import { COMMAND_USAGE, commandQueryAt, isKnownCommand, matchCommands, parseCommand, splitTarget, unescapeCommand } from './lib/commands'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 58 | import type { CommandName } from './lib/commands'; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 59 | import type { ParsedCommand } from './lib/commands'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 67 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | membersLoading, |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 70 | mentionsSnapshot, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | pushBanner, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 72 | imagePacks, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 73 | historyRepairs, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 74 | publishHistoryRepair, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 76 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 77 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 78 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | timelines, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 81 | pinnedTimelines, |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 82 | pinnedTimelineVersions, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 83 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 86 | import type { PendingMessage } from './lib/pending'; |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 87 | import { insideOpenFence } from './lib/markdown'; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 88 | import { TimelineViewport } from './lib/timeline-viewport'; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 89 | import ComposerText from './lib/ComposerText.svelte'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 90 | import { markMentions } from './lib/composer-marks'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 91 | import { mentionQueryAt, mentionsFromHtml, rankPeople, resolveMentions } from './lib/mentions'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 92 | import type { Mention, MentionQuery } from './lib/mentions'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 93 | import { loadQuickReactions, quickReactions, saveQuickReactions } from './lib/quick-reactions'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 94 | import { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 95 | linkPreviews, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 96 | loadUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 97 | requestLinkPreview, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 98 | saveUrlPreviewSettings, |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 99 | urlPreviewSettings |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 100 | } from './lib/link-previews'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | import { formatDay } from './lib/format'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 103 | import { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 104 | MEMBERS_WIDTH, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 105 | SIDE_WIDTH, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 106 | lastSpaceRooms, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 107 | lineHeight, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 108 | membersWidth, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 109 | messageSpacing, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 110 | navFolded, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 111 | railFolded, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 112 | sideWidth |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 113 | } from './lib/appearance'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 114 | import SettingsPanel from './lib/SettingsPanel.svelte'; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 115 | import { packsForRoom, parseEncryptionState, parseOwnProfile, parseVerificationState, contentPreview, senderLabel } from './lib/types'; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 116 | import type { ImagePack, MemberSummary, OwnProfile, PackImage, Person, QuickReaction, ReplyReference, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | let booted = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 120 | let wasOnline = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | let membersOpen = false; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 124 | let replyingTo: ReplyReference | null = null; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 125 | let dialog: 'join' | 'create' | 'security' | 'settings' | 'packs' | null = null; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 126 | let stickersOpen = false; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 127 | let cloneSource: CloneSource | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 131 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 132 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 133 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 134 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 135 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 136 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 137 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 138 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 139 | let timelineEl: HTMLElement | null = null; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 140 | let timelineViewport: TimelineViewport | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 141 | let composerEl: HTMLTextAreaElement | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 142 | let marksEl: HTMLDivElement | null = null; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 143 | let composerComposing = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 144 | $: composerMarks = markMentions( |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 145 | composer, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 146 | ($selectedRoomId && pickedMentions[$selectedRoomId]) || [], |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 147 | resolveEmotes(composer, roomEmotes).map((e) => `:${e.shortcode}:`) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 148 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 149 | let fileInput: HTMLInputElement | null = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 150 | let avatarInput: HTMLInputElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 151 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | let uploadName: string | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 153 | interface StagedAttachment { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 154 | id: number; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 155 | file: File; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 156 | previewUrl: string | null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 157 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 158 | let staged: Record<string, StagedAttachment[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 159 | let editing: { roomId: string; eventId: string; original: string; stash: string } | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 160 | /** 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 | 161 | let pickedMentions: Record<string, Mention[]> = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 162 | let mentionQuery: MentionQuery | null = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 163 | let mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 164 | let nextStagedId = 1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 165 | const WARM_ROOM_LIMIT = 8; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 166 | /** Rooms left open after switching away so coming back is instant, least recently viewed first. */ |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 167 | let warmRooms: string[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 168 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 173 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 175 | let selectedSpaceId: string | null = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 176 | let mentionsOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | let avatarByUser: Record<string, string | null> = {}; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 181 | let restoringRoute = false; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 182 | let repairPanels: Record<string, boolean> = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 183 | let repairBusy: Record<string, boolean> = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 184 | let repairCancelling: Record<string, boolean> = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 185 | let repairErrors: Record<string, string | null> = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 186 | let repairJumps: Record<string, { previous: HistoryRepairReport | null }> = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 187 | let repairAccount: string | null | undefined; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 188 | let repairEpoch = 0; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 189 | $: if ($sessionUser !== repairAccount) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 190 | repairAccount = $sessionUser; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 191 | repairEpoch++; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 192 | repairPanels = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 193 | repairBusy = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 194 | repairCancelling = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 195 | repairErrors = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 196 | repairJumps = {}; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 197 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 198 | $: currentRepair = $selectedRoomId ? $historyRepairs[$selectedRoomId] ?? null : null; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 199 | $: currentRepairActive = !!($selectedRoomId && repairBusy[$selectedRoomId]) || repairActive(currentRepair); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 200 | $: maybeJumpAfterRepair($selectedRoomId, currentRepair, repairJumps); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 201 | $: settleRepairCancellation($historyRepairs, repairBusy); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 202 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 203 | function repairActive(report: HistoryRepairReport | null | undefined): boolean { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 204 | return report?.phase === 'FetchingRecent' || report?.phase === 'Bridging'; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 205 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 206 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 207 | function settleRepairCancellation(reports: Record<string, HistoryRepairReport>, busy: Record<string, boolean>): void { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 208 | for (const [roomId, report] of Object.entries(reports)) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 209 | if (repairCancelling[roomId] && !busy[roomId] && !repairActive(report)) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 210 | repairCancelling = { ...repairCancelling, [roomId]: false }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 211 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 212 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 213 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 214 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 215 | function maybeJumpAfterRepair(roomId: string | null, report: HistoryRepairReport | null, jumps: typeof repairJumps): void { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 216 | if (!roomId || roomId !== $selectedRoomId || !report?.recent_available || !jumps[roomId] || report === jumps[roomId].previous) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 217 | const next = { ...repairJumps }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 218 | delete next[roomId]; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 219 | repairJumps = next; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 220 | stickToBottom = true; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 221 | const epoch = repairEpoch; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 222 | void tick().then(() => { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 223 | if (epoch === repairEpoch && $selectedRoomId === roomId) scrollToBottom(); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 224 | }); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 225 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 226 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 227 | async function showHistoryRepair(roomId: string): Promise<void> { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 228 | if ($selectedRoomId !== roomId) await selectRoom(roomId); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 229 | if ($selectedRoomId === roomId) repairPanels = { ...repairPanels, [roomId]: true }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 230 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 231 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 232 | async function runHistoryRepair(roomId: string, action: 'start' | 'continue' | 'recent', policy: HistoryRepairPolicy | null = null): Promise<void> { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 233 | if (!$sessionUser || repairBusy[roomId] || repairActive($historyRepairs[roomId]) || repairCancelling[roomId]) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 234 | const account = $sessionUser; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 235 | const epoch = repairEpoch; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 236 | repairPanels = { ...repairPanels, [roomId]: true }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 237 | repairBusy = { ...repairBusy, [roomId]: true }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 238 | repairErrors = { ...repairErrors, [roomId]: null }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 239 | if (action !== 'continue') repairJumps = { ...repairJumps, [roomId]: { previous: $historyRepairs[roomId] ?? null } }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 240 | try { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 241 | if (!openReady[roomId]) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 242 | await openRoom(roomId); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 243 | if ($sessionUser !== account || epoch !== repairEpoch) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 244 | openReady = { ...openReady, [roomId]: true }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 245 | const failures = { ...openFailed }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 246 | delete failures[roomId]; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 247 | openFailed = failures; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 248 | touchWarmRoom(roomId); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 249 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 250 | if (repairCancelling[roomId]) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 251 | const report = action === 'continue' ? await continueHistoryRepair(roomId) |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 252 | : action === 'recent' ? await startRecentHistory(roomId) : await historyRepair(roomId, policy); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 253 | if ($sessionUser !== account || epoch !== repairEpoch) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 254 | if (report.room_id !== roomId) throw new Error('History repair returned a different room'); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 255 | publishHistoryRepair(report, account); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 256 | maybeJumpAfterRepair(roomId, report, repairJumps); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 257 | } catch (cause) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 258 | if ($sessionUser === account && epoch === repairEpoch) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 259 | repairErrors = { ...repairErrors, [roomId]: cause instanceof Error ? cause.message : 'Could not repair history' }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 260 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 261 | } finally { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 262 | if ($sessionUser === account && epoch === repairEpoch) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 263 | repairBusy = { ...repairBusy, [roomId]: false }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 264 | repairCancelling = { ...repairCancelling, [roomId]: false }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 265 | if (repairJumps[roomId]) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 266 | const next = { ...repairJumps }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 267 | delete next[roomId]; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 268 | repairJumps = next; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 269 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 270 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 271 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 272 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 273 | |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 274 | async function cancelRoomRepair(roomId: string): Promise<void> { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 275 | if (!$sessionUser || repairCancelling[roomId]) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 276 | const account = $sessionUser; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 277 | const epoch = repairEpoch; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 278 | repairCancelling = { ...repairCancelling, [roomId]: true }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 279 | try { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 280 | await cancelHistoryRepair(roomId); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 281 | if ($sessionUser === account && epoch === repairEpoch && !repairBusy[roomId] && !repairActive($historyRepairs[roomId])) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 282 | repairCancelling = { ...repairCancelling, [roomId]: false }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 283 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 284 | } catch (cause) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 285 | if ($sessionUser === account && epoch === repairEpoch) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 286 | repairCancelling = { ...repairCancelling, [roomId]: false }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 287 | repairErrors = { ...repairErrors, [roomId]: cause instanceof Error ? cause.message : 'Could not cancel history repair' }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 288 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 289 | } |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 290 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 292 | function motionDuration(ms: number): number { |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 293 | return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : ms; |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 294 | } |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 295 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 296 | // 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 | 297 | $: { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 298 | const online = $connection === 'online'; |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 299 | if (online && !wasOnline) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 300 | void loadQuickReactions(); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 301 | void loadPackPreferences(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 302 | void loadUrlPreviewSettings(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 303 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 304 | wasOnline = online; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 305 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 306 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 307 | $: roomPacks = enabledPacks(packsForRoom($imagePacks, $selectedRoomId, $rooms), $disabledPackImages); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 308 | $: roomEmotes = customEmotes(roomPacks); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 309 | $: usableQuickReactions = enabledQuickReactions($quickReactions, allPacks($imagePacks), $disabledPackImages); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 310 | $: previewsAllowed = selectedRoom !== null && (!selectedRoom.encrypted || $urlPreviewSettings.encrypted_rooms); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 311 | $: loadPreview = previewsAllowed && $selectedRoomId ? previewLoader($selectedRoomId) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 312 | $: spaceRooms = $rooms.filter((r) => r.space); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 313 | $: spaceParents = parentSpaceMap(spaceRooms); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 314 | $: railSpaces = spaceRooms.filter((s) => !spaceParents.has(s.room_id)); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 315 | let railOverride: string[] | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 316 | $: if (railOverride && sortSpaces(railSpaces, null).map((s) => s.room_id).join() === railOverride.join()) railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 317 | $: orderedRail = sortSpaces(railSpaces, railOverride); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 318 | $: pinnedRail = orderedRail.filter((s) => s.favourite); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 319 | $: otherRail = orderedRail.filter((s) => !s.favourite); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 320 | $: railSelected = selectedSpaceId ? topSpaceOf(selectedSpaceId, spaceParents) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 321 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 322 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 323 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 324 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 325 | // full list — listing everything would falsely imply it belongs to the space. |
f12c7de2a3ab | atagen | 2026-10-23 08:10 UTC | 326 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds?.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 328 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 329 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 330 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 331 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 332 | : baseRooms; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 333 | $: directRooms = pinnedFirst(visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 334 | $: groupRooms = pinnedFirst(visibleRooms.filter((r) => !r.direct && !r.space && r.membership !== 'Invited')); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 335 | $: spaceList = pinnedFirst(visibleRooms.filter((r) => r.space && r.membership !== 'Invited')); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 336 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 337 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 338 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 339 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 340 | $: currentStaged = $selectedRoomId ? (staged[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 342 | $: memberGroups = groupMembers(members, roomLevels); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 343 | $: people = peopleIn(items, members); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 344 | $: mentionCandidates = mentionQuery ? rankPeople(Object.values(people), mentionQuery.query, $sessionUser ?? null) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 345 | $: if (mentionIndex >= mentionCandidates.length) mentionIndex = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | $: grouped = buildGroups(items); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 348 | $: lastSentId = lastOwnSent(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 354 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 355 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 356 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 360 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 369 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 370 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 371 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 372 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 375 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 376 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 377 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 378 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 379 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 380 | kind: 'Message', |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 381 | 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 | 382 | }, |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 383 | reply_to: p.replyTo, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 384 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 385 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 386 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 387 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 388 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 389 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 390 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 391 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 392 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 393 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 394 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 395 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 396 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 397 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 398 | function lastOwnSent(list: TimelineItem[]): string | null { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 399 | for (let i = list.length - 1; i >= 0; i--) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 400 | const item = list[i]; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 401 | 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 | 402 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 403 | return null; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 404 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 405 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 406 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 407 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 408 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 415 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 416 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 429 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 430 | |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 431 | function recordRoute(spaceId: string | null, roomId: string | null, view?: string): void { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 432 | if (restoringRoute) return; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 433 | const url = new URL(window.location.href); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 434 | url.searchParams.delete('space'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 435 | url.searchParams.delete('room'); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 436 | url.searchParams.delete('view'); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 437 | if (view) url.searchParams.set('view', view); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 438 | if (spaceId) url.searchParams.set('space', spaceId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 439 | if (roomId) url.searchParams.set('room', roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 440 | const next = `${url.pathname}${url.search}${url.hash}`; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 441 | const current = `${window.location.pathname}${window.location.search}${window.location.hash}`; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 442 | if (next !== current) window.history.pushState({ spaceId, roomId }, '', next); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 443 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 444 | |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 445 | async function restoreRoute(): Promise<void> { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 446 | const url = new URL(window.location.href); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 447 | const roomId = url.searchParams.get('room'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 448 | const spaceId = url.searchParams.get('space'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 449 | restoringRoute = true; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 450 | try { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 451 | if (url.searchParams.get('view') === 'mentions') { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 452 | selectMentions(); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 453 | } else if (roomId && $rooms.some((room) => room.room_id === roomId && !room.space)) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 454 | selectedSpaceId = spaceId && $rooms.some((room) => room.room_id === spaceId && room.space) ? spaceId : null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 455 | spaceChildrenError = null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 456 | spaceChildIds = selectedSpaceId ? (await getSpaceChildren(selectedSpaceId)).room_ids ?? [] : null; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 457 | await selectRoom(roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 458 | } else if (spaceId && $rooms.some((room) => room.room_id === spaceId && room.space)) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 459 | await selectSpace(spaceId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 460 | } else { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 461 | await selectHome(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 462 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 463 | } catch (e) { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 464 | pushBanner(e instanceof Error ? e.message : 'Could not restore navigation'); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 465 | } finally { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 466 | restoringRoute = false; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 467 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 468 | } |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 469 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 470 | onMount(() => { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 471 | const onPopState = () => void restoreRoute(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 472 | window.addEventListener('popstate', onPopState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 473 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 474 | return () => { |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 475 | window.removeEventListener('popstate', onPopState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 476 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 477 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 478 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 479 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 480 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 481 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 482 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 483 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 485 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | await refreshRooms(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 490 | await restoreRoute(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 494 | void loadQuickReactions(); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 495 | void loadPackPreferences(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 496 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 497 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 502 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 503 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 504 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 505 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 506 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 507 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 508 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 509 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 510 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 511 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 512 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 513 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 514 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 515 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 516 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 517 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 518 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 519 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 520 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 521 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 524 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 525 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 526 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 527 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 528 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 529 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 530 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 531 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 532 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 533 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 534 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 535 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 536 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 537 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 538 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 539 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 540 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 541 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 542 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 543 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 544 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 545 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 546 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 547 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 548 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 549 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 550 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 551 | void loadQuickReactions(); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 552 | void loadPackPreferences(); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 553 | void loadUrlPreviewSettings(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 555 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 556 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 557 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 561 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 562 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 563 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 564 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 565 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 566 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 567 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 568 | sessionUser.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 569 | lightbox.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | dialog = null; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 573 | cloneSource = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 577 | profileMxc = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 578 | mentionsOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | openFailed = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 584 | warmRooms = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 585 | pickedMentions = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 586 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 587 | clearAllStaged(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 590 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 591 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 592 | /** 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 | 593 | function parentSpaceMap(spaces: RoomSummary[]): Map<string, string> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 594 | const ids = new Set(spaces.map((s) => s.room_id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 595 | const parents = new Map<string, string>(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 596 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 597 | for (const child of space.children) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 598 | 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 | 599 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 600 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 601 | for (const space of spaces) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 602 | const parent = space.parent_spaces.find((id) => id !== space.room_id && ids.has(id)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 603 | if (parent && !parents.has(space.room_id)) parents.set(space.room_id, parent); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 604 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 605 | for (const id of [...parents.keys()]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 606 | const seen = new Set<string>([id]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 607 | let at = parents.get(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 608 | while (at && !seen.has(at)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 609 | seen.add(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 610 | at = parents.get(at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 611 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 612 | if (at) parents.delete(id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 613 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 614 | return parents; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 615 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 616 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 617 | function topSpaceOf(id: string, parents: Map<string, string>): string { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 618 | let at = id; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 619 | while (parents.has(at)) at = parents.get(at)!; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 620 | return at; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 621 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 622 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 623 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 624 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 625 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 626 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 627 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 628 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 629 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 630 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 631 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 632 | async function selectHome(): Promise<void> { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 633 | mentionsOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 634 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 635 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 636 | spaceChildrenError = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 637 | if (window.innerWidth > 640) navFolded.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 638 | sidebarOpen = true; |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 639 | recordRoute(null, null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 640 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 641 | |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 642 | function selectMentions(): void { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 643 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 644 | stopTyping(); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 645 | selectedSpaceId = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 646 | spaceChildIds = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 647 | spaceChildrenError = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 648 | spaceChildrenLoading = false; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 649 | selectedRoomId.set(null); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 650 | replyingTo = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 651 | editing = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 652 | mentionQuery = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 653 | peeking = null; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 654 | membersOpen = false; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 655 | sidebarOpen = false; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 656 | mentionsOpen = true; |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 657 | recordRoute(null, null, 'mentions'); |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 658 | } |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 659 | |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 660 | function toggleChannelsPane(): void { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 661 | if (window.innerWidth <= 640) sidebarOpen = !sidebarOpen; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 662 | else navFolded.update((v) => !v); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 663 | } |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 664 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 665 | async function selectSpace(spaceId: string): Promise<void> { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 666 | mentionsOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 667 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 668 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 669 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 670 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 671 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 672 | spaceChildrenLoading = true; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 673 | const last = $lastSpaceRooms[spaceId]; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 674 | const resume = last && $rooms.some((r) => r.room_id === last && !r.space) ? last : null; |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 675 | if (resume) { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 676 | void selectRoom(resume); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 677 | } else { |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 678 | selectedRoomId.set(null); |
fddb0bcaabeb | atagen | 2026-10-24 07:02 UTC | 679 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 680 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 681 | const res = await getSpaceChildren(spaceId); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 682 | if (selectedSpaceId === spaceId) { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 683 | spaceChildIds = res.room_ids ?? []; |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 684 | const firstChannel = spaceChildIds |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 685 | .map((id) => $rooms.find((room) => room.room_id === id)) |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 686 | .find((room) => room && !room.space); |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 687 | if ((!resume || !spaceChildIds.includes(resume)) && firstChannel) { |
00075327fc57 | atagen | 2026-10-24 11:54 UTC | 688 | await selectRoom(firstChannel.room_id); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 689 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 690 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 691 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 692 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 693 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 694 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 695 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 696 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 697 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 698 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 699 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 700 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 701 | async function selectRoom(roomId: string, peek = false): Promise<void> { |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 702 | mentionsOpen = false; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 703 | peeking = peek ? roomId : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 704 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 705 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 706 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 707 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 708 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 709 | stopTyping(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 710 | const spaceId = selectedSpaceId; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 711 | if (spaceId) lastSpaceRooms.update((all) => ({ ...all, [spaceId]: roomId })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 712 | selectedRoomId.set(roomId); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 713 | recordRoute(selectedSpaceId, roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 714 | composer = drafts[roomId] ?? ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 715 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 716 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 717 | mentionQuery = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 718 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 719 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 720 | sidebarOpen = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 721 | touchWarmRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 722 | if (openReady[roomId]) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 723 | if (membersOpen) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 724 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 725 | scrollToBottom(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 726 | queueReadReceipt(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 727 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 728 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 729 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 730 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 731 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 732 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 733 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 734 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 735 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 736 | await openRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 737 | if (warmRooms.includes(roomId)) openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 738 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 739 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 740 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 741 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 742 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 743 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 744 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 745 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 746 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 747 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 748 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 749 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 750 | function touchWarmRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 751 | warmRooms = [...warmRooms.filter((id) => id !== roomId), roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 752 | while (warmRooms.length > WARM_ROOM_LIMIT) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 753 | const evicted = warmRooms[0]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 754 | warmRooms = warmRooms.slice(1); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 755 | forgetOpenRoom(evicted); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 756 | closeRoom(evicted).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 757 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 758 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 759 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 760 | function forgetOpenRoom(roomId: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 761 | warmRooms = warmRooms.filter((id) => id !== roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 762 | const nextReady = { ...openReady }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 763 | delete nextReady[roomId]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 764 | openReady = nextReady; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 765 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 766 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 767 | function scrollToBottom(): void { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 768 | if (timelineViewport?.element === timelineEl) timelineViewport.scrollToBottom(); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 769 | else if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 770 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 771 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 772 | function noteUserScroll(): void { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 773 | timelineViewport?.releaseScroll(); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 774 | if ($selectedRoomId && repairJumps[$selectedRoomId]) { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 775 | const next = { ...repairJumps }; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 776 | delete next[$selectedRoomId]; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 777 | repairJumps = next; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 778 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 779 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 780 | |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 781 | function syncComposer(node: HTMLTextAreaElement) { |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 782 | const sync = () => { |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 783 | if (!marksEl) return; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 784 | marksEl.style.width = `${node.clientWidth}px`; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 785 | marksEl.scrollTop = node.scrollTop; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 786 | marksEl.scrollLeft = node.scrollLeft; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 787 | }; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 788 | const observer = new ResizeObserver(sync); |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 789 | observer.observe(node); |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 790 | node.addEventListener('scroll', sync); |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 791 | return { destroy: () => { |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 792 | observer.disconnect(); |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 793 | node.removeEventListener('scroll', sync); |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 794 | } }; |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 795 | } |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 796 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 797 | function onTimelineKey(e: KeyboardEvent): void { |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 798 | if (['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '].includes(e.key)) noteUserScroll(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 799 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 800 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 801 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 802 | if (!timelineEl) return; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 803 | if (timelineViewport?.consumeScroll()) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 804 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 805 | stickToBottom = gap < 2; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 806 | timelineViewport?.capture(); |
11cc2db16d17 | atagen | 2026-10-24 12:36 UTC | 807 | if (timelineEl.scrollTop < 80 && !hasStart && !paginateBusy) void paginate(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 808 | } |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 809 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 810 | function pinTimeline(node: HTMLElement) { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 811 | const viewport = new TimelineViewport(node.parentElement!, $selectedRoomId); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 812 | timelineViewport = viewport; |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 813 | const observer = new ResizeObserver(() => { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 814 | if (timelineViewport !== viewport || viewport.roomId !== $selectedRoomId) return; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 815 | if (stickToBottom) viewport.scrollToBottom(true); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 816 | else viewport.restore(); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 817 | }); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 818 | observer.observe(node); |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 819 | if (node.parentElement) observer.observe(node.parentElement); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 820 | return { destroy: () => { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 821 | observer.disconnect(); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 822 | viewport.releaseScroll(); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 823 | if (timelineViewport === viewport) timelineViewport = null; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 824 | } }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 825 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 826 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 827 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 828 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 829 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 830 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 831 | await tick(); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 832 | if (roomId !== $selectedRoomId || timelineViewport?.roomId !== roomId) return; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 833 | if (stickToBottom) timelineViewport.scrollToBottom(true); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 834 | else timelineViewport.restore(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 835 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 836 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 837 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 838 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 839 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 840 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 841 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 842 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 843 | }, 800); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 844 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 845 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 846 | async function sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 847 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 848 | if (!roomId || roomId === peeking) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 849 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 850 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 851 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 852 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 853 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 854 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 855 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 856 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 857 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 858 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 859 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 860 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 861 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 862 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 863 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 864 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 865 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 866 | function send(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 867 | if (editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 868 | submitEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 869 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 870 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 871 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 872 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 873 | const attachments = roomId ? (staged[roomId] ?? []) : []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 874 | if (!roomId || (!body && attachments.length === 0)) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 875 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 876 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 877 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 878 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 879 | if (attachments.length > 0 && uploadBusy) return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 880 | const command = parseCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 881 | if (command && !isKnownCommand(command.name)) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 882 | pushBanner(`Unknown command /${command.name}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 883 | return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 884 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 885 | if (command && attachments.length > 0) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 886 | if (command.name !== 'roomavatar' && command.name !== 'globalavatar') { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 887 | pushBanner(`/${command.name} doesn't take attachments`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 888 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 889 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 890 | if (command.args || attachments.length !== 1 || !attachments[0].file.type.startsWith('image/')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 891 | pushBanner(`/${command.name} takes a single attached image`); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 892 | return; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 893 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 894 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 895 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 896 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 897 | stickToBottom = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 898 | const reply = replyingTo; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 899 | replyingTo = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 900 | const text = unescapeCommand(body); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 901 | const mentions = resolveMentions(text, pickedMentions[roomId] ?? []); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 902 | pickedMentions = { ...pickedMentions, [roomId]: [] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 903 | mentionQuery = null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 904 | if (command) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 905 | const image = attachments[0] ?? null; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 906 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 907 | const { [roomId]: _used, ...rest } = staged; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 908 | staged = rest; |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 909 | } |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 910 | void execute(roomId, command, reply, mentions, image?.file ?? null).finally(() => { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 911 | if (image?.previewUrl) URL.revokeObjectURL(image.previewUrl); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 912 | }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 913 | } else if (attachments.length === 0) { |
e822c659890f | atagen | 2026-10-25 02:37 UTC | 914 | queueSend(roomId, text, reply, mentions, resolveEmotes(text, roomEmotes)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 915 | } else { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 916 | const { [roomId]: _sent, ...rest } = staged; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 917 | staged = rest; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 918 | void sendAttachments(roomId, text, reply, mentions, attachments); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 919 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 920 | if (peeking === roomId) stopPeeking(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 921 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 922 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 923 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 924 | function lastOwnEventId(): string | null { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 925 | for (let i = items.length - 1; i >= 0; i -= 1) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 926 | const entry = items[i]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 927 | if (entry.kind === 'event' && entry.event.own && entry.event.event_id && entry.event.content.kind !== 'Redacted') { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 928 | return entry.event.event_id; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 929 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 930 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 931 | return null; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 932 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 933 | |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 934 | async function execute( |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 935 | roomId: string, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 936 | command: ParsedCommand, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 937 | reply: ReplyReference | null, |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 938 | mentions: Mention[], |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 939 | image: File | null |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 940 | ): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 941 | const { name, args } = command; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 942 | const target = () => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 943 | const found = splitTarget(args, Object.values(people)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 944 | if ('error' in found) throw new Error(found.error); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 945 | return found; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 946 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 947 | const required = (what: string) => { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 948 | if (!args) throw new Error(`/${name} needs ${what}`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 949 | return args; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 950 | }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 951 | try { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 952 | switch (name) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 953 | case 'me': |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 954 | case 'notice': { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 955 | const said = required('something to say'); |
e822c659890f | atagen | 2026-10-25 02:37 UTC | 956 | await sendMessage(roomId, said, null, mentions, name === 'me' ? 'emote' : 'notice', resolveEmotes(said, roomEmotes)); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 957 | break; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 958 | } |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 959 | case 'sticker': { |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 960 | const { pack, sticker } = findSticker(enabledPacks(packsForRoom($imagePacks, roomId, $rooms), $disabledPackImages), required('a sticker name')); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 961 | await runCommand({ op: 'send_sticker', room_id: roomId, pack_id: pack.id, shortcode: sticker.shortcode }); |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 962 | break; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 963 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 964 | case 'msg': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 965 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 966 | const res = (await runCommand({ op: 'direct', user_id })) as { room_id: string }; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 967 | await refreshRooms(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 968 | await selectRoom(res.room_id); |
e822c659890f | atagen | 2026-10-25 02:37 UTC | 969 | if (rest) queueSend(res.room_id, rest); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 970 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 971 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 972 | case 'join': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 973 | await join(required('a room id or alias')); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 974 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 975 | case 'leave': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 976 | await leave(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 977 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 978 | case 'invite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 979 | await runCommand({ op: 'invite', room_id: roomId, user_id: target().user_id }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 980 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 981 | case 'disinvite': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 982 | case 'kick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 983 | case 'ban': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 984 | case 'unban': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 985 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 986 | const op = name === 'disinvite' ? 'kick' : name; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 987 | await runCommand({ op, room_id: roomId, user_id, reason: rest || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 988 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 989 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 990 | case 'powerlevel': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 991 | const { user_id, rest } = target(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 992 | const level = Number(rest); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 993 | if (!rest || !Number.isInteger(level)) throw new Error('/powerlevel needs a whole number after the name'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 994 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id, level }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 995 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 996 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 997 | case 'mute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 998 | case 'unmute': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 999 | await runCommand({ op: 'mute', room_id: roomId, user_id: target().user_id, muted: name === 'mute' }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1000 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1001 | case 'ignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1002 | case 'unignore': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1003 | await runCommand({ op: name, user_id: target().user_id }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1004 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1005 | case 'roomnick': |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1006 | await runCommand({ op: 'set_room_display_name', room_id: roomId, name: args || null }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1007 | break; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1008 | case 'roomavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1009 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1010 | await uploadRoomAvatar(roomId, image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1011 | } else if (args && !args.startsWith('mxc://')) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1012 | throw new Error('/roomavatar takes an mxc:// link, an attached image, or nothing to drop the override'); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1013 | } else { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1014 | await runCommand({ op: 'set_room_avatar', room_id: roomId, mxc: args || null }); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1015 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1016 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1017 | case 'delete': { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1018 | const eventId = reply?.event_id ?? lastOwnEventId(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1019 | if (!eventId) throw new Error('Nothing of yours to delete here'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1020 | await runCommand({ op: 'redact', room_id: roomId, event_id: eventId, reason: args || null }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1021 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1022 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1023 | case 'globalnick': |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1024 | await runCommand({ op: 'set_display_name', name: required('a name') }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1025 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1026 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1027 | case 'globalavatar': |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1028 | if (image) { |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1029 | await uploadAvatar(image); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1030 | await loadProfile(); |
6c8fd192fb8c | atagen | 2026-10-24 08:20 UTC | 1031 | } else if (!args) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1032 | avatarInput?.click(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1033 | } else if (args.startsWith('mxc://')) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1034 | await runCommand({ op: 'set_avatar', mxc: args }); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1035 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1036 | } else { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1037 | throw new Error('/globalavatar takes an mxc:// link, or nothing to pick a file'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1038 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1039 | break; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1040 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1041 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1042 | pushBanner(e instanceof Error ? e.message : `/${name} failed`); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1043 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1044 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1045 | |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1046 | async function onAvatarChosen(): Promise<void> { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1047 | const file = avatarInput?.files?.[0]; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1048 | if (avatarInput) avatarInput.value = ''; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1049 | if (!file) return; |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1050 | try { |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 1051 | await uploadAvatar(file); |
5e9271c9b8f1 | atagen | 2026-10-24 07:45 UTC | 1052 | await loadProfile(); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1053 | } catch (e) { |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1054 | pushBanner(e instanceof Error ? e.message : 'Avatar upload failed'); |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1055 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1056 | } |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 1057 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1058 | async function sendAttachments( |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1059 | roomId: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1060 | body: string, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1061 | reply: ReplyReference | null, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1062 | mentions: Mention[], |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1063 | attachments: StagedAttachment[] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1064 | ): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1065 | let first = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1066 | uploadBusy = true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1067 | try { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1068 | for (const attachment of attachments) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1069 | uploadName = attachment.file.name || 'attachment'; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1070 | try { |
e822c659890f | atagen | 2026-10-25 02:37 UTC | 1071 | if (first) await uploadAttachment(roomId, attachment.file, body || null, reply?.event_id ?? null, mentions, resolveEmotes(body, roomEmotes)); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1072 | else await uploadAttachment(roomId, attachment.file); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1073 | first = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1074 | } catch (e) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1075 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1076 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1077 | if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1078 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1079 | } finally { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1080 | uploadBusy = false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1081 | uploadName = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1082 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1083 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1084 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1085 | function stageFiles(files: File[]): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1086 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1087 | if (!roomId || !openReady[roomId]) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1088 | const accepted: StagedAttachment[] = []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1089 | for (const file of files) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1090 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1091 | pushBanner(`${file.name || 'File'} must be between 1 byte and 20 MiB.`); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1092 | continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1093 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1094 | const previewUrl = file.type.startsWith('image/') ? URL.createObjectURL(file) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1095 | accepted.push({ id: nextStagedId++, file, previewUrl }); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1096 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1097 | if (accepted.length === 0) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1098 | staged = { ...staged, [roomId]: [...(staged[roomId] ?? []), ...accepted] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1099 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1100 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1101 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1102 | function unstage(roomId: string, id: number): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1103 | const list = staged[roomId] ?? []; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1104 | const removed = list.find((a) => a.id === id); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1105 | if (removed?.previewUrl) URL.revokeObjectURL(removed.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1106 | staged = { ...staged, [roomId]: list.filter((a) => a.id !== id) }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1107 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1108 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1109 | function clearAllStaged(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1110 | for (const list of Object.values(staged)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1111 | for (const attachment of list) if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1112 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1113 | staged = {}; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1114 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1115 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1116 | function startEdit(eventId: string, body: string): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1117 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1118 | if (!roomId) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1119 | const stash = editing ? editing.stash : composer; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1120 | editing = { roomId, eventId, original: body, stash }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1121 | const entry = items.find((i) => i.kind === 'event' && i.event.event_id === eventId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1122 | if (entry?.kind === 'event' && entry.event.content.kind === 'Message') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1123 | const existing = mentionsFromHtml(entry.event.content.message.formatted_body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1124 | pickedMentions = { ...pickedMentions, [roomId]: [...(pickedMentions[roomId] ?? []), ...existing] }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1125 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1126 | composer = body; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1127 | replyingTo = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1128 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1129 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1130 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1131 | function cancelEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1132 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1133 | composer = editing.stash; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1134 | editing = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1135 | composerEl?.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1136 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1137 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1138 | function submitEdit(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1139 | if (!editing) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1140 | const { roomId, eventId, original } = editing; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1141 | const body = composer.trim(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1142 | cancelEdit(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1143 | if (!body || body === original.trim()) return; |
e822c659890f | atagen | 2026-10-25 02:37 UTC | 1144 | editMessage(roomId, eventId, body, resolveMentions(body, pickedMentions[roomId] ?? []), resolveEmotes(body, roomEmotes)).catch((e) => pushBanner(e instanceof Error ? e.message : 'Edit failed')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1145 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1146 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1147 | function editLastOwn(): boolean { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1148 | for (let i = items.length - 1; i >= 0; i -= 1) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1149 | const entry = items[i]; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1150 | if (entry.kind !== 'event' || !entry.event.own) continue; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1151 | const ev = entry.event; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1152 | 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 | 1153 | startEdit(ev.event_id, ev.content.message.body); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1154 | return true; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1155 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1156 | return false; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1157 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1158 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1159 | function startReply(target: ReplyReference): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1160 | if (editing) cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1161 | replyingTo = target; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1162 | composerEl?.focus(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1163 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1164 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1165 | let pinnedOpenFor: string | null = null; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1166 | let pinnedCloseVersion = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1167 | let pinsExpanded = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1168 | let pinPreview: TimelineEvent | null = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1169 | let pinJumpBusy = false; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1170 | $: syncPinned(selectedRoom?.room_id ?? null, (selectedRoom?.pinned_events.length ?? 0) > 0, $selectedRoomId ? $pinnedTimelineVersions[$selectedRoomId] ?? 0 : 0, currentRepairActive); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1171 | function syncPinned(roomId: string | null, hasPins: boolean, version: number, repairing: boolean): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1172 | const want = hasPins ? roomId : null; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1173 | if (want === pinnedOpenFor && version === pinnedCloseVersion) return; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1174 | if (want && repairing) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1175 | if (pinnedOpenFor) runCommand({ op: 'close_pinned', room_id: pinnedOpenFor }).catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1176 | pinnedOpenFor = want; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1177 | pinnedCloseVersion = version; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1178 | pinsExpanded = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1179 | if (want) runCommand({ op: 'open_pinned', room_id: want }).catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1180 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1181 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1182 | $: pins = pinnedList(selectedRoom, $pinnedTimelines); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1183 | function pinnedList(room: RoomSummary | null, all: Record<string, TimelineItem[]>): TimelineEvent[] { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1184 | if (!room || !room.pinned_events.length) return []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1185 | const order = new Map(room.pinned_events.map((id, i) => [id, i])); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1186 | return (all[room.room_id] ?? []) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1187 | .flatMap((item) => (item.kind === 'event' && item.event.event_id && order.has(item.event.event_id) ? [item.event] : [])) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1188 | .sort((a, b) => (order.get(b.event_id!) ?? 0) - (order.get(a.event_id!) ?? 0)); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1189 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1190 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1191 | function setPinned(eventId: string, pinned: boolean): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1192 | const roomId = $selectedRoomId; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1193 | if (!roomId) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1194 | runCommand({ op: 'set_pinned', room_id: roomId, event_id: eventId, pinned }).catch((e) => |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1195 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin') |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1196 | ); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1197 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1198 | |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1199 | async function jumpToPin(eventId: string): Promise<void> { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1200 | const roomId = $selectedRoomId; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1201 | if (!roomId || !eventId || pinJumpBusy) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1202 | pinsExpanded = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1203 | pinPreview = pins.find((event) => event.event_id === eventId) ?? null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1204 | pinJumpBusy = true; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1205 | try { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1206 | for (let attempt = 0; attempt < 24; attempt += 1) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1207 | if (($timelines[roomId] ?? []).some((item) => item.kind === 'event' && item.event.event_id === eventId)) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1208 | pinPreview = null; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1209 | await tick(); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1210 | jumpTo(eventId); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1211 | return; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1212 | } |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1213 | await paginateRoom(roomId); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1214 | await new Promise((resolve) => window.setTimeout(resolve, 180)); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1215 | } |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1216 | pushBanner('Could not load that pinned message'); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1217 | } catch (e) { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1218 | pushBanner(e instanceof Error ? e.message : 'Could not load that pinned message'); |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1219 | } finally { |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1220 | pinJumpBusy = false; |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1221 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1222 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1223 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1224 | function jumpTo(eventId: string): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1225 | const el = timelineEl?.querySelector<HTMLElement>(`[data-event="${CSS.escape(eventId)}"]`); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1226 | if (!el) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1227 | pushBanner('The original message is not loaded. Scroll up to load older messages.'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1228 | return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1229 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1230 | stickToBottom = false; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 1231 | timelineViewport?.releaseScroll(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1232 | el.scrollIntoView({ block: 'center', behavior: 'smooth' }); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1233 | el.classList.remove('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1234 | void el.offsetWidth; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1235 | el.classList.add('flash'); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1236 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1237 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1238 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1239 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1240 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1241 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1242 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1243 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1244 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1245 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1246 | stopTyping(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1247 | } else if (edited && roomId !== peeking) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1248 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1249 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1250 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1251 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1252 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1253 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 1254 | if (!roomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1255 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1256 | await tick(); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 1257 | if (roomId !== $selectedRoomId || timelineViewport?.roomId !== roomId) return; |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 1258 | if (stickToBottom) timelineViewport.scrollToBottom(true); |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 1259 | else timelineViewport.restore(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1260 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1261 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1262 | let commandQuery: string | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1263 | let commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1264 | $: commandCandidates = commandQuery === null ? [] : matchCommands(commandQuery); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1265 | $: if (commandIndex >= commandCandidates.length) commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1266 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1267 | async function pickCommand(name: CommandName): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1268 | if (!composerEl) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1269 | const caret = composerEl.selectionStart ?? composer.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1270 | const rest = composer.slice(caret).replace(/^\S*/, ''); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1271 | composer = `/${name}${rest.startsWith(' ') ? rest : ` ${rest}`}`; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1272 | commandQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1273 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1274 | const at = name.length + 2; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1275 | composerEl.focus(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1276 | composerEl.setSelectionRange(at, at); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1277 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1278 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1279 | let emoteQuery: EmoteQuery | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1280 | let emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1281 | let emojiList: EmojiEntry[] = []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1282 | $: emoteCandidates = emoteQuery ? rankEmotes(emoteQuery.query, roomEmotes, emojiList) : []; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1283 | $: if (emoteIndex >= emoteCandidates.length) emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1284 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1285 | function ensureEmoji(): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1286 | if (emojiList.length) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1287 | loadEmoji() |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1288 | .then((groups) => (emojiList = groups.flatMap((g) => g.emojis))) |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1289 | .catch(() => undefined); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1290 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1291 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1292 | async function onComposerInput(): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1293 | if (composerEl && composer.includes(':')) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1294 | ensureEmoji(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1295 | const done = completeShortcode(composerEl.value, composerEl.selectionStart ?? composerEl.value.length, emojiList); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1296 | if (done) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1297 | composer = done.text; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1298 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1299 | composerEl.setSelectionRange(done.caret, done.caret); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1300 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1301 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1302 | updateMentionQuery(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1303 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1304 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1305 | async function pickEmote(candidate: EmoteCandidate): Promise<void> { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1306 | if (!emoteQuery || !composerEl) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1307 | const caret = composerEl.selectionStart ?? composer.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1308 | const inserted = candidate.kind === 'emoji' ? candidate.emoji : `:${candidate.shortcode}: `; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1309 | composer = composer.slice(0, emoteQuery.start) + inserted + composer.slice(caret); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1310 | const at = emoteQuery.start + inserted.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1311 | emoteQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1312 | await tick(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1313 | composerEl.focus(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1314 | composerEl.setSelectionRange(at, at); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1315 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1316 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1317 | function updateMentionQuery(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1318 | const roomId = $selectedRoomId; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1319 | const nextEmote = composerEl ? emoteQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1320 | if (nextEmote?.start !== emoteQuery?.start) emoteIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1321 | emoteQuery = nextEmote; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1322 | const nextCommand = composerEl ? commandQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1323 | if (nextCommand !== commandQuery) commandIndex = 0; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1324 | commandQuery = nextCommand; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1325 | const next = composerEl && roomId ? mentionQueryAt(composerEl.value, composerEl.selectionStart ?? composerEl.value.length) : null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1326 | if (next && !mentionQuery && roomId && !$membersByRoom[roomId]) void loadMembers(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1327 | if (next?.start !== mentionQuery?.start) mentionIndex = 0; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1328 | mentionQuery = next; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1329 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1330 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1331 | async function pickMention(person: Person): Promise<void> { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1332 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1333 | if (!mentionQuery || !roomId || !composerEl) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1334 | const caret = composerEl.selectionStart ?? composer.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1335 | const inserted = `${person.name} `; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1336 | composer = composer.slice(0, mentionQuery.start) + inserted + composer.slice(caret); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1337 | const at = mentionQuery.start + inserted.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1338 | pickedMentions = { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1339 | ...pickedMentions, |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1340 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1341 | }; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1342 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1343 | await tick(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1344 | composerEl.focus(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1345 | composerEl.setSelectionRange(at, at); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1346 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1347 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1348 | function onComposerKey(ev: KeyboardEvent): void { |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 1349 | if (ev.isComposing || composerComposing) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1350 | if (emoteQuery && emoteCandidates.length > 0) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1351 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1352 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1353 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1354 | emoteIndex = (emoteIndex + step + emoteCandidates.length) % emoteCandidates.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1355 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1356 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1357 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1358 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1359 | void pickEmote(emoteCandidates[emoteIndex]); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1360 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1361 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1362 | if (ev.key === 'Escape') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1363 | ev.stopPropagation(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1364 | emoteQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1365 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1366 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1367 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1368 | if (commandQuery !== null && commandCandidates.length > 0) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1369 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1370 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1371 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1372 | commandIndex = (commandIndex + step + commandCandidates.length) % commandCandidates.length; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1373 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1374 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1375 | const exact = commandCandidates.length === 1 && commandCandidates[0] === commandQuery; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1376 | if (ev.key === 'Tab' || (ev.key === 'Enter' && !ev.shiftKey && !exact)) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1377 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1378 | void pickCommand(commandCandidates[commandIndex]); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1379 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1380 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1381 | if (ev.key === 'Escape') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1382 | ev.stopPropagation(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1383 | commandQuery = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1384 | return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1385 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1386 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1387 | if (mentionQuery && mentionCandidates.length > 0) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1388 | if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1389 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1390 | const step = ev.key === 'ArrowDown' ? 1 : -1; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1391 | mentionIndex = (mentionIndex + step + mentionCandidates.length) % mentionCandidates.length; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1392 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1393 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1394 | if ((ev.key === 'Enter' && !ev.shiftKey) || ev.key === 'Tab') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1395 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1396 | void pickMention(mentionCandidates[mentionIndex]); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1397 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1398 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1399 | if (ev.key === 'Escape') { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1400 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1401 | mentionQuery = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1402 | return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1403 | } |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1404 | } |
6d6a4c34bdc1 | atagen | 2026-10-24 06:51 UTC | 1405 | if (ev.key === 'Enter' && !ev.shiftKey && !insideOpenFence(composer, composerEl?.selectionStart ?? composer.length)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1406 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1407 | send(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1408 | } else if (ev.key === 'Escape' && editing) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1409 | ev.stopPropagation(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1410 | cancelEdit(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1411 | } else if (ev.key === 'Escape' && replyingTo) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1412 | ev.stopPropagation(); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1413 | replyingTo = null; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1414 | } else if (ev.key === 'ArrowUp' && !composer && !editing && editLastOwn()) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1415 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1416 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1417 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1418 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1419 | function pickFiles(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1420 | const roomId = $selectedRoomId; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1421 | if (!roomId || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1422 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1423 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1424 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1425 | function onFileChosen(): void { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1426 | stageFiles(Array.from(fileInput?.files ?? [])); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1427 | if (fileInput) fileInput.value = ''; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1428 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1429 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1430 | function onComposerPaste(ev: ClipboardEvent): void { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1431 | const data = ev.clipboardData; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1432 | // 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 | 1433 | if (!data || data.types.includes('text/plain')) return; |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1434 | const images = Array.from(data.files).filter((f) => f.type.startsWith('image/')); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1435 | if (images.length === 0) return; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1436 | ev.preventDefault(); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1437 | stageFiles(images); |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1438 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1439 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1440 | async function react(eventId: string, key: string, shortcode?: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1441 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1442 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1443 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1444 | try { |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1445 | await reactToMessage(roomId, eventId, key, reactionShortcode(key, shortcode, allPacks($imagePacks))); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1446 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1447 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1448 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1449 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1450 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1451 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1452 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1453 | function previewLoader(roomId: string): (url: string) => void { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1454 | return (url) => requestLinkPreview(roomId, url); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1455 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1456 | |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1457 | async function changeEncryptedPreviews(enabled: boolean): Promise<void> { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1458 | try { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1459 | await saveUrlPreviewSettings({ encrypted_rooms: enabled }); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1460 | } catch (e) { |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1461 | pushBanner(e instanceof Error ? e.message : 'Could not save link preview setting'); |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1462 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1463 | } |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 1464 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1465 | async function changeQuickReactions(list: QuickReaction[]): Promise<void> { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1466 | try { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1467 | await saveQuickReactions(list); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1468 | } catch (e) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1469 | pushBanner(e instanceof Error ? e.message : 'Could not save quick reactions'); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1470 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1471 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1472 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1473 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1474 | const roomId = $selectedRoomId; |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1475 | if (!roomId || paginateBusy || currentRepairActive) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1476 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1477 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1478 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1479 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1480 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1481 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1482 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1483 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1484 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1485 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1486 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1487 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1488 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1489 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1490 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1491 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1492 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1493 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1494 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1495 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1496 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1497 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1498 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1499 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1500 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1501 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1502 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1503 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1504 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1505 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1506 | |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1507 | function peopleIn(list: TimelineItem[], roster: MemberSummary[]): Record<string, Person> { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1508 | const out: Record<string, Person> = {}; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1509 | for (const item of list) { |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1510 | if (item.kind !== 'event') continue; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1511 | const s = item.event.sender; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1512 | out[s.user_id] = { user_id: s.user_id, name: senderLabel(s), avatar: s.avatar }; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1513 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1514 | 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 | 1515 | return out; |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1516 | } |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 1517 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1518 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1519 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1520 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1521 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1522 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1523 | membersOpen = !membersOpen; |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1524 | if (membersOpen && $selectedRoomId) { |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1525 | void loadMembers($selectedRoomId); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1526 | void loadLevels($selectedRoomId); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 1527 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1528 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1529 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1530 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1531 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1532 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1533 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1534 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1535 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1536 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1537 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1538 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1539 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1540 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1541 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1542 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1543 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1544 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1545 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1546 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1547 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1548 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1549 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1550 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1551 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1552 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1553 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1554 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1555 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1556 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1557 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1558 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1559 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1560 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1561 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1562 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1563 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1564 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1565 | async function leave(roomId: string | null = $selectedRoomId): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1566 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1567 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1568 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1569 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1570 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1571 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1572 | if (warmRooms.includes(roomId)) { |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1573 | forgetOpenRoom(roomId); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1574 | closeRoom(roomId).catch(() => undefined); |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 1575 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1576 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1577 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1578 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1579 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1580 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1581 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1582 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1583 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1584 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1585 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1586 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1587 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1588 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1589 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1590 | let dragSpaceId: string | null = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1591 | let dropTarget: { id: string; after: boolean } | null = null; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1592 | let menu: { items: MenuItem[]; x: number; y: number; above?: boolean } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1593 | let userCard: { userId: string; x: number; y: number; confirm: 'kick' | 'ban' | null } | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1594 | let levelsByRoom: Record<string, PowerLevels | null> = {}; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1595 | let peeking: string | null = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1596 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1597 | $: roomLevels = $selectedRoomId ? (levelsByRoom[$selectedRoomId] ?? null) : null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1598 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1599 | function personFor(userId: string): Person { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1600 | return people[userId] ?? { user_id: userId, name: userId, avatar: avatarByUser[userId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1601 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1602 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1603 | function memberFor(userId: string): MemberSummary | null { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1604 | return members.find((m) => m.user_id === userId) ?? null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1605 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1606 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1607 | async function loadLevels(roomId: string): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1608 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1609 | const levels = parsePowerLevels(await runCommand({ op: 'power_levels', room_id: roomId })); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1610 | levelsByRoom = { ...levelsByRoom, [roomId]: levels }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1611 | } catch { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1612 | levelsByRoom = { ...levelsByRoom, [roomId]: levelsByRoom[roomId] ?? null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1613 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1614 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1615 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1616 | async function openUser(userId: string, x: number, y: number, asMenu: boolean): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1617 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1618 | if (roomId && !(roomId in levelsByRoom)) await loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1619 | else if (roomId) void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1620 | if (asMenu) menu = { items: userMenuItems(userId, x, y), x, y }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1621 | else userCard = { userId, x, y, confirm: null }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1622 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1623 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1624 | function copyText(text: string): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1625 | navigator.clipboard.writeText(text).catch(() => pushBanner('Could not copy to the clipboard')); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1626 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1627 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1628 | function userMenuItems(userId: string, x: number, y: number): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1629 | const own = userId === $sessionUser; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1630 | const member = memberFor(userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1631 | const items: MenuItem[] = []; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1632 | if (!own) items.push({ label: 'Message', action: () => void userAction(userId, { kind: 'message' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1633 | items.push({ label: 'Mention', action: () => void userAction(userId, { kind: 'mention' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1634 | items.push({ label: 'Copy user ID', action: () => copyText(userId) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1635 | const firstModeration = items.length; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1636 | if (roomLevels && $sessionUser) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1637 | const can = allowed(roomLevels, $sessionUser, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1638 | const banned = member?.membership === 'Ban'; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1639 | if (can.setLevel && !own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1640 | const muted = isMuted(roomLevels, userId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1641 | items.push({ label: muted ? 'Unmute' : 'Mute', action: () => void userAction(userId, { kind: muted ? 'unmute' : 'mute' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1642 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1643 | if (can.kick && !banned) items.push({ label: 'Kick…', danger: true, action: () => (userCard = { userId, x, y, confirm: 'kick' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1644 | if (can.ban && banned) items.push({ label: 'Unban', action: () => void userAction(userId, { kind: 'unban' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1645 | if (can.ban && !banned) items.push({ label: 'Ban…', danger: true, action: () => (userCard = { userId, x, y, confirm: 'ban' }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1646 | if (can.setLevel) items.push({ label: 'Power level…', action: () => (userCard = { userId, x, y, confirm: null }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1647 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1648 | if (items[firstModeration]) items[firstModeration] = { ...items[firstModeration], divider: true }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1649 | if (!own) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1650 | const kind = member?.ignored ? 'unignore' : 'ignore'; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1651 | items.push({ label: member?.ignored ? 'Unignore' : 'Ignore', divider: true, action: () => void userAction(userId, { kind }) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1652 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1653 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1654 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1655 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1656 | async function insertMention(person: Person): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1657 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1658 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1659 | const lead = composer && !/\s$/.test(composer) ? ' ' : ''; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1660 | composer = `${composer}${lead}${person.name} `; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1661 | pickedMentions = { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1662 | ...pickedMentions, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1663 | [roomId]: [...(pickedMentions[roomId] ?? []), { user_id: person.user_id, text: person.name }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1664 | }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1665 | await tick(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1666 | composerEl?.focus(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1667 | composerEl?.setSelectionRange(composer.length, composer.length); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1668 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1669 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1670 | async function userAction(userId: string, action: UserAction): Promise<void> { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1671 | const roomId = $selectedRoomId; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1672 | try { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1673 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1674 | case 'message': { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1675 | const res = (await runCommand({ op: 'direct', user_id: userId })) as { room_id: string }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1676 | await refreshRooms(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1677 | await selectRoom(res.room_id); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1678 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1679 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1680 | case 'mention': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1681 | await insertMention(personFor(userId)); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1682 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1683 | case 'ignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1684 | case 'unignore': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1685 | await runCommand({ op: action.kind, user_id: userId }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1686 | if (roomId) void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1687 | return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1688 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1689 | if (!roomId) return; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1690 | switch (action.kind) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1691 | case 'kick': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1692 | case 'ban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1693 | await runCommand({ op: action.kind, room_id: roomId, user_id: userId, reason: action.reason }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1694 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1695 | case 'unban': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1696 | await runCommand({ op: 'unban', room_id: roomId, user_id: userId, reason: null }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1697 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1698 | case 'mute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1699 | case 'unmute': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1700 | await runCommand({ op: 'mute', room_id: roomId, user_id: userId, muted: action.kind === 'mute' }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1701 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1702 | case 'power': |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1703 | await runCommand({ op: 'set_power_level', room_id: roomId, user_id: userId, level: action.level }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1704 | break; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1705 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1706 | void loadLevels(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1707 | void loadMembers(roomId); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1708 | } catch (e) { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1709 | pushBanner(e instanceof Error ? e.message : 'That action failed'); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1710 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1711 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1712 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1713 | function roomMenuItems(room: RoomSummary): MenuItem[] { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1714 | const items: MenuItem[] = room.space |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1715 | ? [{ label: 'Open', action: () => void selectSpace(room.room_id) }] |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1716 | : [ |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1717 | { label: 'Open', action: () => void selectRoom(room.room_id) }, |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1718 | { label: 'Peek', action: () => void selectRoom(room.room_id, true) } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1719 | ]; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1720 | items.push({ label: room.favourite ? 'Unpin' : room.space ? 'Pin to top' : 'Pin', action: () => void togglePin(room) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1721 | items.push({ label: 'Copy link', action: () => copyText(`https://matrix.to/#/${room.canonical_alias ?? room.room_id}`) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1722 | items.push({ label: 'Copy room ID', action: () => copyText(room.room_id) }); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1723 | if (!room.space && room.membership === 'Joined') { |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1724 | items.push({ label: 'Repair message history', action: () => void showHistoryRepair(room.room_id) }); |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 1725 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1726 | if (room.membership === 'Joined') items.push({ label: 'Leave', danger: true, divider: true, action: () => void leave(room.room_id) }); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1727 | return items; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1728 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1729 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1730 | function openRoomMenu(ev: MouseEvent, room: RoomSummary): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1731 | menu = { items: roomMenuItems(room), x: ev.clientX, y: ev.clientY }; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1732 | } |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1733 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1734 | function roomName(roomId: string): string { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1735 | return $rooms.find((r) => r.room_id === roomId)?.name ?? roomId; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1736 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1737 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1738 | async function sendSticker(roomId: string, pack: ImagePack, image: PackImage): Promise<void> { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1739 | stickersOpen = false; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1740 | stickToBottom = true; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1741 | try { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1742 | await runCommand({ op: 'send_sticker', room_id: roomId, pack_id: pack.id, shortcode: image.shortcode }); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1743 | if (peeking === roomId) stopPeeking(); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1744 | } catch (e) { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1745 | pushBanner(e instanceof Error ? e.message : 'Could not send the sticker'); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1746 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1747 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1748 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1749 | async function runClone(request: CommandRequest, failure: string): Promise<void> { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1750 | try { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1751 | const res = (await runCommand(request)) as { skipped?: string[] } | undefined; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1752 | if (res?.skipped?.length) pushBanner(`Couldn't copy ${res.skipped.map((s) => `:${s}:`).join(', ')}`); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1753 | } catch (e) { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1754 | pushBanner(e instanceof Error ? e.message : failure); |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1755 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1756 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1757 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1758 | function openCloneImageMenu(pack: ImagePack, image: PackImage, x: number, y: number): void { |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1759 | stickersOpen = false; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1760 | menu = null; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1761 | cloneSource = { kind: 'image', pack, image }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1762 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1763 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1764 | function openClonePackMenu(pack: ImagePack, x: number, y: number): void { |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1765 | stickersOpen = false; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1766 | menu = null; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1767 | cloneSource = { kind: 'pack', pack }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1768 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1769 | |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1770 | function openCloneStickerMenu(eventId: string, body: string, x: number, y: number): void { |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1771 | const roomId = $selectedRoomId; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1772 | if (!roomId) return; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1773 | menu = null; |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 1774 | cloneSource = { kind: 'sticker', room_id: roomId, event_id: eventId, body }; |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1775 | } |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 1776 | |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1777 | async function openMessageMenu(event: TimelineEvent, x: number, y: number): Promise<void> { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1778 | const roomId = $selectedRoomId; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1779 | const eventId = event.event_id; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1780 | if (!roomId || !eventId) return; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1781 | if (!(roomId in levelsByRoom)) await loadLevels(roomId); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1782 | const joined = selectedRoom?.membership === 'Joined'; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1783 | const content = event.content; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1784 | const items: MenuItem[] = []; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1785 | if (joined) { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1786 | items.push({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1787 | label: 'Reply', |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1788 | action: () => |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1789 | startReply({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1790 | event_id: eventId, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1791 | details: { kind: 'Ready', sender: event.sender, content, timestamp_ms: event.timestamp_ms } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1792 | }) |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1793 | }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1794 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1795 | if (joined && event.own && event.editable && content.kind === 'Message' && content.message.kind === 'Text') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1796 | const body = content.message.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1797 | items.push({ label: 'Edit', action: () => startEdit(eventId, body) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1798 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1799 | if (content.kind === 'Message' && content.message.body) { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1800 | const body = content.message.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1801 | items.push({ label: 'Copy text', action: () => copyText(body) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1802 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1803 | items.push({ label: 'Copy link', action: () => copyText(`https://matrix.to/#/${roomId}/${eventId}`) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1804 | if (joined && selectedRoom?.can_pin && content.kind !== 'Redacted') { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1805 | const pinned = selectedRoom.pinned_events.includes(eventId); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1806 | items.push({ label: pinned ? 'Unpin' : 'Pin', action: () => setPinned(eventId, !pinned) }); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1807 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1808 | if (content.kind === 'Sticker') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1809 | const body = content.body; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1810 | items.push({ label: 'Clone sticker…', action: () => openCloneStickerMenu(eventId, body, x, y) }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1811 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1812 | const me = $sessionUser; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1813 | if (joined && me && roomLevels && canRedact(roomLevels, me, event.sender.user_id) && content.kind !== 'Redacted') { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1814 | items.push({ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1815 | label: 'Delete message…', |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1816 | danger: true, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1817 | action: () => |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1818 | (menu = { |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1819 | x, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1820 | y, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1821 | items: [ |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1822 | { label: 'Delete', danger: true, action: () => void runClone({ op: 'redact', room_id: roomId, event_id: eventId, reason: null }, 'Could not delete the message') }, |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1823 | { label: 'Cancel', action: () => undefined } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1824 | ] |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1825 | }) |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1826 | }); |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1827 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1828 | if (!event.own) { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1829 | const person = userMenuItems(event.sender.user_id, x, y); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1830 | if (person[0]) person[0] = { ...person[0], divider: true }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1831 | items.push(...person); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1832 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1833 | menu = { items, x, y }; |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1834 | } |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 1835 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1836 | function openAccountMenu(ev: MouseEvent): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1837 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1838 | menu = { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1839 | x: rect.left, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1840 | y: rect.top - 6, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1841 | above: true, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1842 | items: [ |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1843 | { label: 'Security', action: () => (dialog = 'security') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1844 | { label: 'Settings', action: () => (dialog = 'settings') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1845 | { label: 'Sticker and emoji packs', action: () => (dialog = 'packs') }, |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1846 | { label: 'Log out', danger: true, divider: true, action: () => void doLogout() } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1847 | ] |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1848 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1849 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1850 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1851 | let resizing = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1852 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1853 | function startResize(ev: PointerEvent, pane: 'side' | 'members'): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1854 | if (ev.button !== 0) return; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1855 | ev.preventDefault(); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1856 | const handle = ev.currentTarget as HTMLElement; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1857 | handle.setPointerCapture(ev.pointerId); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1858 | const store = pane === 'side' ? sideWidth : membersWidth; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1859 | const range = pane === 'side' ? SIDE_WIDTH : MEMBERS_WIDTH; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1860 | const startX = ev.clientX; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1861 | const startWidth = pane === 'side' ? $sideWidth : $membersWidth; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1862 | resizing = true; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1863 | const move = (e: PointerEvent) => { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1864 | const delta = pane === 'side' ? e.clientX - startX : startX - e.clientX; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1865 | store.set(Math.round(Math.min(range.max, Math.max(range.min, startWidth + delta)))); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1866 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1867 | const end = () => { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1868 | resizing = false; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1869 | handle.removeEventListener('pointermove', move); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1870 | handle.removeEventListener('pointerup', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1871 | handle.removeEventListener('pointercancel', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1872 | }; |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1873 | handle.addEventListener('pointermove', move); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1874 | handle.addEventListener('pointerup', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1875 | handle.addEventListener('pointercancel', end); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1876 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1877 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1878 | function resetWidth(pane: 'side' | 'members'): void { |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1879 | if (pane === 'side') sideWidth.set(SIDE_WIDTH.default); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1880 | else membersWidth.set(MEMBERS_WIDTH.default); |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1881 | } |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1882 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1883 | function stopPeeking(): void { |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1884 | peeking = null; |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1885 | queueReadReceipt(); |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 1886 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1887 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1888 | async function togglePin(room: RoomSummary): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1889 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1890 | await runCommand({ op: 'set_favourite', room_id: room.room_id, favourite: !room.favourite }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1891 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1892 | pushBanner(e instanceof Error ? e.message : 'Could not change the pin'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1893 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1894 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1895 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1896 | function startRailDrag(ev: DragEvent, id: string): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1897 | dragSpaceId = id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1898 | if (ev.dataTransfer) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1899 | ev.dataTransfer.effectAllowed = 'move'; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1900 | ev.dataTransfer.setData('text/plain', id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1901 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1902 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1903 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1904 | function overRailSpace(ev: DragEvent, space: RoomSummary): void { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1905 | const dragged = orderedRail.find((s) => s.room_id === dragSpaceId); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1906 | if (!dragged || dragged.room_id === space.room_id || dragged.favourite !== space.favourite) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1907 | ev.preventDefault(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1908 | const rect = (ev.currentTarget as HTMLElement).getBoundingClientRect(); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1909 | dropTarget = { id: space.room_id, after: ev.clientY > rect.top + rect.height / 2 }; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1910 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1911 | |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1912 | async function dropRailSpace(): Promise<void> { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1913 | const moved = dragSpaceId; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1914 | const target = dropTarget; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1915 | dragSpaceId = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1916 | dropTarget = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1917 | if (!moved || !target) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1918 | const ids = orderedRail.map((s) => s.room_id); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1919 | const before = target.after ? (ids[ids.indexOf(target.id) + 1] ?? null) : target.id; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1920 | const order = moveBefore(ids, moved, before === moved ? null : before); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1921 | if (order.join() === ids.join()) return; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1922 | railOverride = order; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1923 | try { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1924 | await runCommand({ op: 'reorder_spaces', order }); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1925 | } catch (e) { |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1926 | railOverride = null; |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1927 | pushBanner(e instanceof Error ? e.message : 'Could not reorder spaces'); |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1928 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1929 | } |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 1930 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1931 | let roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1932 | let roomMenuEl: HTMLDivElement | null = null; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1933 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1934 | function roomMenuAction(action: () => void): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1935 | roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1936 | action(); |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1937 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1938 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1939 | function closeRoomMenuOutside(ev: PointerEvent): void { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1940 | if (roomMenuOpen && !roomMenuEl?.contains(ev.target as Node)) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1941 | } |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1942 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1943 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1944 | if (ev.key === 'Escape') { |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1945 | if (roomMenuOpen) roomMenuOpen = false; |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1946 | else if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1947 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1948 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1949 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1950 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1951 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1952 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1953 | <svelte:window |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1954 | on:keydown={onKeydown} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1955 | on:pointerdown={closeRoomMenuOutside} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1956 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1957 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1958 | {#if !booted} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1959 | <div class="splash" role="status" aria-label="Loading Malice" out:fade={{ duration: motionDuration(260) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1960 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1961 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1962 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1963 | {:else if $blocked} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1964 | <div class="splash" role="status" aria-label="Malice is open in another tab" in:fade={{ duration: motionDuration(220) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1965 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1966 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1967 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1968 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1969 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1970 | {:else} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1971 | <div |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1972 | class="app" |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 1973 | in:fade={{ duration: motionDuration(220) }} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 1974 | class:nav-folded={$navFolded} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1975 | class:rail-folded={$railFolded && selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1976 | class:members-open={selectedRoom && membersOpen} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1977 | class:resizing |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1978 | style:--side-open={`${$sideWidth}px`} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 1979 | style:--members-open={`${$membersWidth}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1980 | style:--msg-gap={`${$messageSpacing}px`} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1981 | style:--msg-line-height={$lineHeight} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 1982 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1983 | <header class="chat-head"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1984 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1985 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1986 | class="icon-btn only-mobile" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1987 | aria-label="Open room list" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1988 | on:click={() => (sidebarOpen = true)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1989 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1990 | <span aria-hidden="true">☰</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1991 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1992 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1993 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1994 | class="icon-btn only-desktop pane-toggle" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1995 | aria-pressed={!$railFolded} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1996 | aria-label={$railFolded ? 'Show spaces' : 'Hide spaces'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1997 | title={$railFolded ? 'Show spaces' : 'Hide spaces'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1998 | on:click={() => railFolded.update((v) => !v)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 1999 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2000 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2001 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2002 | <circle cx="7" cy="9" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2003 | <circle cx="7" cy="13" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2004 | <circle cx="7" cy="17" r="1.4" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2005 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2006 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2007 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2008 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2009 | class="icon-btn only-desktop pane-toggle" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2010 | aria-pressed={!$navFolded} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2011 | aria-label={$navFolded ? 'Show channels' : 'Hide channels'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2012 | title={$navFolded ? 'Show channels' : 'Hide channels'} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2013 | on:click={toggleChannelsPane} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2014 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2015 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2016 | <rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2017 | <path d="M10 4v16" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2018 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2019 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2020 | {#if selectedRoom} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2021 | <div class="head-title"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2022 | <div class="head-room"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2023 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape="rounded" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2024 | <div class="head-room-text"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2025 | <h1><EmojiText text={selectedRoom.name} /></h1> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2026 | <div class="head-meta"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2027 | {#if selectedRoom.space} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2028 | <span class="pill">space</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2029 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2030 | {#if selectedRoom.encrypted} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2031 | <span class="pill" title="End-to-end encrypted"><EmojiText text="🔒 encrypted" /></span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2032 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2033 | {#if selectedRoom.direct} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2034 | <span class="pill">direct</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2035 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2036 | {#if $connection !== 'online'} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2037 | <span class="conn" title={`Sync state: ${$connection}`}> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2038 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2039 | {$connection} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2040 | </span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2041 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2042 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2043 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2044 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2045 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2046 | {:else} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2047 | <div class="head-title"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2048 | <div class="head-room"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2049 | {#if selectedSpace} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2050 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={36} shape="rounded" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2051 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2052 | <div class="head-room-text"> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2053 | <h1><EmojiText text={mentionsOpen ? 'Mentions' : selectedSpace?.name ?? 'Home'} /></h1> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2054 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2055 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2056 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2057 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2058 | <div class="head-actions"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2059 | {#if selectedRoom} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2060 | {#if peeking === selectedRoom.room_id} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2061 | <button type="button" class="icon-btn" aria-pressed="true" aria-label="Stop peeking" title="Stop peeking" on:click={stopPeeking}> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2062 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2063 | <path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12z" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2064 | <circle cx="12" cy="12" r="3" fill="currentColor" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2065 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2066 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2067 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2068 | {#if selectedRoom.membership !== 'Joined'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2069 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2070 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2071 | class="primary-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2072 | disabled={joinBusy} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2073 | on:click={() => void join(selectedRoom.room_id)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2074 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2075 | {joinBusy ? 'Joining…' : 'Join'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2076 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2077 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2078 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2079 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2080 | class="icon-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2081 | aria-pressed={membersOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2082 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2083 | title="Members" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2084 | on:click={toggleMembers} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2085 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2086 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2087 | <circle cx="12" cy="8" r="4" fill="none" stroke="currentColor" stroke-width="2" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2088 | <path d="M4 20c0-4 3.6-6 8-6s8 2 8 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2089 | </svg> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2090 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2091 | <div class="room-menu-wrap" bind:this={roomMenuEl}> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2092 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2093 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2094 | class="icon-btn" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2095 | aria-haspopup="menu" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2096 | aria-expanded={roomMenuOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2097 | aria-label="Room options" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2098 | title="Room options" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2099 | on:click={() => (roomMenuOpen = !roomMenuOpen)} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2100 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2101 | <span aria-hidden="true">⋯</span> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2102 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2103 | {#if roomMenuOpen} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2104 | <div class="room-menu" role="menu"> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2105 | {#if selectedRoom.membership === 'Joined'} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2106 | <button type="button" role="menuitem" on:click={() => roomMenuAction(() => void showHistoryRepair(selectedRoom.room_id))}> |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2107 | Repair message history |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2108 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2109 | <button |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2110 | type="button" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2111 | role="menuitem" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2112 | class="danger" |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2113 | disabled={leaveBusy} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2114 | on:click={() => roomMenuAction(() => void leave())} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2115 | > |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2116 | {leaveBusy ? 'Leaving…' : 'Leave room'} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2117 | </button> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2118 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2119 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2120 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2121 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2122 | {/if} |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2123 | </div> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2124 | </header> |
1d319c602324 | atagen | 2026-10-24 09:14 UTC | 2125 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2126 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2127 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2128 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2129 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2130 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2131 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2132 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2133 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2134 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2135 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2136 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"><path d="M4 11l8-7 8 7v8a1 1 0 0 1-1 1h-4v-6H9v6H5a1 1 0 0 1-1-1z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2137 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2138 | {#each [pinnedRail, otherRail] as group} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2139 | {#if group.length > 0} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2140 | <div class="rail-sep" aria-hidden="true"></div> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2141 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2142 | {#each group as space (space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2143 | <button |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2144 | type="button" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2145 | class="rail-btn rail-space" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2146 | class:active={railSelected === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2147 | class:drop-before={dropTarget?.id === space.room_id && !dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2148 | class:drop-after={dropTarget?.id === space.room_id && dropTarget.after} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2149 | class:pinned={space.favourite} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2150 | title={space.name} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2151 | aria-label={`Show channels in space ${space.name}`} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2152 | aria-pressed={selectedSpaceId === space.room_id} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2153 | draggable="true" |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2154 | on:click={() => void selectSpace(space.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2155 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2156 | on:dragstart={(ev) => startRailDrag(ev, space.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2157 | on:dragover={(ev) => overRailSpace(ev, space)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2158 | on:dragleave={() => dropTarget?.id === space.room_id && (dropTarget = null)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2159 | on:drop|preventDefault={() => void dropRailSpace()} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2160 | on:dragend={() => ((dragSpaceId = null), (dropTarget = null))} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2161 | > |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2162 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2163 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2164 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2165 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2166 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2167 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2168 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2169 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2170 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2171 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2172 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2173 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2174 | <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"><path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2175 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2176 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2177 | |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2178 | {#if menu} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2179 | <ContextMenu items={menu.items} x={menu.x} y={menu.y} above={menu.above ?? false} onClose={() => (menu = null)} /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2180 | {/if} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2181 | {#if userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2182 | {#key userCard} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2183 | {@const cardUser = userCard.userId} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2184 | <UserCard |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2185 | person={personFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2186 | member={memberFor(cardUser)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2187 | levels={roomLevels} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2188 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2189 | x={userCard.x} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2190 | y={userCard.y} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2191 | confirm={userCard.confirm} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2192 | onAction={(action) => void userAction(cardUser, action)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2193 | onClose={() => (userCard = null)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2194 | /> |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2195 | {/key} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2196 | {/if} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2197 | |
c04b1e46303f | atagen | 2026-10-24 12:08 UTC | 2198 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2199 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2200 | <div class="pane-resize right" title="Drag to resize" on:pointerdown={(e) => startResize(e, 'side')} on:dblclick={() => resetWidth('side')}></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2201 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2202 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2203 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2204 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2205 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2206 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2207 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2208 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2209 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2210 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2211 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2212 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2213 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2214 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2215 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2216 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2217 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2218 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2219 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2220 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2221 | {#key selectedSpaceId ?? 'home'} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2222 | <div class="side-scroll" in:fly={{ y: 5, duration: motionDuration(180) }} out:fade={{ duration: motionDuration(120) }}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2223 | {#if selectedSpace && spaceParents.has(selectedSpace.room_id)} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2224 | {@const parentId = spaceParents.get(selectedSpace.room_id) ?? ''} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2225 | <button type="button" class="room-row up-row" on:click={() => void selectSpace(parentId)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2226 | <span aria-hidden="true">↑</span> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2227 | <span class="room-name"><EmojiText text={$rooms.find((r) => r.room_id === parentId)?.name ?? 'Parent space'} /></span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2228 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2229 | {/if} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2230 | {#if !selectedSpaceId} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2231 | <ul class="room-list"> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2232 | <li> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2233 | <button type="button" class="room-row" class:active={mentionsOpen} on:click={selectMentions}> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2234 | <svg width="26" height="26" viewBox="0 0 26 26" aria-hidden="true"><text x="13" y="19" text-anchor="middle" fill="currentColor" font-size="22">@</text></svg> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2235 | <span class="room-name">Mentions</span> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2236 | {#if $mentionsSnapshot && $mentionsSnapshot.unread_count > 0} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2237 | <span class="badge mention" aria-label={`${$mentionsSnapshot.unread_count} unread mentions`}>{$mentionsSnapshot.unread_count > 99 ? '99+' : $mentionsSnapshot.unread_count}</span> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2238 | {/if} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2239 | </button> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2240 | </li> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2241 | </ul> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2242 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2243 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2244 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2245 | {:else if $rooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2246 | <p class="side-note">No rooms yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2247 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2248 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2249 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2250 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2251 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2252 | {#if selectedSpaceId && spaceChildrenLoading} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2253 | <p class="side-note">Loading channels…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2254 | {:else if selectedSpaceId && spaceChildrenError} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2255 | <p class="side-note" role="alert"><EmojiText text={spaceChildrenError} /></p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2256 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2257 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2258 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2259 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2260 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2261 | <p class="side-note">No channels</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2262 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2263 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2264 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2265 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2266 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2267 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2268 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2269 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2270 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2271 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2272 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2273 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2274 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2275 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2276 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2277 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2278 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2279 | <span class="room-name"><EmojiText text={room.name} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2280 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2281 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2282 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2283 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2284 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2285 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2286 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2287 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2288 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2289 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2290 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2291 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2292 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2293 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2294 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2295 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2296 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2297 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2298 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2299 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2300 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2301 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2302 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2303 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2304 | {#each directRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2305 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2306 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2307 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2308 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2309 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2310 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2311 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2312 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2313 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2314 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2315 | <span class="room-name"><EmojiText text={room.name} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2316 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2317 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2318 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2319 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2320 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2321 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2322 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2323 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2324 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2325 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2326 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2327 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2328 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2329 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2330 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2331 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2332 | {#if groupRooms.length > 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2333 | <h2 class="side-h">{selectedSpace ? 'Channels' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2334 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2335 | {#each groupRooms as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2336 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2337 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2338 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2339 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2340 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2341 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2342 | on:click={() => void selectRoom(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2343 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2344 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2345 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2346 | <span class="room-name"><EmojiText text={room.name} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2347 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2348 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2349 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2350 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2351 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2352 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2353 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2354 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2355 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2356 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2357 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2358 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2359 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2360 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2361 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2362 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2363 | {#if spaceList.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2364 | <h2 class="side-h">{selectedSpace ? 'Subspaces' : 'Spaces'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2365 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2366 | {#each spaceList as room (room.room_id)} |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2367 | <li class="room-item"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2368 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2369 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2370 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2371 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2372 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2373 | on:click={() => void selectSpace(room.room_id)} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2374 | on:contextmenu|preventDefault={(ev) => openRoomMenu(ev, room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2375 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2376 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2377 | <span class="room-name"><EmojiText text={room.name} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2378 | </button> |
7cca1d5628d1 | atagen | 2026-10-24 07:36 UTC | 2379 | <PinButton pinned={room.favourite} label={room.name} onToggle={() => void togglePin(room)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2380 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2381 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2382 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2383 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2384 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2385 | {#if query && visibleRooms.length === 0} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2386 | <p class="side-note">No rooms match “<EmojiText text={search.trim()} />”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2387 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2388 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2389 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2390 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2391 | {/key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2392 | |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2393 | </aside> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2394 | <div class="account"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2395 | <button type="button" class="me-btn" title={$sessionUser} aria-haspopup="menu" on:click={openAccountMenu}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2396 | {#if profileMxc} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2397 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={32} /> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2398 | {:else} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2399 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2400 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2401 | <span class="me-names"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2402 | <span class="me-name"><EmojiText text={profile?.display_name || $sessionUser} /></span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2403 | {#if profile?.display_name && profile.display_name !== $sessionUser}<span class="me-id">{$sessionUser}</span>{/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2404 | </span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2405 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2406 | <div class="account-actions"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2407 | <button type="button" class="icon-btn" title="Encryption and verification" aria-label="Encryption and verification" on:click={() => (dialog = 'security')}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2408 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><path d="M12 3l8 3v6c0 4.5-3.4 8.2-8 9-4.6-.8-8-4.5-8-9V6z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2409 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2410 | <button type="button" class="icon-btn" title="Settings" aria-label="Settings" on:click={() => (dialog = 'settings')}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2411 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8" /><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /></svg> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2412 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2413 | <button type="button" class="icon-btn" title="Log out" aria-label="Log out" on:click={() => void doLogout()}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2414 | <svg viewBox="0 0 24 24" width="17" height="17" aria-hidden="true"><path d="M12 3v8M6.3 6.3a8 8 0 1 0 11.4 0" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" /></svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2415 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2416 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2417 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2418 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2419 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2420 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2421 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2422 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2423 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2424 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2425 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2426 | <div class="banner" role="alert"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2427 | <span><EmojiText text={banner.message} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2428 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2429 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2430 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2431 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2432 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2433 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2434 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2435 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2436 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2437 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2438 | {/if} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2439 | {#key mentionsOpen ? 'mentions' : $selectedRoomId ?? 'home'} |
824dfd38cdf3 | atagen | 2026-10-24 13:43 UTC | 2440 | <div class="chat-view"> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2441 | {#if mentionsOpen && $sessionUser} |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2442 | <MentionsInbox self={$sessionUser} onLive={(roomId) => void selectRoom(roomId)} /> |
668ab5c30531 | atagen | 2026-10-25 03:13 UTC | 2443 | {:else if !selectedRoom} |
824dfd38cdf3 | atagen | 2026-10-24 13:43 UTC | 2444 | <div class="empty" in:fade={{ duration: motionDuration(180) }}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2445 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2446 | {#if selectedSpace} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2447 | <h1><EmojiText text={selectedSpace.name} /></h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2448 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2449 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2450 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2451 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2452 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2453 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2454 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2455 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2456 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2457 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2458 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2459 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2460 | {:else} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2461 | {#if repairPanels[selectedRoom.room_id] ?? !!currentRepair} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2462 | <HistoryRepairPanel |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2463 | report={currentRepair} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2464 | busy={!!repairBusy[selectedRoom.room_id]} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2465 | cancelling={!!repairCancelling[selectedRoom.room_id]} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2466 | error={repairErrors[selectedRoom.room_id] ?? null} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2467 | onStart={(policy) => void runHistoryRepair(selectedRoom.room_id, 'start', policy)} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2468 | onCancel={() => void cancelRoomRepair(selectedRoom.room_id)} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2469 | onContinue={() => void runHistoryRepair(selectedRoom.room_id, 'continue')} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2470 | onRecent={() => void runHistoryRepair(selectedRoom.room_id, 'recent')} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2471 | onClose={() => (repairPanels = { ...repairPanels, [selectedRoom.room_id]: false })} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2472 | /> |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2473 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2474 | {#if pins.length} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2475 | <div class="pinned-strip" class:open={pinsExpanded}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2476 | <div class="pinned-head"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2477 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M9 3h6l-1 6 4 4v2h-5v6l-1 1-1-1v-6H6v-2l4-4z" fill="currentColor" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2478 | <button type="button" class="pinned-latest" title="Jump to pinned message" on:click={() => jumpToPin(pins[0].event_id ?? '')}> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2479 | <strong><EmojiText text={people[pins[0].sender.user_id]?.name ?? senderLabel(pins[0].sender)} /></strong> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2480 | <span><EmojiText text={contentPreview(pins[0].content)} /></span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2481 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2482 | {#if pins.length > 1} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2483 | <button type="button" class="pinned-count" aria-expanded={pinsExpanded} on:click={() => (pinsExpanded = !pinsExpanded)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2484 | {pins.length} pinned |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2485 | <svg viewBox="0 0 24 24" width="12" height="12" aria-hidden="true"><path d="m6 9 6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2486 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2487 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2488 | {#if pinsExpanded && selectedRoom.can_pin} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2489 | <button type="button" class="icon-btn" aria-label="Unpin" title="Unpin" on:click={() => setPinned(pins[0].event_id ?? '', false)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2490 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2491 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2492 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2493 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2494 | {#if pinsExpanded} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2495 | <ul class="pinned-list"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2496 | {#each pins.slice(1) as pin (pin.event_id)} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2497 | <li> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2498 | <button type="button" on:click={() => jumpToPin(pin.event_id ?? '')}> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2499 | <strong><EmojiText text={people[pin.sender.user_id]?.name ?? senderLabel(pin.sender)} /></strong> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2500 | <span><EmojiText text={contentPreview(pin.content)} /></span> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2501 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2502 | {#if selectedRoom.can_pin} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2503 | <button type="button" class="icon-btn" aria-label="Unpin" title="Unpin" on:click={() => setPinned(pin.event_id ?? '', false)}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2504 | <svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" /></svg> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2505 | </button> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2506 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2507 | </li> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2508 | {/each} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2509 | </ul> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2510 | {/if} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2511 | </div> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2512 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2513 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2514 | <div class="sec-banner warn" role="status"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2515 | <span>Message history is locked</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2516 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2517 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2518 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2519 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2520 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2521 | {#if verificationBanner.kind === 'Incoming'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2522 | <span>A device wants to verify this session</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2523 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2524 | {:else if verificationBanner.kind === 'Comparison'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2525 | <span>Verification codes ready</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2526 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2527 | {:else if verificationBanner.kind === 'Waiting'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2528 | <span>Verification started</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2529 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2530 | {:else if verificationBanner.kind === 'Failed'} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2531 | <span>Verification failed: <EmojiText text={verificationBanner.message} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2532 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2533 | {:else if verificationBanner.kind === 'Cancelled'} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2534 | <span>Verification cancelled: <EmojiText text={verificationBanner.reason} /></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2535 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2536 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2537 | <span>Verification in progress</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2538 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2539 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2540 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2541 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2542 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2543 | <p class="conn-banner error" role="alert"><EmojiText text={openFailed[$selectedRoomId]} /></p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2544 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2545 | |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2546 | {#if pinPreview} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2547 | <div class="pin-preview" role="dialog" aria-label="Pinned message preview"> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2548 | <div class="pin-preview-head"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2549 | <strong><EmojiText text={people[pinPreview.sender.user_id]?.name ?? senderLabel(pinPreview.sender)} /></strong> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2550 | <button type="button" class="icon-btn" aria-label="Close pinned message preview" on:click={() => (pinPreview = null)}>✕</button> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2551 | </div> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2552 | <p><EmojiText text={contentPreview(pinPreview.content)} /></p> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2553 | <button type="button" class="primary-btn" disabled={pinJumpBusy} on:click={() => void jumpToPin(pinPreview?.event_id ?? '')}> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2554 | {pinJumpBusy ? 'Loading message…' : 'Jump to message'} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2555 | </button> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2556 | </div> |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2557 | {/if} |
7efc4c6d41ab | atagen | 2026-10-24 11:40 UTC | 2558 | |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2559 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2560 | <div |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2561 | class="timeline" |
824dfd38cdf3 | atagen | 2026-10-24 13:43 UTC | 2562 | in:fly={{ y: 6, duration: motionDuration(180) }} |
824dfd38cdf3 | atagen | 2026-10-24 13:43 UTC | 2563 | out:fade={{ duration: motionDuration(120) }} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2564 | bind:this={timelineEl} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2565 | on:scroll={onTimelineScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2566 | on:wheel={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2567 | on:touchmove={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2568 | on:keydown={onTimelineKey} |
1b586ca05859 | atagen | 2026-10-25 02:37 UTC | 2569 | on:pointerdown={noteUserScroll} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2570 | aria-label={`Messages in ${selectedRoom.name}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2571 | > |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2572 | <div class="timeline-inner" use:pinTimeline> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2573 | <div class="timeline-top"> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2574 | {#if hasStart} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2575 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2576 | {:else} |
9f996e377406 | atagen | 2026-10-25 03:32 UTC | 2577 | <button type="button" class="ghost-btn" disabled={paginateBusy || currentRepairActive} on:click={() => void paginate()}> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2578 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2579 | </button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2580 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2581 | </div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2582 | {#if grouped.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2583 | <p class="side-note timeline-empty">No messages yet</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2584 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2585 | {#each grouped as g (g.key)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2586 | {#if g.item.kind === 'day'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2587 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2588 | {:else if g.item.kind === 'readMarker'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2589 | <div class="new-row"><span>New</span></div> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2590 | {:else if g.item.kind === 'start'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2591 | <p class="start-note">Beginning of history</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2592 | {:else if g.item.kind === 'unknown'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2593 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2594 | {:else} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2595 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2596 | itemId={g.key} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2597 | event={g.item.event} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2598 | showSender={g.showSender} |
787cdbbf0721 | atagen | 2026-10-24 06:50 UTC | 2599 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id) ?? g.item.event.sender.avatar} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2600 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2601 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2602 | quickReactions={usableQuickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2603 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2604 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2605 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2606 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2607 | {people} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2608 | self={$sessionUser ?? null} |
d8624c214c04 | atagen | 2026-10-24 08:24 UTC | 2609 | onUser={(userId, x, y, asMenu) => void openUser(userId, x, y, asMenu)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2610 | onCloneSticker={openCloneStickerMenu} |
0380cd8c765c | atagen | 2026-10-24 09:08 UTC | 2611 | onMore={(ev, x, y) => void openMessageMenu(ev, x, y)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2612 | onReply={selectedRoom.membership === 'Joined' ? startReply : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2613 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2614 | onEdit={selectedRoom.membership === 'Joined' ? startEdit : null} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2615 | editing={editing !== null && editing.eventId === g.item.event.event_id} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2616 | showSent={g.item.event.item_id === lastSentId && pendingItems.length === 0} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2617 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2618 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2619 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2620 | {/if} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2621 | {#each pendingItems as p, i (p.id)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2622 | <MessageRow |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2623 | itemId={`pending-${p.id}`} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2624 | event={pendingToEvent(p)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2625 | onJump={jumpTo} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2626 | showSender={pendingShowSender(i)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2627 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2628 | {reacting} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2629 | onReact={(eventId, key, shortcode) => void react(eventId, key, shortcode)} |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2630 | quickReactions={usableQuickReactions} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2631 | packs={roomPacks} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2632 | linkPreviews={$linkPreviews} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2633 | {loadPreview} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2634 | onQuickChange={(list) => void changeQuickReactions(list)} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2635 | /> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2636 | {#if p.status === 'failed'} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2637 | <div class="pending-actions"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2638 | <span class="pending-error" role="alert"><EmojiText text={p.error ?? ''} /></span> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2639 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2640 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2641 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2642 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2643 | {/each} |
705b1e1062c2 | atagen | 2026-10-23 09:05 UTC | 2644 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2645 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2646 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2647 | {#if selectedRoom.membership === 'Joined'} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2648 | {#if editing} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2649 | <div class="reply-bar" role="status"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2650 | <span class="reply-bar-label"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2651 | Editing message |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2652 | <span class="reply-bar-text"><EmojiText text={editing.original} /></span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2653 | </span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2654 | <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 | 2655 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2656 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2657 | </div> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2658 | {:else if replyingTo && replyingTo.details.kind === 'Ready'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2659 | <div class="reply-bar" role="status"> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2660 | <span class="reply-bar-label"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2661 | Replying to <strong><EmojiText text={people[replyingTo.details.sender.user_id]?.name ?? senderLabel(replyingTo.details.sender)} /></strong> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2662 | <span class="reply-bar-text"><EmojiText text={contentPreview(replyingTo.details.content)} /></span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2663 | </span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2664 | <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 | 2665 | <span aria-hidden="true">✕</span> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2666 | </button> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2667 | </div> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2668 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2669 | {#if $selectedRoomId && currentStaged.length > 0} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2670 | {@const stagedRoom = $selectedRoomId} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2671 | <ul class="staged" aria-label="Attachments to send"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2672 | {#each currentStaged as attachment (attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2673 | <li class="staged-item"> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2674 | {#if attachment.previewUrl} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2675 | <img src={attachment.previewUrl} alt={attachment.file.name || 'Pasted image'} /> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2676 | {:else} |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2677 | <span class="staged-name"><EmojiText text={attachment.file.name || 'attachment'} /></span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2678 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2679 | <button |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2680 | type="button" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2681 | class="icon-btn staged-remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2682 | aria-label={`Remove ${attachment.file.name || 'attachment'}`} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2683 | title="Remove" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2684 | on:click={() => unstage(stagedRoom, attachment.id)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2685 | > |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2686 | <span aria-hidden="true">✕</span> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2687 | </button> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2688 | </li> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2689 | {/each} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2690 | </ul> |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2691 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2692 | <form class="composer" class:replying={replyingTo || editing} class:staging={currentStaged.length > 0} on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2693 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2694 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2695 | type="file" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2696 | multiple |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2697 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2698 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2699 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2700 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2701 | /> |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2702 | <input |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2703 | type="file" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2704 | accept="image/*" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2705 | bind:this={avatarInput} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2706 | class="visually-hidden" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2707 | aria-label="Choose a new avatar" |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2708 | on:change={() => void onAvatarChosen()} |
e4c64c36f105 | atagen | 2026-10-24 07:09 UTC | 2709 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2710 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2711 | type="button" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2712 | class="icon-btn" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2713 | class:busy={uploadBusy} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2714 | title={uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : 'Attach an image or file'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2715 | aria-label="Attach an image or file" |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2716 | aria-busy={uploadBusy} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2717 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2718 | on:click={pickFiles} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2719 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2720 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2721 | <path d="M20 11.5l-8.2 8.2a5 5 0 0 1-7-7L13 4.4a3.3 3.3 0 0 1 4.7 4.7l-8.2 8.2a1.7 1.7 0 0 1-2.4-2.4l7.5-7.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" /> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2722 | </svg> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2723 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2724 | <button |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2725 | type="button" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2726 | class="icon-btn sticker-btn" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2727 | title="Stickers" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2728 | aria-label="Stickers" |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2729 | aria-expanded={stickersOpen} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2730 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2731 | on:click={() => (stickersOpen = !stickersOpen)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2732 | > |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2733 | <svg viewBox="0 0 24 24" width="19" height="19" aria-hidden="true"> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2734 | <path d="M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v7l-7 7H6a2 2 0 0 1-2-2z" fill="none" stroke="currentColor" stroke-width="1.8" /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2735 | <path d="M13 20v-5a2 2 0 0 1 2-2h5" fill="none" stroke="currentColor" stroke-width="1.8" /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2736 | </svg> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2737 | </button> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2738 | {#if stickersOpen && $selectedRoomId} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2739 | {@const stickerRoom = $selectedRoomId} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2740 | <div class="sticker-pop"> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2741 | <StickerPicker |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2742 | packs={roomPacks} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2743 | {roomName} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2744 | onSend={(pack, image) => void sendSticker(stickerRoom, pack, image)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2745 | onClone={(pack, image, x, y) => openCloneImageMenu(pack, image, x, y)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2746 | onClonePack={(pack, x, y) => openClonePackMenu(pack, x, y)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2747 | onManage={() => ((stickersOpen = false), (dialog = 'packs'))} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2748 | onClose={() => (stickersOpen = false)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2749 | /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2750 | </div> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2751 | {/if} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2752 | <div class="composer-field" class:composing={composerComposing}> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2753 | {#if commandQuery !== null && commandCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2754 | <ul class="mention-finder" role="listbox" aria-label="Commands"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2755 | {#each commandCandidates as name, i (name)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2756 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2757 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2758 | aria-selected={i === commandIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2759 | class:active={i === commandIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2760 | on:pointerdown|preventDefault={() => void pickCommand(name)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2761 | on:pointerenter={() => (commandIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2762 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2763 | <span class="mention-name">/{name}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2764 | <span class="mention-id">{COMMAND_USAGE[name]}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2765 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2766 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2767 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2768 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2769 | {#if emoteQuery && emoteCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2770 | <ul class="mention-finder" role="listbox" aria-label="Emotes"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2771 | {#each emoteCandidates as candidate, i (candidate.kind + candidate.shortcode)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2772 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2773 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2774 | aria-selected={i === emoteIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2775 | class:active={i === emoteIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2776 | on:pointerdown|preventDefault={() => void pickEmote(candidate)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2777 | on:pointerenter={() => (emoteIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2778 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2779 | {#if candidate.kind === 'custom'} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2780 | <img class="finder-emote" src={mediaUrl(candidate.mxc) ?? ''} alt="" /> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2781 | {:else} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2782 | <span class="finder-emote"><EmojiText text={candidate.emoji} /></span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2783 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2784 | <span class="mention-name">:{candidate.shortcode}:</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2785 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2786 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2787 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2788 | {/if} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2789 | {#if mentionQuery && mentionCandidates.length > 0} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2790 | <ul class="mention-finder" role="listbox" aria-label="Mention someone"> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2791 | {#each mentionCandidates as person, i (person.user_id)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2792 | <li |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2793 | role="option" |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2794 | aria-selected={i === mentionIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2795 | class:active={i === mentionIndex} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2796 | on:pointerdown|preventDefault={() => void pickMention(person)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2797 | on:pointerenter={() => (mentionIndex = i)} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2798 | > |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2799 | <MxcAvatar mxc={person.avatar} label={person.name} size={22} /> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2800 | <span class="mention-name"><EmojiText text={person.name} /></span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2801 | <span class="mention-id">{person.user_id}</span> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2802 | </li> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2803 | {/each} |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2804 | </ul> |
f604ef6df0c4 | atagen | 2026-10-24 10:08 UTC | 2805 | {/if} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2806 | <div class="composer-marks" aria-hidden="true" bind:this={marksEl}>{#each composerMarks as part}{#if part.mark}<mark><ComposerText text={part.text} /></mark>{:else}<ComposerText text={part.text} />{/if}{/each}​</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2807 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2808 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2809 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2810 | bind:value={composer} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2811 | use:syncComposer |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2812 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2813 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2814 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2815 | on:keydown={onComposerKey} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2816 | on:input={() => void onComposerInput()} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2817 | on:compositionstart={() => (composerComposing = true)} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2818 | on:compositionend={() => (composerComposing = false)} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2819 | on:click={updateMentionQuery} |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2820 | on:focus={ensureEmoji} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2821 | on:keyup={(e) => (e.key.startsWith('Arrow') && e.key !== 'ArrowUp' && e.key !== 'ArrowDown') || e.key === 'Home' || e.key === 'End' ? updateMentionQuery() : undefined} |
2021154f9e16 | atagen | 2026-10-25 02:37 UTC | 2822 | on:blur={() => ((mentionQuery = null), (commandQuery = null), (emoteQuery = null), (composerComposing = false))} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2823 | on:paste={onComposerPaste} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2824 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2825 | ></textarea> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2826 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2827 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2828 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2829 | class="primary-btn" |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2830 | disabled={(!composer.trim() && currentStaged.length === 0) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2831 | !($selectedRoomId && openReady[$selectedRoomId]) || |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 2832 | (currentStaged.length > 0 && uploadBusy)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2833 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2834 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2835 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2836 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2837 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2838 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2839 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2840 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2841 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2842 | <EmojiText text={joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2843 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2844 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2845 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2846 | {/if} |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2847 | </div> |
d4c0d65f690a | atagen | 2026-10-24 12:50 UTC | 2848 | {/key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2849 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2850 | |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2851 | {#if selectedRoom} |
e15025643a20 | atagen | 2026-10-24 06:51 UTC | 2852 | <aside class="members" aria-hidden={!membersOpen} aria-label={`Members of ${selectedRoom.name}`}> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2853 | <!-- svelte-ignore a11y_no_static_element_interactions --> |
05a48e9e7942 | atagen | 2026-10-24 09:32 UTC | 2854 | <div class="pane-resize left" title="Drag to resize" on:pointerdown={(e) => startResize(e, 'members')} on:dblclick={() => resetWidth('members')}></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2855 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2856 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2857 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2858 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2859 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2860 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2861 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2862 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2863 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2864 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2865 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2866 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2867 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2868 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2869 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2870 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2871 | <ul class="member-list"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2872 | {#each memberGroups as group (group.label)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2873 | <li class="member-group"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2874 | <h3 class="member-group-label">{group.label}<span>{group.members.length}</span></h3> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2875 | <ul class="member-group-list"> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2876 | {#each group.members as member (member.user_id)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2877 | <li> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2878 | <button |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2879 | type="button" |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2880 | class="member" |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2881 | on:click={(ev) => { |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2882 | const rect = ev.currentTarget.getBoundingClientRect(); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2883 | void openUser(member.user_id, rect.left - 308, rect.top, false); |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2884 | }} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2885 | on:contextmenu|preventDefault={(ev) => void openUser(member.user_id, ev.clientX, ev.clientY, true)} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2886 | > |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2887 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} seed={member.user_id} size={28} /> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2888 | <span class="member-names"> |
445bf199a9cf | atagen | 2026-10-25 02:56 UTC | 2889 | <span class="member-name"><EmojiText text={member.display_name || member.name} /></span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2890 | <span class="member-id">{member.user_id}</span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2891 | </span> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2892 | </button> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2893 | </li> |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2894 | {/each} |
dfd1feaae855 | atagen | 2026-10-24 10:54 UTC | 2895 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2896 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2897 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2898 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2899 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2900 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2901 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2902 | |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2903 | {#if cloneSource} |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2904 | <div class="modal-wrap" role="presentation" on:click|self={() => (cloneSource = null)}> |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2905 | <PackCloneDialog source={cloneSource} packs={$imagePacks} rooms={$rooms} onError={pushBanner} onClose={() => (cloneSource = null)} /> |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2906 | </div> |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2907 | {/if} |
132eeceeb362 | atagen | 2026-10-25 03:34 UTC | 2908 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2909 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2910 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2911 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2912 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2913 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2914 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2915 | onAction={() => void loadEncryption()} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2916 | encryptedPreviews={$urlPreviewSettings.encrypted_rooms} |
ecb8598b38af | atagen | 2026-10-22 09:19 UTC | 2917 | onEncryptedPreviews={(enabled) => void changeEncryptedPreviews(enabled)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2918 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2919 | /> |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2920 | {:else if dialog === 'settings'} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2921 | <SettingsPanel |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2922 | quick={$quickReactions} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2923 | packs={roomPacks} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2924 | onQuickChange={(list) => void changeQuickReactions(list)} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2925 | on:close={() => (dialog = null)} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2926 | on:packs={() => (dialog = 'packs')} |
df3c0f2b3da4 | atagen | 2026-10-22 13:07 UTC | 2927 | /> |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2928 | {:else if dialog === 'packs'} |
d095131eec0e | atagen | 2026-10-24 08:39 UTC | 2929 | <PackManager packs={$imagePacks} rooms={$rooms} onError={pushBanner} on:close={() => (dialog = null)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2930 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2931 | <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 | 2932 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2933 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2934 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2935 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2936 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2937 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2938 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2939 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2940 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2941 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2942 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2943 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2944 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2945 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2946 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2947 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2948 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2949 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2950 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2951 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2952 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2953 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2954 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2955 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2956 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2957 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2958 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2959 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2960 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2961 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2962 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2963 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2964 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2965 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2966 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2967 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2968 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2969 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2970 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2971 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2972 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2973 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2974 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2975 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2976 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2977 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2978 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2979 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2980 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2981 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2982 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2983 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2984 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2985 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2986 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2987 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2988 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2989 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2990 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2991 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2992 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2993 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2994 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2995 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2996 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2997 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2998 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2999 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3000 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3001 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3002 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3003 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3004 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3005 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3006 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3007 | {/if} |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 3008 | |
cf23dbf4e77c | atagen | 2026-10-23 06:36 UTC | 3009 | <ImageLightbox /> |