From 45886ccef1bee57dc555060a491834567e45b59c Mon Sep 17 00:00:00 2001 From: TheCatLady <52870424+TheCatLady@users.noreply.github.com> Date: Tue, 9 Mar 2021 21:39:42 -0500 Subject: [PATCH] fix(ui): display "Season" vs. "Seasons" as appropriate, and fix request block "Seasons" formatting (#1127) --- src/components/RequestBlock/index.tsx | 22 +++++++++++-------- src/components/RequestCard/index.tsx | 15 ++++++++----- .../RequestList/RequestItem/index.tsx | 16 +++++++++----- src/i18n/locale/en.json | 6 ++--- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/src/components/RequestBlock/index.tsx b/src/components/RequestBlock/index.tsx index 28966d2f5..37a356c7a 100644 --- a/src/components/RequestBlock/index.tsx +++ b/src/components/RequestBlock/index.tsx @@ -10,7 +10,7 @@ import RequestModal from '../RequestModal'; import useRequestOverride from '../../hooks/useRequestOverride'; const messages = defineMessages({ - seasons: 'Seasons', + seasons: '{seasonCount, plural, one {Season} other {Seasons}}', requestoverrides: 'Request Overrides', server: 'Server', profilechanged: 'Profile Changed', @@ -65,12 +65,12 @@ const RequestBlock: React.FC = ({ request, onUpdate }) => { setShowEditModal(false); }} /> -
+
-
+
= ({ request, onUpdate }) => { {request.modifiedBy && (
= ({ request, onUpdate }) => {
-
+
{request.is4k && ( 4K @@ -214,9 +214,9 @@ const RequestBlock: React.FC = ({ request, onUpdate }) => { )}
-
+
= ({ request, onUpdate }) => {
{(request.seasons ?? []).length > 0 && (
-
{intl.formatMessage(messages.seasons)}
+
+ {intl.formatMessage(messages.seasons, { + seasonCount: request.seasons.length, + })} +
{request.seasons.map((season) => ( = ({ request, onTitleData }) => {
- {request.seasons.length > 0 && ( + {!isMovie(title) && request.seasons.length > 0 && (
- {intl.formatMessage(messages.seasons)} + {intl.formatMessage(messages.seasons, { + seasonCount: + title.seasons.filter((season) => season.seasonNumber !== 0) + .length === request.seasons.length + ? 0 + : request.seasons.length, + })} - {!isMovie(title) && - title.seasons.filter((season) => season.seasonNumber !== 0) + {title.seasons.filter((season) => season.seasonNumber !== 0) .length === request.seasons.length ? ( {intl.formatMessage(messages.all)} diff --git a/src/components/RequestList/RequestItem/index.tsx b/src/components/RequestList/RequestItem/index.tsx index 246076488..418396dc2 100644 --- a/src/components/RequestList/RequestItem/index.tsx +++ b/src/components/RequestList/RequestItem/index.tsx @@ -22,7 +22,7 @@ import RequestModal from '../../RequestModal'; import ConfirmButton from '../../Common/ConfirmButton'; const messages = defineMessages({ - seasons: 'Seasons', + seasons: '{seasonCount, plural, one {Season} other {Seasons}}', all: 'All', notavailable: 'N/A', failedretry: 'Something went wrong while retrying the request.', @@ -190,13 +190,19 @@ const RequestItem: React.FC = ({
- {request.seasons.length > 0 && ( + {!isMovie(title) && request.seasons.length > 0 && (
- {intl.formatMessage(messages.seasons)} + {intl.formatMessage(messages.seasons, { + seasonCount: + title.seasons.filter( + (season) => season.seasonNumber !== 0 + ).length === request.seasons.length + ? 0 + : request.seasons.length, + })} - {!isMovie(title) && - title.seasons.filter((season) => season.seasonNumber !== 0) + {title.seasons.filter((season) => season.seasonNumber !== 0) .length === request.seasons.length ? ( {intl.formatMessage(messages.all)} diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index 5ff9f8cd0..b4bd7667d 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -151,7 +151,7 @@ "components.RequestBlock.profilechanged": "Quality Profile", "components.RequestBlock.requestoverrides": "Request Overrides", "components.RequestBlock.rootfolder": "Root Folder", - "components.RequestBlock.seasons": "Seasons", + "components.RequestBlock.seasons": "{seasonCount, plural, one {Season} other {Seasons}}", "components.RequestBlock.server": "Destination Server", "components.RequestButton.approve4krequests": "Approve {requestCount} 4K {requestCount, plural, one {Request} other {Requests}}", "components.RequestButton.approverequest": "Approve Request", @@ -168,7 +168,7 @@ "components.RequestButton.viewrequest": "View Request", "components.RequestButton.viewrequest4k": "View 4K Request", "components.RequestCard.all": "All", - "components.RequestCard.seasons": "Seasons", + "components.RequestCard.seasons": "{seasonCount, plural, one {Season} other {Seasons}}", "components.RequestCard.status": "Status", "components.RequestList.RequestItem.all": "All", "components.RequestList.RequestItem.areyousure": "Are you sure?", @@ -177,7 +177,7 @@ "components.RequestList.RequestItem.modifieduserdate": "{date} by {user}", "components.RequestList.RequestItem.notavailable": "N/A", "components.RequestList.RequestItem.requested": "Requested", - "components.RequestList.RequestItem.seasons": "Seasons", + "components.RequestList.RequestItem.seasons": "{seasonCount, plural, one {Season} other {Seasons}}", "components.RequestList.RequestItem.status": "Status", "components.RequestList.filterAll": "All", "components.RequestList.filterApproved": "Approved",