cheogram-www

created pr with cheogram-www/style-overhaul-for-real-v2.1 on 2026-11-25T15:28:10Z · by 3c31bc8c
commented on 2026-11-25T15:28:10Z · by 3c31bc8c
Changes are available at https://tangled.org/mrry.band/cheogram-www style-overhaul-for-real-v2
added cheogram-www/style-overhaul-for-real-v2.2 on 2026-11-25T15:38:17Z · by 3c31bc8c
1: 7b21cbd ! 1: 894cb5f Design refresh + dark mode + custom themes
added cheogram-www/style-overhaul-for-real-v2.3 on 2026-11-25T15:51:03Z · by 3c31bc8c
1: 894cb5f ! 1: 13476dc Design refresh + dark mode + custom themes
added cheogram-www/style-overhaul-for-real-v2.4 on 2026-11-25T20:42:04Z · by 3c31bc8c
1: 13476dc ! 1: 8658664 Design refresh + dark mode + custom themes
added cheogram-www/style-overhaul-for-real-v2.5 on 2026-11-25T21:14:39Z · by 3c31bc8c
1: 8658664 ! 1: 3a9bdd1 Design refresh + dark mode + custom themes
cmds
checkout latest patchset:
ssh pr.pico.sh pull cheogram-www:style-overhaul-for-real-v2 | git am -3
checkout specific patchset revision:
ssh pr.pico.sh pull cheogram-www:style-overhaul-for-real-v2 [rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh cheogram-www:style-overhaul-for-real-v2
add comment to patch request:
ssh pr.pico.sh comment cheogram-www:style-overhaul-for-real-v2 "lgtm!"

Patchset cheogram-www/style-overhaul-for-real-v2.2 on 2026-11-25T15:38:17Z · commit 894cb5f

Design refresh + dark mode + custom themes
Eric Roberts 2026-10-29T19:01:59Z
Tweaks a lot of things about the design, adds multiple colour schemes,
and allows users to set custom colour schemes.

Our internal colour schemes have a few extra colour options so we can
customize them further than the custom editor allows. Trying to keep the
custom editor minimal while still allowing for us to have some more
freedom for in house themes.
Diff stat
21 files changed, 1804 insertions(+), 636 deletions(-)
Semantic diff summary
12 added, 0 modified, 0 signature changed, 0 removed across 17 analyzed files (4 files skipped: unsupported file type)
+3 -1 index.html #
......@@ -5,14 +5,16 @@
55 <link rel="icon" href="/favicon.ico" />
66 <meta
77 name="viewport"
8- content="width=device-width, initial-scale=1, interactive-widget=resizes-content"
8+ content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover, interactive-widget=resizes-content"
99 />
1010 <meta name="theme-color" content="#7401cf" />
11+ <meta name="apple-mobile-web-app-capable" content="yes" />
1112 <base target="_blank" />
1213 <title>%VITE_APP_TITLE%</title>
1314 <script type="module" src="/src/bootstrap.ts"></script>
1415 </head>
1516 <body>
17+ <div id="ios-status-bar-surface" aria-hidden="true"></div>
1618 <noscript>You need to enable JavaScript to run this app.</noscript>
1719 <a class="sr-only" href="https://wiki.soprani.ca/CheogramWWW/Orca?action=raw">Information about using this app with a screen reader</a>
1820 <div id="root">
+2 -1 src-tauri/capabilities/default.json #
......@@ -10,6 +10,7 @@
1010 "sql:default",
1111 "core:window:allow-show",
1212 "core:window:allow-unminimize",
13- "core:window:allow-set-focus"
13+ "core:window:allow-set-focus",
14+ "core:window:allow-start-dragging"
1415 ]
1516 }
+2 -2 src-tauri/tauri.conf.json #
......@@ -14,8 +14,8 @@
1414 {
1515 "create": false,
1616 "title": "Cheogram",
17- "titleBarStyle": "Transparent",
18- "backgroundColor": "#7401cf",
17+ "titleBarStyle": "Overlay",
18+ "backgroundColor": "#7C01DE",
1919 "width": 1200,
2020 "height": 800,
2121 "resizable": true,
+836 -334 src/App.scss #
......@@ -1,6 +1,7 @@
1-@use "sass:color";
1+@use "sass:meta";
22 @import "@chatscope/chat-ui-kit-styles/themes/default/helpers/_functions.scss";
33 $default-font-family: system-ui, sans-serif;
4+$default-border-radius: 6px;
45 $conversation-font-family: $default-font-family;
56 $conversation-header-font-family: $default-font-family;
67 $expansion-panel-font-family: $default-font-family;
......@@ -14,18 +15,6 @@ $message-input-content-editor-font-family: $default-font-family;
1415 $message-separator-font-family: $default-font-family;
1516 $typing-indicator-font-family: $default-font-family;
1617
17-$perpy: #7401cf;
18-$color-primary: color.scale($perpy, $lightness: 70%, $saturation: -25%);
19-$color-primary-light: color.scale($color-primary, $lightness: 30%);
20-$color-primary-dark: $perpy;
21-
22-$yeller: #ffc700;
23-$color-secondary: color.scale($yeller, $lightness: 70%, $saturation: -25%);
24-$color-secondary-light: color.scale($color-secondary, $lightness: 30%);
25-$color-secondary-dark: $yeller;
26-
27-$search-border-radius: 10em;
28-
2918 $conversation-header-font-size: 1.5em;
3019 $conversation-header-bg-color: transparent;
3120 $conversation-header-color: inherit;
......@@ -35,79 +24,245 @@ $main-container-sidebar-left-max-width: 22em;
3524 $main-container-sidebar-right-max-width: 22em;
3625
3726 :root {
38- --color-primary: #{$color-primary};
39- --color-primary-light: #{$color-primary-light};
40- --color-primary-dark: #{$color-primary-dark};
41- --color-secondary: #{$color-secondary};
42- --color-secondary-light: #{$color-secondary-light};
43- --color-secondary-dark: #{$color-secondary-dark};
44- --color-on-secondary: #1e0038;
27+ --accent-surface: var(--theme-light-accent-surface);
28+ color-scheme: light;
29+ --theme-primary: var(--theme-light-primary, #7401cf);
30+ --theme-secondary: var(--theme-light-secondary, #ffc700);
31+ --theme-on-primary: var(--theme-light-on-primary, white);
32+ --theme-on-secondary: var(--theme-light-on-secondary, #212121);
33+ --surface-base: var(--theme-light-background, white);
34+ --text-base: var(--theme-light-text, #212121);
35+ --app-background: var(--theme-primary);
36+ --color-on-app: var(--theme-light-on-app, white);
37+ --default-bg-color: var(--surface-base);
38+ --paper-background: var(--default-bg-color);
39+ --color-primary: var(
40+ --accent-surface,
41+ color-mix(in srgb, var(--theme-primary) 13%, var(--surface-base))
42+ );
43+ --color-primary-light: var(
44+ --accent-surface,
45+ color-mix(in srgb, var(--theme-primary) 8%, var(--surface-base))
46+ );
47+ --color-primary-dark: var(--theme-light-link, #7401cf);
48+ --color-secondary: color-mix(
49+ in srgb,
50+ var(--theme-secondary) 30%,
51+ var(--surface-base)
52+ );
53+ --color-secondary-light: color-mix(
54+ in srgb,
55+ var(--theme-secondary) 20%,
56+ white
57+ );
58+ --color-secondary-dark: var(--theme-secondary);
59+ --color-on-primary: var(--theme-light-on-link, white);
60+ --color-on-secondary: var(--theme-on-secondary);
4561 --color-danger: rgb(211, 47, 47);
46- --color-on-danger: #fff;
47- --default-border-color: #{rgba-to-rgb(
48- rgba(scale-color($color-primary-dark, $saturation: -55%), 0.4),
49- #fff
50- )};
51- --color-bg-hover: #{rgba-to-rgb(rgba($color-primary-dark, 0.08), #fff)};
52- --color-bg-focus: #{rgba-to-rgb(
53- rgba($color-primary-dark, 0.24),
54- $color-primary-light
55- )};
56- --default-bg-color: #fff;
57- --color-text: rgba(0, 0, 0, 0.87);
58- --color-text-medium: rgba(0, 0, 0, 0.6);
59- --color-text-disabled: rgba(0, 0, 0, 0.38);
60- --message-outgoing-color: var(--color-text);
61-}
62-
63-/*@media (prefers-color-scheme: dark) {
64- :root {
65- --color-primary: #{color.scale($perpy, $saturation: -60%)};
66- --color-secondary: #{color.scale($yeller, $saturation: -60%)};
67- --default-bg-color: #000;
68- --color-text: rgba(255, 255, 255, 0.87);
69- --color-text-medium: rgba(255, 255, 255, 0.6);
70- --color-text-disabled: rgba(255, 255, 255, 0.38);
71- --message-outgoing-color: rgba(0, 0, 0, 0.87);
72- --default-border-color: #{rgba-to-rgb(
73- rgba(scale-color($color-primary-dark, $saturation: -55%), 0.6),
74- #000
75- )};
76- --color-bg-hover: #{rgba-to-rgb(rgba($color-primary-dark, 0.2), #000)};
77- }
78-}*/
62+ --color-on-danger: white;
63+ --color-text: var(--text-base);
64+ --color-text-medium: color-mix(
65+ in srgb,
66+ var(--text-base) 70%,
67+ var(--surface-base)
68+ );
69+ --color-text-disabled: color-mix(
70+ in srgb,
71+ var(--text-base) 45%,
72+ var(--surface-base)
73+ );
74+ --default-border-color: color-mix(
75+ in srgb,
76+ var(--text-base) 20%,
77+ var(--surface-base)
78+ );
79+ --divider-color: var(--default-border-color);
80+ --color-bg-hover: var(
81+ --accent-surface,
82+ color-mix(in srgb, var(--theme-primary) 8%, var(--surface-base))
83+ );
84+ --color-bg-focus: var(
85+ --accent-surface,
86+ color-mix(in srgb, var(--theme-primary) 24%, var(--surface-base))
87+ );
88+ --chat-panel-border: var(--surface-base);
89+ --chat-panel-background: color-mix(
90+ in srgb,
91+ var(--surface-base) 85%,
92+ transparent
93+ );
94+ --border-radius: #{$default-border-radius};
95+ --message-incoming-background: var(
96+ --theme-incoming-background,
97+ color-mix(in srgb, var(--text-base) 7%, var(--surface-base))
98+ );
99+ --theme-incoming-background: var(--theme-light-incoming-background);
100+ --message-outgoing-background: var(
101+ --theme-light-outgoing-background,
102+ var(--theme-primary)
103+ );
104+ --message-outgoing-color: var(
105+ --theme-light-outgoing-color,
106+ var(--theme-on-primary)
107+ );
108+ --gloop-start: color-mix(in srgb, var(--app-background) 94%, white);
109+ --gloop-end: color-mix(in srgb, var(--app-background) 88%, white);
110+}
111+
112+:root[data-theme="dark"] {
113+ --accent-surface: var(--theme-dark-accent-surface);
114+ color-scheme: dark;
115+ --theme-incoming-background: var(--theme-dark-incoming-background);
116+ --message-outgoing-background: var(
117+ --theme-dark-outgoing-background,
118+ var(--theme-primary)
119+ );
120+ --message-outgoing-color: var(
121+ --theme-dark-outgoing-color,
122+ var(--theme-on-primary)
123+ );
124+ --theme-primary: var(--theme-dark-primary, #7401cf);
125+ --theme-secondary: var(--theme-dark-secondary, #ffc700);
126+ --theme-on-primary: var(--theme-dark-on-primary, white);
127+ --theme-on-secondary: var(--theme-dark-on-secondary, #212121);
128+ --surface-base: var(--theme-dark-background, #191919);
129+ --text-base: var(--theme-dark-text, #f1f1f1);
130+ --color-on-app: var(--theme-dark-on-app, white);
131+ --paper-background: color-mix(
132+ in srgb,
133+ var(--text-base) 3%,
134+ var(--surface-base)
135+ );
136+ --color-primary-light: var(
137+ --accent-surface,
138+ color-mix(in srgb, var(--theme-primary) 24%, var(--surface-base))
139+ );
140+ --color-primary-dark: var(--theme-dark-link, #c99aff);
141+ --color-on-primary: var(--theme-dark-on-link, black);
142+ --chat-panel-border: color-mix(in srgb, var(--text-base) 12%, transparent);
143+ --chat-panel-background: color-mix(
144+ in srgb,
145+ var(--paper-background) 90%,
146+ transparent
147+ );
148+
149+ @include meta.load-css("highlight.js/styles/github-dark.css");
150+
151+ .ql-snow {
152+ .ql-stroke {
153+ stroke: var(--color-text-medium);
154+ }
155+
156+ .ql-fill {
157+ fill: var(--color-text-medium);
158+ }
159+
160+ .ql-picker {
161+ color: var(--color-text-medium);
162+ }
163+
164+ .ql-picker-options,
165+ .ql-tooltip {
166+ background: var(--default-bg-color);
167+ color: var(--color-text);
168+ border-color: var(--default-border-color);
169+ }
170+
171+ .ql-editor.ql-blank::before {
172+ color: var(--color-text-disabled);
173+ }
174+ }
175+}
79176
80177 $default-bg-color: var(--default-bg-color);
81-$typing-indicator-indicator-bg-color: transparent;
82-//$color-text: var(--color-text);
83178 $color-text-medium: var(--color-text-medium);
84179 $color-text-disabled: var(--color-text-disabled);
85180 $default-border-color: var(--default-border-color);
86181 $color-bg-hover: var(--color-bg-hover);
87182 $color-bg-focus: var(--color-bg-focus);
88-$message-header-color: color-mix(in srgb, var(--color-text), white 30%);
89-$message-footer-color: color-mix(in srgb, var(--color-text), white 30%);
183+$message-header-color: color-mix(
184+ in srgb,
185+ var(--color-text),
186+ var(--default-bg-color) 30%
187+);
188+$message-footer-color: $message-header-color;
90189 $color-selected: color-mix(in srgb, var(--color-primary-dark), black 25%);
91-$color-activated: color-mix(in srgb, var(--color-primary-dark), black 25%);
190+$color-activated: $color-selected;
92191 $color-primary: var(--color-primary);
93192 $color-primary-light: var(--color-primary-light);
94193 $color-primary-dark: var(--color-primary-dark);
95-$color-secondary: var(--color-secondary);
96-$color-secondary-light: var(--color-secondary-light);
97-$color-secondary-dark: var(--color-secondary-dark);
98194
99-$conversation-unread-bg-color: var(--color-primary-dark);
195+$conversation-unread-bg-color: var(--theme-primary);
196+$conversation-unread-color: var(--theme-on-primary);
197+
198+$message-list-typing-indicator-bg-color: $default-bg-color;
199+$message-list-loading-more-bg-color: $default-bg-color;
100200
101201 $message-outgoing-color: var(--message-outgoing-color);
102202 $message-content-outgoing-color: var(--message-outgoing-color);
103203 $message-group-message-content-outgoing-color: var(--message-outgoing-color);
104-$message-content-outgoing-bg-color: $color-secondary;
204+$message-content-incoming-bg-color: var(--message-incoming-background);
205+$message-group-message-content-incoming-bg-color: $message-content-incoming-bg-color;
206+$message-content-outgoing-bg-color: var(--message-outgoing-background);
105207 $message-group-message-content-outgoing-bg-color: $message-content-outgoing-bg-color;
208+$conversation-activated-bg-color: $color-primary;
209+$conversation-hover-bg-color: $conversation-activated-bg-color;
210+$conversation-name-activated-color: var(--color-text);
211+$conversation-info-activated-color: var(--color-text-medium);
212+
213+// ChatScope uses its base text color in Sass color functions.
214+$main-container-color: var(--color-text);
215+$chat-container-color: var(--color-text);
216+$chat-container-message-input-color: var(--color-text);
217+$chat-container-input-toolbox-color: var(--color-text);
218+$conversation-color: var(--color-text);
219+$conversation-name-color: var(--color-text);
220+$conversation-header-actions-color: var(--color-text);
221+$conversation-list-color: var(--color-text);
222+$expansion-panel-color: var(--color-text);
223+$expansion-panel-content-color: var(--color-text);
224+$loader-color: var(--color-text);
225+$message-color: var(--color-text);
226+$message-content-color: var(--color-text);
227+$message-content-incoming-color: var(--color-text);
228+$message-group-message-content-incoming-color: var(--color-text);
229+$message-input-content-editor-color: var(--color-text);
230+$message-list-color: var(--color-text);
231+$search-color: var(--color-text);
232+$search-placeholder-color: var(--color-text);
233+$status-list-color: var(--color-text);
234+$status-list-item-active-color: var(--color-text);
106235
107236 @import "@chatscope/chat-ui-kit-styles/themes/default/main.scss";
108237
238+.cs-conversation__unread-dot {
239+ background: radial-gradient(
240+ circle at 3px 3px,
241+ color-mix(in srgb, var(--theme-primary), white 30%),
242+ var(--theme-primary)
243+ );
244+}
245+
109246 * {
110247 box-sizing: border-box;
248+ scrollbar-width: thin;
249+ scrollbar-color: var(--color-primary) transparent;
250+}
251+
252+@supports not (scrollbar-color: auto) {
253+ ::-webkit-scrollbar {
254+ width: 6px;
255+ height: 6px;
256+ }
257+
258+ ::-webkit-scrollbar-thumb {
259+ background: var(--color-primary);
260+ border-radius: $default-border-radius;
261+ }
262+
263+ ::-webkit-scrollbar-track {
264+ background: transparent;
265+ }
111266 }
112267
113268 html,
......@@ -115,6 +270,7 @@ body {
115270 color: var(--color-text);
116271 background-color: var(--default-bg-color);
117272 font-family: system-ui, sans-serif;
273+ -webkit-font-smoothing: antialiased;
118274 }
119275
120276 body,
......@@ -124,14 +280,62 @@ html,
124280 height: 100%;
125281 margin: 0;
126282 padding: 0;
127- box-sizing: border-box;
128283 font-size: 16px;
129284 }
130285
286+#ios-status-bar-surface {
287+ display: none;
288+}
289+
290+@media (display-mode: standalone) {
291+ @supports (-webkit-touch-callout: none) and (-webkit-background-clip: text) {
292+ // Avoid iOS 27's system blur over page content. Keep a nontransparent
293+ // background for WebKit's sampler; empty-text clipping prevents painting.
294+ // https://github.com/HKUDS/nanobot/blob/main/docs/guides/ios-pwa-status-bar.md
295+ #ios-status-bar-surface {
296+ display: block;
297+ position: fixed;
298+ inset: 0 0 auto;
299+ height: 11px;
300+ z-index: 2147483647;
301+ pointer-events: none;
302+ background-color: var(--app-background);
303+ -webkit-background-clip: text;
304+ background-clip: text;
305+ }
306+
307+ body:has(.cs-chat-container[role="main"].active) #ios-status-bar-surface {
308+ background-color: var(--default-bg-color);
309+ }
310+
311+ .cs-chat-container[role="main"].active {
312+ --chat-message-gutter: 1rem;
313+
314+ --chat-composer-bottom-offset: 1.2rem;
315+
316+ > .chat-composer {
317+ margin-bottom: 0;
318+ }
319+ }
320+ }
321+}
322+
131323 input {
132324 font-size: inherit;
133325 }
134326
327+#root.tauri-overlay {
328+ padding-top: 28px;
329+}
330+
331+.tauri-titlebar {
332+ position: fixed;
333+ top: 0;
334+ left: 0;
335+ right: 0;
336+ height: 28px;
337+}
338+
135339 .form-option-icon {
136340 display: flex;
137341 align-items: center;
......@@ -199,9 +403,42 @@ li.MuiListSubheader-root {
199403 object-fit: cover;
200404 }
201405
406+#root:not(.tauri-overlay):not(:has(.cs-chat-container[role="main"].active)) {
407+ padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0
408+ env(safe-area-inset-left, 0px);
409+}
410+
202411 #root {
203412 display: flex;
204- padding-bottom: env(safe-area-inset-bottom, 0px);
413+ position: relative;
414+ isolation: isolate;
415+ background: var(--app-background);
416+
417+ &::before,
418+ &::after {
419+ content: "";
420+ position: absolute;
421+ z-index: -1;
422+ pointer-events: none;
423+ width: 50vh;
424+ max-width: 100%;
425+ background: linear-gradient(135deg, var(--gloop-start), var(--gloop-end));
426+ mask: var(--gloop-mask) center / contain no-repeat;
427+ }
428+
429+ &::before {
430+ --gloop-mask: url(/gloop01.svg);
431+ top: 0;
432+ left: 0;
433+ aspect-ratio: 748 / 660;
434+ }
435+
436+ &::after {
437+ --gloop-mask: url(/gloop02.svg);
438+ bottom: 0;
439+ right: 0;
440+ aspect-ratio: 1260 / 1852;
441+ }
205442
206443 > main {
207444 display: flex;
......@@ -222,17 +459,12 @@ li.MuiListSubheader-root {
222459 margin: auto;
223460 min-width: 25em;
224461 max-width: 100vw;
225- border: 1px solid var(--default-border-color);
226462 border-radius: 2em;
227463 text-align: center;
228- background: var(--color-primary-dark) url(/gloop01.svg) no-repeat;
229- background-size: 40%;
230464 overflow: hidden;
231- color: white;
465+ color: var(--color-on-app);
232466
233467 > form {
234- background: url(/gloop02.svg) no-repeat right bottom;
235- background-size: 60%;
236468 padding: 2em;
237469 }
238470
......@@ -249,7 +481,7 @@ li.MuiListSubheader-root {
249481 button {
250482 display: block;
251483 border-radius: 10em;
252- color: #1e0038;
484+ color: #212121;
253485 background: var(--color-secondary-light);
254486 padding: 1em;
255487 width: 100%;
......@@ -257,6 +489,7 @@ li.MuiListSubheader-root {
257489 }
258490
259491 button {
492+ color: var(--color-on-secondary);
260493 background: var(--color-secondary-dark);
261494 }
262495
......@@ -266,12 +499,12 @@ li.MuiListSubheader-root {
266499 gap: 1em;
267500 width: 21em;
268501 margin-top: 1em;
269- background: rgba(96, 14, 181, 0.4);
502+ background: color-mix(in srgb, var(--app-background) 80%, black);
270503 border-radius: 10em;
271- border: 1px solid #550ca1;
272- box-shadow: 0 1px 0 #550ca1;
504+ border: 1px solid var(--app-background);
505+ box-shadow: 0 1px 0 var(--app-background);
273506 padding: 1em;
274- text-shadow: 0 2px 1px #550ca1;
507+ text-shadow: 0 2px 1px var(--app-background);
275508
276509 span {
277510 flex: 1;
......@@ -324,6 +557,107 @@ li.MuiListSubheader-root {
324557 }
325558 }
326559
560+.cs-chat-container[role="main"] {
561+ --chat-message-gutter: 0.5rem;
562+ --chat-composer-bottom-offset: env(safe-area-inset-bottom, 0px);
563+ position: relative;
564+ min-height: 0;
565+
566+ > .cs-conversation-header,
567+ > .chat-composer {
568+ position: absolute;
569+ left: env(safe-area-inset-left, 0px);
570+ right: env(safe-area-inset-right, 0px);
571+ z-index: 2;
572+ margin: 10px var(--chat-message-gutter);
573+ margin-right: calc(
574+ var(--chat-message-gutter) + var(--chat-scrollbar-width, 0px)
575+ );
576+ }
577+
578+ > .cs-conversation-header,
579+ #message-input-root,
580+ .chat-typing-overlay {
581+ border: 1px solid var(--chat-panel-border);
582+ border-radius: 6px;
583+ -webkit-backdrop-filter: blur(12px);
584+ backdrop-filter: blur(12px);
585+ background: var(--chat-panel-background);
586+ }
587+
588+ > .cs-conversation-header,
589+ #message-input-root {
590+ box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
591+ }
592+
593+ > .cs-conversation-header {
594+ top: env(safe-area-inset-top, 0px);
595+ margin-top: var(--chat-message-gutter);
596+ }
597+
598+ > .chat-composer {
599+ bottom: var(--chat-composer-bottom-offset);
600+ }
601+
602+ #message-input-root {
603+ .cs-message-input {
604+ border: 0;
605+ background: transparent;
606+ }
607+
608+ .cs-message-input__content-editor-wrapper {
609+ background: transparent;
610+ }
611+ }
612+
613+ .chat-typing-overlay {
614+ width: fit-content;
615+ max-width: 100%;
616+ margin-bottom: 8px;
617+ padding: 0.4em 0.75em;
618+ pointer-events: none;
619+ }
620+
621+ > .cs-message-list {
622+ min-height: 0;
623+ height: 100%;
624+
625+ .virtuoso-container {
626+ min-height: 0;
627+ }
628+
629+ .jump-to-bottom {
630+ bottom: calc(
631+ var(--chat-composer-height, 0px) + var(--chat-composer-bottom-offset) +
632+ 1rem
633+ );
634+ }
635+ }
636+
637+ > .cs-message-list:has(> .MuiTabs-root) {
638+ padding-top: calc(
639+ var(--chat-header-height, 0px) + env(safe-area-inset-top, 0px) + 20px
640+ );
641+
642+ .chat-header-spacer {
643+ height: 0;
644+ }
645+ }
646+
647+ .chat-header-spacer {
648+ height: calc(
649+ var(--chat-header-height, 0px) + env(safe-area-inset-top, 0px)
650+ );
651+ }
652+
653+ .chat-composer-spacer {
654+ height: calc(
655+ var(--chat-composer-height, 0px) + var(--chat-composer-bottom-offset) +
656+ 12px
657+ );
658+ }
659+}
660+
327661 .cs-message-list {
328662 display: flex;
329663 flex-direction: column;
......@@ -347,7 +681,7 @@ li.MuiListSubheader-root {
347681 background: var(--color-danger);
348682 color: var(--color-on-danger);
349683 padding: 0.5em 1em;
350- border-radius: 10em;
684+ border-radius: $default-border-radius;
351685
352686 &:first-of-type {
353687 color: var(--color-on-secondary);
......@@ -399,8 +733,7 @@ li.MuiListSubheader-root {
399733 section {
400734 display: grid;
401735 grid-template-columns: max-content 1fr;
402- row-gap: 0.5em;
403- column-gap: 1em;
736+ gap: 0.5em 1em;
404737
405738 h1 {
406739 font-size: 1em;
......@@ -412,7 +745,6 @@ li.MuiListSubheader-root {
412745
413746 > .field {
414747 display: contents;
415- align-items: start;
416748
417749 label {
418750 font-style: italic;
......@@ -431,7 +763,6 @@ li.MuiListSubheader-root {
431763 flex-direction: column;
432764 overflow: auto;
433765 flex: 1;
434- field-sizing: content;
435766
436767 > iframe {
437768 flex: 1;
......@@ -479,36 +810,21 @@ li.MuiListSubheader-root {
479810
480811 [readonly] {
481812 caret-color: transparent;
482-
483- ~ fieldset.MuiOutlinedInput-notchedOutline:hover {
484- border-color: rgba(0, 0, 0, 0.23);
485- border-width: 1px;
486- }
487813 }
488814
489- .MuiInputBase-root:hover {
490- [readonly] ~ fieldset.MuiOutlinedInput-notchedOutline {
491- border-color: rgba(0, 0, 0, 0.23);
492- border-width: 1px;
493- }
494- }
495-
496- .MuiInputBase-root.Mui-readOnly:hover {
497- fieldset.MuiOutlinedInput-notchedOutline {
498- border-color: rgba(0, 0, 0, 0.23);
499- border-width: 1px;
500- }
815+ [readonly] ~ fieldset.MuiOutlinedInput-notchedOutline:hover,
816+ .MuiInputBase-root:hover
817+ [readonly]
818+ ~ fieldset.MuiOutlinedInput-notchedOutline,
819+ .MuiInputBase-root.Mui-readOnly:hover
820+ fieldset.MuiOutlinedInput-notchedOutline,
821+ div.Mui-focused [readonly] ~ fieldset.MuiOutlinedInput-notchedOutline {
822+ border-color: var(--mui-palette-divider);
823+ border-width: 1px;
501824 }
502825
503826 label.Mui-focused:has(~ .MuiInputBase-root [readonly]) {
504- color: rgba(0, 0, 0, 0.6);
505- }
506-
507- div.Mui-focused {
508- [readonly] ~ fieldset.MuiOutlinedInput-notchedOutline {
509- border-color: rgba(0, 0, 0, 0.23);
510- border-width: 1px;
511- }
827+ color: var(--color-text-medium);
512828 }
513829
514830 .command-actions {
......@@ -531,10 +847,6 @@ li.MuiListSubheader-root {
531847 margin: auto;
532848 }
533849
534- .cs-typing-indicator {
535- position: static;
536- }
537-
538850 .jump-to-bottom {
539851 opacity: 0;
540852 position: absolute;
......@@ -566,8 +878,8 @@ li.MuiListSubheader-root {
566878
567879 section.cs-message-group {
568880 margin: 0;
569- padding-left: 0.5em;
570- padding-right: 0.5em;
881+ padding-left: var(--chat-message-gutter, 0.5rem);
882+ padding-right: var(--chat-message-gutter, 0.5rem);
571883 padding-bottom: 0.5em;
572884
573885 * {
......@@ -579,32 +891,33 @@ li.MuiListSubheader-root {
579891 padding-bottom: 0.5em;
580892 }
581893
582- &.back-in-time .meta time {
583- font-weight: bold;
584- color: var(--color-primary-dark);
585- }
586-
587894 .cs-message-group__content {
588895 flex: 1;
896+ min-width: 0;
589897 max-width: 80em;
590898 }
591899
592900 .cs-message:not(:only-child) {
593901 margin: 0;
594902 padding-top: 0.2em;
903+
904+ &:first-child {
905+ padding-top: 0;
906+ }
595907 }
596908
597909 &.cs-message-group--incoming {
598- padding-right: 0.5em;
910+ padding-right: calc(
911+ var(--chat-message-gutter, 0.5rem) +
912+ var(--chat-avatar-size, #{$avatar-md-width}) + 8px - 2rem
913+ );
599914 }
600915
601916 &.cs-message-group--outgoing {
602- padding-left: 0.5em;
603- }
604-
605- .cs-message-group__footer {
606- margin: 0;
607- padding-top: 0.2em;
917+ padding-left: calc(
918+ var(--chat-message-gutter, 0.5rem) +
919+ var(--chat-avatar-size, #{$avatar-md-width}) + 8px - 2em
920+ );
608921 }
609922
610923 .call {
......@@ -629,29 +942,7 @@ li.MuiListSubheader-root {
629942 }
630943
631944 .cs-message--outgoing .cs-message__content button.cs-button {
632- color: var(--color-primary-dark);
633- }
634-
635- .cs-message--incoming .meta {
636- display: flex;
637- flex-wrap: wrap;
638- flex-direction: row;
639- div:not(.h-card.sender) {
640- order: 2;
641- flex: 1;
642- }
643- .h-card.sender {
644- margin-right: 1em;
645- order: 1;
646- }
647- }
648-
649- .small.cs-message--incoming .meta {
650- flex-direction: column;
651- div:not(.h-card.sender) {
652- margin-left: 0;
653- order: 0;
654- }
945+ color: inherit;
655946 }
656947 }
657948
......@@ -673,7 +964,7 @@ li.MuiListSubheader-root {
673964 display: flex;
674965 flex-direction: row;
675966 align-items: center;
676- border-radius: 10em;
967+ border-radius: $default-border-radius;
677968 padding: 0.6em 0.6em;
678969 margin: 0.5em auto;
679970 width: fit-content;
......@@ -738,7 +1029,7 @@ div.cs-message__content {
7381029 white-space-collapse: preserve-spaces;
7391030
7401031 blockquote {
741- border-left: 1px solid black;
1032+ border-left: 1px solid currentColor;
7421033 padding-left: 0.5em;
7431034 opacity: 0.7;
7441035 margin: 0;
......@@ -785,7 +1076,7 @@ div.cs-message__content {
7851076 text-decoration: none;
7861077 color: var(--color-text);
7871078 background: var(--color-bg-focus);
788- border-radius: 3em;
1079+ border-radius: $default-border-radius;
7891080 margin: 1em;
7901081 padding: 1.5em;
7911082
......@@ -795,7 +1086,7 @@ div.cs-message__content {
7951086 margin-bottom: 0.5em;
7961087 max-height: 10em;
7971088 max-width: 80vw;
798- border-radius: 1em;
1089+ border-radius: $default-border-radius;
7991090 }
8001091
8011092 .p-name {
......@@ -862,11 +1153,6 @@ div.cs-message__content {
8621153 }
8631154 }
8641155
865-.cs-conversation-header__avatar {
866- margin-top: auto;
867- margin-bottom: auto;
868-}
869-
8701156 .cs-conversation-header__content {
8711157 overflow: hidden;
8721158 text-overflow: ellipsis;
......@@ -927,6 +1213,16 @@ div.cs-message__content {
9271213 }
9281214
9291215 &.cs-sidebar--left {
1216+ [data-index] {
1217+ padding: 0 0.35em;
1218+ border-bottom: 1px solid transparent;
1219+ }
1220+
1221+ .cs-conversation:hover,
1222+ .cs-conversation--active {
1223+ border-radius: $default-border-radius;
1224+ }
1225+
9301226 .cs-conversation-header {
9311227 padding-top: 0.5em;
9321228 padding-bottom: 0.7em;
......@@ -992,7 +1288,7 @@ div.cs-message__content {
9921288 }
9931289
9941290 &:not(.h-card) {
995- border-bottom: 1px solid #ccc;
1291+ border-bottom: 1px solid var(--divider-color);
9961292 }
9971293
9981294 > .MuiBadge-root > button {
......@@ -1013,7 +1309,7 @@ div.cs-message__content {
10131309 li {
10141310 list-style-type: none;
10151311 padding: 0.2em 0;
1016- border-bottom: 1px solid #ccc;
1312+ border-bottom: 1px solid var(--divider-color);
10171313 margin-bottom: 0.5em;
10181314 }
10191315 }
......@@ -1054,10 +1350,10 @@ div.cs-message__content {
10541350
10551351 #tag-nav {
10561352 width: fit-content;
1057- margin: 0 0.5rem 0.5rem;
1353+ margin: 0 0.5rem 0.5em;
10581354 padding: 0.3rem 0.9rem;
10591355 border: none;
1060- border-radius: 2em;
1356+ border-radius: $default-border-radius;
10611357 background: var(--color-secondary);
10621358 }
10631359
......@@ -1112,7 +1408,7 @@ div.cs-message__content {
11121408 margin: 1em auto;
11131409 }
11141410
1115- > .status > .text {
1411+ .status > .text {
11161412 font-style: italic;
11171413 }
11181414
......@@ -1124,7 +1420,7 @@ div.cs-message__content {
11241420 display: inline-block;
11251421 padding: 0.2em 0.5em;
11261422 margin: 0.5em;
1127- border-radius: 2em;
1423+ border-radius: $default-border-radius;
11281424 color: var(--color-on-danger);
11291425 text-transform: lowercase;
11301426 font-variant: small-caps;
......@@ -1145,19 +1441,13 @@ div.cs-message__content {
11451441 }
11461442
11471443 #message-input-root {
1148- border-top: 1px solid var(--default-border-color);
1149-
1150- &:has(.reply) {
1151- border-top: none;
1152- }
1153-
11541444 .reply {
11551445 display: flex;
11561446 flex-direction: row;
11571447
1158- background: var(--color-primary-dark);
1159- color: var(--default-bg-color);
1160- border-radius: 1em 1em 0 0;
1448+ background: var(--theme-primary);
1449+ color: var(--theme-on-primary);
1450+ border-radius: $default-border-radius $default-border-radius 0 0;
11611451 padding: 0 1em;
11621452 line-height: 2;
11631453
......@@ -1167,14 +1457,13 @@ div.cs-message__content {
11671457
11681458 button {
11691459 margin-left: auto;
1170- color: var(--default-bg-color);
1460+ color: var(--theme-on-primary);
11711461 padding: 0;
11721462 }
11731463 }
11741464
11751465 .attachments {
11761466 display: flex;
1177- flex-direction: flex-row;
11781467 padding: 0.5em;
11791468
11801469 img {
......@@ -1205,9 +1494,6 @@ div.cs-message__content {
12051494 }
12061495
12071496 .cs-message-input {
1208- display: "flex";
1209- flex-direction: "row";
1210-
12111497 .cs-message-input__tools {
12121498 margin: auto 0;
12131499
......@@ -1241,6 +1527,10 @@ div.cs-message__content {
12411527 }
12421528
12431529 .ql-toolbar {
1530+ // Quill's bold icon starts 4px into its SVG, after 5px of button padding.
1531+ // The negative margin visually aligns the B with the "Send message" placeholder below.
1532+ margin-left: -9px;
1533+ margin-bottom: 0.25rem;
12441534 white-space: nowrap;
12451535 overflow: hidden;
12461536 }
......@@ -1271,58 +1561,58 @@ div.cs-message__content {
12711561 cursor: pointer;
12721562 }
12731563
1274-.cs-message:has(.cs-message__footer.reactions) {
1275- padding-bottom: 0.55em;
1276-}
1277-
1278-.cs-message__footer.reactions {
1279- position: absolute;
1280- bottom: -0.2em;
1281- right: 0;
1564+section.cs-message .cs-message__footer.reactions {
1565+ position: relative;
1566+ margin: -8px -1px -1px -1px;
1567+ display: flex;
1568+ flex-wrap: wrap;
1569+ gap: 2px;
12821570
12831571 .cs-button.reaction {
1284- padding: 0 0.2em;
1285- border-color: var(--default-border-color);
1572+ margin: 0;
1573+ padding: 0 4px;
1574+ border-radius: 6px;
1575+ border: 1px solid var(--default-bg-color);
12861576 color: var(--color-text);
1287- background: color-mix(in srgb, var(--color-primary-light), transparent 35%);
1577+ background: var(--color-primary-light);
12881578 width: max-content;
1289- }
1579+ opacity: 1;
1580+ transition:
1581+ background-color 120ms ease,
1582+ color 120ms ease;
1583+ height: 22px;
1584+ line-height: 20px;
1585+ font-size: 10px;
1586+ display: flex;
1587+ align-items: center;
1588+ gap: 4px;
12901589
1291- .cs-button.reaction.mine {
1292- color: var(--default-bg-color);
1293- background: color-mix(in srgb, var(--color-primary-dark), transparent 35%);
1294- }
1590+ > span {
1591+ font-size: 16px;
1592+ }
12951593
1296- .cs-button.reaction img {
1297- max-height: 1rem;
1298- }
1299-}
1594+ img {
1595+ max-height: 1rem;
1596+ }
13001597
1301-.cs-message.cs-message--single:has(.cs-message__footer.reactions),
1302-.cs-message.cs-message--last:has(.cs-message__footer.reactions) {
1303- padding-bottom: 0em;
1598+ &.mine,
1599+ &:hover,
1600+ &:focus-visible {
1601+ background: var(--color-secondary-dark);
1602+ color: var(--color-on-secondary);
1603+ }
13041604
1305- .cs-message__footer.reactions {
1306- bottom: -0.6em;
1605+ &.mine:hover,
1606+ &.mine:focus-visible {
1607+ color: var(--color-text);
1608+ background: $color-primary;
1609+ }
13071610 }
13081611 }
13091612
1310-.cs-message--outgoing .cs-message__footer.reactions {
1311- .cs-button.reaction {
1312- background: color-mix(
1313- in srgb,
1314- var(--color-secondary-light),
1315- transparent 35%
1316- );
1317- }
1318-
1319- .cs-button.reaction.mine {
1320- background: color-mix(
1321- in srgb,
1322- var(--color-secondary-dark),
1323- transparent 35%
1324- );
1325- }
1613+.cs-message-group--outgoing section.cs-message .cs-message__footer.reactions,
1614+section.cs-message--outgoing .cs-message__footer.reactions {
1615+ justify-content: flex-end;
13261616 }
13271617
13281618 img.thread {
......@@ -1351,26 +1641,60 @@ img.thread {
13511641 }
13521642
13531643 .cs-message__custom-content {
1354- .meta {
1355- line-height: 1.3;
1644+ .message-timed-text {
1645+ position: relative;
13561646
1357- img.thread {
1358- float: right;
1359- margin-top: 0.25em;
1360- margin-left: 0.5em;
1647+ &::after {
1648+ content: attr(data-time);
1649+ display: inline-block;
1650+ visibility: hidden;
1651+ padding-right: calc(var(--message-status-count, 0) * 1.5em);
13611652 }
13621653
1363- time,
1364- svg {
1365- font-size: 0.8em;
1366- opacity: 0.6;
1654+ > .message-time {
1655+ position: absolute;
1656+ right: 0;
1657+ bottom: 0;
1658+ }
1659+ }
1660+
1661+ .message-timed-text::after,
1662+ .message-time {
1663+ font-size: 0.75rem;
1664+ font-weight: normal;
1665+ font-style: normal;
1666+ white-space: nowrap;
1667+ padding-left: 0.75em;
1668+ line-height: 1.5;
1669+ }
1670+
1671+ .message-time {
1672+ display: inline-flex;
1673+ align-items: center;
1674+
1675+ .message-badge {
1676+ width: 1.5em;
1677+ color: inherit;
1678+
1679+ svg {
1680+ font-size: 1em;
1681+ }
13671682 }
13681683
1369- svg {
1370- padding-left: 0.5em;
1684+ > :not(:has(.thread)) {
1685+ color: color-mix(in srgb, currentColor 60%, transparent);
13711686 }
13721687 }
13731688
1689+ .message-time-row {
1690+ display: block;
1691+ text-align: right;
1692+ }
1693+
1694+ .meta {
1695+ line-height: 1.3;
1696+ }
1697+
13741698 .action {
13751699 font-style: italic;
13761700 &:before {
......@@ -1383,18 +1707,66 @@ img.thread {
13831707 }
13841708 }
13851709
1386- .cs-message__html-content:has(.action) ~ .meta .sender {
1710+ div:has(> .cs-message__html-content .action) > .sender {
13871711 display: none;
13881712 }
13891713
13901714 .h-card.sender {
13911715 color: var(--color-primary-dark);
1716+ font-weight: 500;
13921717 }
13931718 }
13941719
13951720 section.cs-message {
13961721 overflow: visible;
13971722 position: relative;
1723+ max-width: 100%;
1724+
1725+ .cs-message__content {
1726+ position: relative;
1727+ }
1728+
1729+ .message-badge {
1730+ display: flex;
1731+ align-items: center;
1732+ justify-content: center;
1733+ font: inherit;
1734+ color: var(--color-text-disabled);
1735+ padding: 0;
1736+ border: 0;
1737+ background: transparent;
1738+
1739+ svg {
1740+ font-size: 0.75em;
1741+ }
1742+
1743+ img {
1744+ height: 0.75em;
1745+ object-fit: contain;
1746+ }
1747+ }
1748+
1749+ button.message-badge {
1750+ cursor: pointer;
1751+ }
1752+
1753+ .cs-message__custom-content a {
1754+ color: var(--color-primary-dark);
1755+ text-decoration: underline;
1756+ text-underline-offset: 0.15em;
1757+ text-decoration-thickness: 1px;
1758+ text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
1759+ transition: text-decoration-color 250ms ease;
1760+
1761+ &:hover,
1762+ &:focus-visible {
1763+ text-decoration-color: currentColor;
1764+ }
1765+ }
1766+
1767+ &.cs-message--outgoing .cs-message__custom-content a {
1768+ color: var(--message-outgoing-color);
1769+ }
13981770
13991771 .cs-message__header {
14001772 opacity: 0;
......@@ -1417,12 +1789,11 @@ section.cs-message {
14171789 content: "Private invite only to you";
14181790 font-style: italic;
14191791 opacity: 0.9;
1420- text-size: 0.9em;
14211792 color: var(--color-primary-dark);
14221793 }
14231794
14241795 &.highlight .cs-message__content {
1425- border: 3px solid var(--color-primary-dark);
1796+ border: 3px solid var(--accent-surface, var(--color-primary-dark));
14261797 }
14271798
14281799 &.cs-message--incoming {
......@@ -1433,10 +1804,6 @@ section.cs-message {
14331804 float: right;
14341805 margin-right: -2em;
14351806 }
1436-
1437- .cs-message__footer {
1438- margin-right: 2em;
1439- }
14401807 }
14411808
14421809 &.cs-message--outgoing {
......@@ -1450,6 +1817,9 @@ section.cs-message {
14501817
14511818 .cs-message__content-wrapper {
14521819 display: block;
1820+ position: relative;
1821+ min-width: 0;
1822+ max-width: 100%;
14531823 }
14541824 }
14551825
......@@ -1472,38 +1842,29 @@ section.cs-message {
14721842
14731843 .embed-responsive {
14741844 position: relative;
1475- display: block;
1476- width: 100%;
1845+ aspect-ratio: 4 / 3;
14771846 overflow: hidden;
1478- padding: 0;
1479-
1480- &::before {
1481- content: "";
1482- display: block;
1483- padding-top: 75%;
1484- }
14851847
14861848 video {
14871849 position: absolute;
1488- top: 0;
1489- bottom: 0;
1490- left: 0;
1850+ inset: 0;
14911851 width: 100%;
14921852 height: 100%;
14931853 }
14941854 }
14951855
1496- .h-card {
1856+ .h-card,
1857+ .call-account {
14971858 display: flex;
14981859 align-items: center;
14991860 justify-content: center;
1861+ }
1862+
1863+ .h-card {
15001864 margin-top: 1.5em;
15011865 }
15021866
15031867 .call-account {
1504- display: flex;
1505- align-items: center;
1506- justify-content: center;
15071868 gap: 0.5em;
15081869 font-size: 0.85em;
15091870 line-height: 1;
......@@ -1531,17 +1892,24 @@ section.cs-message {
15311892 width: 100%;
15321893 text-align: left;
15331894 border-radius: 0;
1534- border-bottom: 1px solid #ccc;
1895+ border-bottom: 1px solid var(--divider-color);
15351896 margin-bottom: 0.5em;
15361897 padding: 0.2em 0;
15371898 line-height: 1;
15381899 gap: 0.5em;
15391900 }
15401901
1541- a.u-email::before {
1902+ a.u-email::before,
1903+ a.u-tel::before,
1904+ a.u-url::before,
1905+ a.u-impp::before,
1906+ .p-org::before,
1907+ .p-pronouns::before,
1908+ .p-tz::before,
1909+ time::before,
1910+ .dt-bday::before {
15421911 content: "";
1543- mask: url(@fortawesome/fontawesome-free/svgs/solid/envelope.svg) no-repeat
1544- center;
1912+ mask: none no-repeat center;
15451913 background: var(--color-text);
15461914 height: 1em;
15471915 width: 1em;
......@@ -1549,98 +1917,43 @@ section.cs-message {
15491917 flex-shrink: 0;
15501918 }
15511919
1920+ a.u-email::before {
1921+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/envelope.svg);
1922+ }
1923+
15521924 a.u-tel::before {
1553- content: "";
1554- mask: url(@fortawesome/fontawesome-free/svgs/solid/phone.svg) no-repeat
1555- center;
1556- background: var(--color-text);
1557- height: 1em;
1558- width: 1em;
1559- display: block;
1560- flex-shrink: 0;
1925+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/phone.svg);
15611926 }
15621927
15631928 a.u-url::before {
1564- content: "";
1565- mask: url(@fortawesome/fontawesome-free/svgs/solid/link.svg) no-repeat
1566- center;
1567- background: var(--color-text);
1568- height: 1em;
1569- width: 1em;
1570- display: block;
1571- flex-shrink: 0;
1929+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/link.svg);
15721930 }
15731931
15741932 a.u-impp::before {
1575- content: "";
1576- mask: url(@fortawesome/fontawesome-free/svgs/solid/message.svg) no-repeat
1577- center;
1578- background: var(--color-text);
1579- height: 1em;
1580- width: 1em;
1581- display: block;
1582- flex-shrink: 0;
1933+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/message.svg);
15831934 }
15841935
15851936 .p-org::before {
1586- content: "";
1587- mask: url(@fortawesome/fontawesome-free/svgs/solid/building.svg) no-repeat
1588- center;
1589- background: var(--color-text);
1590- height: 1em;
1591- width: 1em;
1592- display: block;
1593- flex-shrink: 0;
1937+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/building.svg);
15941938 }
15951939
15961940 .p-pronouns::before {
1597- content: "";
1598- mask: url(@fortawesome/fontawesome-free/svgs/solid/genderless.svg) no-repeat
1599- center;
1600- background: var(--color-text);
1601- height: 1em;
1602- width: 1em;
1603- display: block;
1604- flex-shrink: 0;
1941+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/genderless.svg);
16051942 }
16061943
16071944 .p-tz::before {
1608- content: "";
1609- mask: url(@fortawesome/fontawesome-free/svgs/solid/user-clock.svg) no-repeat
1610- center;
1611- background: var(--color-text);
1612- height: 1em;
1613- width: 1em;
1614- display: block;
1615- flex-shrink: 0;
1945+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/user-clock.svg);
16161946 }
16171947
16181948 time::before {
1619- content: "";
1620- mask: url(@fortawesome/fontawesome-free/svgs/solid/calendar.svg) no-repeat
1621- center;
1622- background: var(--color-text);
1623- height: 1em;
1624- width: 1em;
1625- display: block;
1626- flex-shrink: 0;
1949+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/calendar.svg);
16271950 }
16281951
16291952 .dt-bday::before {
1630- content: "";
1631- mask: url(@fortawesome/fontawesome-free/svgs/solid/cake-candles.svg)
1632- no-repeat center;
1633- background: var(--color-text);
1634- height: 1em;
1635- width: 1em;
1636- display: block;
1637- flex-shrink: 0;
1638- }
1639-
1640- a.u-url[href^="https://www.patreon.com/c/"]::before {
1641- mask-image: url(@fortawesome/fontawesome-free/svgs/brands/patreon.svg);
1953+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/cake-candles.svg);
16421954 }
16431955
1956+ a.u-url[href^="https://www.patreon.com/c/"]::before,
16441957 a.u-url[href^="https://patreon.com/c/"]::before {
16451958 mask-image: url(@fortawesome/fontawesome-free/svgs/brands/patreon.svg);
16461959 }
......@@ -1718,6 +2031,17 @@ button.MuiFab-root {
17182031 }
17192032
17202033 @media (max-width: 576px) {
2034+ .cs-main-container {
2035+ --chat-avatar-size: 28px;
2036+
2037+ .cs-avatar.cs-avatar--md {
2038+ width: var(--chat-avatar-size);
2039+ height: var(--chat-avatar-size);
2040+ min-width: var(--chat-avatar-size);
2041+ min-height: var(--chat-avatar-size);
2042+ }
2043+ }
2044+
17212045 .cs-main-container--responsive {
17222046 .cs-sidebar .cs-search {
17232047 display: flex;
......@@ -1727,6 +2051,7 @@ button.MuiFab-root {
17272051 display: flex;
17282052 flex-basis: 100%;
17292053 max-width: 100%;
2054+ border-right: 0;
17302055 }
17312056
17322057 > .cs-chat-container {
......@@ -1734,12 +2059,14 @@ button.MuiFab-root {
17342059 }
17352060 }
17362061
1737- #account-nav:has(~ .cs-main-container) {
2062+ #account-nav:has(~ main > .cs-main-container) {
17382063 display: none;
17392064 }
17402065
1741- #account-nav:has(~ .cs-main-container > .cs-sidebar--left.active),
1742- #account-nav:has(~ .cs-main-container > .active > .cs-message-list.account) {
2066+ #account-nav:has(~ main > .cs-main-container > .cs-sidebar--left.active),
2067+ #account-nav:has(
2068+ ~ main > .cs-main-container > .active > .cs-message-list.account
2069+ ) {
17432070 display: flex;
17442071 }
17452072 }
......@@ -1759,17 +2086,102 @@ button.MuiFab-root {
17592086 }
17602087 }
17612088
2089+.cs-main-container {
2090+ border: 0;
2091+
2092+ &.page {
2093+ flex: 1;
2094+ min-height: 0;
2095+
2096+ .page-back {
2097+ display: none;
2098+ font-size: $conversation-header-font-size;
2099+ padding: 0;
2100+ @media (max-width: 576px) {
2101+ display: inline-flex;
2102+ }
2103+ }
2104+
2105+ > section {
2106+ margin: 0 auto;
2107+ max-width: 100%;
2108+ overflow: auto;
2109+ scrollbar-gutter: stable;
2110+ padding: 1em 2em;
2111+
2112+ &:has(> .settings-appearance) {
2113+ width: 40rem;
2114+ }
2115+ }
2116+ }
2117+
2118+ &.tauri {
2119+ flex: 1;
2120+ min-height: 0;
2121+ height: auto;
2122+ border-radius: $default-border-radius;
2123+ border-bottom-right-radius: 13px;
2124+ overflow: hidden;
2125+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
2126+ }
2127+}
2128+
2129+main:has(> .cs-main-container.tauri) {
2130+ padding: 0.35em 0.35em 0.35em 0;
2131+}
2132+
2133+#account-nav:has(~ main > .cs-main-container.tauri) {
2134+ isolation: auto;
2135+ box-shadow: none;
2136+
2137+ .active-account,
2138+ > a.active {
2139+ z-index: 1;
2140+ }
2141+
2142+ > .active-account:first-child::after {
2143+ background-image: radial-gradient(
2144+ circle at bottom left,
2145+ transparent 70%,
2146+ var(--default-bg-color) 72%
2147+ );
2148+ background-position: bottom;
2149+ }
2150+}
2151+
2152+#account-nav:has(> .active-account:first-child)
2153+ ~ main
2154+ > .cs-main-container.tauri {
2155+ border-top-left-radius: 0;
2156+}
2157+
17622158 #account-nav {
1763- background: var(--color-primary-dark) url(/gloop01.svg) no-repeat;
1764- background-size: 40vh;
2159+ flex: 0 0 5.5em;
2160+ width: 5.5em;
2161+ padding-block: 0.35em;
2162+ isolation: isolate;
2163+ overflow: hidden;
2164+ box-shadow: inset -12px 0 12px -8px rgba(0, 0, 0, 0.2);
17652165 display: flex;
17662166 flex-direction: column;
2167+ gap: 0.35em;
17672168
1768- > a {
2169+ .account-nav-group {
2170+ position: relative;
2171+ margin-left: 0.35em;
2172+ padding: 0.35em 0;
2173+ display: flex;
2174+ flex-direction: column;
2175+ gap: 0.35em;
2176+ }
2177+
2178+ > a,
2179+ .account-nav-group > a {
17692180 position: relative;
17702181 display: block;
2182+ margin-left: 0.35em;
17712183 padding: 0.5em;
1772- color: white;
2184+ color: inherit;
17732185 text-decoration: none;
17742186
17752187 .cs-avatar {
......@@ -1803,9 +2215,62 @@ button.MuiFab-root {
18032215 }
18042216 }
18052217
1806- a.active {
1807- background: $color-primary-light;
1808- color: $color-primary-dark;
2218+ color: var(--color-on-app);
2219+
2220+ .account-nav-group > a {
2221+ margin: 0 0.35em;
2222+ }
2223+
2224+ .account-nav-group .cs-avatar {
2225+ border: 2px solid var(--color-on-app);
2226+ }
2227+
2228+ .active-account > a.active {
2229+ border-radius: $default-border-radius;
2230+ background: $conversation-activated-bg-color;
2231+ }
2232+
2233+ .active-account::after,
2234+ > a.active::after {
2235+ content: "";
2236+ position: absolute;
2237+ right: 0;
2238+ top: -$default-border-radius;
2239+ bottom: -$default-border-radius;
2240+ width: $default-border-radius;
2241+ background:
2242+ radial-gradient(
2243+ circle at top left,
2244+ transparent 70%,
2245+ var(--default-bg-color) 72%
2246+ )
2247+ top,
2248+ radial-gradient(
2249+ circle at bottom left,
2250+ transparent 70%,
2251+ var(--default-bg-color) 72%
2252+ )
2253+ bottom;
2254+ background-size: 100% $default-border-radius;
2255+ background-repeat: no-repeat;
2256+ pointer-events: none;
2257+ }
2258+
2259+ .active-account,
2260+ > a.active {
2261+ border-radius: $default-border-radius 0 0 $default-border-radius;
2262+ background: var(--default-bg-color);
2263+ color: var(--color-primary-dark);
2264+
2265+ &::before {
2266+ content: "";
2267+ position: absolute;
2268+ inset: 0;
2269+ border-radius: inherit;
2270+ z-index: -1;
2271+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
2272+ pointer-events: none;
2273+ }
18092274 }
18102275 }
18112276
......@@ -1873,6 +2338,12 @@ em-emoji-picker {
18732338 }
18742339 }
18752340
2341+.message-attachments .message-attachment-media {
2342+ max-height: 15em;
2343+ max-width: min(100%, 35em);
2344+ object-fit: scale-down;
2345+}
2346+
18762347 .message-attachments-toggle {
18772348 display: inline-flex;
18782349 align-items: center;
......@@ -1881,6 +2352,7 @@ em-emoji-picker {
18812352 border: 0;
18822353 background: transparent;
18832354 font-size: 0.8em;
2355+ color: inherit;
18842356 opacity: 0.6;
18852357 text-align: left;
18862358 cursor: pointer;
......@@ -1889,3 +2361,33 @@ em-emoji-picker {
18892361 font-size: 0.75em;
18902362 }
18912363 }
2364+
2365+.settings-appearance {
2366+ > .MuiFormControl-root {
2367+ margin-bottom: 1em;
2368+ }
2369+
2370+ display: flex;
2371+ flex-direction: column;
2372+ gap: 1em;
2373+ margin-top: 2em;
2374+ padding-top: 1em;
2375+ border-top: 1px solid var(--divider-color);
2376+
2377+ h2 {
2378+ margin: 0;
2379+ }
2380+
2381+ .theme-colour {
2382+ display: flex;
2383+ align-items: flex-start;
2384+ gap: 0.75em;
2385+
2386+ input[type="color"] {
2387+ flex-shrink: 0;
2388+ width: 2.5em;
2389+ height: 2.5em;
2390+ cursor: pointer;
2391+ }
2392+ }
2393+}
+25 -1 src/App.tsx #
......@@ -1,6 +1,12 @@
1+import {
2+ applyTheme,
3+ defaultCustomPalette,
4+ defaultTheme,
5+ type Theme,
6+} from "./theme";
17 import { assertNever } from "./assert-never";
28 import "./App.scss";
3-import { CircularProgress } from "@mui/material";
9+import { CircularProgress, useColorScheme } from "@mui/material";
410 import { newAccount } from "./components/Login";
511 import { Suspense, useEffect, useState } from "react";
612 import * as borogove from "borogove";
......@@ -83,6 +89,13 @@ const AppInner = () => {
8389 };
8490 const [accounts, setAccounts] = useState(initialAccounts);
8591 const [settings, setSettings] = useState<SettingsData>(initialSettings);
92+ const { setMode } = useColorScheme();
93+ useEffect(() => {
94+ setMode(settings.appearance);
95+ }, [setMode, settings.appearance]);
96+ useEffect(() => {
97+ applyTheme(settings.theme, settings.customPalette);
98+ }, [settings.theme, settings.customPalette]);
8699 const params = useParams();
87100 const { showNotification, onNotificationClick, onNotificationClose } =
88101 useNotifications();
......@@ -242,12 +255,23 @@ const initialP = (async () => {
242255 const accountIds = await persistence.listAccounts();
243256 const initialSelectedAccount =
244257 (await persistence.get("ui#selectedAccount")) || accountIds[0];
258+ const appearance = await persistence.get("config#appearance");
259+ const savedTheme = (await persistence.get(
260+ "config#themePreset",
261+ )) as Theme | null;
262+ const savedCustomPalette = await persistence.get("config#customPalette");
245263 return {
246264 initialAccounts: Object.fromEntries(
247265 accountIds.map((id: string) => [id, newAccount(id, idbp, persistence)]),
248266 ),
249267 initialSelectedAccount,
250268 initialSettings: {
269+ theme: savedTheme ?? defaultTheme,
270+ customPalette: savedCustomPalette
271+ ? JSON.parse(savedCustomPalette)
272+ : defaultCustomPalette,
273+ appearance:
274+ appearance === "light" || appearance === "dark" ? appearance : "system",
251275 enterIsSend:
252276 "" + (await persistence.get("config#enterIsSend")) !== "false",
253277 richTextToolbar:
+3 -2 src/components/About.tsx #
......@@ -1,9 +1,10 @@
1+import { Page } from "./Page";
12 import { sha, describe } from "~build/git";
23 import * as borogove from "borogove";
34
45 export const About = () => {
56 return (
6- <section>
7+ <Page>
78 <h1>About</h1>
89 <p>
910 This is AGPLv3 licensed software, version{" "}
......@@ -14,6 +15,6 @@ export const About = () => {
1415 <a href="https://borogove.dev">Borogove {borogove.VERSION}</a>
1516 </p>
1617 <p>This is an alpha test version.</p>
17- </section>
18+ </Page>
1819 );
1920 };
+10 -4 src/components/Accounts.tsx #
......@@ -8,7 +8,7 @@ import {
88 useParams,
99 useNavigate,
1010 } from "react-router";
11-import { Fragment, useContext, useEffect, useState } from "react";
11+import { useContext, useEffect, useState } from "react";
1212 import { useHotkeys } from "react-hotkeys-hook";
1313 import { Context } from "../App";
1414 import { AvatarWithPlaceholder } from "./AvatarWithPlaceholder";
......@@ -231,8 +231,14 @@ export const Accounts = () => {
231231 const client = accounts[accountId].client;
232232 const selfChat = client.getChat(accountId);
233233 return (
234- <Fragment key={`account-${accountId}`}>
235- <NavLink to={href("/accounts/:accountId", { accountId })}>
234+ <div
235+ key={`account-${accountId}`}
236+ className={
237+ "account-nav-group" +
238+ (params.accountId === accountId ? " active-account" : "")
239+ }
240+ >
241+ <NavLink end to={href("/accounts/:accountId", { accountId })}>
236242 <AvatarWithPlaceholder
237243 displayName={`Account: ${accountId}`}
238244 placeholderUri={selfChat?.getPlaceholder()}
......@@ -279,7 +285,7 @@ export const Accounts = () => {
279285 <div className="label">Requests</div>
280286 </NavLink>
281287 )}
282- </Fragment>
288+ </div>
283289 );
284290 })}
285291 <NavLink to="/login" title="Add Account">
+128 -0 src/components/AppearanceSettings.tsx #
......@@ -0,0 +1,128 @@
1+import type { persistence } from "borogove";
2+import { useState } from "react";
3+import { contrast, themePresets, type Palette, type Theme } from "../theme";
4+import type { SettingsData } from "./Settings";
5+import {
6+ MenuItem,
7+ TextField,
8+ FormLabel,
9+ FormControl,
10+ RadioGroup,
11+ Radio,
12+ FormControlLabel,
13+} from "@mui/material";
14+import { capitalize } from "@mui/material/utils";
15+
16+const colourRoles = ["background", "text", "primary", "secondary"] as const;
17+
18+function ColourField({
19+ role,
20+ value,
21+ onChange,
22+}: {
23+ role: keyof Palette;
24+ value: string;
25+ onChange: (value: string) => void;
26+}) {
27+ const [draft, setDraft] = useState(value);
28+ const isColour = (value: string) => /^#[\da-f]{6}$/i.test(value);
29+ const change = (value: string) => {
30+ setDraft(value);
31+ if (isColour(value.trim())) onChange(value.trim());
32+ };
33+ const invalid = !isColour(draft.trim());
34+ return (
35+ <div className="theme-colour">
36+ <TextField
37+ fullWidth
38+ size="small"
39+ label={`${capitalize(role)} colour`}
40+ value={draft}
41+ error={invalid}
42+ helperText={invalid ? "Use a six-digit hex colour." : undefined}
43+ onChange={(event) => change(event.target.value)}
44+ />
45+ <input
46+ type="color"
47+ aria-label={`Choose ${role} colour`}
48+ value={value}
49+ onChange={(event) => change(event.target.value)}
50+ />
51+ </div>
52+ );
53+}
54+
55+export function AppearanceSettings({
56+ settings,
57+ setSettings,
58+ persistence,
59+}: {
60+ settings: SettingsData;
61+ setSettings: (settings: SettingsData) => void;
62+ persistence: persistence.KeyValueStore;
63+}) {
64+ const { customPalette } = settings;
65+ return (
66+ <section className="settings-appearance" aria-labelledby="appearance-title">
67+ <h2 id="appearance-title">Appearance</h2>
68+
69+ <FormControl>
70+ <FormLabel id="appearance-label">Mode</FormLabel>
71+ <RadioGroup
72+ aria-labelledby="appearance-label"
73+ row
74+ value={settings.appearance}
75+ onChange={(_, value) => {
76+ const appearance = value as SettingsData["appearance"];
77+ persistence.set("config#appearance", appearance);
78+ setSettings({ ...settings, appearance });
79+ }}
80+ >
81+ <FormControlLabel value="system" control={<Radio />} label="System" />
82+ <FormControlLabel value="light" control={<Radio />} label="Light" />
83+ <FormControlLabel value="dark" control={<Radio />} label="Dark" />
84+ </RadioGroup>
85+ </FormControl>
86+
87+ <TextField
88+ select
89+ label="Theme"
90+ value={settings.theme}
91+ onChange={(event) => {
92+ const theme = event.target.value as Theme;
93+ persistence.set("config#themePreset", theme);
94+ setSettings({ ...settings, theme });
95+ }}
96+ >
97+ {Object.entries(themePresets).map(([id, preset]) => (
98+ <MenuItem key={id} value={id}>
99+ {preset.name}
100+ </MenuItem>
101+ ))}
102+ <MenuItem value="custom">Custom</MenuItem>
103+ </TextField>
104+ {settings.theme === "custom" && (
105+ <>
106+ {colourRoles.map((role) => (
107+ <ColourField
108+ key={role}
109+ role={role}
110+ value={customPalette[role]}
111+ onChange={(value) => {
112+ const palette = { ...customPalette, [role]: value };
113+ persistence.set(
114+ "config#customPalette",
115+ JSON.stringify(palette),
116+ );
117+ setSettings({ ...settings, customPalette: palette });
118+ }}
119+ />
120+ ))}
121+ {contrast(customPalette.text, customPalette.background) < 4.5 && (
122+ <p role="status">Text and background have low contrast.</p>
123+ )}
124+ </>
125+ )}
126+ </section>
127+ );
128+}
+6 -6 src/components/Call.tsx #
......@@ -347,7 +347,7 @@ export const Call = ({
347347 transform: "translateX(-50%)",
348348 border: "1px solid red",
349349 padding: "0.5em 1em",
350- borderRadius: "1em",
350+ borderRadius: "var(--border-radius)",
351351 }}
352352 >
353353 {call.videoTracks().length > 0 &&
......@@ -515,7 +515,7 @@ export const Call = ({
515515 sx={{
516516 transform: "translateX(-50%)",
517517 padding: "1em 4em",
518- borderRadius: "1em",
518+ borderRadius: "var(--border-radius)",
519519 textAlign: "center",
520520 }}
521521 >
......@@ -558,7 +558,7 @@ export const Call = ({
558558 onClick={() => call.hangup()}
559559 style={{
560560 background: "red",
561- borderRadius: "10em",
561+ borderRadius: "var(--border-radius)",
562562 color: "white",
563563 padding: "0.5em 2em",
564564 marginTop: "1.5em",
......@@ -581,7 +581,7 @@ export const Call = ({
581581 sx={{
582582 transform: "translateX(-50%)",
583583 padding: "1em 4em",
584- borderRadius: "1em",
584+ borderRadius: "var(--border-radius)",
585585 textAlign: "center",
586586 }}
587587 >
......@@ -618,7 +618,7 @@ export const Call = ({
618618 border
619619 onClick={() => call.accept()}
620620 style={{
621- borderRadius: "10em",
621+ borderRadius: "var(--border-radius)",
622622 padding: "0.5em 2em",
623623 }}
624624 >
......@@ -628,7 +628,7 @@ export const Call = ({
628628 onClick={() => call.hangup()}
629629 style={{
630630 background: "red",
631- borderRadius: "10em",
631+ borderRadius: "var(--border-radius)",
632632 color: "white",
633633 padding: "0.5em 2em",
634634 }}
+230 -177 src/components/Chat.tsx #
......@@ -31,6 +31,7 @@ import {
3131 Suspense,
3232 useState,
3333 useEffect,
34+ useLayoutEffect,
3435 useMemo,
3536 useRef,
3637 useCallback,
......@@ -49,6 +50,7 @@ import {
4950 Message,
5051 MessageList,
5152 MessageInput,
53+ InputToolbox,
5254 SendButton,
5355 TypingIndicator,
5456 } from "@chatscope/chat-ui-kit-react";
......@@ -135,6 +137,23 @@ type Group = {
135137 messages: borogove.ChatMessage[];
136138 };
137139
140+const messageListComponents = {
141+ Header: () => <div className="chat-header-spacer" />,
142+ Footer: () => <div className="chat-composer-spacer" />,
143+};
144+
145+function measureScrollbarWidth(scroller: HTMLElement | null) {
146+ if (!scroller) return 0;
147+ const style = getComputedStyle(scroller);
148+ return Math.max(
149+ 0,
150+ scroller.offsetWidth -
151+ scroller.clientWidth -
152+ parseFloat(style.borderLeftWidth) -
153+ parseFloat(style.borderRightWidth),
154+ );
155+}
156+
138157 export const ChatInner = () => {
139158 const { enterIsSend, richTextToolbar, messageRequests } =
140159 useContext(SettingsContext);
......@@ -189,8 +208,13 @@ export const ChatInner = () => {
189208 const scrollTop = useRef<string | null>(null);
190209 const inputRef = useRef<QuillInner>();
191210 const messageListContainer = useRef<HTMLDivElement | null>(null);
192- const virtuosoContainer = useRef<HTMLDivElement | null>(null);
211+ const composerRef = useRef<HTMLDivElement | null>(null);
212+ const [scroller, setScroller] = useState<HTMLElement | null>(null);
213+ const setScrollerRef = useCallback((node: HTMLElement | Window | null) => {
214+ setScroller(node instanceof HTMLElement ? node : null);
215+ }, []);
193216 const messageList = useRef<VirtuosoHandle | null>(null);
217+ const headerHeight = useRef(0);
194218 const {
195219 messages: initialMessages,
196220 members: initialMembers,
......@@ -235,21 +259,16 @@ export const ChatInner = () => {
235259 idx + 1 < messages.length
236260 ? ["readUpToMarker"]
237261 : [];
238- // There is a group less than 5 messages from the same sender and thread not more than 2 minutes long
262+ // Group consecutive messages from the same sender and thread.
239263 if (
240264 lastGroup &&
241265 lastGroup !== "readUpToMarker" &&
242- lastGroup.messages.length < 5 &&
243266 (message.moderationReason() ||
244267 lastGroup.senderId === message.senderId) &&
245268 lastGroup.threadId === message.threadId &&
246269 lastGroup.type === message.type &&
247270 lastGroup.messages[0].moderationReason() ===
248- message.moderationReason() &&
249- Math.abs(
250- new Date(lastGroup.messages[0].timeSent).getTime() -
251- new Date(message.timeSent).getTime(),
252- ) < 120000
271+ message.moderationReason()
253272 ) {
254273 return [
255274 ...groups.slice(0, -1),
......@@ -415,7 +434,10 @@ export const ChatInner = () => {
415434 if (!messageList.current) return;
416435
417436 if (hashIndex) {
418- messageList.current.scrollToIndex({ index: hashIndex });
437+ messageList.current.scrollToIndex({
438+ index: hashIndex,
439+ offset: -headerHeight.current,
440+ });
419441 } else if (messageId) {
420442 const chat = activeChat;
421443 const message = await persistence.getMessage(
......@@ -937,7 +959,11 @@ export const ChatInner = () => {
937959 );
938960 if (!typingText) return null;
939961
940- return <TypingIndicator content={typingText} />;
962+ return (
963+ <div as={InputToolbox} className="chat-typing-overlay">
964+ <TypingIndicator content={typingText} />
965+ </div>
966+ );
941967 };
942968
943969 const waitForImagesLoaded = useCallback(() => {
......@@ -1051,37 +1077,60 @@ export const ChatInner = () => {
10511077 setAtBottom(nowAtBottom);
10521078 };
10531079
1054- useEffect(() => {
1055- if (atBottom) {
1056- (async () => {
1057- await waitForImagesLoaded();
1058- setTimeout(() => {
1059- console.log("XYZZY force to bottom", atBottom);
1060- messageList.current?.scrollToIndex({
1061- index: Number.MAX_SAFE_INTEGER,
1062- align: "end",
1063- });
1064- }, 400);
1065- })();
1066- }
1067- }, [messages.length, atBottom, waitForImagesLoaded]);
1068-
1069- useEffect(() => {
1070- const container = virtuosoContainer.current;
1071- if (!container) return;
1072-
1073- const observer = new ResizeObserver(() => {
1074- if (!atBottom) return;
1075-
1080+ const forceToBottom = useCallback(async () => {
1081+ await waitForImagesLoaded();
1082+ setTimeout(() => {
10761083 messageList.current?.scrollToIndex({
10771084 index: Number.MAX_SAFE_INTEGER,
10781085 align: "end",
10791086 });
1080- });
1081- observer.observe(container);
1087+ }, 400);
1088+ }, [waitForImagesLoaded]);
1089+
1090+ useEffect(() => {
1091+ if (atBottom) void forceToBottom();
1092+ }, [messages.length, atBottom, forceToBottom]);
1093+
1094+ const followComposerResize = useEffectEvent((heightChange: number) => {
1095+ if (atBottom && heightChange > 0)
1096+ messageList.current?.scrollBy({ top: heightChange, behavior: "auto" });
1097+ });
1098+
1099+ useLayoutEffect(() => {
1100+ const container = messageListContainer.current?.parentElement;
1101+ const header = container?.querySelector<HTMLElement>(
1102+ ":scope > .cs-conversation-header",
1103+ );
1104+ if (!container || !header) return;
1105+ const composer = composerRef.current;
1106+
1107+ // Keep the message spacer stable when the floating header wraps or resizes.
1108+ if (!headerHeight.current)
1109+ headerHeight.current = header.getBoundingClientRect().height;
1110+ container.style.setProperty(
1111+ "--chat-header-height",
1112+ `${headerHeight.current}px`,
1113+ );
1114+
1115+ const update = () => {
1116+ container.style.setProperty(
1117+ "--chat-scrollbar-width",
1118+ `${measureScrollbarWidth(scroller)}px`,
1119+ );
1120+ const previousHeight = parseFloat(
1121+ container.style.getPropertyValue("--chat-composer-height"),
1122+ );
1123+ const height = composer?.getBoundingClientRect().height ?? 0;
1124+ container.style.setProperty("--chat-composer-height", `${height}px`);
1125+ followComposerResize(height - previousHeight);
1126+ };
1127+ const observer = new ResizeObserver(update);
1128+ if (composer) observer.observe(composer);
1129+ if (scroller) observer.observe(scroller);
1130+ update();
10821131
10831132 return () => observer.disconnect();
1084- }, [atBottom]);
1133+ }, [active, tabIndex, isInvite, scroller, virtuosoGeneration]);
10851134
10861135 const pgUpRef = useHotkeys(
10871136 "PageUp",
......@@ -1318,14 +1367,15 @@ export const ChatInner = () => {
13181367 />
13191368 )}
13201369 <div
1321- ref={virtuosoContainer}
13221370 className="virtuoso-container"
13231371 style={{ display: tabIndex === 0 ? "block" : "none" }}
13241372 >
13251373 <Virtuoso
13261374 aria-label="Chat Messages"
1375+ components={messageListComponents}
13271376 key={virtuosoGeneration}
13281377 ref={messageList}
1378+ scrollerRef={setScrollerRef}
13291379 followOutput={() => atBottom}
13301380 alignToBottom={true}
13311381 startReached={onYReachStart}
......@@ -1431,20 +1481,17 @@ export const ChatInner = () => {
14311481 />
14321482 </div>
14331483 {tabIndex === 0 && (
1434- <>
1435- {getTypingIndicator()}
1436- <Button
1437- title="Jump to bottom"
1438- className={"jump-to-bottom " + (atBottom ? "" : "visible")}
1439- {...{ inert: atBottom ? "" : undefined }}
1440- icon={
1441- <FontAwesomeIcon
1442- icon={faAnglesDown}
1443- onClick={() => jumpToBottom()}
1444- />
1445- }
1446- />
1447- </>
1484+ <Button
1485+ title="Jump to bottom"
1486+ className={"jump-to-bottom " + (atBottom ? "" : "visible")}
1487+ {...{ inert: atBottom ? "" : undefined }}
1488+ icon={
1489+ <FontAwesomeIcon
1490+ icon={faAnglesDown}
1491+ onClick={() => jumpToBottom()}
1492+ />
1493+ }
1494+ />
14481495 )}
14491496 {isInvite && (
14501497 <div className="invite-approve">
......@@ -1498,148 +1545,154 @@ export const ChatInner = () => {
14981545 </div>
14991546
15001547 {tabIndex === 0 && !isInvite && (
1501- <div as={MessageInput} id="message-input-root">
1502- {replyTo && (
1503- <div className="reply">
1504- <span>
1505- Replying to{" "}
1506- <span className="h-card">
1507- {members.get(replyTo.senderId)?.displayName}
1548+ <div as={MessageInput} className="chat-composer" ref={composerRef}>
1549+ {getTypingIndicator()}
1550+ <div id="message-input-root">
1551+ {replyTo && (
1552+ <div className="reply">
1553+ <span>
1554+ Replying to{" "}
1555+ <span className="h-card">
1556+ {members.get(replyTo.senderId)?.displayName}
1557+ </span>
15081558 </span>
1509- </span>
1510- <Button
1511- onClick={() => {
1512- setReplyTo(null);
1513- setSelectedThread(null);
1514- }}
1515- title="Cancel reply"
1516- icon={<FontAwesomeIcon icon={faCircleXmark} />}
1517- />
1518- </div>
1519- )}
1520- {attachmentError && (
1521- <Alert severity="error" onClose={() => setAttachmentError(null)}>
1522- {attachmentError}
1523- </Alert>
1524- )}
1525- {(attachmentProgress || attachments.length > 0) && (
1526- <div className="attachments">
1527- {attachments.map((attachment) => (
1528- <img
1529- crossOrigin="anonymous"
1530- key={attachment.uri}
1531- src={attachment.uri}
1532- alt={attachment.attachment.name ?? undefined}
1533- title="Click to remove"
1534- onClick={() => removeAttachment(attachment)}
1535- />
1536- ))}
1537- {attachmentProgress && <CircularProgress />}
1538- </div>
1539- )}
1540- <div className="cs-message-input" ref={inputHotkeyRef}>
1541- <div className="cs-message-input__tools">
1542- {activeChat.hasCommands() && (
1543- <CommandMenu
1544- chat={activeChat}
1545- addSession={addCommandSession}
1559+ <Button
1560+ onClick={() => {
1561+ setReplyTo(null);
1562+ setSelectedThread(null);
1563+ }}
1564+ title="Cancel reply"
1565+ icon={<FontAwesomeIcon icon={faCircleXmark} />}
15461566 />
1547- )}
1548- {activeChat.canSend() && (
1549- <>
1550- <Button
1551- onClick={() => setSelectedThread(uuidv7())}
1552- onContextMenu={(event) => {
1553- event.preventDefault();
1554- setSelectedThread(null);
1555- }}
1556- title={
1557- currentThread
1558- ? "Thread to send this message to. Click to start a new thread or right-click to clear"
1559- : "Click to start a new thread"
1560- }
1561- icon={
1562- currentThread ? (
1563- <img
1564- src={borogove.Identicon.svg(currentThread ?? "")}
1565- alt="Thread icon"
1566- className="svg-inline--fa"
1567- />
1568- ) : (
1569- <SpoolIcon />
1570- )
1571- }
1567+ </div>
1568+ )}
1569+ {attachmentError && (
1570+ <Alert
1571+ severity="error"
1572+ onClose={() => setAttachmentError(null)}
1573+ >
1574+ {attachmentError}
1575+ </Alert>
1576+ )}
1577+ {(attachmentProgress || attachments.length > 0) && (
1578+ <div className="attachments">
1579+ {attachments.map((attachment) => (
1580+ <img
1581+ crossOrigin="anonymous"
1582+ key={attachment.uri}
1583+ src={attachment.uri}
1584+ alt={attachment.attachment.name ?? undefined}
1585+ title="Click to remove"
1586+ onClick={() => removeAttachment(attachment)}
15721587 />
1573- <AttachmentButton
1574- title="Attach media to message"
1575- onClick={handleAttach}
1588+ ))}
1589+ {attachmentProgress && <CircularProgress />}
1590+ </div>
1591+ )}
1592+ <div className="cs-message-input" ref={inputHotkeyRef}>
1593+ <div className="cs-message-input__tools">
1594+ {activeChat.hasCommands() && (
1595+ <CommandMenu
1596+ chat={activeChat}
1597+ addSession={addCommandSession}
15761598 />
1599+ )}
1600+ {activeChat.canSend() && (
1601+ <>
1602+ <Button
1603+ onClick={() => setSelectedThread(uuidv7())}
1604+ onContextMenu={(event) => {
1605+ event.preventDefault();
1606+ setSelectedThread(null);
1607+ }}
1608+ title={
1609+ currentThread
1610+ ? "Thread to send this message to. Click to start a new thread or right-click to clear"
1611+ : "Click to start a new thread"
1612+ }
1613+ icon={
1614+ currentThread ? (
1615+ <img
1616+ src={borogove.Identicon.svg(currentThread ?? "")}
1617+ alt="Thread icon"
1618+ className="svg-inline--fa"
1619+ />
1620+ ) : (
1621+ <SpoolIcon />
1622+ )
1623+ }
1624+ />
1625+ <AttachmentButton
1626+ title="Attach media to message"
1627+ onClick={handleAttach}
1628+ />
1629+ </>
1630+ )}
1631+ </div>
1632+ {activeChat.canSend() ? (
1633+ <>
1634+ <Quill
1635+ aria-label="Compose message"
1636+ className="cs-message-input__content-editor-wrapper"
1637+ ref={inputRef}
1638+ toolbar={richTextToolbar}
1639+ onTextChange={handleChange}
1640+ triggerRecentEdit={triggerRecentEdit}
1641+ enterIsSend={enterIsSend && handleSend}
1642+ mentionHandler={mentionHandler}
1643+ mentionClose={mentionClose}
1644+ attachFiles={attachFiles}
1645+ placeholder="Send message"
1646+ />
1647+ {!editing && (
1648+ <div className="cs-message-input__tools">
1649+ <SendButton
1650+ title="Send message"
1651+ onClick={handleSend}
1652+ disabled={inputEmpty && attachments.length < 1}
1653+ />
1654+ </div>
1655+ )}
15771656 </>
1657+ ) : (
1658+ activeChat instanceof borogove.Channel && (
1659+ <Button
1660+ style={{ marginLeft: "auto" }}
1661+ border
1662+ onClick={() => {
1663+ activeChat.requestToSend();
1664+ setRequestToSpeakSent(true);
1665+ }}
1666+ disabled={requestToSpeakSent}
1667+ >
1668+ {requestToSpeakSent ? "Request Sent" : "Request to Speak"}
1669+ </Button>
1670+ )
15781671 )}
15791672 </div>
1580- {activeChat.canSend() ? (
1581- <>
1582- <Quill
1583- aria-label="Compose message"
1584- className="cs-message-input__content-editor-wrapper"
1585- ref={inputRef}
1586- toolbar={richTextToolbar}
1587- onTextChange={handleChange}
1588- triggerRecentEdit={triggerRecentEdit}
1589- enterIsSend={enterIsSend && handleSend}
1590- mentionHandler={mentionHandler}
1591- mentionClose={mentionClose}
1592- attachFiles={attachFiles}
1593- placeholder="Send message"
1594- />
1595- {!editing && (
1596- <div className="cs-message-input__tools">
1597- <SendButton
1598- title="Send message"
1599- onClick={handleSend}
1600- disabled={inputEmpty && attachments.length < 1}
1601- />
1602- </div>
1603- )}
1604- </>
1605- ) : (
1606- activeChat instanceof borogove.Channel && (
1673+ {editing && (
1674+ <div className="edit-tools">
1675+ <small>editing</small>
16071676 <Button
1608- style={{ marginLeft: "auto" }}
16091677 border
16101678 onClick={() => {
1611- activeChat.requestToSend();
1612- setRequestToSpeakSent(true);
1679+ setEditing(null);
1680+ inputRef.current?.setText("");
1681+ clearAttachments();
16131682 }}
1614- disabled={requestToSpeakSent}
16151683 >
1616- {requestToSpeakSent ? "Request Sent" : "Request to Speak"}
1684+ Cancel
16171685 </Button>
1618- )
1686+ <Button
1687+ border
1688+ onClick={handleSend}
1689+ disabled={inputEmpty && attachments.length < 1}
1690+ >
1691+ Save
1692+ </Button>
1693+ </div>
16191694 )}
16201695 </div>
1621- {editing && (
1622- <div className="edit-tools">
1623- <small>editing</small>
1624- <Button
1625- border
1626- onClick={() => {
1627- setEditing(null);
1628- inputRef.current?.setText("");
1629- clearAttachments();
1630- }}
1631- >
1632- Cancel
1633- </Button>
1634- <Button
1635- border
1636- onClick={handleSend}
1637- disabled={inputEmpty && attachments.length < 1}
1638- >
1639- Save
1640- </Button>
1641- </div>
1642- )}
16431696 </div>
16441697 )}
16451698 </ChatContainer>
+2 -1 src/components/Chats.tsx #
......@@ -1,4 +1,5 @@
11 import * as borogove from "borogove";
2+import { isTauri } from "@tauri-apps/api/core";
23 import Fuse from "fuse.js";
34 import {
45 Button as MuiButton,
......@@ -503,7 +504,7 @@ export const Chats = () => {
503504 );
504505
505506 return (
506- <MainContainer responsive>
507+ <MainContainer responsive className={isTauri() ? "tauri" : ""}>
507508 <Sidebar
508509 position="left"
509510 scrollable={false}
+3 -4 src/components/CommandMenu.tsx #
......@@ -56,17 +56,16 @@ export const CommandMenu = ({
5656 return (
5757 <>
5858 <Button
59+ aria-label="Menu"
5960 aria-haspopup="menu"
60- border
61+ aria-expanded={!!menu}
6162 icon={<FontAwesomeIcon icon={faBars} />}
6263 onClick={(e) => {
6364 setMenu(e.currentTarget);
6465 setPromise(chat.commands());
6566 setKey(key + 1);
6667 }}
67- >
68- Menu
69- </Button>
68+ />
7069 <Menu
7170 open={!!menu}
7271 anchorEl={menu}
+3 -3 src/components/LoginRequest.tsx #
......@@ -52,7 +52,7 @@ export const LoginRequest = ({
5252 sx={{
5353 transform: "translateX(-50%)",
5454 padding: "1em 4em",
55- borderRadius: "1em",
55+ borderRadius: "var(--border-radius)",
5656 textAlign: "center",
5757 }}
5858 >
......@@ -77,7 +77,7 @@ export const LoginRequest = ({
7777 setLoginRequest(null);
7878 }}
7979 style={{
80- borderRadius: "10em",
80+ borderRadius: "var(--border-radius)",
8181 padding: "0.5em 2em",
8282 }}
8383 >
......@@ -93,7 +93,7 @@ export const LoginRequest = ({
9393 }}
9494 style={{
9595 background: "red",
96- borderRadius: "10em",
96+ borderRadius: "var(--border-radius)",
9797 color: "white",
9898 padding: "0.5em 2em",
9999 }}
+2 -2 src/components/MessageAttachments.tsx #
......@@ -133,7 +133,7 @@ const AttachmentContent = ({
133133 alt={attachment.name || "attachment"}
134134 crossOrigin="anonymous"
135135 src={uri}
136- style={{ height: "15em", objectFit: "scale-down" }}
136+ className="message-attachment-media"
137137 />
138138 </a>
139139 );
......@@ -144,7 +144,7 @@ const AttachmentContent = ({
144144 <video
145145 crossOrigin="anonymous"
146146 src={uri}
147- style={{ height: "15em", objectFit: "scale-down" }}
147+ className="message-attachment-media"
148148 controls
149149 ></video>
150150 );
+0 -1 src/components/MessageBubble.test.tsx #
......@@ -10,7 +10,6 @@ import { MessageBubble } from "./MessageBubble";
1010 afterEach(cleanup);
1111
1212 const html = {
13- reduce: () => [0],
1413 asDOM: () => document.createDocumentFragment(),
1514 toPlainText: () => "",
1615 } as unknown as borogove.Html;
+127 -84 src/components/MessageBubble.tsx #
......@@ -8,6 +8,7 @@ import { useNavigate } from "react-router";
88 import { MessageAttachments } from "./MessageAttachments";
99 import { ReactNode, useRef, useLayoutEffect, useState } from "react";
1010 import hljs from "highlight.js";
11+import { createPortal } from "react-dom";
1112 import { shortDateTimeOnlyToday } from "../util";
1213 import {
1314 Dialog,
......@@ -97,14 +98,25 @@ const MessageContent = ({
9798 selfName,
9899 sender,
99100 hook,
101+ timestamp,
102+ metadata,
103+ statusCount = 0,
100104 }: {
101105 m: borogove.ChatMessage;
102106 selfName: string;
103107 sender: borogove.Member | undefined;
104108 hook?: (frag: DocumentFragment) => DocumentFragment;
109+ timestamp?: string;
110+ metadata?: ReactNode;
111+ statusCount?: number;
105112 }) => {
106113 const contentRef = useRef<HTMLDivElement | null>(null);
107114 const senderRef = useRef(sender);
115+ const [metadataHost] = useState(() => {
116+ const host = document.createElement("span");
117+ host.className = "message-time";
118+ return host;
119+ });
108120
109121 useLayoutEffect(() => {
110122 if (!contentRef.current) return;
......@@ -113,6 +125,8 @@ const MessageContent = ({
113125 DOMPurify.sanitize(formatMention(html, selfName));
114126 const toInsert = hook ? hook(html) : html;
115127
128+ contentRef.current.classList.remove("message-timed-text");
129+ delete contentRef.current.dataset.time;
116130 contentRef.current.replaceChildren(toInsert);
117131 for (const el of contentRef.current.querySelectorAll<HTMLElement>(
118132 "pre > code",
......@@ -121,10 +135,21 @@ const MessageContent = ({
121135 if (!el.className) el.className = "language-plaintext";
122136 hljs.highlightElement(el);
123137 }
124- }, [m, selfName, hook]);
138+ if (timestamp || statusCount) {
139+ let target = contentRef.current;
140+ while (target.lastElementChild?.matches("div, p, blockquote")) {
141+ target = target.lastElementChild as HTMLDivElement;
142+ }
143+ target.classList.add("message-timed-text");
144+ target.dataset.time = timestamp ?? "";
145+ target.style.setProperty("--message-status-count", String(statusCount));
146+ target.append(metadataHost);
147+ }
148+ }, [m, selfName, hook, timestamp, statusCount, metadataHost]);
125149
126150 return (
127151 <>
152+ {createPortal(metadata, metadataHost)}
128153 {!m.moderationReason() &&
129154 m.encryption?.status !==
130155 borogove.EncryptionStatus.DecryptionFailure && (
......@@ -250,12 +275,6 @@ export const MessageBubble = ({
250275 };
251276
252277 const [showEdits, setShowEdits] = useState(false);
253- const bodyLength = m
254- .body()
255- .reduce((txt, isTag, _, kids: number[] | null) =>
256- isTag ? (kids ?? []).reduce((x, y) => x + y, 0) : txt.length,
257- )
258- .reduce((x, y) => x + y, 0);
259278 const parentMessage = m.replyToMessage;
260279 const reactionEntries = [...(m.reactions.entries() || [])];
261280 const shortDateTimeHuman = shortDateTimeOnlyToday(new Date(m.timeSent));
......@@ -266,14 +285,91 @@ export const MessageBubble = ({
266285 })
267286 .replace(/\s*\b[A-Z]{2,4}$/, ""); // remove trailing TZ abbrev
268287
288+ const delivery = !m.isIncoming()
289+ ? {
290+ [borogove.MessageStatus.MessagePending]: [
291+ faClock,
292+ "Sending...",
293+ ] as const,
294+ [borogove.MessageStatus.MessageFailedToSend]: [
295+ faCircleExclamation,
296+ "Error",
297+ ] as const,
298+ [borogove.MessageStatus.MessageDeliveredToServer]: [
299+ faCheck,
300+ "Sent",
301+ ] as const,
302+ [borogove.MessageStatus.MessageDeliveredToDevice]: [
303+ faCheckDouble,
304+ "Received",
305+ ] as const,
306+ }[m.status]
307+ : undefined;
308+
309+ const timestamp = ["last", "single"].includes(position)
310+ ? shortDateTimeHuman
311+ : undefined;
312+ const inlineTime =
313+ !m.attachments.length &&
314+ !m.linkMetadata.length &&
315+ !m.moderationReason() &&
316+ m.encryption?.status !== borogove.EncryptionStatus.DecryptionFailure;
269317 const sender = members.get(m.senderId);
270318 const showSender =
271319 m.senderId !== chat.chatId &&
272- ["last", "single"].includes(position) &&
320+ ["first", "single"].includes(position) &&
273321 !m.moderationReason() &&
274322 m.isIncoming();
275323 const mention = sender && onMention ? () => onMention(sender) : undefined;
276324
325+ const encrypted =
326+ m.encryption?.status === borogove.EncryptionStatus.EncryptionInfoSuccess;
327+ const statusCount =
328+ Number(m.versions.length > 0) +
329+ Number(!!delivery) +
330+ Number(!!m.threadId) +
331+ Number(encrypted);
332+ const metadata = (timestamp || statusCount > 0) && (
333+ <>
334+ {timestamp && <time dateTime={m.timeSent}>{timestamp}</time>}
335+ {m.versions.length > 0 && (
336+ <button
337+ type="button"
338+ className="message-badge"
339+ aria-label={"Edited " + (m.versions.length - 1) + " times"}
340+ onClick={() => setShowEdits(true)}
341+ >
342+ <FontAwesomeIcon icon={faPencil} />
343+ </button>
344+ )}
345+ {delivery && (
346+ <span
347+ className="message-badge"
348+ aria-label={m.statusText ?? delivery[1]}
349+ >
350+ <FontAwesomeIcon icon={delivery[0]} />
351+ </span>
352+ )}
353+ {m.threadId && (
354+ <span className="message-badge">
355+ <img
356+ src={m.threadIcon() ?? undefined}
357+ alt={"thread " + m.threadId.substring(0, 5)}
358+ className="thread"
359+ />
360+ </span>
361+ )}
362+ {encrypted && (
363+ <span className="message-badge">
364+ <FontAwesomeIcon
365+ icon={faLock}
366+ title={m.encryption!.methodName ?? m.encryption!.method}
367+ />
368+ </span>
369+ )}
370+ </>
371+ );
372+
277373 return (
278374 <Message
279375 model={{
......@@ -285,17 +381,24 @@ export const MessageBubble = ({
285381 data-server-id={m.serverId}
286382 data-local-id={m.localId}
287383 className={
288- (bodyLength < 25 && !m.replyToMessage ? "small " : "") +
289- (m.type === borogove.MessageType.MessageChannelPrivate
290- ? "invite"
291- : "") +
292- " " +
293- className
384+ m.type === borogove.MessageType.MessageChannelPrivate
385+ ? `invite ${className ?? ""}`
386+ : className
294387 }
295388 >
296389 {children}
297390 <Message.CustomContent>
298391 <div title={fullDateTimeHuman}>
392+ <div
393+ className={
394+ (showSender ? "" : "sr-only") +
395+ " h-card sender " +
396+ (mention ? "clickable" : "")
397+ }
398+ onClick={mention}
399+ >
400+ {sender?.displayName}
401+ </div>
299402 <MessageDebugger m={m} />
300403 {parentMessage && (
301404 <>
......@@ -327,86 +430,26 @@ export const MessageBubble = ({
327430 m={m}
328431 selfName={client.displayName()}
329432 sender={sender}
433+ timestamp={inlineTime ? timestamp : undefined}
434+ statusCount={inlineTime ? statusCount : 0}
435+ metadata={metadata}
330436 />
331437 {m.attachments.length > 0 && (
332438 <MessageAttachments client={client} chat={chat} message={m} />
333439 )}
334440 {m.linkMetadata.map((meta) => linkMeta(meta))}
335- <div className="meta">
336- <div
337- className={
338- (showSender ? "" : "sr-only") +
339- " h-card sender " +
340- (mention ? "clickable" : "")
341- }
342- onClick={mention}
343- >
344- {sender?.displayName}
441+ {!inlineTime && metadata && (
442+ <div className="message-time-row">
443+ <span className="message-time">{metadata}</span>
345444 </div>
346-
445+ )}
446+ <div className="meta">
347447 <div>
348448 {m.subject() && (
349449 <>
350450 <strong>{m.subject()}</strong>{" "}
351451 </>
352452 )}
353- {m.timeSent && ["last", "single"].includes(position) && (
354- <time dateTime={m.timeSent} title={fullDateTimeHuman}>
355- {shortDateTimeHuman}
356- </time>
357- )}
358- {m.versions.length > 0 && (
359- <FontAwesomeIcon
360- icon={faPencil}
361- title={"Edited " + (m.versions.length - 1) + " times"}
362- onClick={() => setShowEdits(true)}
363- />
364- )}
365- {m.threadId && (
366- <img
367- src={m.threadIcon() ?? undefined}
368- alt={"thread " + m.threadId.substring(0, 5)}
369- className="thread"
370- />
371- )}
372- {m.encryption &&
373- m.encryption?.status ===
374- borogove.EncryptionStatus.EncryptionInfoSuccess && (
375- <FontAwesomeIcon
376- icon={faLock}
377- title={m.encryption.methodName ?? m.encryption.method}
378- />
379- )}
380- {!m.isIncoming() &&
381- m.status === borogove.MessageStatus.MessagePending && (
382- <FontAwesomeIcon
383- icon={faClock}
384- title={m.statusText ?? "Sending..."}
385- />
386- )}
387- {!m.isIncoming() &&
388- m.status === borogove.MessageStatus.MessageFailedToSend && (
389- <FontAwesomeIcon
390- icon={faCircleExclamation}
391- title={m.statusText ?? "Error"}
392- />
393- )}
394- {!m.isIncoming() &&
395- m.status ===
396- borogove.MessageStatus.MessageDeliveredToServer && (
397- <FontAwesomeIcon
398- icon={faCheck}
399- title={m.statusText ?? "Sent"}
400- />
401- )}
402- {!m.isIncoming() &&
403- m.status ===
404- borogove.MessageStatus.MessageDeliveredToDevice && (
405- <FontAwesomeIcon
406- icon={faCheckDouble}
407- title={m.statusText ?? "Received"}
408- />
409- )}
410453 </div>
411454 </div>
412455 </div>
......@@ -422,7 +465,6 @@ export const MessageBubble = ({
422465 <Message.Footer className="reactions">
423466 {reactionEntries.map(([key, reactions]) => (
424467 <Button
425- border
426468 onClick={() =>
427469 toggleReaction(
428470 m,
......@@ -445,7 +487,8 @@ export const MessageBubble = ({
445487 )
446488 .join("\n")}
447489 >
448- {renderReaction(reactions[0])} {" " + reactions.length}
490+ <span>{renderReaction(reactions[0])}</span>
491+ {reactions.length > 1 && " " + reactions.length}
449492 </Button>
450493 ))}
451494 </Message.Footer>
+24 -0 src/components/Page.tsx #
......@@ -0,0 +1,24 @@
1+import { ArrowButton, MainContainer } from "@chatscope/chat-ui-kit-react";
2+import { isTauri } from "@tauri-apps/api/core";
3+import type { ReactNode } from "react";
4+import { useNavigate } from "react-router";
5+
6+export const Page = ({ children }: { children: ReactNode }) => {
7+ const navigate = useNavigate();
8+ return (
9+ <MainContainer className={isTauri() ? "page tauri" : "page"}>
10+ <section>
11+ <ArrowButton
12+ className="page-back"
13+ direction="left"
14+ aria-label="Back"
15+ onClick={() => {
16+ if (window.history.state?.idx > 0) navigate(-1);
17+ else navigate("/");
18+ }}
19+ />
20+ {children}
21+ </section>
22+ </MainContainer>
23+ );
24+};
+21 -2 src/components/Settings.tsx #
......@@ -1,3 +1,11 @@
1+import {
2+ defaultCustomPalette,
3+ defaultTheme,
4+ type Palette,
5+ type Theme,
6+} from "../theme";
7+import { AppearanceSettings } from "./AppearanceSettings";
8+import { Page } from "./Page";
19 import * as borogove from "borogove";
210 import { createContext, useContext } from "react";
311 import { useOutletContext } from "react-router";
......@@ -12,6 +20,9 @@ import {
1220 } from "@mui/material";
1321
1422 export type SettingsData = {
23+ theme: Theme;
24+ customPalette: Palette;
25+ appearance: "system" | "light" | "dark";
1526 enterIsSend: boolean;
1627 richTextToolbar: boolean;
1728 audibleNotifications: boolean;
......@@ -19,6 +30,9 @@ export type SettingsData = {
1930 e2ee: "none" | "pfs";
2031 };
2132 export const SettingsContext = createContext<SettingsData>({
33+ theme: defaultTheme,
34+ customPalette: defaultCustomPalette,
35+ appearance: "system",
2236 enterIsSend: true,
2337 richTextToolbar: false,
2438 audibleNotifications: false,
......@@ -41,7 +55,7 @@ export const Settings = () => {
4155 } = settings;
4256
4357 return (
44- <section>
58+ <Page>
4559 <h1>Settings</h1>
4660
4761 <FormGroup>
......@@ -154,6 +168,11 @@ export const Settings = () => {
154168 </RadioGroup>
155169 </FormControl>
156170 </FormGroup>
157- </section>
171+ <AppearanceSettings
172+ settings={settings}
173+ setSettings={setSettings}
174+ persistence={persistence}
175+ />
176+ </Page>
158177 );
159178 };
+44 -11 src/index.tsx #
......@@ -1,4 +1,5 @@
11 import { StrictMode } from "react";
2+import { isTauri } from "@tauri-apps/api/core";
23 import { readyServiceWorker, serviceWorker } from "./util";
34 import ReactDOM from "react-dom/client";
45 import { About } from "./components/About";
......@@ -26,21 +27,53 @@ import "~build/console";
2627 window.libsignal = libsignal;
2728
2829 const muiTheme = createTheme({
29- cssVariables: { nativeColor: true },
30- palette: {
31- primary: {
32- main: "var(--color-primary-dark)",
33- },
34- secondary: {
35- main: "var(--color-secondary-dark)",
36- },
37- },
30+ cssVariables: { nativeColor: true, colorSchemeSelector: "data-theme" },
31+ shape: { borderRadius: 6 },
32+ colorSchemes: Object.fromEntries(
33+ ["light", "dark"].map((mode) => [
34+ mode,
35+ {
36+ palette: {
37+ primary: {
38+ main: "var(--color-primary-dark)",
39+ contrastText: "var(--color-on-primary)",
40+ },
41+ secondary: {
42+ main: "var(--theme-secondary)",
43+ contrastText: "var(--theme-on-secondary)",
44+ },
45+ background: {
46+ default: "var(--default-bg-color)",
47+ paper: "var(--paper-background)",
48+ },
49+ text: {
50+ primary: "var(--color-text)",
51+ secondary: "var(--color-text-medium)",
52+ disabled: "var(--color-text-disabled)",
53+ },
54+ divider: "var(--divider-color)",
55+ action: {
56+ hover: "var(--color-bg-hover)",
57+ selected: "var(--color-bg-focus)",
58+ focus: "var(--color-bg-focus)",
59+ disabled: "var(--color-text-disabled)",
60+ },
61+ },
62+ },
63+ ]),
64+ ),
3865 });
3966
40-const root = ReactDOM.createRoot(document.getElementById("root")!);
67+const overlayTitlebar = isTauri() && navigator.platform.startsWith("Mac");
68+const rootElement = document.getElementById("root")!;
69+rootElement.classList.toggle("tauri-overlay", overlayTitlebar);
70+const root = ReactDOM.createRoot(rootElement);
4171 root.render(
4272 <StrictMode>
43- <MuiThemeProvider theme={muiTheme}>
73+ {overlayTitlebar && (
74+ <div className="tauri-titlebar" data-tauri-drag-region />
75+ )}
76+ <MuiThemeProvider theme={muiTheme} storageManager={null}>
4477 <ConfirmDialog />
4578 <div
4679 id="chat-messages-aria-live"
+86 -0 src/theme.test.ts #
......@@ -0,0 +1,86 @@
1+import { describe, expect, it } from "vitest";
2+import { contrast, defaultTheme, themePresets, themeVariables } from "./theme";
3+
4+describe("theme presets", () => {
5+ it("preserves the default Cheogram overrides", () => {
6+ const vars = themeVariables(themePresets[defaultTheme]);
7+ expect(vars["--theme-light-accent-surface"]).toBe("#f3daff");
8+ expect(vars["--theme-light-outgoing-background"]).toBe("#f3daff");
9+ expect(vars["--theme-light-outgoing-color"]).toBe("#27123a");
10+ expect(vars["--theme-dark-outgoing-background"]).toBe(
11+ themePresets[defaultTheme].dark.primary,
12+ );
13+ expect(
14+ contrast(vars["--theme-light-link"], "#f3daff"),
15+ ).toBeGreaterThanOrEqual(4.5);
16+ });
17+
18+ it("uses the original Classic bubble colours", () => {
19+ const vars = themeVariables(themePresets.classic);
20+ expect(vars["--theme-light-incoming-background"]).toBe("#d6b0f3");
21+ expect(vars["--theme-light-outgoing-background"]).toBe("#f5e9bc");
22+ expect(
23+ contrast(vars["--theme-light-link"], "#d6b0f3"),
24+ ).toBeGreaterThanOrEqual(4.5);
25+ });
26+
27+ for (const [preset, palette] of Object.entries(themePresets)) {
28+ it(`keeps ${preset} text and accent foregrounds readable`, () => {
29+ const vars = themeVariables(palette);
30+ for (const mode of ["light", "dark"] as const) {
31+ const colours = palette[mode];
32+ const incoming = vars[`--theme-${mode}-incoming-background`];
33+ const accent = vars[`--theme-${mode}-accent-surface`];
34+ for (const surface of [incoming, accent]) {
35+ if (surface === "initial") continue;
36+ expect(contrast(colours.text, surface)).toBeGreaterThanOrEqual(4.5);
37+ expect(
38+ contrast(vars[`--theme-${mode}-link`], surface),
39+ ).toBeGreaterThanOrEqual(4.5);
40+ }
41+ expect(
42+ contrast(
43+ vars[`--theme-${mode}-outgoing-color`],
44+ vars[`--theme-${mode}-outgoing-background`],
45+ ),
46+ ).toBeGreaterThanOrEqual(4.5);
47+ expect(
48+ contrast(colours.text, colours.background),
49+ ).toBeGreaterThanOrEqual(4.5);
50+ expect(
51+ contrast(vars[`--theme-${mode}-link`], colours.background),
52+ ).toBeGreaterThanOrEqual(4.5);
53+ for (const role of ["primary", "secondary"] as const)
54+ expect(
55+ contrast(colours[role], vars[`--theme-${mode}-on-${role}`]),
56+ ).toBeGreaterThanOrEqual(4.5);
57+ }
58+ });
59+ }
60+
61+ const base = themePresets[defaultTheme];
62+ for (const primary of [
63+ "#ffffff",
64+ "#000000",
65+ "#ffff00",
66+ "#00ff00",
67+ "#ff0000",
68+ "#0000ff",
69+ "#777777",
70+ ]) {
71+ it(`keeps accent text readable with ${primary}`, () => {
72+ const vars = themeVariables({
73+ light: { ...base.light, primary },
74+ dark: { ...base.dark, primary },
75+ });
76+ for (const mode of ["light", "dark"] as const) {
77+ expect(
78+ contrast(primary, vars[`--theme-${mode}-on-primary`]),
79+ ).toBeGreaterThanOrEqual(4.5);
80+ expect(
81+ contrast(vars[`--theme-${mode}-link`], base[mode].background),
82+ ).toBeGreaterThanOrEqual(4.5);
83+ }
84+ });
85+ }
86+});
+247 -0 src/theme.ts #
......@@ -0,0 +1,247 @@
1+export type Palette = {
2+ background: string;
3+ text: string;
4+ primary: string;
5+ secondary: string;
6+};
7+
8+type PresetPalette = Palette & {
9+ accentSurface?: string;
10+ incomingBackground?: string;
11+ outgoingBackground?: string;
12+ outgoingColor?: string;
13+};
14+
15+const cheogramDark: Palette = {
16+ background: "#191919",
17+ text: "#f1f1f1",
18+ primary: "#7401cf",
19+ secondary: "#ffc700",
20+};
21+
22+export const themePresets = {
23+ cheogram: {
24+ name: "Cheogram",
25+ light: {
26+ background: "#f7f5f0",
27+ text: "#212121",
28+ primary: "#7401cf",
29+ secondary: "#ffc700",
30+ accentSurface: "#f3daff",
31+ outgoingBackground: "#f3daff",
32+ outgoingColor: "#27123a",
33+ },
34+ dark: cheogramDark,
35+ },
36+ classic: {
37+ name: "Cheogram Classic",
38+ light: {
39+ background: "#ffffff",
40+ text: "#212121",
41+ primary: "#7401cf",
42+ secondary: "#ffc700",
43+ incomingBackground: "#d6b0f3",
44+ outgoingBackground: "#f5e9bc",
45+ outgoingColor: "#212121",
46+ },
47+ dark: {
48+ ...cheogramDark,
49+ incomingBackground: "#3c2951",
50+ outgoingBackground: "#493d20",
51+ },
52+ },
53+ velvet: {
54+ name: "Velvet",
55+ light: {
56+ background: "#eff1f5",
57+ text: "#4c4f69",
58+ primary: "#8839ef",
59+ secondary: "#df8e1d",
60+ accentSurface: "#ccd0da",
61+ incomingBackground: "#e6e9ef",
62+ outgoingBackground: "#e3d5f5",
63+ outgoingColor: "#4c4f69",
64+ },
65+ dark: {
66+ background: "#1e1e2e",
67+ text: "#cdd6f4",
68+ primary: "#a779d6",
69+ secondary: "#f9e2af",
70+ accentSurface: "#45475a",
71+ incomingBackground: "#313244",
72+ outgoingBackground: "#45365e",
73+ outgoingColor: "#cdd6f4",
74+ },
75+ },
76+ plum: {
77+ name: "Plum",
78+ light: {
79+ background: "#faf4ed",
80+ text: "#464261",
81+ primary: "#826b9b",
82+ secondary: "#d7827e",
83+ accentSurface: "#dfdad9",
84+ incomingBackground: "#f2e9e1",
85+ outgoingBackground: "#ece2f1",
86+ outgoingColor: "#464261",
87+ },
88+ dark: {
89+ background: "#191724",
90+ text: "#e0def4",
91+ primary: "#744c9b",
92+ secondary: "#f6c177",
93+ accentSurface: "#403d52",
94+ incomingBackground: "#26233a",
95+ outgoingBackground: "#40314c",
96+ outgoingColor: "#e0def4",
97+ },
98+ },
99+ solarized: {
100+ name: "Solarized",
101+ light: {
102+ background: "#fdf6e3",
103+ text: "#51666d",
104+ primary: "#268bd2",
105+ secondary: "#b58900",
106+ accentSurface: "#eee8d5",
107+ incomingBackground: "#eee8d5",
108+ outgoingBackground: "#d9ebee",
109+ outgoingColor: "#51666d",
110+ },
111+ dark: {
112+ background: "#002b36",
113+ text: "#93a1a1",
114+ primary: "#268bd2",
115+ secondary: "#b58900",
116+ accentSurface: "#073642",
117+ incomingBackground: "#073642",
118+ outgoingBackground: "#164654",
119+ outgoingColor: "#eee8d5",
120+ },
121+ },
122+ hotdogstand: {
123+ name: "Hot Dog Stand",
124+ light: {
125+ background: "#fec701",
126+ text: "#561029",
127+ primary: "#b51b00",
128+ secondary: "#5a1c00",
129+ },
130+ dark: {
131+ background: "#b51b00",
132+ text: "#fff2cf",
133+ primary: "#fec701",
134+ secondary: "#5a1c00",
135+ },
136+ },
137+};
138+
139+export type Theme = keyof typeof themePresets | "custom";
140+export const defaultTheme = "cheogram";
141+export const defaultCustomPalette: Palette = {
142+ background: themePresets.cheogram.light.background,
143+ text: themePresets.cheogram.light.text,
144+ primary: themePresets.cheogram.light.primary,
145+ secondary: themePresets.cheogram.light.secondary,
146+};
147+
148+const channels = (hex: string) =>
149+ [1, 3, 5].map((offset) => parseInt(hex.slice(offset, offset + 2), 16));
150+
151+function mix(color: string, background: string, weight: number) {
152+ const base = channels(background);
153+ return (
154+ "#" +
155+ channels(color)
156+ .map((channel, i) =>
157+ Math.round(channel * weight + base[i] * (1 - weight))
158+ .toString(16)
159+ .padStart(2, "0"),
160+ )
161+ .join("")
162+ );
163+}
164+
165+// https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html#dfn-relative-luminance
166+function luminance(color: string) {
167+ return channels(color).reduce((sum, channel, i) => {
168+ const value = channel / 255;
169+ return (
170+ sum +
171+ (value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4) *
172+ [0.2126, 0.7152, 0.0722][i]
173+ );
174+ }, 0);
175+}
176+
177+export function contrast(a: string, b: string) {
178+ const values = [luminance(a), luminance(b)].sort((x, y) => y - x);
179+ return (values[0] + 0.05) / (values[1] + 0.05);
180+}
181+
182+function foreground(background: string) {
183+ return contrast(background, "#ffffff") > contrast(background, "#000000")
184+ ? "#ffffff"
185+ : "#000000";
186+}
187+
188+export function themeVariables(theme: {
189+ light: PresetPalette;
190+ dark: PresetPalette;
191+}) {
192+ const variables: Record<string, string> = {};
193+ for (const mode of ["light", "dark"] as const) {
194+ const {
195+ background,
196+ text,
197+ primary,
198+ secondary,
199+ accentSurface,
200+ incomingBackground,
201+ outgoingBackground = primary,
202+ outgoingColor = foreground(outgoingBackground),
203+ } = theme[mode];
204+ const backgrounds = [
205+ background,
206+ incomingBackground ?? mix(text, background, 0.07),
207+ accentSurface ?? mix(primary, background, 0.13),
208+ accentSurface ?? mix(primary, background, 0.24),
209+ mix(secondary, background, 0.3),
210+ ];
211+ const target = foreground(background);
212+ let link = primary;
213+ for (
214+ let step = 1;
215+ backgrounds.some((bg) => contrast(link, bg) < 4.5) && step <= 100;
216+ step++
217+ )
218+ link = mix(primary, target, 1 - step / 100);
219+ const colours = {
220+ background,
221+ text,
222+ primary,
223+ secondary,
224+ "accent-surface": accentSurface ?? "initial",
225+ "incoming-background": incomingBackground ?? "initial",
226+ "outgoing-background": outgoingBackground,
227+ "outgoing-color": outgoingColor,
228+ "on-primary": foreground(primary),
229+ "on-secondary": foreground(secondary),
230+ "on-app": foreground(primary),
231+ link,
232+ "on-link": foreground(link),
233+ };
234+ for (const [role, colour] of Object.entries(colours))
235+ variables[`--theme-${mode}-${role}`] = colour;
236+ }
237+ return variables;
238+}
239+
240+export function applyTheme(theme: Theme, customPalette: Palette) {
241+ const palettes =
242+ theme === "custom"
243+ ? { light: customPalette, dark: customPalette }
244+ : themePresets[theme];
245+ for (const [name, colour] of Object.entries(themeVariables(palettes)))
246+ document.documentElement.style.setProperty(name, colour);
247+}
Back to top