refactor: use new web service architecture (1/2)

This commit is contained in:
izzy
2026-01-13 13:18:58 +00:00
parent 67cc937bb0
commit 69b2e36a38
6 changed files with 263 additions and 168 deletions
@@ -0,0 +1,41 @@
<script lang="ts">
import OnEvents from '$lib/components/OnEvents.svelte';
import { getIntegrityReportItemActions } from '$lib/services/integrity.service';
import type { IntegrityReportType } from '@immich/sdk';
import { ContextMenuButton, TableCell, TableRow } from '@immich/ui';
import { t } from 'svelte-i18n';
interface Props {
id: string;
path: string;
reportType: IntegrityReportType;
}
let { id, path, reportType }: Props = $props();
let deleting = $state(false);
const { Download, Delete } = $derived(getIntegrityReportItemActions($t, id, reportType));
function onIntegrityReportDelete({
id: reportId,
type,
isDeleting,
}: {
id?: string;
type?: IntegrityReportType;
isDeleting: boolean;
}) {
if (type === reportType || reportId === id) {
deleting = isDeleting;
}
}
</script>
<OnEvents {onIntegrityReportDelete} />
<TableRow>
<TableCell class="w-7/8 text-left px-4">{path}</TableCell>
<TableCell class="w-1/8 flex justify-end">
<ContextMenuButton disabled={deleting} position="top-right" aria-label={$t('open')} items={[Download, Delete]} />
</TableCell>
</TableRow>