Removed mantine libraries; Removed mandatory authentication
This commit is contained in:
@ -2,7 +2,10 @@ import { create } from 'zustand';
|
||||
|
||||
export type Mode = 'edit' | 'view'
|
||||
|
||||
export type ColorScheme = 'light' | 'dark' | 'auto'
|
||||
|
||||
export interface AppState {
|
||||
colorScheme: ColorScheme,
|
||||
mapTab: Record<string, {
|
||||
year: number | null,
|
||||
region: number | null,
|
||||
@ -12,10 +15,20 @@ export interface AppState {
|
||||
}
|
||||
|
||||
export const useAppStore = create<AppState>(() => ({
|
||||
colorScheme: 'auto',
|
||||
currentTab: null,
|
||||
mapTab: {}
|
||||
}))
|
||||
|
||||
const getColorScheme = () => {
|
||||
useAppStore.getState().colorScheme
|
||||
}
|
||||
|
||||
const setColorScheme = (colorScheme: ColorScheme) => {
|
||||
useAppStore.setState(() => ({ colorScheme: colorScheme }))
|
||||
localStorage.setItem('colorScheme', colorScheme.toString())
|
||||
}
|
||||
|
||||
const getCurrentTab = () => useAppStore.getState().currentTab
|
||||
const setCurrentTab = (id: string | null) => useAppStore.setState(() => ({ currentTab: id }))
|
||||
|
||||
@ -39,5 +52,7 @@ export {
|
||||
deleteMapTab,
|
||||
getCurrentTab,
|
||||
setCurrentTab,
|
||||
setMapTabYear
|
||||
setMapTabYear,
|
||||
getColorScheme,
|
||||
setColorScheme
|
||||
}
|
Reference in New Issue
Block a user