fix: add Move confirm button to bulk actions (two-step flow)

Previously the 'Move to...' dropdown fired immediately on selection with
no confirm step. Now it's a two-step flow: pick target status from dropdown,
then click 'Move' button to confirm — consistent with Archive and Delete.

Fixes task_20260201_NqmOuf
This commit is contained in:
Brad Groux 2026-02-01 15:25:19 -06:00
parent dc6bd85405
commit dfa81b0405

View file

@ -64,6 +64,7 @@ export function BulkActionsBar({ tasks }: BulkActionsBarProps) {
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
const [isProcessing, setIsProcessing] = useState(false);
const [moveTarget, setMoveTarget] = useState<TaskStatus | null>(null);
// Group task IDs by status
const taskIdsByStatus = useMemo(() => {
@ -109,13 +110,17 @@ export function BulkActionsBar({ tasks }: BulkActionsBarProps) {
return someSelected && !allSelectedInGroup;
};
const handleMoveToStatus = async (status: TaskStatus) => {
const handleMoveToStatus = async () => {
if (!moveTarget) return;
setIsProcessing(true);
try {
await Promise.all(
Array.from(selectedIds).map((id) => updateTask.mutateAsync({ id, input: { status } }))
Array.from(selectedIds).map((id) =>
updateTask.mutateAsync({ id, input: { status: moveTarget } })
)
);
clearSelection();
setMoveTarget(null);
} finally {
setIsProcessing(false);
}
@ -210,16 +215,20 @@ export function BulkActionsBar({ tasks }: BulkActionsBarProps) {
{selectedCount > 0 && (
<div className="flex items-center gap-2">
{/* Move to status */}
{/* Move to status — two-step: pick target → confirm */}
<Select
value=""
onValueChange={(value) => handleMoveToStatus(value as TaskStatus)}
value={moveTarget ?? ''}
onValueChange={(value) => setMoveTarget(value as TaskStatus)}
disabled={isProcessing}
>
<SelectTrigger className="w-[140px]">
<div className="flex items-center gap-1">
<ArrowRight className="h-4 w-4" />
<span>Move to...</span>
<span>
{moveTarget
? (STATUS_BUTTONS.find((s) => s.id === moveTarget)?.label ?? 'Move to...')
: 'Move to...'}
</span>
</div>
</SelectTrigger>
<SelectContent>
@ -231,6 +240,17 @@ export function BulkActionsBar({ tasks }: BulkActionsBarProps) {
</SelectContent>
</Select>
{moveTarget && (
<Button
variant="default"
size="sm"
onClick={handleMoveToStatus}
disabled={isProcessing}
>
{isProcessing ? 'Moving...' : 'Move'}
</Button>
)}
{/* Archive */}
<Button
variant="outline"