3 changed files with 15 additions and 200 deletions
+14 -10
View File
@@ -167,14 +167,21 @@ export function ClientRoot({ children }: ClientRootProps) {
// first sync) can not leave the splash up forever. // first sync) can not leave the splash up forever.
const splashDeadline = useRef<number | undefined>(undefined); const splashDeadline = useRef<number | undefined>(undefined);
const scheduleHide = useCallback((reason?: string) => { // The splash particles animate for 450ms with up to 640ms of stagger. Hold only
if (splashHoldTimer.current !== undefined) return; // for whatever is left of that, so a load that already took longer swaps at once.
const splashShownAt = useRef(performance.now());
const splashHidden = useRef(false);
if (reason) console.log(`[ClientRoot] Hiding splash: ${reason}`); const scheduleHide = useCallback((reason?: string) => {
if (splashHidden.current) return;
const hold = Math.max(0, 1100 - (performance.now() - splashShownAt.current));
if (reason) console.log(`[ClientRoot] Hiding splash: ${reason} (hold ${Math.round(hold)}ms)`);
splashHidden.current = true;
splashHoldTimer.current = window.setTimeout(() => { splashHoldTimer.current = window.setTimeout(() => {
splashHoldTimer.current = undefined; splashHoldTimer.current = undefined;
setLoading(false); setLoading(false);
}, 1500); }, hold);
}, []); }, []);
// The UI renders chats from the room-list atoms, which are filled by // The UI renders chats from the room-list atoms, which are filled by
@@ -182,10 +189,9 @@ export function ClientRoot({ children }: ClientRootProps) {
// so the first paint after the splash already contains the chats. // so the first paint after the splash already contains the chats.
const roomsAtom = useAtomValue(allRoomsAtom); const roomsAtom = useAtomValue(allRoomsAtom);
const directsAtom = useAtomValue(mDirectAtom); const directsAtom = useAtomValue(mDirectAtom);
const chatsReady = // An account with no direct chats can never satisfy a gate that requires one, so it
roomsAtom.length > 0 && // always waits for the deadline. Gate on the rooms only.
directsAtom.size > 0 && const chatsReady = roomsAtom.length > 0;
roomsAtom.some((roomId) => directsAtom.has(roomId));
const tryHide = useCallback( const tryHide = useCallback(
(reason: string): boolean => { (reason: string): boolean => {
@@ -285,12 +291,10 @@ export function ClientRoot({ children }: ClientRootProps) {
}, 10000); }, 10000);
} }
const poll = window.setInterval(check, 400);
mx.on(ClientEvent.Room, check); mx.on(ClientEvent.Room, check);
mx.on(ClientEvent.AccountData, check); mx.on(ClientEvent.AccountData, check);
return () => { return () => {
window.clearInterval(poll);
mx.removeListener(ClientEvent.Room, check); mx.removeListener(ClientEvent.Room, check);
mx.removeListener(ClientEvent.AccountData, check); mx.removeListener(ClientEvent.AccountData, check);
}; };
+1 -8
View File
@@ -7,16 +7,9 @@ const getVariant = (variant: TContainerColor): ComplexStyleRule => ({
backgroundColor: color[variant].Container, backgroundColor: color[variant].Container,
borderColor: color[variant].ContainerLine, borderColor: color[variant].ContainerLine,
outlineColor: color[variant].ContainerLine, outlineColor: color[variant].ContainerLine,
},
selectors: {
// DefaultReset sets `color: inherit` with the same specificity as this rule,
// so which one wins depends on stylesheet order. In the Android build the
// ContainerColor chunk is emitted before folds' reset, so the theme color
// loses and text falls back to the initial color. Raise specificity so the
// theme color wins regardless of order.
'&[class]': {
color: color[variant].OnContainer, color: color[variant].OnContainer,
}, },
selectors: {
'button&[aria-pressed=true]': { 'button&[aria-pressed=true]': {
backgroundColor: color[variant].ContainerActive, backgroundColor: color[variant].ContainerActive,
}, },
-182
View File
@@ -2007,185 +2007,3 @@ textarea {
audio:not([controls]) { audio:not([controls]) {
display: none !important; display: none !important;
} }
html.immersive-landscape-keyboard {
--safe-area-inset-top: 0px;
}
.twilight-theme [role='navigation'],
.twilight-theme aside {
background: linear-gradient(180deg, rgba(20, 18, 31, 0.8) 0%, rgba(28, 26, 46, 0.9) 100%);
backdrop-filter: blur(8px);
}
[data-route-transition='true'] {
animation: fadeSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 750px) {
[data-route-transition='true'] {
animation: none;
}
}
html.mobile-gesture-lock,
html.mobile-gesture-lock body {
overscroll-behavior: none;
}
html.mobile-gesture-lock [data-timeline-scroll] {
overflow: hidden !important;
touch-action: none;
}
.twilight-theme [data-route-transition='true'] {
animation: fadeSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.twilight-theme button,
.twilight-theme [role='button'],
.twilight-theme a,
.twilight-theme input,
.twilight-theme textarea {
transition:
background-color 0.2s ease,
color 0.2s ease,
transform 0.15s ease;
}
.twilight-theme button:hover,
.twilight-theme [role='button']:hover {
transform: translateY(-1px);
}
.twilight-theme button:active,
.twilight-theme [role='button']:active {
transform: translateY(0);
}
.twilight-theme [data-selected='true'],
.twilight-theme [aria-selected='true'],
.twilight-theme [aria-current='true'] {
position: relative;
transition: all 0.2s ease;
}
.twilight-theme [data-selected='true']::before,
.twilight-theme [aria-selected='true']::before,
.twilight-theme [aria-current='true']::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: linear-gradient(180deg, #8b7fff 0%, #6e62e8 100%);
transition: width 0.2s ease;
}
.twilight-theme ::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #4a4580 0%, #625bac 100%);
}
.mocha-theme [role='navigation'],
.mocha-theme aside {
background: linear-gradient(180deg, rgba(26, 22, 20, 0.8) 0%, rgba(36, 32, 25, 0.9) 100%);
backdrop-filter: blur(8px);
}
.mocha-theme [data-route-transition='true'] {
animation: fadeSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.mocha-theme button,
.mocha-theme [role='button'],
.mocha-theme a,
.mocha-theme input,
.mocha-theme textarea {
transition:
background-color 0.2s ease,
color 0.2s ease,
transform 0.15s ease;
}
.mocha-theme button:hover,
.mocha-theme [role='button']:hover {
transform: translateY(-1px);
}
.mocha-theme button:active,
.mocha-theme [role='button']:active {
transform: translateY(0);
}
.mocha-theme [data-selected='true'],
.mocha-theme [aria-selected='true'],
.mocha-theme [aria-current='true'] {
position: relative;
transition: all 0.2s ease;
}
.mocha-theme [data-selected='true']::before,
.mocha-theme [aria-selected='true']::before,
.mocha-theme [aria-current='true']::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: linear-gradient(180deg, #d4a574 0%, #b48660 100%);
transition: width 0.2s ease;
}
.mocha-theme ::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, #625548 0%, #7e6d5a 100%);
}
.stationery ::-webkit-scrollbar-thumb:hover {
background: linear-gradient(180deg, var(--manila-edge) 0%, var(--manila-dark) 100%);
}
html.android-capacitor,
html.android-capacitor.dark-theme,
html.android-capacitor.butter-theme,
html.android-capacitor.discord-theme,
html.android-capacitor.discord-darker-theme,
html.android-capacitor.twilight-theme,
html.android-capacitor.mocha-theme,
html.android-capacitor.light-theme,
html.android-capacitor.silver-theme,
html.android-capacitor.stationery-theme,
html.android-capacitor.stationery-dark-theme {
--font-secondary: system-ui, Roboto, 'Noto Sans', sans-serif;
}
html.android-capacitor body {
font-family: system-ui, Roboto, 'Noto Sans', sans-serif;
letter-spacing: normal;
word-spacing: normal;
font-variant-ligatures: normal;
}
@media (max-width: 750px) {
*,
*::before,
*::after {
scrollbar-width: none;
-ms-overflow-style: none;
}
*::-webkit-scrollbar,
*::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
display: none;
width: 0;
height: 0;
background: transparent;
}
.twilight-theme ::-webkit-scrollbar,
.twilight-theme ::-webkit-scrollbar-thumb,
.twilight-theme ::-webkit-scrollbar-track,
.mocha-theme ::-webkit-scrollbar,
.mocha-theme ::-webkit-scrollbar-thumb,
.mocha-theme ::-webkit-scrollbar-track {
display: none;
width: 0;
height: 0;
background: transparent;
}
}
html.android-capacitor,
html.android-capacitor *,
html.android-capacitor *::before,
html.android-capacitor *::after {
scrollbar-width: none;
-ms-overflow-style: none;
}
html.android-capacitor *::-webkit-scrollbar,
html.android-capacitor *::-webkit-scrollbar-thumb,
html.android-capacitor *::-webkit-scrollbar-track,
html.android-capacitor *::-webkit-scrollbar-corner {
display: none;
width: 0;
height: 0;
background: transparent;
}