Files
shumai/packages/webui/components/archive-confirm-dialog.tsx
T
Yiling-J ba3c6dbfee feat(storage): add archive storage support for assets (#514)
* feat(storage): add archive storage support for assets

* fix(webui): show archive icon in front of file name in breadcrumb bar

* fix(webui): display archive icon in breadcrumbs when restoring

* refactor(transcode): simplify restore asset workflow to single while loop

* docs(configuration): add archive storage documentation and readme entries

* fix(webui): show archive icon in front of version names and prevent version card overflow

* fix(webui): fix overflow in manage versions dialog scroll area

* fix(webui): prevent manage versions dialog overflow on long file names

* docs(configuration): fix archive storage environment variables and defaults

* fix(storage): address code review findings for archive storage
2026-11-03 20:31:56 +08:00

57 lines
1.6 KiB
TypeScript

import { m } from '@/ui/paraglide/messages.js'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/ui/components/ui/alert-dialog'
export interface ArchiveConfirmDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
mode: 'archive' | 'restore'
onConfirm: () => void
isPending?: boolean
}
export function ArchiveConfirmDialog({
open,
onOpenChange,
mode,
onConfirm,
isPending = false,
}: ArchiveConfirmDialogProps) {
const isArchive = mode === 'archive'
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent data-testid="archive-confirm-dialog">
<AlertDialogHeader>
<AlertDialogTitle>
{isArchive ? m.archive_confirm_title() : m.restore_archive_confirm_title()}
</AlertDialogTitle>
<AlertDialogDescription>
{isArchive ? m.archive_confirm_description() : m.restore_archive_confirm_description()}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={isPending}>{m.cancel()}</AlertDialogCancel>
<AlertDialogAction
data-testid="archive-confirm-submit"
disabled={isPending}
onClick={(e) => {
e.preventDefault()
onConfirm()
}}
>
{isArchive ? m.archive() : m.restore_from_archive()}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}