import type { FC } from 'react' import type { Translation, EditorialInfo } from '../lib/api.ts' import { STATUS_LABELS, STATUS_VARIANTS } from '../lib/editorial.ts' import { RetroBadge } from './retro' interface Props { translation: Translation | null editorial: EditorialInfo visible: boolean /** Active layers from profile — controls which languages are shown */ activeLayers?: string[] } const TranslationPanel: FC = ({ translation, editorial, visible, activeLayers }) => { if (!visible) return null const showFr = !activeLayers || activeLayers.includes('translation_fr') const showEn = !activeLayers || activeLayers.includes('translation_en') return (
Traduction {STATUS_LABELS[editorial.status]}
{showFr && (
FR
{translation?.fr ? (

{translation.fr}

) : (

Traduction FR non disponible.

)}
)} {showEn && (
EN
{translation?.en ? (

{translation.en}

) : (

Traduction EN non disponible.

)}
)} {!showFr && !showEn && (

Aucune couche de traduction active.

)}
) } export default TranslationPanel