fix(frontend): always show request modal option for tv

pull/175/head
sct 4 years ago
parent a99705f6a5
commit 2b46268824

@ -328,6 +328,12 @@ const TvRequestModal: React.FC<RequestModalProps> = ({
MediaRequestStatus.AVAILABLE && ( MediaRequestStatus.AVAILABLE && (
<Badge badgeType="success">Available</Badge> <Badge badgeType="success">Available</Badge>
)} )}
{mediaSeason?.status ===
MediaStatus.PARTIALLY_AVAILABLE && (
<Badge badgeType="success">
Partially Available
</Badge>
)}
{mediaSeason?.status === MediaStatus.AVAILABLE && ( {mediaSeason?.status === MediaStatus.AVAILABLE && (
<Badge badgeType="success">Available</Badge> <Badge badgeType="success">Available</Badge>
)} )}

@ -97,7 +97,8 @@ const TitleCard: React.FC<TitleCardProps> = ({
right: '-1px', right: '-1px',
}} }}
> >
{currentStatus === MediaStatus.AVAILABLE && ( {(currentStatus === MediaStatus.AVAILABLE ||
currentStatus === MediaStatus.PARTIALLY_AVAILABLE) && (
<Available className="rounded-tr-md" /> <Available className="rounded-tr-md" />
)} )}
{currentStatus === MediaStatus.PENDING && ( {currentStatus === MediaStatus.PENDING && (
@ -256,7 +257,8 @@ const TitleCard: React.FC<TitleCardProps> = ({
</svg> </svg>
</button> </button>
)} )}
{currentStatus === MediaStatus.AVAILABLE && ( {(currentStatus === MediaStatus.AVAILABLE ||
currentStatus === MediaStatus.PARTIALLY_AVAILABLE) && (
<button className="w-full h-7 text-center text-white bg-green-400 rounded-sm ml-2"> <button className="w-full h-7 text-center text-white bg-green-400 rounded-sm ml-2">
<svg <svg
className="w-4 mx-auto" className="w-4 mx-auto"

@ -175,91 +175,89 @@ const TvDetails: React.FC<TvDetailsProps> = ({ tv }) => {
<FormattedMessage {...messages.request} /> <FormattedMessage {...messages.request} />
</Button> </Button>
)} )}
{data.mediaInfo && {data.mediaInfo && data.mediaInfo.status !== MediaStatus.UNKNOWN && (
data.mediaInfo.status !== MediaStatus.UNKNOWN && <ButtonWithDropdown
data.mediaInfo.status !== MediaStatus.AVAILABLE && ( dropdownIcon={
<ButtonWithDropdown <svg
dropdownIcon={ className="w-5 h-5"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z"
clipRule="evenodd"
/>
</svg>
}
text={
<>
<svg <svg
className="w-5 h-5" className="w-4 mr-1"
fill="currentColor" fill="currentColor"
viewBox="0 0 20 20" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
> >
<path <path
fillRule="evenodd" fillRule="evenodd"
d="M11.3 1.046A1 1 0 0112 2v5h4a1 1 0 01.82 1.573l-7 10A1 1 0 018 18v-5H4a1 1 0 01-.82-1.573l7-10a1 1 0 011.12-.38z" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
clipRule="evenodd" clipRule="evenodd"
/> />
</svg> </svg>
} <FormattedMessage {...messages.requestmore} />
text={ </>
}
onClick={() => setShowRequestModal(true)}
>
{hasPermission(Permission.MANAGE_REQUESTS) &&
activeRequests &&
activeRequests.length > 0 && (
<> <>
<svg <ButtonWithDropdown.Item
className="w-4 mr-1" onClick={() => modifyRequests('approve')}
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
> >
<path <svg
fillRule="evenodd" className="w-4 mr-1"
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" fill="currentColor"
clipRule="evenodd" viewBox="0 0 20 20"
/> xmlns="http://www.w3.org/2000/svg"
</svg>
<FormattedMessage {...messages.requestmore} />
</>
}
onClick={() => setShowRequestModal(true)}
>
{hasPermission(Permission.MANAGE_REQUESTS) &&
activeRequests &&
activeRequests.length > 0 && (
<>
<ButtonWithDropdown.Item
onClick={() => modifyRequests('approve')}
> >
<svg <path
className="w-4 mr-1" fillRule="evenodd"
fill="currentColor" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
viewBox="0 0 20 20" clipRule="evenodd"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule="evenodd"
/>
</svg>
<FormattedMessage
{...messages.approverequests}
values={{ requestCount: activeRequests.length }}
/> />
</ButtonWithDropdown.Item> </svg>
<ButtonWithDropdown.Item <FormattedMessage
onClick={() => modifyRequests('decline')} {...messages.approverequests}
values={{ requestCount: activeRequests.length }}
/>
</ButtonWithDropdown.Item>
<ButtonWithDropdown.Item
onClick={() => modifyRequests('decline')}
>
<svg
className="w-4 mr-1"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg"
> >
<svg <path
className="w-4 mr-1" fillRule="evenodd"
fill="currentColor" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
viewBox="0 0 20 20" clipRule="evenodd"
xmlns="http://www.w3.org/2000/svg"
>
<path
fillRule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clipRule="evenodd"
/>
</svg>
<FormattedMessage
{...messages.declinerequests}
values={{ requestCount: activeRequests.length }}
/> />
</ButtonWithDropdown.Item> </svg>
</> <FormattedMessage
)} {...messages.declinerequests}
</ButtonWithDropdown> values={{ requestCount: activeRequests.length }}
)} />
</ButtonWithDropdown.Item>
</>
)}
</ButtonWithDropdown>
)}
{hasPermission(Permission.MANAGE_REQUESTS) && ( {hasPermission(Permission.MANAGE_REQUESTS) && (
<Button buttonType="default" className="ml-2"> <Button buttonType="default" className="ml-2">
<svg <svg

Loading…
Cancel
Save