feat: polish
This commit is contained in:
parent
2e6177fe74
commit
4bd927bb4e
137 changed files with 6357 additions and 137560 deletions
86
src/lib/features/settings/schema.ts
Normal file
86
src/lib/features/settings/schema.ts
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* Declarative settings schema. Each `SettingsField` describes a single setting
|
||||
* that renders as a labeled form control in the Settings panel. Keep this
|
||||
* independent of Svelte so the same schema can drive future serializers
|
||||
* (export/import settings, URL state, etc.).
|
||||
*/
|
||||
|
||||
export type FieldKind = 'boolean' | 'select' | 'number' | 'string';
|
||||
|
||||
export interface BaseField<K extends FieldKind> {
|
||||
kind: K;
|
||||
/** Dot-separated path into AppSettings (e.g. `'map.baseLayer'`). */
|
||||
path: string;
|
||||
labelKey: string;
|
||||
descriptionKey?: string;
|
||||
}
|
||||
|
||||
export interface BooleanField extends BaseField<'boolean'> {}
|
||||
|
||||
export interface NumberField extends BaseField<'number'> {
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
}
|
||||
|
||||
export interface StringField extends BaseField<'string'> {
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
export interface SelectField extends BaseField<'select'> {
|
||||
options: { value: string; labelKey: string }[];
|
||||
}
|
||||
|
||||
export type SettingsField = BooleanField | NumberField | StringField | SelectField;
|
||||
|
||||
export interface SettingsSection {
|
||||
titleKey: string;
|
||||
fields: SettingsField[];
|
||||
}
|
||||
|
||||
export const SETTINGS_SCHEMA: SettingsSection[] = [
|
||||
{
|
||||
titleKey: 'settings.language',
|
||||
fields: [
|
||||
{
|
||||
kind: 'select',
|
||||
path: 'locale',
|
||||
labelKey: 'settings.language',
|
||||
options: [
|
||||
{ value: 'ru', labelKey: 'common.yes' },
|
||||
{ value: 'en', labelKey: 'common.yes' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
titleKey: 'settings.map',
|
||||
fields: [
|
||||
{
|
||||
kind: 'select',
|
||||
path: 'map.baseLayer',
|
||||
labelKey: 'settings.baseLayer',
|
||||
options: [
|
||||
{ value: 'osm', labelKey: 'settings.baseLayer' },
|
||||
{ value: 'satellite', labelKey: 'settings.baseLayer' },
|
||||
],
|
||||
},
|
||||
{ kind: 'boolean', path: 'map.showScale', labelKey: 'settings.showScale' },
|
||||
{ kind: 'boolean', path: 'map.showNavigation', labelKey: 'settings.showNavigation' },
|
||||
],
|
||||
},
|
||||
{
|
||||
titleKey: 'settings.units',
|
||||
fields: [
|
||||
{
|
||||
kind: 'select',
|
||||
path: 'units.system',
|
||||
labelKey: 'settings.units',
|
||||
options: [
|
||||
{ value: 'metric', labelKey: 'settings.metric' },
|
||||
{ value: 'imperial', labelKey: 'settings.imperial' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue