mirror of
https://github.com/immich-app/immich.git
synced 2025-04-17 21:46:25 +02:00
fix(web): map settings (#15375)
This commit is contained in:
parent
6ce1533117
commit
89f40b311c
1 changed files with 12 additions and 2 deletions
|
@ -62,7 +62,7 @@ export interface MapSettings {
|
||||||
dateBefore: string;
|
dateBefore: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mapSettings = persisted<MapSettings>('map-settings', {
|
const defaultMapSettings = {
|
||||||
allowDarkMode: true,
|
allowDarkMode: true,
|
||||||
includeArchived: false,
|
includeArchived: false,
|
||||||
onlyFavorites: false,
|
onlyFavorites: false,
|
||||||
|
@ -71,7 +71,17 @@ export const mapSettings = persisted<MapSettings>('map-settings', {
|
||||||
relativeDate: '',
|
relativeDate: '',
|
||||||
dateAfter: '',
|
dateAfter: '',
|
||||||
dateBefore: '',
|
dateBefore: '',
|
||||||
});
|
};
|
||||||
|
|
||||||
|
const persistedObject = <T>(key: string, defaults: T) =>
|
||||||
|
persisted<T>(key, defaults, {
|
||||||
|
serializer: {
|
||||||
|
parse: (text) => ({ ...defaultMapSettings, ...JSON.parse(text ?? null) }),
|
||||||
|
stringify: JSON.stringify,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const mapSettings = persistedObject<MapSettings>('map-settings', defaultMapSettings);
|
||||||
|
|
||||||
export const videoViewerVolume = persisted<number>('video-viewer-volume', 1, {});
|
export const videoViewerVolume = persisted<number>('video-viewer-volume', 1, {});
|
||||||
export const videoViewerMuted = persisted<boolean>('video-viewer-muted', false, {});
|
export const videoViewerMuted = persisted<boolean>('video-viewer-muted', false, {});
|
||||||
|
|
Loading…
Add table
Reference in a new issue