feat: replace the starring page with a person page
A credit now opens /person/{id}: portrait, name, department, life dates and
birthplace, the biography, and the full filmography ranked by vote count.
One request carries all of it — combined_credits rides along on the person
call — so the discover based starring query and its with_people filter go.
The biography fills whatever height the portrait leaves and fades where it
is cut, with the whole text in a tooltip on hover; a phone has no height to
respect there, so it simply runs on.
Route level and query level skeletons stand in while it loads, built from
the shadcn primitive.
Development server side fetches go over the loopback rather than SITE_URL,
which is a LAN address meant for other devices: once that address moves the
fetch hangs until undici times out, ten seconds per navigation.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6fc41c0901
commit
3dc2ebfe53
22 files changed
+342
-108
No files matched your search
@@ -0,0 +1,65 @@
|
||||
'use client';
|
||||
|
||||
import { FC } from 'react';
|
||||
|
||||
import List from '@/components/List';
|
||||
import NoResults from '@/components/NoResults';
|
||||
import { formatDate } from '@/lib/utils';
|
||||
|
||||
import Biography from './components/Biography';
|
||||
import PersonSkeleton from './components/Skeleton';
|
||||
import useProfile from './useProfile';
|
||||
|
||||
interface Props {
|
||||
personId: string;
|
||||
}
|
||||
|
||||
const lifespan = ({ birthday, deathday }: Profile) => {
|
||||
if (!birthday) return '';
|
||||
|
||||
return deathday ? `${formatDate(birthday)} — ${formatDate(deathday)}` : formatDate(birthday);
|
||||
};
|
||||
|
||||
const Person: FC<Props> = ({ personId }) => {
|
||||
const { data: profile, isError } = useProfile({ personId });
|
||||
|
||||
if (isError) return <NoResults />;
|
||||
|
||||
if (!profile) return <PersonSkeleton />;
|
||||
|
||||
const dates = lifespan(profile);
|
||||
|
||||
return (
|
||||
<div className='flex flex-1 flex-col'>
|
||||
<div className='flex flex-col gap-2 md:flex-row'>
|
||||
{Boolean(profile.photo) && (
|
||||
<div className='card-aspect-ratio static-aspect-ratio relative mx-auto overflow-hidden rounded-lg bg-black'>
|
||||
<img className='size-full object-cover' src={profile.photo} alt={profile.name} />
|
||||
</div>
|
||||
)}
|
||||
<div className='flex grow flex-col bg-background'>
|
||||
<span className='mb-4 text-3xl'>{profile.name}</span>
|
||||
|
||||
<div className='mb-4 flex w-full flex-wrap gap-5 whitespace-nowrap text-sm'>
|
||||
{Boolean(profile.department) && <span>{profile.department}</span>}
|
||||
{Boolean(dates) && <span>{dates}</span>}
|
||||
{Boolean(profile.birthplace) && <span className='whitespace-normal'>{profile.birthplace}</span>}
|
||||
</div>
|
||||
|
||||
<Biography text={profile.biography} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{Boolean(profile.shows.length) && (
|
||||
<div className='mt-5'>
|
||||
<span className='mb-3 inline-block text-lg'>Filmography</span>
|
||||
<List shows={profile.shows} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!profile.shows.length && <NoResults />}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Person;
|
||||
Reference in new issue
Block a user