Add cancel confirmation and cancellable statuses

Introduce a unified CANCELLABLE_STATUSES constant and add confirmation UI for cancelling requests. RequestActionsDropdown and RequestCard now show a ConfirmModal before cancelling and use the shared CANCELLABLE_STATUSES to gate cancel actions. The API route imports the constant to enforce server-side validation and uses Prisma.DbNull for selectedTorrent when withdrawing an awaiting-approval request. Tests updated to expect Prisma.DbNull. Improves UX and centralizes cancel logic to avoid duplicated status lists.
This commit is contained in:
kikootwo
2026-05-15 09:49:42 -04:00
parent 1a9aeb4713
commit b775ccf473
5 changed files with 83 additions and 31 deletions
+9
View File
@@ -5,3 +5,12 @@
/** Terminal statuses indicating a request has been fulfilled and files are ready */
export const COMPLETED_STATUSES = ['available', 'downloaded'] as const;
/** Statuses from which a request can be cancelled (server-enforced and UI-gated) */
export const CANCELLABLE_STATUSES = [
'pending',
'searching',
'downloading',
'awaiting_search',
'awaiting_approval',
] as const;