From 16677a4cdf421891c61f72089546b6a1fb118c0f Mon Sep 17 00:00:00 2001 From: Brandon Date: Sat, 18 Mar 2023 19:41:47 -0400 Subject: [PATCH] fix: modified components to display deleted as a status --- overseerr-api.yml | 16 ++++++++-- server/routes/request.ts | 9 ++++++ .../Common/StatusBadgeMini/index.tsx | 11 ++++++- .../Discover/RecentRequestsSlider/index.tsx | 2 ++ src/components/RequestBlock/index.tsx | 5 +++ src/components/RequestButton/index.tsx | 8 +++-- src/components/RequestList/index.tsx | 8 +++++ .../RequestModal/TvRequestModal.tsx | 4 ++- src/components/StatusBadge/index.tsx | 11 +++++++ src/components/TvDetails/index.tsx | 32 +++++++++++++++++++ src/i18n/globalMessages.ts | 2 ++ 11 files changed, 101 insertions(+), 7 deletions(-) diff --git a/overseerr-api.yml b/overseerr-api.yml index 6e8f58964..4deaa9814 100644 --- a/overseerr-api.yml +++ b/overseerr-api.yml @@ -1053,7 +1053,7 @@ components: status: type: number example: 0 - description: Availability of the media. 1 = `UNKNOWN`, 2 = `PENDING`, 3 = `PROCESSING`, 4 = `PARTIALLY_AVAILABLE`, 5 = `AVAILABLE` + description: Availability of the media. 1 = `UNKNOWN`, 2 = `PENDING`, 3 = `PROCESSING`, 4 = `PARTIALLY_AVAILABLE`, 5 = `AVAILABLE`, 6 = `DELETED` requests: type: array readOnly: true @@ -4955,6 +4955,7 @@ paths: processing, unavailable, failed, + deleted, ] - in: query name: sort @@ -5694,7 +5695,16 @@ paths: schema: type: string nullable: true - enum: [all, available, partial, allavailable, processing, pending] + enum: + [ + all, + available, + partial, + allavailable, + processing, + pending, + deleted, + ] - in: query name: sort schema: @@ -5753,7 +5763,7 @@ paths: example: available schema: type: string - enum: [available, partial, processing, pending, unknown] + enum: [available, partial, processing, pending, unknown, deleted] requestBody: content: application/json: diff --git a/server/routes/request.ts b/server/routes/request.ts index 83c05b485..1f8fcf664 100644 --- a/server/routes/request.ts +++ b/server/routes/request.ts @@ -55,12 +55,17 @@ requestRoutes.get, RequestResultsResponse>( case 'failed': statusFilter = [MediaRequestStatus.FAILED]; break; + case 'completed': + case 'deleted': + statusFilter = [MediaRequestStatus.COMPLETED]; + break; default: statusFilter = [ MediaRequestStatus.PENDING, MediaRequestStatus.APPROVED, MediaRequestStatus.DECLINED, MediaRequestStatus.FAILED, + MediaRequestStatus.COMPLETED, ]; } @@ -79,6 +84,9 @@ requestRoutes.get, RequestResultsResponse>( MediaStatus.PARTIALLY_AVAILABLE, ]; break; + case 'deleted': + mediaStatusFilter = [MediaStatus.DELETED]; + break; default: mediaStatusFilter = [ MediaStatus.UNKNOWN, @@ -86,6 +94,7 @@ requestRoutes.get, RequestResultsResponse>( MediaStatus.PROCESSING, MediaStatus.PARTIALLY_AVAILABLE, MediaStatus.AVAILABLE, + MediaStatus.DELETED, ]; } diff --git a/src/components/Common/StatusBadgeMini/index.tsx b/src/components/Common/StatusBadgeMini/index.tsx index a7e24a378..d98648a21 100644 --- a/src/components/Common/StatusBadgeMini/index.tsx +++ b/src/components/Common/StatusBadgeMini/index.tsx @@ -1,6 +1,11 @@ import Spinner from '@app/assets/spinner.svg'; import { CheckCircleIcon } from '@heroicons/react/20/solid'; -import { BellIcon, ClockIcon, MinusSmallIcon } from '@heroicons/react/24/solid'; +import { + BellIcon, + ClockIcon, + MinusSmallIcon, + TrashIcon, +} from '@heroicons/react/24/solid'; import { MediaStatus } from '@server/constants/media'; interface StatusBadgeMiniProps { @@ -50,6 +55,10 @@ const StatusBadgeMini = ({ ); indicatorIcon = ; break; + case MediaStatus.DELETED: + badgeStyle.push('bg-red-500 border-red-400 ring-red-400 text-red-100'); + indicatorIcon = ; + break; } if (inProgress) { diff --git a/src/components/Discover/RecentRequestsSlider/index.tsx b/src/components/Discover/RecentRequestsSlider/index.tsx index 96309d613..72909c8da 100644 --- a/src/components/Discover/RecentRequestsSlider/index.tsx +++ b/src/components/Discover/RecentRequestsSlider/index.tsx @@ -21,6 +21,8 @@ const RecentRequestsSlider = () => { return null; } + console.log({ requests }); + return ( <>
diff --git a/src/components/RequestBlock/index.tsx b/src/components/RequestBlock/index.tsx index ca8cb5fa6..8d3c74998 100644 --- a/src/components/RequestBlock/index.tsx +++ b/src/components/RequestBlock/index.tsx @@ -204,6 +204,11 @@ const RequestBlock = ({ request, onUpdate }: RequestBlockProps) => { {intl.formatMessage(globalMessages.failed)} )} + {request.status === MediaRequestStatus.COMPLETED && ( + + {intl.formatMessage(globalMessages.completed)} + + )}
diff --git a/src/components/RequestButton/index.tsx b/src/components/RequestButton/index.tsx index 56e91810b..b41a5fde5 100644 --- a/src/components/RequestButton/index.tsx +++ b/src/components/RequestButton/index.tsx @@ -264,7 +264,9 @@ const RequestButton = ({ // Standard request button if ( - (!media || media.status === MediaStatus.UNKNOWN) && + (!media || + media.status === MediaStatus.UNKNOWN || + media.status === MediaStatus.DELETED) && hasPermission( [ Permission.REQUEST, @@ -307,7 +309,9 @@ const RequestButton = ({ // 4K request button if ( - (!media || media.status4k === MediaStatus.UNKNOWN) && + (!media || + media.status4k === MediaStatus.UNKNOWN || + media.status4k === MediaStatus.DELETED) && hasPermission( [ Permission.REQUEST_4K, diff --git a/src/components/RequestList/index.tsx b/src/components/RequestList/index.tsx index bffd7c067..b01e36f57 100644 --- a/src/components/RequestList/index.tsx +++ b/src/components/RequestList/index.tsx @@ -34,6 +34,7 @@ enum Filter { AVAILABLE = 'available', UNAVAILABLE = 'unavailable', FAILED = 'failed', + DELETED = 'deleted', } type Sort = 'added' | 'modified'; @@ -99,6 +100,10 @@ const RequestList = () => { ); }, [currentFilter, currentSort, currentPageSize]); + console.log({ currentFilter }); + + console.log({ data }); + if (!data && !error) { return ; } @@ -177,6 +182,9 @@ const RequestList = () => { +
diff --git a/src/components/RequestModal/TvRequestModal.tsx b/src/components/RequestModal/TvRequestModal.tsx index 25c8fd3c2..c0e2d4daa 100644 --- a/src/components/RequestModal/TvRequestModal.tsx +++ b/src/components/RequestModal/TvRequestModal.tsx @@ -569,7 +569,9 @@ const TvRequestModal = ({ (sn) => sn.seasonNumber === season.seasonNumber && sn[is4k ? 'status4k' : 'status'] !== - MediaStatus.UNKNOWN + MediaStatus.UNKNOWN && + sn[is4k ? 'status4k' : 'status'] !== + MediaStatus.DELETED ); return ( diff --git a/src/components/StatusBadge/index.tsx b/src/components/StatusBadge/index.tsx index b60b7af04..cda8eb59e 100644 --- a/src/components/StatusBadge/index.tsx +++ b/src/components/StatusBadge/index.tsx @@ -299,6 +299,17 @@ const StatusBadge = ({ ); + case MediaStatus.DELETED: + return ( + + + {intl.formatMessage(is4k ? messages.status4k : messages.status, { + status: intl.formatMessage(globalMessages.deleted), + })} + + + ); + default: return null; } diff --git a/src/components/TvDetails/index.tsx b/src/components/TvDetails/index.tsx index 2f44a7d8c..f9ece0fe0 100644 --- a/src/components/TvDetails/index.tsx +++ b/src/components/TvDetails/index.tsx @@ -647,6 +647,18 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
)} + {mSeason?.status === MediaStatus.DELETED && ( + <> +
+ + {intl.formatMessage(globalMessages.deleted)} + +
+
+ +
+ + )} {((!mSeason4k && request4k?.status === MediaRequestStatus.APPROVED) || @@ -733,6 +745,26 @@ const TvDetails = ({ tv }: TvDetailsProps) => { )} + {mSeason4k?.status4k === MediaStatus.DELETED && + show4k && ( + <> +
+ + {intl.formatMessage(messages.status4k, { + status: intl.formatMessage( + globalMessages.deleted + ), + })} + +
+
+ +
+ + )}