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