[refactor] refactored DefaultConfig on client side to resemble typing in StaticConfig

This commit is contained in:
silentrald
2024-10-06 00:33:50 +08:00
parent fc212cecb4
commit 50322b69cc
@@ -1,6 +1,24 @@
import { BsvSearchOrder } from "shared/models/maps/beat-saver.model";
export const defaultConfiguration: { [key in DefaultConfigKey]: any } = {
// NOTE: To refactor. Rename to LocalStorageConfigKeyValues since these are stored in the
// localStorage in the browser, and for readability
export interface DefaultConfigKeyValues {
"first-color": string;
"second-color": string;
theme: ThemeConfig;
language: string;
supported_languages: string[];
default_mods: string[];
"default-shared-folders": string[];
"playlist-sort-order": BsvSearchOrder;
"map-sort-order": BsvSearchOrder;
};
export type DefaultConfigKey = keyof DefaultConfigKeyValues;
export const defaultConfiguration: {
[key in DefaultConfigKey]: DefaultConfigKeyValues[key]
} = {
"first-color": "#3b82ff",
"second-color": "#ff4444",
theme: "os",
@@ -16,6 +34,4 @@ export const defaultConfiguration: { [key in DefaultConfigKey]: any } = {
"map-sort-order": BsvSearchOrder.Latest,
};
export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods" | "default-shared-folders" | "playlist-sort-order" | "map-sort-order";
export type ThemeConfig = "dark" | "light" | "os";