Files
kandev/apps/web/components/task/task-archive-confirm-flow.tsx
T
João Salavisa ac520a8cdc feat(web): archive the current task from the command palette (#2346)
Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 11:29:24 +02:00

38 lines
1.1 KiB
TypeScript

"use client";
import { TaskArchiveConfirmDialog } from "@/components/task/task-archive-confirm-dialog";
import type { useTaskArchiveConfirm } from "@/hooks/use-task-archive-confirm";
type TaskArchiveConfirmFlowProps = {
taskId: string;
archive: ReturnType<typeof useTaskArchiveConfirm>;
/** Test id for the dialog's Archive button — the only per-surface difference. */
confirmTestId: string;
};
/**
* Binds a `useTaskArchiveConfirm` result to the shared confirmation dialog, so
* every archive entry point maps the hook onto the dialog the same way and a
* dialog prop change lands in one place.
*/
export function TaskArchiveConfirmFlow({
taskId,
archive,
confirmTestId,
}: TaskArchiveConfirmFlowProps) {
return (
<TaskArchiveConfirmDialog
open={archive.target !== null}
onOpenChange={(open) => {
if (!open) archive.closeConfirm();
}}
taskTitle={archive.target?.title ?? ""}
taskId={taskId}
executorType={archive.target?.executorType}
isArchiving={archive.isPending}
onConfirm={archive.confirmArchive}
confirmTestId={confirmTestId}
/>
);
}