mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
fix(web): map settings (#15375)
This commit is contained in:
parent
6ce1533117
commit
89f40b311c
@ -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…
x
Reference in New Issue
Block a user