Skip to content

Commit

Permalink
fix(ui): display "Season" vs. "Seasons" as appropriate, and fix reque…
Browse files Browse the repository at this point in the history
…st block "Seasons" formatting (#1127)
  • Loading branch information
TheCatLady committed Mar 10, 2021
1 parent 84ef40e commit 45886cc
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
22 changes: 13 additions & 9 deletions src/components/RequestBlock/index.tsx
Expand Up @@ -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',
Expand Down Expand Up @@ -65,12 +65,12 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
setShowEditModal(false);
}}
/>
<div className="px-4 py-4">
<div className="px-4 py-4 text-gray-300">
<div className="flex items-center justify-between">
<div className="flex-col items-center flex-1 min-w-0 mr-6 text-sm leading-5 text-gray-300">
<div className="flex-col items-center flex-1 min-w-0 mr-6 text-sm leading-5">
<div className="flex mb-1 flex-nowrap white">
<svg
className="min-w-0 flex-shrink-0 mr-1.5 h-5 w-5 text-gray-300"
className="min-w-0 flex-shrink-0 mr-1.5 h-5 w-5"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -88,7 +88,7 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
{request.modifiedBy && (
<div className="flex flex-nowrap">
<svg
className="flex-shrink-0 mr-1.5 h-5 w-5 text-gray-300"
className="flex-shrink-0 mr-1.5 h-5 w-5"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
Expand Down Expand Up @@ -191,7 +191,7 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
</div>
<div className="mt-2 sm:flex sm:justify-between">
<div className="sm:flex">
<div className="flex items-center mr-6 text-sm leading-5 text-gray-300">
<div className="flex items-center mr-6 text-sm leading-5">
{request.is4k && (
<span className="mr-1">
<Badge badgeType="warning">4K</Badge>
Expand All @@ -214,9 +214,9 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
)}
</div>
</div>
<div className="flex items-center mt-2 text-sm leading-5 text-gray-300 sm:mt-0">
<div className="flex items-center mt-2 text-sm leading-5 sm:mt-0">
<svg
className="flex-shrink-0 mr-1.5 h-5 w-5 text-gray-300"
className="flex-shrink-0 mr-1.5 h-5 w-5"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
Expand All @@ -234,7 +234,11 @@ const RequestBlock: React.FC<RequestBlockProps> = ({ request, onUpdate }) => {
</div>
{(request.seasons ?? []).length > 0 && (
<div className="flex flex-col mt-2 text-sm">
<div className="mb-2">{intl.formatMessage(messages.seasons)}</div>
<div className="mb-1 font-medium">
{intl.formatMessage(messages.seasons, {
seasonCount: request.seasons.length,
})}
</div>
<div>
{request.seasons.map((season) => (
<span
Expand Down
15 changes: 10 additions & 5 deletions src/components/RequestCard/index.tsx
Expand Up @@ -21,7 +21,7 @@ import StatusBadge from '../StatusBadge';

const messages = defineMessages({
status: 'Status',
seasons: 'Seasons',
seasons: '{seasonCount, plural, one {Season} other {Seasons}}',
all: 'All',
});

Expand Down Expand Up @@ -129,13 +129,18 @@ const RequestCard: React.FC<RequestCardProps> = ({ request, onTitleData }) => {
</a>
</Link>
</div>
{request.seasons.length > 0 && (
{!isMovie(title) && request.seasons.length > 0 && (
<div className="sm:flex items-center my-0.5 sm:my-1 text-sm hidden">
<span className="mr-2 font-medium">
{intl.formatMessage(messages.seasons)}
{intl.formatMessage(messages.seasons, {
seasonCount:
title.seasons.filter((season) => season.seasonNumber !== 0)
.length === request.seasons.length
? 0
: request.seasons.length,
})}
</span>
{!isMovie(title) &&
title.seasons.filter((season) => season.seasonNumber !== 0)
{title.seasons.filter((season) => season.seasonNumber !== 0)
.length === request.seasons.length ? (
<span className="mr-2 uppercase">
<Badge>{intl.formatMessage(messages.all)}</Badge>
Expand Down
16 changes: 11 additions & 5 deletions src/components/RequestList/RequestItem/index.tsx
Expand Up @@ -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.',
Expand Down Expand Up @@ -190,13 +190,19 @@ const RequestItem: React.FC<RequestItemProps> = ({
</a>
</Link>
</div>
{request.seasons.length > 0 && (
{!isMovie(title) && request.seasons.length > 0 && (
<div className="card-field">
<span className="card-field-name">
{intl.formatMessage(messages.seasons)}
{intl.formatMessage(messages.seasons, {
seasonCount:
title.seasons.filter(
(season) => season.seasonNumber !== 0
).length === request.seasons.length
? 0
: request.seasons.length,
})}
</span>
{!isMovie(title) &&
title.seasons.filter((season) => season.seasonNumber !== 0)
{title.seasons.filter((season) => season.seasonNumber !== 0)
.length === request.seasons.length ? (
<span className="mr-2 uppercase">
<Badge>{intl.formatMessage(messages.all)}</Badge>
Expand Down
6 changes: 3 additions & 3 deletions src/i18n/locale/en.json
Expand Up @@ -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",
Expand All @@ -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?",
Expand All @@ -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",
Expand Down

0 comments on commit 45886cc

Please sign in to comment.