mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 20:25:32 -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;
|
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…
x
Reference in New Issue
Block a user