This repository has been archived on 2026-08-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
drizzli/src/lib/stores/settings.ts
T

84 lines
2.1 KiB
TypeScript

import { persisted } from 'svelte-persisted-store';
export interface GeoLocation {
id: number;
name: string;
latitude: number;
longitude: number;
elevation: number;
feature_code: string;
country_code: string | undefined;
admin1_id: number | undefined;
admin3_id?: number | undefined;
admin4_id?: number | undefined;
timezone: string;
population: number | undefined;
postcodes: string[] | undefined;
country_id: number | undefined;
country: string | undefined;
admin1: string | undefined;
admin3?: string | undefined;
admin4?: string | undefined;
}
export const defaultLocation: GeoLocation = {
id: 2950159,
name: 'Berlin',
latitude: 52.52437,
longitude: 13.41053,
elevation: 74,
feature_code: 'PPLC',
country_code: 'DE',
admin1_id: 2950157,
admin3_id: 6547383,
admin4_id: 6547539,
timezone: 'Europe/Berlin',
population: 3426354,
postcodes: ['10967', '13347'],
country_id: 2921044,
country: 'Germany',
admin1: 'Land Berlin',
admin3: 'Berlin, Stadt',
admin4: 'Berlin'
};
export const storedLocation = persisted('stored_location', defaultLocation as GeoLocation);
export type Theme = 'system' | 'light' | 'dark';
export const storedTheme = persisted<Theme>('theme', 'system');
/** Selected forecast model, shared across the whole site. */
export const storedModel = persisted<string>('selected_model', 'best_match');
/** Which variables are visible in the hourly table and the meteograms. */
export interface VariablePrefs {
table: Record<string, boolean>;
charts: Record<string, boolean>;
}
export const defaultVariablePrefs: VariablePrefs = {
table: {
icons: true,
temperature: true,
feels: true,
wind: true,
humidity: true,
clouds: true,
precipitation: true
},
charts: {
temperature: true,
cloud_cover: true,
precipitation: true,
precipitation_probability: true,
wind: true,
humidity: true
}
};
export const storedVariablePrefs = persisted<VariablePrefs>('variable_prefs', defaultVariablePrefs);
/** Selected ensemble model for the 14-day spread forecast. */
export const storedEnsembleModel = persisted<string>('ensemble_model', 'ncep_gefs_seamless');