mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-14 19:20:28 +03:00
* add active theme context * add chroma js library * add hook for accessible tag color * disable reply user color - temporary * render user color based on tag in room timeline * remove default tag icons * move accessible color function to plugins * render user power color in reply * increase username weight in timeline * add default color for member power level tag * show red slash in power color badge with no color * show power level color in room input reply * show power level username color in notifications * show power level color in notification reply * show power level color in message search * render power level color in room pin menu * add toggle for legacy username colors * drop over saturation from member default color * change border color of power color badge * show legacy username color in direct rooms
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import React, { ReactNode, useEffect } from 'react';
|
|
import { configClass, varsClass } from 'folds';
|
|
import {
|
|
DarkTheme,
|
|
LightTheme,
|
|
ThemeContextProvider,
|
|
ThemeKind,
|
|
useActiveTheme,
|
|
useSystemThemeKind,
|
|
} from '../hooks/useTheme';
|
|
|
|
export function UnAuthRouteThemeManager() {
|
|
const systemThemeKind = useSystemThemeKind();
|
|
|
|
useEffect(() => {
|
|
document.body.className = '';
|
|
document.body.classList.add(configClass, varsClass);
|
|
if (systemThemeKind === ThemeKind.Dark) {
|
|
document.body.classList.add(...DarkTheme.classNames);
|
|
}
|
|
if (systemThemeKind === ThemeKind.Light) {
|
|
document.body.classList.add(...LightTheme.classNames);
|
|
}
|
|
}, [systemThemeKind]);
|
|
|
|
return null;
|
|
}
|
|
|
|
export function AuthRouteThemeManager({ children }: { children: ReactNode }) {
|
|
const activeTheme = useActiveTheme();
|
|
|
|
useEffect(() => {
|
|
document.body.className = '';
|
|
document.body.classList.add(configClass, varsClass);
|
|
|
|
document.body.classList.add(...activeTheme.classNames);
|
|
}, [activeTheme]);
|
|
|
|
return <ThemeContextProvider value={activeTheme}>{children}</ThemeContextProvider>;
|
|
}
|