feat(mobx): refactor and remove (react-)redux

This commit is contained in:
Paul
2021-12-23 21:43:11 +00:00
parent 6e1bcab92b
commit cc0e45526c
55 changed files with 249 additions and 1522 deletions

View File

@@ -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 {