mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix(web): settings accordion open state (#7504)
This commit is contained in:
parent
84fe41df31
commit
93f0a866a3
5 changed files with 108 additions and 107 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { NotificationType, notificationController } from '$lib/components/shared-components/notification/notification';
|
||||
import { locales } from '$lib/constants';
|
||||
import { handleError } from '$lib/utils/handle-error';
|
||||
|
|
@ -14,37 +12,6 @@ import {
|
|||
unlinkOAuthAccount,
|
||||
type UserResponseDto,
|
||||
} from '@immich/sdk';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
interface UpdateParamAction {
|
||||
param: string;
|
||||
value: string;
|
||||
add: boolean;
|
||||
}
|
||||
|
||||
const getParamValues = (param: string) =>
|
||||
new Set((get(page).url.searchParams.get(param) || '').split(' ').filter((x) => x !== ''));
|
||||
|
||||
export const hasParamValue = (param: string, value: string) => getParamValues(param).has(value);
|
||||
|
||||
export const updateParamList = async ({ param, value, add }: UpdateParamAction) => {
|
||||
const values = getParamValues(param);
|
||||
|
||||
if (add) {
|
||||
values.add(value);
|
||||
} else {
|
||||
values.delete(value);
|
||||
}
|
||||
|
||||
const searchParams = new URLSearchParams(get(page).url.searchParams);
|
||||
searchParams.set(param, [...values.values()].join(' '));
|
||||
|
||||
if (values.size === 0) {
|
||||
searchParams.delete(param);
|
||||
}
|
||||
|
||||
await goto(`?${searchParams.toString()}`, { replaceState: true, noScroll: true, keepFocus: true });
|
||||
};
|
||||
|
||||
export const getJobName = (jobName: JobName) => {
|
||||
const names: Record<JobName, string> = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue