mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat(ui): add 'show more/less...' for studios on movie details page (#1770)
This commit is contained in:

committed by
GitHub

parent
57b52fc9cc
commit
680ea0c87a
@@ -6,6 +6,8 @@ import {
|
|||||||
} from '@heroicons/react/outline';
|
} from '@heroicons/react/outline';
|
||||||
import {
|
import {
|
||||||
CheckCircleIcon,
|
CheckCircleIcon,
|
||||||
|
ChevronDoubleDownIcon,
|
||||||
|
ChevronDoubleUpIcon,
|
||||||
DocumentRemoveIcon,
|
DocumentRemoveIcon,
|
||||||
ExternalLinkIcon,
|
ExternalLinkIcon,
|
||||||
} from '@heroicons/react/solid';
|
} from '@heroicons/react/solid';
|
||||||
@@ -73,6 +75,8 @@ const messages = defineMessages({
|
|||||||
play4konplex: 'Play in 4K on Plex',
|
play4konplex: 'Play in 4K on Plex',
|
||||||
markavailable: 'Mark as Available',
|
markavailable: 'Mark as Available',
|
||||||
mark4kavailable: 'Mark as Available in 4K',
|
mark4kavailable: 'Mark as Available in 4K',
|
||||||
|
showmore: 'Show More',
|
||||||
|
showless: 'Show Less',
|
||||||
});
|
});
|
||||||
|
|
||||||
interface MovieDetailsProps {
|
interface MovieDetailsProps {
|
||||||
@@ -86,6 +90,8 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
|||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { locale } = useLocale();
|
const { locale } = useLocale();
|
||||||
const [showManager, setShowManager] = useState(false);
|
const [showManager, setShowManager] = useState(false);
|
||||||
|
const minStudios = 3;
|
||||||
|
const [showMoreStudios, setShowMoreStudios] = useState(false);
|
||||||
|
|
||||||
const { data, error, revalidate } = useSWR<MovieDetailsType>(
|
const { data, error, revalidate } = useSWR<MovieDetailsType>(
|
||||||
`/api/v1/movie/${router.query.movieId}`,
|
`/api/v1/movie/${router.query.movieId}`,
|
||||||
@@ -111,6 +117,7 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
|||||||
return <Error statusCode={404} />;
|
return <Error statusCode={404} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showAllStudios = data.productionCompanies.length <= minStudios + 1;
|
||||||
const mediaLinks: PlayButtonLink[] = [];
|
const mediaLinks: PlayButtonLink[] = [];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -627,16 +634,44 @@ const MovieDetails: React.FC<MovieDetailsProps> = ({ movie }) => {
|
|||||||
})}
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="media-fact-value">
|
<span className="media-fact-value">
|
||||||
{data.productionCompanies.map((s) => {
|
{data.productionCompanies
|
||||||
return (
|
.slice(
|
||||||
<Link
|
0,
|
||||||
href={`/discover/movies/studio/${s.id}`}
|
showAllStudios || showMoreStudios
|
||||||
key={`studio-${s.id}`}
|
? data.productionCompanies.length
|
||||||
>
|
: minStudios
|
||||||
<a className="block">{s.name}</a>
|
)
|
||||||
</Link>
|
.map((s) => {
|
||||||
);
|
return (
|
||||||
})}
|
<Link
|
||||||
|
href={`/discover/movies/studio/${s.id}`}
|
||||||
|
key={`studio-${s.id}`}
|
||||||
|
>
|
||||||
|
<a className="block">{s.name}</a>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
{!showAllStudios && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setShowMoreStudios(!showMoreStudios);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="flex items-center">
|
||||||
|
{intl.formatMessage(
|
||||||
|
!showMoreStudios
|
||||||
|
? messages.showmore
|
||||||
|
: messages.showless
|
||||||
|
)}
|
||||||
|
{!showMoreStudios ? (
|
||||||
|
<ChevronDoubleDownIcon className="w-4 h-4 ml-1" />
|
||||||
|
) : (
|
||||||
|
<ChevronDoubleUpIcon className="w-4 h-4 ml-1" />
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@@ -83,6 +83,8 @@
|
|||||||
"components.MovieDetails.releasedate": "Release Date",
|
"components.MovieDetails.releasedate": "Release Date",
|
||||||
"components.MovieDetails.revenue": "Revenue",
|
"components.MovieDetails.revenue": "Revenue",
|
||||||
"components.MovieDetails.runtime": "{minutes} minutes",
|
"components.MovieDetails.runtime": "{minutes} minutes",
|
||||||
|
"components.MovieDetails.showless": "Show Less",
|
||||||
|
"components.MovieDetails.showmore": "Show More",
|
||||||
"components.MovieDetails.similar": "Similar Titles",
|
"components.MovieDetails.similar": "Similar Titles",
|
||||||
"components.MovieDetails.studio": "{studioCount, plural, one {Studio} other {Studios}}",
|
"components.MovieDetails.studio": "{studioCount, plural, one {Studio} other {Studios}}",
|
||||||
"components.MovieDetails.viewfullcrew": "View Full Crew",
|
"components.MovieDetails.viewfullcrew": "View Full Crew",
|
||||||
|
@@ -160,7 +160,8 @@ ul.media-crew > li {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.crew-name,
|
a.crew-name,
|
||||||
.media-fact-value a {
|
.media-fact-value a,
|
||||||
|
.media-fact-value button {
|
||||||
@apply font-normal text-gray-400 transition duration-300 hover:underline hover:text-gray-100;
|
@apply font-normal text-gray-400 transition duration-300 hover:underline hover:text-gray-100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,11 +174,11 @@ a.crew-name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
.media-fact {
|
.media-fact {
|
||||||
@apply flex px-4 py-2 border-b border-gray-700 last:border-b-0;
|
@apply flex justify-between px-4 py-2 border-b border-gray-700 last:border-b-0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-fact-value {
|
.media-fact-value {
|
||||||
@apply flex-1 text-sm font-normal text-right text-gray-400;
|
@apply text-sm font-normal text-right text-gray-400;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-ratings {
|
.media-ratings {
|
||||||
|
Reference in New Issue
Block a user