2022-11-07 16:53:47 -05:00
|
|
|
<script lang="ts">
|
2025-09-16 15:01:23 -04:00
|
|
|
import FormatMessage from '$lib/elements/FormatMessage.svelte';
|
2025-11-11 07:42:33 -05:00
|
|
|
import { handleRestoreUserAdmin } from '$lib/services/user-admin.service';
|
|
|
|
|
import { type UserAdminResponseDto } from '@immich/sdk';
|
|
|
|
|
import { ConfirmModal } from '@immich/ui';
|
2025-05-13 10:40:50 -04:00
|
|
|
import { mdiDeleteRestore } from '@mdi/js';
|
2024-06-22 18:08:56 +02:00
|
|
|
import { t } from 'svelte-i18n';
|
2022-11-07 16:53:47 -05:00
|
|
|
|
2025-11-11 07:42:33 -05:00
|
|
|
type Props = {
|
|
|
|
|
user: UserAdminResponseDto;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
};
|
2024-11-14 08:43:25 -06:00
|
|
|
|
2025-05-05 23:54:42 +02:00
|
|
|
let { user, onClose }: Props = $props();
|
2022-11-07 16:53:47 -05:00
|
|
|
|
2025-11-11 07:42:33 -05:00
|
|
|
const handleClose = async (confirmed: boolean) => {
|
|
|
|
|
if (!confirmed) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const success = await handleRestoreUserAdmin(user);
|
|
|
|
|
if (success) {
|
|
|
|
|
onClose();
|
2023-11-28 15:16:27 -05:00
|
|
|
}
|
2023-07-01 00:50:47 -04:00
|
|
|
};
|
2022-11-07 16:53:47 -05:00
|
|
|
</script>
|
|
|
|
|
|
2025-11-11 07:42:33 -05:00
|
|
|
<ConfirmModal
|
|
|
|
|
icon={mdiDeleteRestore}
|
|
|
|
|
title={$t('restore_user')}
|
|
|
|
|
confirmText={$t('restore')}
|
|
|
|
|
confirmColor="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
onClose={handleClose}
|
|
|
|
|
>
|
|
|
|
|
{#snippet promptSnippet()}
|
2024-06-21 22:08:36 +02:00
|
|
|
<p>
|
2024-11-14 08:43:25 -06:00
|
|
|
<FormatMessage key="admin.user_restore_description" values={{ user: user.name }}>
|
|
|
|
|
{#snippet children({ message })}
|
|
|
|
|
<b>{message}</b>
|
|
|
|
|
{/snippet}
|
2024-06-21 22:08:36 +02:00
|
|
|
</FormatMessage>
|
|
|
|
|
</p>
|
2025-11-11 07:42:33 -05:00
|
|
|
{/snippet}
|
|
|
|
|
</ConfirmModal>
|