add quick town selection and category selection from homescreen with localstorage!
This commit is contained in:
parent
73f5683fbc
commit
02e699aad5
24 changed files with 619 additions and 137 deletions
|
|
@ -5,6 +5,7 @@ type Theme = 'dark' | 'light' | 'system'
|
|||
const useTheme = () => {
|
||||
const theme = ref<Theme>('dark')
|
||||
const systemTheme = ref<'dark' | 'light'>('light')
|
||||
const currentTown = ref(localStorage.getItem('current-town') || 'all')
|
||||
|
||||
const updateSystemTheme = () => {
|
||||
systemTheme.value = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
||||
|
|
@ -42,11 +43,18 @@ const useTheme = () => {
|
|||
localStorage.setItem('ui-theme', newTheme)
|
||||
}
|
||||
|
||||
const setCurrentTown = (town: string) => {
|
||||
currentTown.value = town
|
||||
localStorage.setItem('current-town', town)
|
||||
}
|
||||
|
||||
return {
|
||||
theme,
|
||||
setTheme,
|
||||
systemTheme,
|
||||
currentTheme
|
||||
currentTheme,
|
||||
currentTown,
|
||||
setCurrentTown
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue