mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
feat(mobx): refactor and remove (react-)redux
This commit is contained in:
@@ -5,7 +5,6 @@ import { createGlobalStyle } from "styled-components";
|
||||
import { useEffect } from "preact/hooks";
|
||||
|
||||
import { useApplicationState } from "../mobx/State";
|
||||
import { getState } from "../redux";
|
||||
|
||||
export type Variables =
|
||||
| "accent"
|
||||
@@ -280,28 +279,6 @@ export const PRESETS: Record<string, Theme> = {
|
||||
},
|
||||
};
|
||||
|
||||
// todo: store used themes locally
|
||||
export function getBaseTheme(name: string): Theme {
|
||||
if (name in PRESETS) {
|
||||
return PRESETS[name];
|
||||
}
|
||||
|
||||
// TODO: properly initialize `themes` in state instead of letting it be undefined
|
||||
const themes = getState().themes ?? {};
|
||||
|
||||
if (name in themes) {
|
||||
const { theme } = themes[name];
|
||||
|
||||
return {
|
||||
...PRESETS[theme.light ? "light" : "dark"],
|
||||
...theme,
|
||||
};
|
||||
}
|
||||
|
||||
// how did we get here
|
||||
return PRESETS["dark"];
|
||||
}
|
||||
|
||||
const keys = Object.keys(PRESETS.dark);
|
||||
const GlobalTheme = createGlobalStyle<{ theme: Theme }>`
|
||||
:root {
|
||||
|
||||
Reference in New Issue
Block a user