import { useEffect, useRef } from 'react'; import { useTranslation } from '../../i18n'; import { fs } from '../shared/DialogShell'; import { PHOTO_CREDITS, PUBLIC_DOMAIN, commonsPage, creditTitle, licenseDeed, type PhotoCredit, } from './demoCreditsModel'; type Translate = ReturnType['t']; const LINK = 'underline decoration-edge underline-offset-2 hover:text-content'; /** One photo: its title linking to its page on Commons, who took it, and its license linking to the deed. */ function CreditRow({ credit, t }: { credit: PhotoCredit; t: Translate }) { const deed = licenseDeed(credit.license); const license = credit.license === PUBLIC_DOMAIN ? t('demo.credits.publicDomain') : credit.license; return (
  • {creditTitle(credit.file)} {t('demo.credits.by', { author: credit.author })} {deed ? ( {license} ) : ( {license} )}
  • ); } /** * The credits for the demo's photos, the welcome dialog's second view. Its own * chunk, loaded when a visitor opens it: only a demo instance shows the * welcome, and few visitors open its credits. */ export default function DemoCredits() { const { t } = useTranslation(); const intro = useRef(null); // The dialog's body keeps the welcome's scroll position when the credits // take its place; they start at their top. useEffect(() => { intro.current?.scrollIntoView({ block: 'nearest' }); }, []); return ( <>

    {t('demo.credits.intro')}

    ); }