mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user