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:
nerandClaude Opus 5 committed 2026-08-04 22:09:33 +03:00
1 parent 6fc41c0901
commit 3dc2ebfe53
22 files changed
+342 -108

No files matched your search

@@ -0,0 +1,65 @@
'use client';
import { FC, useEffect, useRef, useState } from 'react';
import { cn } from '@/lib/utils';
interface Props {
text: string;
}
const Biography: FC<Props> = ({ text }) => {
const [open, setOpen] = useState(false);
const [overflows, setOverflows] = useState(false);
const textRef = useRef<HTMLParagraphElement>(null);
useEffect(() => {
const element = textRef.current;
if (!element) return;
const measure = () => setOverflows(element.scrollHeight > element.clientHeight + 1);
measure();
const observer = new ResizeObserver(measure);
observer.observe(element);
return () => observer.disconnect();
}, [text]);
if (!text) return null;
return (
<div
className='relative z-10 grow animate-fade-aside-slide-in opacity-0 md:min-h-0'
onPointerEnter={({ pointerType }) => pointerType === 'mouse' && overflows && setOpen(true)}
onPointerLeave={({ pointerType }) => pointerType === 'mouse' && setOpen(false)}
>
<div className='flex flex-col md:absolute md:inset-0'>
<p ref={textRef} className='min-h-0 grow whitespace-pre-line md:overflow-hidden'>
{text}
</p>
{overflows && (
<span className='pointer-events-none absolute inset-x-0 bottom-0 h-16 bg-gradient-to-b from-transparent to-background' />
)}
</div>
{overflows && (
<div
role='tooltip'
aria-hidden={!open}
className={cn(
'absolute inset-x-0 top-0 hidden max-h-[70vh] overflow-y-auto rounded-lg border bg-popover p-3 text-popover-foreground shadow-md transition-opacity md:block',
open ? 'opacity-100' : 'pointer-events-none opacity-0'
)}
>
<p className='whitespace-pre-line'>{text}</p>
</div>
)}
</div>
);
};
export default Biography;
@@ -0,0 +1,52 @@
import { FC } from 'react';
import { Skeleton } from '@/components/ui/skeleton';
import { cn } from '@/lib/utils';
const PARAGRAPHS = [
['w-full', 'w-full', 'w-10/12'],
['w-full', 'w-full', 'w-full', 'w-4/5'],
['w-full', 'w-full', 'w-3/4'],
['w-full', 'w-2/3']
];
const POSTERS = Array.from({ length: 8 }, (_, index) => index);
const PersonSkeleton: FC = () => (
<div className='flex flex-1 flex-col'>
<div className='flex flex-col gap-2 md:flex-row'>
<Skeleton className='card-aspect-ratio static-aspect-ratio mx-auto rounded-lg' />
<div className='flex grow flex-col'>
<Skeleton className='mb-4 h-9 w-72 max-w-full' />
<div className='mb-4 flex w-full flex-wrap gap-5'>
<Skeleton className='h-5 w-20' />
<Skeleton className='h-5 w-28' />
<Skeleton className='h-5 w-56 max-w-full' />
</div>
<div className='flex grow flex-col gap-5 overflow-hidden md:min-h-0'>
{PARAGRAPHS.map((lines, paragraph) => (
<div key={paragraph} className='flex shrink-0 flex-col gap-2'>
{lines.map((width, line) => (
<Skeleton key={line} className={cn('h-4', width)} />
))}
</div>
))}
</div>
</div>
</div>
<div className='mt-5'>
<Skeleton className='mb-3 h-7 w-36' />
<div className='flex flex-wrap justify-center gap-2'>
{POSTERS.map((index) => (
<Skeleton key={index} className={cn('card-aspect-ratio rounded-lg', { 'hidden md:block': index >= 2 })} />
))}
</div>
</div>
</div>
);
export default PersonSkeleton;
+65
View File
@@ -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;
+7
View File
@@ -0,0 +1,7 @@
import { useQuery } from '@tanstack/react-query';
import personQuery, { PersonQueryProps } from '@/data/queries/person';
const useProfile = ({ personId }: PersonQueryProps) => useQuery(personQuery({ personId }));
export default useProfile;