mirror of
https://github.com/immich-app/immich.git
synced 2025-02-18 01:24:26 -05: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;
|
||||
}
|
||||
|
||||
export const mapSettings = persisted<MapSettings>('map-settings', {
|
||||
const defaultMapSettings = {
|
||||
allowDarkMode: true,
|
||||
includeArchived: false,
|
||||
onlyFavorites: false,
|
||||
|
@ -71,7 +71,17 @@ export const mapSettings = persisted<MapSettings>('map-settings', {
|
|||
relativeDate: '',
|
||||
dateAfter: '',
|
||||
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 videoViewerMuted = persisted<boolean>('video-viewer-muted', false, {});
|
||||
|
|
Loading…
Add table
Reference in a new issue