shoutrrr alerts / settings page

This commit is contained in:
Henry Dollman
2024-09-12 19:39:27 -04:00
parent 2889d151ea
commit 9710d0d2f1
16 changed files with 450 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
import PocketBase from 'pocketbase'
import { atom, WritableAtom } from 'nanostores'
import { AlertRecord, ChartTimes, SystemRecord } from '@/types'
import { atom, map, WritableAtom } from 'nanostores'
import { AlertRecord, ChartTimes, SystemRecord, UserSettings } from '@/types'
/** PocketBase JS Client */
export const pb = new PocketBase('/')
@@ -23,6 +23,17 @@ export const $hubVersion = atom('')
/** Chart time period */
export const $chartTime = atom('1h') as WritableAtom<ChartTimes>
/** User settings */
export const $userSettings = map<UserSettings>({
chartTime: '1h',
emails: [pb.authStore.model?.email || ''],
})
// update local storage on change
$userSettings.subscribe((value) => {
// console.log('user settings changed', value)
$chartTime.set(value.chartTime)
})
/** Container chart filter */
export const $containerFilter = atom('')