mirror of
https://github.com/immich-app/immich
synced 2025-06-09 04:48:02 +00:00

* feat(web,a11y): slider accessibility improvements * add perceivable focus outline * label all sliders for screen readers * chore: add IDs to all settings sliders * chore: add comment to id prop * fix: switch to using CSS to add outlines * fix: reactive sliderId * fix: bring back the slot * fix: add aria-describedby for the subtitle * fix: cleanup css because disabled slider cannot be focused * fix: add border to the slider when focus is visible --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
52 lines
1.5 KiB
Svelte
52 lines
1.5 KiB
Svelte
<script lang="ts">
|
|
import {
|
|
notificationController,
|
|
NotificationType,
|
|
} from '$lib/components/shared-components/notification/notification';
|
|
import { updateUser, type UserResponseDto } from '@immich/sdk';
|
|
import { fade } from 'svelte/transition';
|
|
import { handleError } from '../../utils/handle-error';
|
|
|
|
import Button from '../elements/buttons/button.svelte';
|
|
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
|
|
|
export let user: UserResponseDto;
|
|
|
|
const handleSave = async () => {
|
|
try {
|
|
const data = await updateUser({
|
|
updateUserDto: {
|
|
id: user.id,
|
|
memoriesEnabled: user.memoriesEnabled,
|
|
},
|
|
});
|
|
|
|
Object.assign(user, data);
|
|
|
|
notificationController.show({ message: 'Saved settings', type: NotificationType.Info });
|
|
} catch (error) {
|
|
handleError(error, 'Unable to update settings');
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<section class="my-4">
|
|
<div in:fade={{ duration: 500 }}>
|
|
<form autocomplete="off" on:submit|preventDefault>
|
|
<div class="ml-4 mt-4 flex flex-col gap-4">
|
|
<div class="ml-4">
|
|
<SettingSwitch
|
|
id="time-based-memories"
|
|
title="Time-based memories"
|
|
subtitle="Photos from previous years"
|
|
bind:checked={user.memoriesEnabled}
|
|
/>
|
|
</div>
|
|
<div class="flex justify-end">
|
|
<Button type="submit" size="sm" on:click={() => handleSave()}>Save</Button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|