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.3 on 2026-11-25T15:51:03Z · commit 13476dc

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, 1812 insertions(+), 632 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,
+843 -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;
13671658 }
1659+ }
13681660
1369- svg {
1370- padding-left: 0.5em;
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+ }
1682+ }
1683+
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,73 @@ 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;
1717+ }
1718+}
1719+
1720+.back-in-time .cs-message__custom-content {
1721+ .message-timed-text::after,
1722+ .message-time > time {
1723+ font-weight: bold;
13921724 }
13931725 }
13941726
13951727 section.cs-message {
13961728 overflow: visible;
13971729 position: relative;
1730+ max-width: 100%;
1731+
1732+ .cs-message__content {
1733+ position: relative;
1734+ }
1735+
1736+ .message-badge {
1737+ display: flex;
1738+ align-items: center;
1739+ justify-content: center;
1740+ font: inherit;
1741+ color: var(--color-text-disabled);
1742+ padding: 0;
1743+ border: 0;
1744+ background: transparent;
1745+
1746+ svg {
1747+ font-size: 0.75em;
1748+ }
1749+
1750+ img {
1751+ height: 0.75em;
1752+ object-fit: contain;
1753+ }
1754+ }
1755+
1756+ button.message-badge {
1757+ cursor: pointer;
1758+ }
1759+
1760+ .cs-message__custom-content a {
1761+ color: var(--color-primary-dark);
1762+ text-decoration: underline;
1763+ text-underline-offset: 0.15em;
1764+ text-decoration-thickness: 1px;
1765+ text-decoration-color: color-mix(in srgb, currentColor 30%, transparent);
1766+ transition: text-decoration-color 250ms ease;
1767+
1768+ &:hover,
1769+ &:focus-visible {
1770+ text-decoration-color: currentColor;
1771+ }
1772+ }
1773+
1774+ &.cs-message--outgoing .cs-message__custom-content a {
1775+ color: var(--message-outgoing-color);
1776+ }
13981777
13991778 .cs-message__header {
14001779 opacity: 0;
......@@ -1417,12 +1796,11 @@ section.cs-message {
14171796 content: "Private invite only to you";
14181797 font-style: italic;
14191798 opacity: 0.9;
1420- text-size: 0.9em;
14211799 color: var(--color-primary-dark);
14221800 }
14231801
14241802 &.highlight .cs-message__content {
1425- border: 3px solid var(--color-primary-dark);
1803+ border: 3px solid var(--accent-surface, var(--color-primary-dark));
14261804 }
14271805
14281806 &.cs-message--incoming {
......@@ -1433,10 +1811,6 @@ section.cs-message {
14331811 float: right;
14341812 margin-right: -2em;
14351813 }
1436-
1437- .cs-message__footer {
1438- margin-right: 2em;
1439- }
14401814 }
14411815
14421816 &.cs-message--outgoing {
......@@ -1450,6 +1824,9 @@ section.cs-message {
14501824
14511825 .cs-message__content-wrapper {
14521826 display: block;
1827+ position: relative;
1828+ min-width: 0;
1829+ max-width: 100%;
14531830 }
14541831 }
14551832
......@@ -1472,38 +1849,29 @@ section.cs-message {
14721849
14731850 .embed-responsive {
14741851 position: relative;
1475- display: block;
1476- width: 100%;
1852+ aspect-ratio: 4 / 3;
14771853 overflow: hidden;
1478- padding: 0;
1479-
1480- &::before {
1481- content: "";
1482- display: block;
1483- padding-top: 75%;
1484- }
14851854
14861855 video {
14871856 position: absolute;
1488- top: 0;
1489- bottom: 0;
1490- left: 0;
1857+ inset: 0;
14911858 width: 100%;
14921859 height: 100%;
14931860 }
14941861 }
14951862
1496- .h-card {
1863+ .h-card,
1864+ .call-account {
14971865 display: flex;
14981866 align-items: center;
14991867 justify-content: center;
1868+ }
1869+
1870+ .h-card {
15001871 margin-top: 1.5em;
15011872 }
15021873
15031874 .call-account {
1504- display: flex;
1505- align-items: center;
1506- justify-content: center;
15071875 gap: 0.5em;
15081876 font-size: 0.85em;
15091877 line-height: 1;
......@@ -1531,17 +1899,24 @@ section.cs-message {
15311899 width: 100%;
15321900 text-align: left;
15331901 border-radius: 0;
1534- border-bottom: 1px solid #ccc;
1902+ border-bottom: 1px solid var(--divider-color);
15351903 margin-bottom: 0.5em;
15361904 padding: 0.2em 0;
15371905 line-height: 1;
15381906 gap: 0.5em;
15391907 }
15401908
1541- a.u-email::before {
1909+ a.u-email::before,
1910+ a.u-tel::before,
1911+ a.u-url::before,
1912+ a.u-impp::before,
1913+ .p-org::before,
1914+ .p-pronouns::before,
1915+ .p-tz::before,
1916+ time::before,
1917+ .dt-bday::before {
15421918 content: "";
1543- mask: url(@fortawesome/fontawesome-free/svgs/solid/envelope.svg) no-repeat
1544- center;
1919+ mask: none no-repeat center;
15451920 background: var(--color-text);
15461921 height: 1em;
15471922 width: 1em;
......@@ -1549,98 +1924,43 @@ section.cs-message {
15491924 flex-shrink: 0;
15501925 }
15511926
1927+ a.u-email::before {
1928+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/envelope.svg);
1929+ }
1930+
15521931 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;
1932+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/phone.svg);
15611933 }
15621934
15631935 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;
1936+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/link.svg);
15721937 }
15731938
15741939 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;
1940+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/message.svg);
15831941 }
15841942
15851943 .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;
1944+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/building.svg);
15941945 }
15951946
15961947 .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;
1948+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/genderless.svg);
16051949 }
16061950
16071951 .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;
1952+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/user-clock.svg);
16161953 }
16171954
16181955 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;
1956+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/calendar.svg);
16271957 }
16281958
16291959 .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);
1960+ mask-image: url(@fortawesome/fontawesome-free/svgs/solid/cake-candles.svg);
16421961 }
16431962
1963+ a.u-url[href^="https://www.patreon.com/c/"]::before,
16441964 a.u-url[href^="https://patreon.com/c/"]::before {
16451965 mask-image: url(@fortawesome/fontawesome-free/svgs/brands/patreon.svg);
16461966 }
......@@ -1718,6 +2038,17 @@ button.MuiFab-root {
17182038 }
17192039
17202040 @media (max-width: 576px) {
2041+ .cs-main-container {
2042+ --chat-avatar-size: 28px;
2043+
2044+ .cs-avatar.cs-avatar--md {
2045+ width: var(--chat-avatar-size);
2046+ height: var(--chat-avatar-size);
2047+ min-width: var(--chat-avatar-size);
2048+ min-height: var(--chat-avatar-size);
2049+ }
2050+ }
2051+
17212052 .cs-main-container--responsive {
17222053 .cs-sidebar .cs-search {
17232054 display: flex;
......@@ -1727,6 +2058,7 @@ button.MuiFab-root {
17272058 display: flex;
17282059 flex-basis: 100%;
17292060 max-width: 100%;
2061+ border-right: 0;
17302062 }
17312063
17322064 > .cs-chat-container {
......@@ -1734,12 +2066,14 @@ button.MuiFab-root {
17342066 }
17352067 }
17362068
1737- #account-nav:has(~ .cs-main-container) {
2069+ #account-nav:has(~ main > .cs-main-container) {
17382070 display: none;
17392071 }
17402072
1741- #account-nav:has(~ .cs-main-container > .cs-sidebar--left.active),
1742- #account-nav:has(~ .cs-main-container > .active > .cs-message-list.account) {
2073+ #account-nav:has(~ main > .cs-main-container > .cs-sidebar--left.active),
2074+ #account-nav:has(
2075+ ~ main > .cs-main-container > .active > .cs-message-list.account
2076+ ) {
17432077 display: flex;
17442078 }
17452079 }
......@@ -1759,17 +2093,102 @@ button.MuiFab-root {
17592093 }
17602094 }
17612095
2096+.cs-main-container {
2097+ border: 0;
2098+
2099+ &.page {
2100+ flex: 1;
2101+ min-height: 0;
2102+
2103+ .page-back {
2104+ display: none;
2105+ font-size: $conversation-header-font-size;
2106+ padding: 0;
2107+ @media (max-width: 576px) {
2108+ display: inline-flex;
2109+ }
2110+ }
2111+
2112+ > section {
2113+ margin: 0 auto;
2114+ max-width: 100%;
2115+ overflow: auto;
2116+ scrollbar-gutter: stable;
2117+ padding: 1em 2em;
2118+
2119+ &:has(> .settings-appearance) {
2120+ width: 40rem;
2121+ }
2122+ }
2123+ }
2124+
2125+ &.tauri {
2126+ flex: 1;
2127+ min-height: 0;
2128+ height: auto;
2129+ border-radius: $default-border-radius;
2130+ border-bottom-right-radius: 13px;
2131+ overflow: hidden;
2132+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
2133+ }
2134+}
2135+
2136+main:has(> .cs-main-container.tauri) {
2137+ padding: 0.35em 0.35em 0.35em 0;
2138+}
2139+
2140+#account-nav:has(~ main > .cs-main-container.tauri) {
2141+ isolation: auto;
2142+ box-shadow: none;
2143+
2144+ .active-account,
2145+ > a.active {
2146+ z-index: 1;
2147+ }
2148+
2149+ > .active-account:first-child::after {
2150+ background-image: radial-gradient(
2151+ circle at bottom left,
2152+ transparent 70%,
2153+ var(--default-bg-color) 72%
2154+ );
2155+ background-position: bottom;
2156+ }
2157+}
2158+
2159+#account-nav:has(> .active-account:first-child)
2160+ ~ main
2161+ > .cs-main-container.tauri {
2162+ border-top-left-radius: 0;
2163+}
2164+
17622165 #account-nav {
1763- background: var(--color-primary-dark) url(/gloop01.svg) no-repeat;
1764- background-size: 40vh;
2166+ flex: 0 0 5.5em;
2167+ width: 5.5em;
2168+ padding-block: 0.35em;
2169+ isolation: isolate;
2170+ overflow: hidden;
2171+ box-shadow: inset -12px 0 12px -8px rgba(0, 0, 0, 0.2);
17652172 display: flex;
17662173 flex-direction: column;
2174+ gap: 0.35em;
17672175
1768- > a {
2176+ .account-nav-group {
2177+ position: relative;
2178+ margin-left: 0.35em;
2179+ padding: 0.35em 0;
2180+ display: flex;
2181+ flex-direction: column;
2182+ gap: 0.35em;
2183+ }
2184+
2185+ > a,
2186+ .account-nav-group > a {
17692187 position: relative;
17702188 display: block;
2189+ margin-left: 0.35em;
17712190 padding: 0.5em;
1772- color: white;
2191+ color: inherit;
17732192 text-decoration: none;
17742193
17752194 .cs-avatar {
......@@ -1803,9 +2222,62 @@ button.MuiFab-root {
18032222 }
18042223 }
18052224
1806- a.active {
1807- background: $color-primary-light;
1808- color: $color-primary-dark;
2225+ color: var(--color-on-app);
2226+
2227+ .account-nav-group > a {
2228+ margin: 0 0.35em;
2229+ }
2230+
2231+ .account-nav-group .cs-avatar {
2232+ border: 2px solid var(--color-on-app);
2233+ }
2234+
2235+ .active-account > a.active {
2236+ border-radius: $default-border-radius;
2237+ background: $conversation-activated-bg-color;
2238+ }
2239+
2240+ .active-account::after,
2241+ > a.active::after {
2242+ content: "";
2243+ position: absolute;
2244+ right: 0;
2245+ top: -$default-border-radius;
2246+ bottom: -$default-border-radius;
2247+ width: $default-border-radius;
2248+ background:
2249+ radial-gradient(
2250+ circle at top left,
2251+ transparent 70%,
2252+ var(--default-bg-color) 72%
2253+ )
2254+ top,
2255+ radial-gradient(
2256+ circle at bottom left,
2257+ transparent 70%,
2258+ var(--default-bg-color) 72%
2259+ )
2260+ bottom;
2261+ background-size: 100% $default-border-radius;
2262+ background-repeat: no-repeat;
2263+ pointer-events: none;
2264+ }
2265+
2266+ .active-account,
2267+ > a.active {
2268+ border-radius: $default-border-radius 0 0 $default-border-radius;
2269+ background: var(--default-bg-color);
2270+ color: var(--color-primary-dark);
2271+
2272+ &::before {
2273+ content: "";
2274+ position: absolute;
2275+ inset: 0;
2276+ border-radius: inherit;
2277+ z-index: -1;
2278+ box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
2279+ pointer-events: none;
2280+ }
18092281 }
18102282 }
18112283
......@@ -1873,6 +2345,12 @@ em-emoji-picker {
18732345 }
18742346 }
18752347
2348+.message-attachments .message-attachment-media {
2349+ max-height: 15em;
2350+ max-width: min(100%, 35em);
2351+ object-fit: scale-down;
2352+}
2353+
18762354 .message-attachments-toggle {
18772355 display: inline-flex;
18782356 align-items: center;
......@@ -1881,6 +2359,7 @@ em-emoji-picker {
18812359 border: 0;
18822360 background: transparent;
18832361 font-size: 0.8em;
2362+ color: inherit;
18842363 opacity: 0.6;
18852364 text-align: left;
18862365 cursor: pointer;
......@@ -1889,3 +2368,33 @@ em-emoji-picker {
18892368 font-size: 0.75em;
18902369 }
18912370 }
2371+
2372+.settings-appearance {
2373+ > .MuiFormControl-root {
2374+ margin-bottom: 1em;
2375+ }
2376+
2377+ display: flex;
2378+ flex-direction: column;
2379+ gap: 1em;
2380+ margin-top: 2em;
2381+ padding-top: 1em;
2382+ border-top: 1px solid var(--divider-color);
2383+
2384+ h2 {
2385+ margin: 0;
2386+ }
2387+
2388+ .theme-colour {
2389+ display: flex;
2390+ align-items: flex-start;
2391+ gap: 0.75em;
2392+
2393+ input[type="color"] {
2394+ flex-shrink: 0;
2395+ width: 2.5em;
2396+ height: 2.5em;
2397+ cursor: pointer;
2398+ }
2399+ }
2400+}
+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 }}
+231 -173 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,11 +259,10 @@ 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
239262 if (
240263 lastGroup &&
241264 lastGroup !== "readUpToMarker" &&
242- lastGroup.messages.length < 5 &&
265+ lastGroup.messages.length < 10 &&
243266 (message.moderationReason() ||
244267 lastGroup.senderId === message.senderId) &&
245268 lastGroup.threadId === message.threadId &&
......@@ -249,7 +272,8 @@ export const ChatInner = () => {
249272 Math.abs(
250273 new Date(lastGroup.messages[0].timeSent).getTime() -
251274 new Date(message.timeSent).getTime(),
252- ) < 120000
275+ ) <
276+ 10 * 60 * 1000
253277 ) {
254278 return [
255279 ...groups.slice(0, -1),
......@@ -415,7 +439,10 @@ export const ChatInner = () => {
415439 if (!messageList.current) return;
416440
417441 if (hashIndex) {
418- messageList.current.scrollToIndex({ index: hashIndex });
442+ messageList.current.scrollToIndex({
443+ index: hashIndex,
444+ offset: -headerHeight.current,
445+ });
419446 } else if (messageId) {
420447 const chat = activeChat;
421448 const message = await persistence.getMessage(
......@@ -937,7 +964,11 @@ export const ChatInner = () => {
937964 );
938965 if (!typingText) return null;
939966
940- return <TypingIndicator content={typingText} />;
967+ return (
968+ <div as={InputToolbox} className="chat-typing-overlay">
969+ <TypingIndicator content={typingText} />
970+ </div>
971+ );
941972 };
942973
943974 const waitForImagesLoaded = useCallback(() => {
......@@ -1051,37 +1082,60 @@ export const ChatInner = () => {
10511082 setAtBottom(nowAtBottom);
10521083 };
10531084
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-
1085+ const forceToBottom = useCallback(async () => {
1086+ await waitForImagesLoaded();
1087+ setTimeout(() => {
10761088 messageList.current?.scrollToIndex({
10771089 index: Number.MAX_SAFE_INTEGER,
10781090 align: "end",
10791091 });
1080- });
1081- observer.observe(container);
1092+ }, 400);
1093+ }, [waitForImagesLoaded]);
1094+
1095+ useEffect(() => {
1096+ if (atBottom) void forceToBottom();
1097+ }, [messages.length, atBottom, forceToBottom]);
1098+
1099+ const followComposerResize = useEffectEvent((heightChange: number) => {
1100+ if (atBottom && heightChange > 0)
1101+ messageList.current?.scrollBy({ top: heightChange, behavior: "auto" });
1102+ });
1103+
1104+ useLayoutEffect(() => {
1105+ const container = messageListContainer.current?.parentElement;
1106+ const header = container?.querySelector<HTMLElement>(
1107+ ":scope > .cs-conversation-header",
1108+ );
1109+ if (!container || !header) return;
1110+ const composer = composerRef.current;
1111+
1112+ // Keep the message spacer stable when the floating header wraps or resizes.
1113+ if (!headerHeight.current)
1114+ headerHeight.current = header.getBoundingClientRect().height;
1115+ container.style.setProperty(
1116+ "--chat-header-height",
1117+ `${headerHeight.current}px`,
1118+ );
1119+
1120+ const update = () => {
1121+ container.style.setProperty(
1122+ "--chat-scrollbar-width",
1123+ `${measureScrollbarWidth(scroller)}px`,
1124+ );
1125+ const previousHeight = parseFloat(
1126+ container.style.getPropertyValue("--chat-composer-height"),
1127+ );
1128+ const height = composer?.getBoundingClientRect().height ?? 0;
1129+ container.style.setProperty("--chat-composer-height", `${height}px`);
1130+ followComposerResize(height - previousHeight);
1131+ };
1132+ const observer = new ResizeObserver(update);
1133+ if (composer) observer.observe(composer);
1134+ if (scroller) observer.observe(scroller);
1135+ update();
10821136
10831137 return () => observer.disconnect();
1084- }, [atBottom]);
1138+ }, [active, tabIndex, isInvite, scroller, virtuosoGeneration]);
10851139
10861140 const pgUpRef = useHotkeys(
10871141 "PageUp",
......@@ -1318,14 +1372,15 @@ export const ChatInner = () => {
13181372 />
13191373 )}
13201374 <div
1321- ref={virtuosoContainer}
13221375 className="virtuoso-container"
13231376 style={{ display: tabIndex === 0 ? "block" : "none" }}
13241377 >
13251378 <Virtuoso
13261379 aria-label="Chat Messages"
1380+ components={messageListComponents}
13271381 key={virtuosoGeneration}
13281382 ref={messageList}
1383+ scrollerRef={setScrollerRef}
13291384 followOutput={() => atBottom}
13301385 alignToBottom={true}
13311386 startReached={onYReachStart}
......@@ -1431,20 +1486,17 @@ export const ChatInner = () => {
14311486 />
14321487 </div>
14331488 {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- </>
1489+ <Button
1490+ title="Jump to bottom"
1491+ className={"jump-to-bottom " + (atBottom ? "" : "visible")}
1492+ {...{ inert: atBottom ? "" : undefined }}
1493+ icon={
1494+ <FontAwesomeIcon
1495+ icon={faAnglesDown}
1496+ onClick={() => jumpToBottom()}
1497+ />
1498+ }
1499+ />
14481500 )}
14491501 {isInvite && (
14501502 <div className="invite-approve">
......@@ -1498,148 +1550,154 @@ export const ChatInner = () => {
14981550 </div>
14991551
15001552 {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}
1553+ <div as={MessageInput} className="chat-composer" ref={composerRef}>
1554+ {getTypingIndicator()}
1555+ <div id="message-input-root">
1556+ {replyTo && (
1557+ <div className="reply">
1558+ <span>
1559+ Replying to{" "}
1560+ <span className="h-card">
1561+ {members.get(replyTo.senderId)?.displayName}
1562+ </span>
15081563 </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}
1564+ <Button
1565+ onClick={() => {
1566+ setReplyTo(null);
1567+ setSelectedThread(null);
1568+ }}
1569+ title="Cancel reply"
1570+ icon={<FontAwesomeIcon icon={faCircleXmark} />}
15461571 />
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- }
1572+ </div>
1573+ )}
1574+ {attachmentError && (
1575+ <Alert
1576+ severity="error"
1577+ onClose={() => setAttachmentError(null)}
1578+ >
1579+ {attachmentError}
1580+ </Alert>
1581+ )}
1582+ {(attachmentProgress || attachments.length > 0) && (
1583+ <div className="attachments">
1584+ {attachments.map((attachment) => (
1585+ <img
1586+ crossOrigin="anonymous"
1587+ key={attachment.uri}
1588+ src={attachment.uri}
1589+ alt={attachment.attachment.name ?? undefined}
1590+ title="Click to remove"
1591+ onClick={() => removeAttachment(attachment)}
15721592 />
1573- <AttachmentButton
1574- title="Attach media to message"
1575- onClick={handleAttach}
1593+ ))}
1594+ {attachmentProgress && <CircularProgress />}
1595+ </div>
1596+ )}
1597+ <div className="cs-message-input" ref={inputHotkeyRef}>
1598+ <div className="cs-message-input__tools">
1599+ {activeChat.hasCommands() && (
1600+ <CommandMenu
1601+ chat={activeChat}
1602+ addSession={addCommandSession}
15761603 />
1604+ )}
1605+ {activeChat.canSend() && (
1606+ <>
1607+ <Button
1608+ onClick={() => setSelectedThread(uuidv7())}
1609+ onContextMenu={(event) => {
1610+ event.preventDefault();
1611+ setSelectedThread(null);
1612+ }}
1613+ title={
1614+ currentThread
1615+ ? "Thread to send this message to. Click to start a new thread or right-click to clear"
1616+ : "Click to start a new thread"
1617+ }
1618+ icon={
1619+ currentThread ? (
1620+ <img
1621+ src={borogove.Identicon.svg(currentThread ?? "")}
1622+ alt="Thread icon"
1623+ className="svg-inline--fa"
1624+ />
1625+ ) : (
1626+ <SpoolIcon />
1627+ )
1628+ }
1629+ />
1630+ <AttachmentButton
1631+ title="Attach media to message"
1632+ onClick={handleAttach}
1633+ />
1634+ </>
1635+ )}
1636+ </div>
1637+ {activeChat.canSend() ? (
1638+ <>
1639+ <Quill
1640+ aria-label="Compose message"
1641+ className="cs-message-input__content-editor-wrapper"
1642+ ref={inputRef}
1643+ toolbar={richTextToolbar}
1644+ onTextChange={handleChange}
1645+ triggerRecentEdit={triggerRecentEdit}
1646+ enterIsSend={enterIsSend && handleSend}
1647+ mentionHandler={mentionHandler}
1648+ mentionClose={mentionClose}
1649+ attachFiles={attachFiles}
1650+ placeholder="Send message"
1651+ />
1652+ {!editing && (
1653+ <div className="cs-message-input__tools">
1654+ <SendButton
1655+ title="Send message"
1656+ onClick={handleSend}
1657+ disabled={inputEmpty && attachments.length < 1}
1658+ />
1659+ </div>
1660+ )}
15771661 </>
1662+ ) : (
1663+ activeChat instanceof borogove.Channel && (
1664+ <Button
1665+ style={{ marginLeft: "auto" }}
1666+ border
1667+ onClick={() => {
1668+ activeChat.requestToSend();
1669+ setRequestToSpeakSent(true);
1670+ }}
1671+ disabled={requestToSpeakSent}
1672+ >
1673+ {requestToSpeakSent ? "Request Sent" : "Request to Speak"}
1674+ </Button>
1675+ )
15781676 )}
15791677 </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 && (
1678+ {editing && (
1679+ <div className="edit-tools">
1680+ <small>editing</small>
16071681 <Button
1608- style={{ marginLeft: "auto" }}
16091682 border
16101683 onClick={() => {
1611- activeChat.requestToSend();
1612- setRequestToSpeakSent(true);
1684+ setEditing(null);
1685+ inputRef.current?.setText("");
1686+ clearAttachments();
16131687 }}
1614- disabled={requestToSpeakSent}
16151688 >
1616- {requestToSpeakSent ? "Request Sent" : "Request to Speak"}
1689+ Cancel
16171690 </Button>
1618- )
1691+ <Button
1692+ border
1693+ onClick={handleSend}
1694+ disabled={inputEmpty && attachments.length < 1}
1695+ >
1696+ Save
1697+ </Button>
1698+ </div>
16191699 )}
16201700 </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- )}
16431701 </div>
16441702 )}
16451703 </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