initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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);
|
||||
@@ -0,0 +1,23 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
// Placeholder function for urlHashStore
|
||||
// In a real application, this would handle URL hash parameters
|
||||
// and return a Svelte store that reflects those parameters.
|
||||
export function urlHashStore(initialValue: Record<string, any>) {
|
||||
const { subscribe, set, update } = writable(initialValue);
|
||||
|
||||
// In a full implementation, you would add logic here to:
|
||||
// 1. Read the URL hash on initialization
|
||||
// 2. Parse the hash into an object
|
||||
// 3. Update the store with these values
|
||||
// 4. Listen for changes to the store and update the URL hash accordingly
|
||||
// 5. Listen for URL hash changes (e.g., back/forward buttons) and update the store
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
set,
|
||||
update,
|
||||
// You might want to add methods to easily update specific hash parameters
|
||||
updateParam: (key: string, value: any) => update((current) => ({ ...current, [key]: value }))
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user