mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 09:15:05 +03:00
refactor: map setting modal (#24789)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
||||||
import DateInput from '$lib/elements/DateInput.svelte';
|
import DateInput from '$lib/elements/DateInput.svelte';
|
||||||
import type { MapSettings } from '$lib/stores/preferences.store';
|
import type { MapSettings } from '$lib/stores/preferences.store';
|
||||||
import { Button, Field, HStack, Modal, ModalBody, ModalFooter, Stack, Switch } from '@immich/ui';
|
import { Button, Field, FormModal, Stack, Switch } from '@immich/ui';
|
||||||
import { Duration } from 'luxon';
|
import { Duration } from 'luxon';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
import { fly } from 'svelte/transition';
|
import { fly } from 'svelte/transition';
|
||||||
@@ -17,15 +17,12 @@
|
|||||||
|
|
||||||
let customDateRange = $state(!!settings.dateAfter || !!settings.dateBefore);
|
let customDateRange = $state(!!settings.dateAfter || !!settings.dateBefore);
|
||||||
|
|
||||||
const onsubmit = (event: Event) => {
|
const onSubmit = () => {
|
||||||
event.preventDefault();
|
|
||||||
onClose(settings);
|
onClose(settings);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal title={$t('map_settings')} {onClose} size="small">
|
<FormModal title={$t('map_settings')} {onClose} {onSubmit} size="small">
|
||||||
<ModalBody>
|
|
||||||
<form {onsubmit} id="map-settings-form">
|
|
||||||
<Stack gap={4}>
|
<Stack gap={4}>
|
||||||
<Field label={$t('allow_dark_mode')}>
|
<Field label={$t('allow_dark_mode')}>
|
||||||
<Switch bind:checked={settings.allowDarkMode} />
|
<Switch bind:checked={settings.allowDarkMode} />
|
||||||
@@ -123,13 +120,4 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</Stack>
|
</Stack>
|
||||||
</form>
|
</FormModal>
|
||||||
</ModalBody>
|
|
||||||
|
|
||||||
<ModalFooter>
|
|
||||||
<HStack fullWidth>
|
|
||||||
<Button color="secondary" shape="round" fullWidth onclick={() => onClose()}>{$t('cancel')}</Button>
|
|
||||||
<Button type="submit" shape="round" fullWidth form="map-settings-form">{$t('save')}</Button>
|
|
||||||
</HStack>
|
|
||||||
</ModalFooter>
|
|
||||||
</Modal>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user