973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1 | <script lang="ts"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 2 | import { onMount, tick } from 'svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 3 | import LoginPanel from './lib/LoginPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 4 | import MessageRow from './lib/MessageRow.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 5 | import MxcAvatar from './lib/MxcAvatar.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 6 | import SecurityPanel from './lib/SecurityPanel.svelte'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 7 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 8 | closeRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 9 | createRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 10 | getEncryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 11 | getMembers, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 12 | getProfile, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 13 | getRooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 14 | getSession, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 15 | getSpaceChildren, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 16 | joinRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 17 | leaveRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 18 | logout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 19 | markRead, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 20 | openRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 21 | paginateRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 22 | reactToMessage, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 23 | uploadAttachment |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 24 | } from './lib/api'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 25 | import { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 26 | banners, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 27 | blocked, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 28 | connectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 29 | connection, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 30 | disconnectEvents, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 31 | dismissBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 32 | encryption, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 33 | membersByRoom, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 34 | membersLoading, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 35 | pushBanner, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 36 | resetClientState, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 37 | rooms, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 38 | selectedRoomId, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 39 | sessionUser, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 40 | softLogout, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 41 | timelines, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 42 | verification |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 43 | } from './lib/store'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 44 | import { discardPending, pendingByRoom, queueSend, resetPending, retryPending } from './lib/pending'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 45 | import type { PendingMessage } from './lib/pending'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 46 | import { loadQuickReactions, quickReactions, saveQuickReactions } from './lib/quick-reactions'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 47 | import { notifyTyping, stopTyping } from './lib/typing'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 48 | import { formatDay } from './lib/format'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 49 | import { parseEncryptionState, parseOwnProfile, parseVerificationState } from './lib/types'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 50 | import type { MemberSummary, OwnProfile, QuickReaction, RoomSummary, SendState, TimelineEvent, TimelineItem } from './lib/types'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 51 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 52 | let roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 53 | let booted = false; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 54 | let wasOnline = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 55 | let search = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 56 | let sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 57 | let membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 58 | let dialog: 'join' | 'create' | 'security' | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 59 | let joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 60 | let joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 61 | let createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 62 | let createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 63 | let createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 64 | let leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 65 | let paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 66 | let reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 67 | let composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 68 | let drafts: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 69 | let stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 70 | let timelineEl: HTMLElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 71 | let composerEl: HTMLTextAreaElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 72 | let fileInput: HTMLInputElement | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 73 | let uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 74 | let uploadName: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 75 | let openedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 76 | let openReady: Record<string, boolean> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 77 | let openFailed: Record<string, string> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 78 | let membersFor: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 79 | let lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 80 | let readTimer: number | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 81 | let profile: OwnProfile | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 82 | let profileMxc: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 83 | let selectedSpaceId: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 84 | let spaceChildIds: string[] | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 85 | let spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 86 | let spaceChildrenError: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 87 | let avatarByUser: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 88 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 89 | // 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 | 90 | $: { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 91 | const online = $connection === 'online'; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 92 | if (online && !wasOnline) void loadQuickReactions(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 93 | wasOnline = online; |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 94 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 95 | $: selectedRoom = $rooms.find((r) => r.room_id === $selectedRoomId) ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 96 | $: spaceRooms = $rooms.filter((r) => r.space); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 97 | $: invites = $rooms.filter((r) => r.membership === 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 98 | $: query = search.trim().toLowerCase(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 99 | $: selectedSpace = selectedSpaceId ? ($rooms.find((r) => r.room_id === selectedSpaceId) ?? null) : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 100 | // While a space's children load (or fail), show no channels rather than the |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 101 | // full list — listing everything would falsely imply it belongs to the space. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 102 | $: baseRooms = selectedSpaceId ? (spaceChildIds ? $rooms.filter((r) => spaceChildIds.includes(r.room_id)) : []) : $rooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 103 | $: visibleRooms = query |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 104 | ? baseRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 105 | (r) => |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 106 | r.name.toLowerCase().includes(query) || r.room_id.toLowerCase().includes(query) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 107 | ) |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 108 | : baseRooms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 109 | $: directRooms = visibleRooms.filter((r) => r.direct && !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 110 | $: groupRooms = visibleRooms.filter( |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 111 | (r) => !r.direct && !r.space && r.membership !== 'Invited' |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 112 | ); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 113 | $: spaceList = visibleRooms.filter((r) => r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 114 | $: channelRooms = baseRooms.filter((r) => !r.space && r.membership !== 'Invited'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 115 | $: recoveryBanner = $encryption && ($encryption.recovery === 'Disabled' || $encryption.recovery === 'Incomplete') ? $encryption : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 116 | $: verificationBanner = $verification && $verification.kind !== 'Done' ? $verification : null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 117 | $: items = $selectedRoomId ? ($timelines[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 118 | $: members = $selectedRoomId ? ($membersByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 119 | $: hasStart = items.some((i) => i.kind === 'start'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 120 | $: grouped = buildGroups(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 121 | $: pendingItems = $selectedRoomId ? ($pendingByRoom[$selectedRoomId] ?? []) : []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 122 | $: lastRealOwn = lastSenderIsOwn(items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 123 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 124 | function lastSenderIsOwn(list: TimelineItem[]): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 125 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 126 | const it = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 127 | if (it.kind === 'event') return it.event.sender.user_id === $sessionUser; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 128 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 129 | return false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 130 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 131 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 132 | function pendingShowSender(index: number): boolean { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 133 | return index === 0 ? !lastRealOwn : false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 134 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 135 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 136 | function pendingToEvent(p: PendingMessage): TimelineEvent { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 137 | const state: SendState = p.status === 'failed' ? { kind: 'Failed', will_retry: false } : { kind: 'Sending' }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 138 | return { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 139 | item_id: `pending-${p.id}`, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 140 | event_id: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 141 | transaction_id: p.id, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 142 | sender: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 143 | user_id: $sessionUser ?? '', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 144 | display_name: profile?.display_name ?? null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 145 | avatar: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 146 | name_ambiguous: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 147 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 148 | timestamp_ms: p.createdAt, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 149 | own: true, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 150 | send_state: state, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 151 | content: { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 152 | kind: 'Message', |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 153 | message: { kind: 'Text', body: p.body, geo_uri: null, formatted_body: null, edited: false, media: null } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 154 | }, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 155 | reply_to: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 156 | thread_root: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 157 | thread_summary: null, |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 158 | reactions: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 159 | read_by: [], |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 160 | editable: false |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 161 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 162 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 163 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 164 | interface Group { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 165 | key: string; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 166 | item: TimelineItem; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 167 | showSender: boolean; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 168 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 169 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 170 | function buildGroups(list: TimelineItem[]): Group[] { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 171 | const out: Group[] = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 172 | let prevSender: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 173 | let prevTs = 0; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 174 | list.forEach((item, index) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 175 | let showSender = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 176 | if (item.kind === 'event') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 177 | const e = item.event; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 178 | showSender = |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 179 | prevSender !== e.sender.user_id || Math.abs(e.timestamp_ms - prevTs) > 5 * 60 * 1000; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 180 | prevSender = e.sender.user_id; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 181 | prevTs = e.timestamp_ms; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 182 | out.push({ key: e.item_id || e.event_id || `m-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 183 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 184 | prevSender = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 185 | out.push({ key: `${item.kind}-${index}`, item, showSender }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 186 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 187 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 188 | return out; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 189 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 190 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 191 | function roomUnread(r: RoomSummary): number { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 192 | return r.unread_messages + r.unread_mentions; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 193 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 194 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 195 | onMount(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 196 | void boot(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 197 | return () => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 198 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 199 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 200 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 201 | }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 202 | }); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 203 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 204 | async function boot(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 205 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 206 | const session = await getSession(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 207 | blocked.set(session.blocked ?? false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 208 | sessionUser.set(session.user_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 209 | if (session.user_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 210 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 211 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 212 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 213 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 214 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 215 | void loadQuickReactions(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 216 | } else { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 217 | softLogout.set(session.soft_logout ?? null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 218 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 219 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 220 | pushBanner(e instanceof Error ? `Session check failed: ${e.message}` : 'Session check failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 221 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 222 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 223 | booted = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 224 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 225 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 226 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 227 | async function refreshRooms(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 228 | roomsLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 229 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 230 | const res = await getRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 231 | rooms.set(res.rooms); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 232 | pruneSpaceFilter(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 233 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 234 | pushBanner(e instanceof Error ? e.message : 'Could not load rooms'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 235 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 236 | roomsLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 237 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 238 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 239 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 240 | async function loadProfile(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 241 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 242 | const raw = await getProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 243 | profile = parseOwnProfile(raw); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 244 | profileMxc = profile.avatar_url; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 245 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 246 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 247 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 248 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 249 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 250 | async function loadEncryption(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 251 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 252 | const res = await getEncryption(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 253 | const state = parseEncryptionState(res.state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 254 | if (state) encryption.set(state); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 255 | const verificationState = parseVerificationState(res.verification); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 256 | if (verificationState) verification.set(verificationState); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 257 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 258 | // Encryption status also arrives over SSE; a failed first fetch is not fatal. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 259 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 260 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 261 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 262 | function afterLogin(userId: string): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 263 | sessionUser.set(userId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 264 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 265 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 266 | void refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 267 | connectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 268 | void loadProfile(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 269 | void loadEncryption(); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 270 | void loadQuickReactions(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 271 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 272 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 273 | async function doLogout(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 274 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 275 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 276 | await logout(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 277 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 278 | pushBanner(e instanceof Error ? e.message : 'Logout failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 279 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 280 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 281 | disconnectEvents(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 282 | resetClientState(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 283 | softLogout.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 284 | blocked.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 285 | sessionUser.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 286 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 287 | drafts = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 288 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 289 | membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 290 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 291 | profile = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 292 | profileMxc = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 293 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 294 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 295 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 296 | openReady = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 297 | openFailed = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 298 | avatarByUser = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 299 | resetPending(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 300 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 301 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 302 | function pruneSpaceFilter(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 303 | if (!selectedSpaceId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 304 | if (!$rooms.some((r) => r.room_id === selectedSpaceId)) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 305 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 306 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 307 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 308 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 309 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 310 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 311 | async function selectHome(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 312 | selectedSpaceId = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 313 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 314 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 315 | sidebarOpen = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 316 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 317 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 318 | async function selectSpace(spaceId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 319 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 320 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 321 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 322 | if (prev) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 323 | openedRoom = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 324 | closeRoom(prev).catch(() => undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 325 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 326 | selectedSpaceId = spaceId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 327 | spaceChildIds = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 328 | spaceChildrenError = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 329 | spaceChildrenLoading = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 330 | sidebarOpen = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 331 | // A space is navigation, not a message timeline. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 332 | selectedRoomId.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 333 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 334 | const res = await getSpaceChildren(spaceId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 335 | if (selectedSpaceId === spaceId) spaceChildIds = res.room_ids ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 336 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 337 | if (selectedSpaceId === spaceId) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 338 | spaceChildrenError = e instanceof Error ? e.message : 'Could not load rooms in this space'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 339 | spaceChildIds = []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 340 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 341 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 342 | if (selectedSpaceId === spaceId) spaceChildrenLoading = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 343 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 344 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 345 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 346 | async function selectRoom(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 347 | if ($selectedRoomId && composer.trim()) drafts[$selectedRoomId] = composer; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 348 | if (roomId === $selectedRoomId && openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 349 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 350 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 351 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 352 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 353 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 354 | openedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 355 | selectedRoomId.set(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 356 | composer = drafts[roomId] ?? ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 357 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 358 | lastReadKey = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 359 | sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 360 | openReady = { ...openReady, [roomId]: false }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 361 | if (openFailed[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 362 | const nextFailed = { ...openFailed }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 363 | delete nextFailed[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 364 | openFailed = nextFailed; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 365 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 366 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 367 | await openRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 368 | openReady = { ...openReady, [roomId]: true }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 369 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 370 | const message = e instanceof Error ? e.message : `Could not open room ${roomId}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 371 | openFailed = { ...openFailed, [roomId]: message }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 372 | pushBanner(message); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 373 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 374 | if (membersOpen) void loadMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 375 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 376 | scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 377 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 378 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 379 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 380 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 381 | function scrollToBottom(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 382 | if (timelineEl) timelineEl.scrollTop = timelineEl.scrollHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 383 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 384 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 385 | function onTimelineScroll(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 386 | if (!timelineEl) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 387 | const gap = timelineEl.scrollHeight - timelineEl.scrollTop - timelineEl.clientHeight; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 388 | stickToBottom = gap < 80; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 389 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 390 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 391 | $: void trackTimeline($selectedRoomId, items); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 392 | async function trackTimeline(roomId: string | null, list: TimelineItem[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 393 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 394 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 395 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 396 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 397 | queueReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 398 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 399 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 400 | function queueReadReceipt(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 401 | if (readTimer !== null) window.clearTimeout(readTimer); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 402 | readTimer = window.setTimeout(() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 403 | readTimer = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 404 | void sendReadReceipt(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 405 | }, 800); |
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 sendReadReceipt(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 409 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 410 | if (!roomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 411 | const list = $timelines[roomId] ?? []; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 412 | for (let i = list.length - 1; i >= 0; i -= 1) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 413 | const entry = list[i]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 414 | if (entry.kind === 'event' && entry.event.event_id) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 415 | const key = `${roomId}:${entry.event.event_id}`; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 416 | if (key === lastReadKey) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 417 | lastReadKey = key; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 418 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 419 | await markRead(roomId, entry.event.event_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 420 | } catch { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 421 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 422 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 423 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 424 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 425 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 426 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 427 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 428 | function send(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 429 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 430 | const body = composer.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 431 | if (!roomId || !body) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 432 | if (!openReady[roomId]) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 433 | pushBanner('Still opening this room — sending is disabled until the room is ready.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 434 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 435 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 436 | composer = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 437 | if (roomId in drafts) delete drafts[roomId]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 438 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 439 | queueSend(roomId, body); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 440 | composerEl?.focus(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 441 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 442 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 443 | let typedText = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 444 | let typedRoom: string | null = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 445 | $: trackTypingInput(composer, $selectedRoomId, openReady); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 446 | function trackTypingInput(text: string, roomId: string | null, ready: Record<string, boolean>): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 447 | const edited = roomId === typedRoom && text !== typedText; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 448 | typedText = text; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 449 | typedRoom = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 450 | if (!roomId || !ready[roomId] || !text.trim()) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 451 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 452 | } else if (edited) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 453 | notifyTyping(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 454 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 455 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 456 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 457 | $: void trackPending($selectedRoomId, pendingItems); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 458 | async function trackPending(roomId: string | null, list: PendingMessage[]): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 459 | if (!roomId || list.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 460 | if (roomId !== $selectedRoomId) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 461 | await tick(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 462 | if (stickToBottom) scrollToBottom(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 463 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 464 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 465 | function onComposerKey(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 466 | if (ev.key === 'Enter' && !ev.shiftKey) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 467 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 468 | send(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 469 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 470 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 471 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 472 | async function upload(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 473 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 474 | if (!roomId || uploadBusy || !openReady[roomId]) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 475 | fileInput?.click(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 476 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 477 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 478 | async function onFileChosen(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 479 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 480 | const files = fileInput?.files; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 481 | if (!roomId || !files || files.length === 0) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 482 | const file = files[0]; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 483 | if (file.size === 0 || file.size > 20 * 1024 * 1024) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 484 | pushBanner('File must be between 1 byte and 20 MiB.'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 485 | if (fileInput) fileInput.value = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 486 | return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 487 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 488 | uploadBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 489 | uploadName = file.name || 'attachment'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 490 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 491 | await uploadAttachment(roomId, file); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 492 | stickToBottom = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 493 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 494 | pushBanner(e instanceof Error ? e.message : 'Upload failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 495 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 496 | uploadBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 497 | uploadName = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 498 | if (fileInput) fileInput.value = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 499 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 500 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 501 | async function react(eventId: string, key: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 502 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 503 | if (!roomId || !eventId || reacting) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 504 | reacting = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 505 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 506 | await reactToMessage(roomId, eventId, key); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 507 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 508 | pushBanner(e instanceof Error ? e.message : 'Reaction failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 509 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 510 | reacting = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 511 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 512 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 513 | |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 514 | async function changeQuickReactions(list: QuickReaction[]): Promise<void> { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 515 | try { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 516 | await saveQuickReactions(list); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 517 | } catch (e) { |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 518 | pushBanner(e instanceof Error ? e.message : 'Could not save quick reactions'); |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 519 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 520 | } |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 521 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 522 | async function paginate(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 523 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 524 | if (!roomId || paginateBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 525 | paginateBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 526 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 527 | await paginateRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 528 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 529 | pushBanner(e instanceof Error ? e.message : 'Loading older messages failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 530 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 531 | paginateBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 532 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 533 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 534 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 535 | async function loadMembers(roomId: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 536 | if (membersFor === roomId && $membersLoading) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 537 | membersFor = roomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 538 | membersLoading.set(true); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 539 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 540 | const res = await getMembers(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 541 | membersByRoom.update((all) => ({ ...all, [roomId]: res.members })); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 542 | avatarByUser = { ...avatarByUser, ...avatarMap(res.members) }; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 543 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 544 | pushBanner(e instanceof Error ? e.message : 'Could not load members'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 545 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 546 | if (membersFor === roomId) membersLoading.set(false); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 547 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 548 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 549 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 550 | function avatarMap(list: MemberSummary[]): Record<string, string | null> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 551 | const next: Record<string, string | null> = {}; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 552 | for (const member of list) next[member.user_id] = member.avatar; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 553 | return next; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 554 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 555 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 556 | function senderAvatarFor(userId: string): string | null { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 557 | return avatarByUser[userId] ?? null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 558 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 559 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 560 | function toggleMembers(): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 561 | membersOpen = !membersOpen; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 562 | if (membersOpen && $selectedRoomId) void loadMembers($selectedRoomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 563 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 564 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 565 | async function join(target: string): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 566 | const room = target.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 567 | if (!room || joinBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 568 | joinBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 569 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 570 | const res = await joinRoom(room); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 571 | joinTarget = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 572 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 573 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 574 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 575 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 576 | pushBanner(e instanceof Error ? e.message : 'Join failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 577 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 578 | joinBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 579 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 580 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 581 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 582 | async function create(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 583 | const name = createName.trim(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 584 | if (!name || createBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 585 | createBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 586 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 587 | const res = await createRoom(name, createTopic.trim() || undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 588 | createName = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 589 | createTopic = ''; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 590 | dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 591 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 592 | await selectRoom(res.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 593 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 594 | pushBanner(e instanceof Error ? e.message : 'Create room failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 595 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 596 | createBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 597 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 598 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 599 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 600 | async function leave(): Promise<void> { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 601 | const roomId = $selectedRoomId; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 602 | if (!roomId || leaveBusy) return; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 603 | leaveBusy = true; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 604 | stopTyping(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 605 | try { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 606 | await leaveRoom(roomId); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 607 | const prev = openedRoom; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 608 | if (prev === roomId) openedRoom = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 609 | if ($selectedRoomId === roomId) selectedRoomId.set(null); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 610 | if (prev) closeRoom(prev).catch(() => undefined); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 611 | await refreshRooms(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 612 | } catch (e) { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 613 | pushBanner(e instanceof Error ? e.message : 'Leave failed'); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 614 | } finally { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 615 | leaveBusy = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 616 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 617 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 618 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 619 | function connectionClass(state: string): string { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 620 | if (state === 'online') return 'dot-online'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 621 | if (state === 'connecting' || state === 'reconnecting') return 'dot-busy'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 622 | return 'dot-off'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 623 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 624 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 625 | function onKeydown(ev: KeyboardEvent): void { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 626 | if (ev.key === 'Escape') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 627 | if (dialog) dialog = null; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 628 | else if (membersOpen && window.innerWidth < 1100) membersOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 629 | else if (sidebarOpen) sidebarOpen = false; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 630 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 631 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 632 | </script> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 633 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 634 | <svelte:window on:keydown={onKeydown} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 635 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 636 | {#if !booted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 637 | <div class="splash" role="status" aria-label="Loading Malice"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 638 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 639 | <p>Loading Malice…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 640 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 641 | {:else if $blocked} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 642 | <div class="splash" role="status" aria-label="Malice is open in another tab"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 643 | <div class="splash-mark" aria-hidden="true">M</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 644 | <p>Malice is open in another tab. Close this tab or use that one instead.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 645 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 646 | {:else if $sessionUser == null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 647 | <LoginPanel softLogout={$softLogout} on:done={(ev) => afterLogin(ev.detail)} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 648 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 649 | <div class="app"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 650 | <nav class="rail" aria-label="Servers and spaces"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 651 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 652 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 653 | class="rail-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 654 | class:active={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 655 | title="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 656 | aria-label="Home — all channels" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 657 | aria-pressed={selectedSpaceId === null} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 658 | on:click={() => void selectHome()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 659 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 660 | <span aria-hidden="true">⌂</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 661 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 662 | <div class="rail-sep" aria-hidden="true"></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 663 | {#each spaceRooms as space (space.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 664 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 665 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 666 | class="rail-btn rail-space" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 667 | class:active={selectedSpaceId === space.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 668 | title={space.name} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 669 | aria-label={`Show channels in space ${space.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 670 | aria-pressed={selectedSpaceId === space.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 671 | on:click={() => void selectSpace(space.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 672 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 673 | <MxcAvatar mxc={space.avatar} label={space.name} size={44} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 674 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 675 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 676 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 677 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 678 | class="rail-btn rail-add" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 679 | aria-label="Join or create a room" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 680 | on:click={() => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 681 | dialog = 'join'; |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 682 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 683 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 684 | <span aria-hidden="true">+</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 685 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 686 | </nav> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 687 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 688 | <aside class="sidebar" class:open={sidebarOpen} aria-label="Rooms"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 689 | <div class="side-search"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 690 | <label class="visually-hidden" for="room-search">Search rooms</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 691 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 692 | id="room-search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 693 | type="search" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 694 | placeholder="Search rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 695 | bind:value={search} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 696 | autocomplete="off" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 697 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 698 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 699 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 700 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 701 | title="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 702 | aria-label="Refresh rooms" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 703 | disabled={roomsLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 704 | on:click={() => void refreshRooms()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 705 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 706 | <span aria-hidden="true">⟳</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 707 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 708 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 709 | <div class="side-scroll"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 710 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 711 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 712 | <MxcAvatar mxc={selectedSpace.avatar} label={selectedSpace.name} size={28} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 713 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 714 | <strong>{selectedSpace.name}</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 715 | <span>Space — channels below</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 716 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 717 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 718 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 719 | <div class="space-context"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 720 | <div class="space-context-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 721 | <strong>Home</strong> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 722 | <span>All channels</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 723 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 724 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 725 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 726 | {#if roomsLoading && $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 727 | <p class="side-note">Loading rooms…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 728 | {:else if $rooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 729 | <p class="side-note">No rooms yet. Join one or create your own.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 730 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 731 | <button type="button" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 732 | <button type="button" on:click={() => (dialog = 'create')}>Create one</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 733 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 734 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 735 | {#if selectedSpaceId && spaceChildrenLoading} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 736 | <p class="side-note">Loading channels in this space…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 737 | {:else if selectedSpaceId && spaceChildrenError} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 738 | <p class="side-note" role="alert">{spaceChildrenError}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 739 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 740 | <button type="button" on:click={() => selectedSpaceId && void selectSpace(selectedSpaceId)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 741 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 742 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 743 | {:else if selectedSpaceId && spaceChildIds && channelRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 744 | <p class="side-note">No channels found in this space yet.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 745 | <div class="side-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 746 | <button type="button" on:click={() => void selectHome()}>Back to Home</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 747 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 748 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 749 | {#if invites.length > 0 && !selectedSpaceId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 750 | <h2 class="side-h">Invites</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 751 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 752 | {#each invites as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 753 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 754 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 755 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 756 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 757 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 758 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 759 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 760 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 761 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 762 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 763 | class="invite-join" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 764 | role="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 765 | tabindex="0" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 766 | aria-label={`Join ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 767 | on:click|stopPropagation={() => void join(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 768 | on:keydown|stopPropagation={(ev) => { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 769 | if (ev.key === 'Enter' || ev.key === ' ') { |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 770 | ev.preventDefault(); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 771 | void join(room.room_id); |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 772 | } |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 773 | }} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 774 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 775 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 776 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 777 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 778 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 779 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 780 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 781 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 782 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 783 | {#if directRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 784 | <h2 class="side-h">Direct messages</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 785 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 786 | {#each directRooms as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 787 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 788 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 789 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 790 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 791 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 792 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 793 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 794 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 795 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 796 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 797 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 798 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 799 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 800 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 801 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 802 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 803 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 804 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 805 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 806 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 807 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 808 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 809 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 810 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 811 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 812 | {#if groupRooms.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 813 | <h2 class="side-h">{selectedSpace ? 'Channels in this space' : 'Rooms'}</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 814 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 815 | {#each groupRooms as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 816 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 817 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 818 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 819 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 820 | class:active={$selectedRoomId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 821 | aria-current={$selectedRoomId === room.room_id ? 'true' : undefined} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 822 | on:click={() => void selectRoom(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 823 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 824 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 825 | <span class="room-hash" aria-hidden="true">#</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 826 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 827 | {#if roomUnread(room) > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 828 | <span |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 829 | class="badge" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 830 | class:mention={room.unread_mentions > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 831 | aria-label={`${roomUnread(room)} unread`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 832 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 833 | {roomUnread(room) > 99 ? '99+' : roomUnread(room)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 834 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 835 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 836 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 837 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 838 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 839 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 840 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 841 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 842 | {#if !selectedSpaceId && spaceList.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 843 | <h2 class="side-h">Spaces</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 844 | <ul class="room-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 845 | {#each spaceList as room (room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 846 | <li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 847 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 848 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 849 | class="room-row" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 850 | class:active={selectedSpaceId === room.room_id} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 851 | aria-label={`Show channels in space ${room.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 852 | on:click={() => void selectSpace(room.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 853 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 854 | <MxcAvatar mxc={room.avatar} label={room.name} size={26} shape="rounded" /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 855 | <span class="room-hash" aria-hidden="true">◇</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 856 | <span class="room-name">{room.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 857 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 858 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 859 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 860 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 861 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 862 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 863 | {#if query && visibleRooms.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 864 | <p class="side-note">No rooms match “{search.trim()}”.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 865 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 866 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 867 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 868 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 869 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 870 | <div class="side-footer"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 871 | <div class="me" title={$sessionUser}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 872 | {#if profileMxc} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 873 | <MxcAvatar mxc={profileMxc} label={profile?.display_name ?? $sessionUser} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 874 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 875 | <span class="me-avatar" aria-hidden="true">{$sessionUser.slice(1, 2).toUpperCase()}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 876 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 877 | <span class="me-id">{profile?.display_name && profile.display_name !== $sessionUser ? `${profile.display_name} (${$sessionUser})` : $sessionUser}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 878 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 879 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 880 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 881 | class="icon-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 882 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 883 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 884 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 885 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 886 | <span aria-hidden="true">🛡</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 887 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 888 | <button type="button" class="icon-btn" title="Log out" aria-label="Log out" on:click={() => void doLogout()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 889 | <span aria-hidden="true">⏻</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 890 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 891 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 892 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 893 | {#if sidebarOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 894 | <button type="button" class="scrim" aria-label="Close room list" on:click={() => (sidebarOpen = false)}></button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 895 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 896 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 897 | <main class="chat"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 898 | {#if $banners.length > 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 899 | <div class="banners" aria-live="polite"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 900 | {#each $banners as banner (banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 901 | <div class="banner" role="alert"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 902 | <span>{banner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 903 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 904 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 905 | aria-label="Dismiss error" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 906 | on:click={() => dismissBanner(banner.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 907 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 908 | ✕ |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 909 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 910 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 911 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 912 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 913 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 914 | {#if !selectedRoom} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 915 | <div class="empty"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 916 | <div class="empty-mark" aria-hidden="true">◈</div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 917 | {#if selectedSpace} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 918 | <h1>{selectedSpace.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 919 | <p>Select a channel below to start chatting. Spaces group channels — they are not chat rooms.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 920 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 921 | <h1>Welcome to Malice</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 922 | <p>Pick a room from the sidebar, or join one to get started.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 923 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 924 | <div class="empty-cta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 925 | <button type="button" class="primary-btn" on:click={() => (dialog = 'join')}>Join a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 926 | <button type="button" class="ghost-btn" on:click={() => (dialog = 'create')}>Create a room</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 927 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 928 | <p class="conn-line"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 929 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 930 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 931 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 932 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 933 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 934 | <header class="chat-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 935 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 936 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 937 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 938 | aria-label="Open room list" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 939 | on:click={() => (sidebarOpen = true)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 940 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 941 | <span aria-hidden="true">☰</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 942 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 943 | <div class="head-title"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 944 | <div class="head-room"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 945 | <MxcAvatar mxc={selectedRoom.avatar} label={selectedRoom.name} size={36} shape={selectedRoom.space ? 'rounded' : 'circle'} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 946 | <div class="head-room-text"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 947 | <h1>{selectedRoom.name}</h1> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 948 | <div class="head-meta"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 949 | {#if selectedRoom.space} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 950 | <span class="pill">space</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 951 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 952 | {#if selectedRoom.encrypted} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 953 | <span class="pill" title="End-to-end encrypted">🔒 encrypted</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 954 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 955 | {#if selectedRoom.direct} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 956 | <span class="pill">direct</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 957 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 958 | <span class="conn" title={`Sync state: ${$connection}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 959 | <span class="dot {connectionClass($connection)}" aria-hidden="true"></span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 960 | {$connection} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 961 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 962 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 963 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 964 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 965 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 966 | <div class="head-actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 967 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 968 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 969 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 970 | aria-label="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 971 | title="Encryption and verification" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 972 | on:click={() => (dialog = 'security')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 973 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 974 | 🛡 Security |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 975 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 976 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 977 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 978 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 979 | aria-pressed={membersOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 980 | aria-label={membersOpen ? 'Hide members' : 'Show members'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 981 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 982 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 983 | Members |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 984 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 985 | {#if selectedRoom.membership === 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 986 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 987 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 988 | class="ghost-btn danger" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 989 | disabled={leaveBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 990 | on:click={() => void leave()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 991 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 992 | {leaveBusy ? 'Leaving…' : 'Leave'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 993 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 994 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 995 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 996 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 997 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 998 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 999 | on:click={() => void join(selectedRoom.room_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1000 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1001 | {joinBusy ? 'Joining…' : 'Join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1002 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1003 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1004 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1005 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1006 | class="icon-btn only-mobile" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1007 | aria-label="Toggle members" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1008 | on:click={toggleMembers} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1009 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1010 | <span aria-hidden="true">ⓘ</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1011 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1012 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1013 | </header> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1014 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1015 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1016 | {#if recoveryBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1017 | <div class="sec-banner warn" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1018 | <span>Message history is locked — recovery is {recoveryBanner.recovery}. Enter your recovery key to decrypt.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1019 | <button type="button" on:click={() => (dialog = 'security')}>Recover</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1020 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1021 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1022 | {#if verificationBanner} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1023 | <div class="sec-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1024 | {#if verificationBanner.kind === 'Incoming'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1025 | <span>A device wants to verify this session. Review the request to accept it.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1026 | <button type="button" on:click={() => (dialog = 'security')}>Review request</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1027 | {:else if verificationBanner.kind === 'Comparison'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1028 | <span>Verification codes are ready — compare emojis and numbers.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1029 | <button type="button" on:click={() => (dialog = 'security')}>Compare codes</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1030 | {:else if verificationBanner.kind === 'Waiting'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1031 | <span>Verification started — approve on your other device, then compare codes here.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1032 | <button type="button" on:click={() => (dialog = 'security')}>Open verification</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1033 | {:else if verificationBanner.kind === 'Failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1034 | <span>Verification failed: {verificationBanner.message}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1035 | <button type="button" on:click={() => (dialog = 'security')}>Try again</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1036 | {:else if verificationBanner.kind === 'Cancelled'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1037 | <span>Verification cancelled: {verificationBanner.reason}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1038 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1039 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1040 | <span>Verification in progress.</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1041 | <button type="button" on:click={() => (dialog = 'security')}>Open security</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1042 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1043 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1044 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1045 | {#if $connection !== 'online'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1046 | <p class="conn-banner" role="status"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1047 | Sync is {$connection}. New messages will appear when the connection recovers. |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1048 | </p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1049 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1050 | {#if $selectedRoomId && !openReady[$selectedRoomId] && !openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1051 | <p class="conn-banner" role="status">Opening {selectedRoom.name}… sending is disabled until the room is ready.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1052 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1053 | {#if $selectedRoomId && openFailed[$selectedRoomId]} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1054 | <p class="conn-banner error" role="alert">{openFailed[$selectedRoomId]}</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1055 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1056 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1057 | <div class="timeline" bind:this={timelineEl} on:scroll={onTimelineScroll} aria-label={`Messages in ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1058 | <div class="timeline-top"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1059 | {#if hasStart} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1060 | <p class="start-note">This is the beginning of the visible history.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1061 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1062 | <button type="button" class="ghost-btn" disabled={paginateBusy} on:click={() => void paginate()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1063 | {paginateBusy ? 'Loading…' : 'Load older messages'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1064 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1065 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1066 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1067 | {#if grouped.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1068 | <p class="side-note timeline-empty">No messages yet. Say hello!</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1069 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1070 | {#each grouped as g (g.key)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1071 | {#if g.item.kind === 'day'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1072 | <div class="day-row"><span>{formatDay(g.item.timestamp_ms)}</span></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1073 | {:else if g.item.kind === 'readMarker'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1074 | <div class="new-row"><span>New</span></div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1075 | {:else if g.item.kind === 'start'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1076 | <p class="start-note">This is the beginning of the visible history.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1077 | {:else if g.item.kind === 'unknown'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1078 | <p class="unknown-note">Unsupported event ({g.item.label})</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1079 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1080 | <MessageRow |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1081 | itemId={g.key} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1082 | event={g.item.event} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1083 | showSender={g.showSender} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1084 | senderAvatar={senderAvatarFor(g.item.event.sender.user_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1085 | {reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1086 | onReact={(eventId, key) => void react(eventId, key)} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1087 | quickReactions={$quickReactions} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1088 | packs={[]} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1089 | onQuickChange={(list) => void changeQuickReactions(list)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1090 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1091 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1092 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1093 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1094 | {#each pendingItems as p, i (p.id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1095 | <MessageRow |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1096 | itemId={`pending-${p.id}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1097 | event={pendingToEvent(p)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1098 | showSender={pendingShowSender(i)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1099 | senderAvatar={senderAvatarFor($sessionUser ?? '')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1100 | {reacting} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1101 | onReact={(eventId, key) => void react(eventId, key)} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1102 | quickReactions={$quickReactions} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1103 | packs={[]} |
544a170ead2c | atagen | 2026-10-20 11:47 UTC | 1104 | onQuickChange={(list) => void changeQuickReactions(list)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1105 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1106 | {#if p.status === 'failed'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1107 | <div class="pending-actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1108 | <span class="pending-error" role="alert">{p.error}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1109 | <button type="button" class="ghost-btn" on:click={() => retryPending(p.id)}>Retry</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1110 | <button type="button" class="ghost-btn danger" on:click={() => discardPending(p.id)}>Discard</button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1111 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1112 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1113 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1114 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1115 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1116 | {#if selectedRoom.membership === 'Joined'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1117 | <form class="composer" on:submit|preventDefault={() => send()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1118 | <label class="visually-hidden" for="composer">Message {selectedRoom.name}</label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1119 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1120 | type="file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1121 | bind:this={fileInput} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1122 | class="visually-hidden" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1123 | aria-label="Attach a file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1124 | on:change={() => void onFileChosen()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1125 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1126 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1127 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1128 | class="ghost-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1129 | title="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1130 | aria-label="Attach an image or file" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1131 | disabled={!($selectedRoomId && openReady[$selectedRoomId]) || uploadBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1132 | on:click={() => void upload()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1133 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1134 | {uploadBusy ? `Uploading ${uploadName ?? 'file'}…` : '📎'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1135 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1136 | <textarea |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1137 | id="composer" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1138 | bind:this={composerEl} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1139 | bind:value={composer} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1140 | rows="1" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1141 | placeholder={`Message ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1142 | aria-label={`Message ${selectedRoom.name}. Enter to send, Shift Enter for a new line.`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1143 | on:keydown={onComposerKey} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1144 | disabled={!($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1145 | ></textarea> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1146 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1147 | type="submit" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1148 | class="primary-btn" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1149 | disabled={!composer.trim() || !($selectedRoomId && openReady[$selectedRoomId])} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1150 | title={!($selectedRoomId && openReady[$selectedRoomId]) ? 'Waiting for the room to open' : 'Send message'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1151 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1152 | Send |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1153 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1154 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1155 | <p class="composer-note">Sending and failed states show under your message.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1156 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1157 | <div class="join-bar"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1158 | <p>You are not a member of this room.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1159 | <button type="button" class="primary-btn" disabled={joinBusy} on:click={() => void join(selectedRoom.room_id)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1160 | {joinBusy ? 'Joining…' : `Join ${selectedRoom.name}`} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1161 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1162 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1163 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1164 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1165 | </main> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1166 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1167 | {#if selectedRoom && membersOpen} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1168 | <aside class="members" aria-label={`Members of ${selectedRoom.name}`}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1169 | <div class="members-head"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1170 | <h2>Members</h2> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1171 | <button type="button" class="icon-btn" aria-label="Close members" on:click={() => (membersOpen = false)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1172 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1173 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1174 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1175 | {#if $membersLoading && members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1176 | <p class="side-note">Loading members…</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1177 | {:else if members.length === 0} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1178 | <p class="side-note">No members loaded.</p> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1179 | {#if $selectedRoomId} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1180 | <button type="button" class="ghost-btn" on:click={() => $selectedRoomId && void loadMembers($selectedRoomId)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1181 | Retry |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1182 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1183 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1184 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1185 | <ul class="member-list"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1186 | {#each members as member (member.user_id)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1187 | <li class="member"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1188 | <MxcAvatar mxc={member.avatar} label={member.display_name || member.name || member.user_id} size={30} /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1189 | <span class="member-names"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1190 | <span class="member-name">{member.display_name || member.name}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1191 | <span class="member-id">{member.user_id}</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1192 | </span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1193 | </li> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1194 | {/each} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1195 | </ul> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1196 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1197 | </aside> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1198 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1199 | |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1200 | {#if dialog} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1201 | <div class="modal-wrap" role="presentation" on:click|self={() => (dialog = null)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1202 | {#if dialog === 'security'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1203 | <SecurityPanel |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1204 | encryptionState={$encryption} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1205 | verificationState={$verification} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1206 | onAction={() => void loadEncryption()} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1207 | on:close={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1208 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1209 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1210 | <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 | 1211 | <div class="modal-tabs" role="tablist" aria-label="Room actions"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1212 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1213 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1214 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1215 | aria-selected={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1216 | class:active={dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1217 | on:click={() => (dialog = 'join')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1218 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1219 | Join |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1220 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1221 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1222 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1223 | role="tab" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1224 | aria-selected={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1225 | class:active={dialog === 'create'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1226 | on:click={() => (dialog = 'create')} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1227 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1228 | Create |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1229 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1230 | <button |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1231 | type="button" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1232 | class="icon-btn modal-x" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1233 | aria-label="Close dialog" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1234 | on:click={() => (dialog = null)} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1235 | > |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1236 | <span aria-hidden="true">✕</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1237 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1238 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1239 | {#if dialog === 'join'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1240 | <form on:submit|preventDefault={() => void join(joinTarget)}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1241 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1242 | <span>Room ID or alias</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1243 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1244 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1245 | placeholder="!room:example.org or #alias:example.org" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1246 | bind:value={joinTarget} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1247 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1248 | disabled={joinBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1249 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1250 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1251 | <button type="submit" class="primary-btn wide" disabled={joinBusy || !joinTarget.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1252 | {joinBusy ? 'Joining…' : 'Join room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1253 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1254 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1255 | {:else} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1256 | <form on:submit|preventDefault={() => void create()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1257 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1258 | <span>Room name</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1259 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1260 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1261 | placeholder="Weekend plans" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1262 | bind:value={createName} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1263 | required |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1264 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1265 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1266 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1267 | <label class="field"> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1268 | <span>Topic (optional)</span> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1269 | <input |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1270 | type="text" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1271 | placeholder="What should this room be about?" |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1272 | bind:value={createTopic} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1273 | disabled={createBusy} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1274 | /> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1275 | </label> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1276 | <button type="submit" class="primary-btn wide" disabled={createBusy || !createName.trim()}> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1277 | {createBusy ? 'Creating…' : 'Create room'} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1278 | </button> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1279 | </form> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1280 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1281 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1282 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1283 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1284 | {/if} |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1285 | </div> |
973f8fbdaf80 | atagen | 2026-09-28 09:10 UTC | 1286 | {/if} |