Files
movie-advisor/components/ui/hint.tsx
T
nerandClaude Opus 5 3dc2ebfe53 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>
2026-08-04 22:09:33 +03:00

48 lines
1.3 KiB
TypeScript

'use client';
import { FC, ReactNode, useState } from 'react';
import { cn } from '@/lib/utils';
interface Props {
lines: string[];
children: ReactNode;
className?: string;
}
const Hint: FC<Props> = ({ lines, children, className }) => {
const [open, setOpen] = useState(false);
return (
<span className={cn('relative z-10 inline-flex', className)}>
<button
type='button'
aria-label={lines.join('. ')}
className='inline-flex cursor-help items-center'
onPointerEnter={({ pointerType }) => pointerType === 'mouse' && setOpen(true)}
onPointerLeave={({ pointerType }) => pointerType === 'mouse' && setOpen(false)}
onClick={() => setOpen((value) => !value)}
onBlur={() => setOpen(false)}
>
{children}
</button>
<span
role='tooltip'
aria-hidden={!open}
className={cn(
'pointer-events-none absolute left-1/2 top-full z-10 mt-1.5 -translate-x-1/2 whitespace-nowrap rounded-md border bg-popover px-2 py-1 text-xs text-popover-foreground shadow-md transition-opacity',
open ? 'opacity-100' : 'opacity-0'
)}
>
{lines.map((line) => (
<span key={line} className='block'>
{line}
</span>
))}
</span>
</span>
);
};
export default Hint;