Files
pichunt/app/stores/settings.ts
T
Pascal 61cc516f47
Docker Image CI / test (push) Failing after 41s
Docker Image CI / deploy (push) Skipped
Tests / unit (push) Failing after 36s
Tests / integration (push) Successful in 1m34s
feat(hunt): track walking distance via GPS, show live locations on map
Add foreground-only GPS distance tracking for hunts
2026-09-27 20:55:58 +02:00

31 lines
856 B
TypeScript

export const useSettingsStore = defineStore(
'picSettings',
() => {
const hideAnswers = ref(true);
const isSidebarVisible = ref(false);
// Per-hunt, client-only consent for GPS distance tracking. Off by default;
// the server cannot prove consent, so this lives only in the client store.
const trackConsent = ref<Record<number, boolean>>({});
function hasTrackConsent(huntId: number): boolean {
return trackConsent.value[huntId] ?? false;
}
function setTrackConsent(huntId: number, consent: boolean) {
trackConsent.value[huntId] = consent;
}
return {
hideAnswers,
isSidebarVisible,
trackConsent,
hasTrackConsent,
setTrackConsent
};
},
{ persist: true }
);
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useSettingsStore, import.meta.hot));
}