Spaces:
Build error
Build error
File size: 2,060 Bytes
eec7490 9097545 80f9a97 eec7490 4002561 eec7490 4002561 eec7490 4002561 eec7490 80f9a97 4002561 80f9a97 eec7490 80f9a97 eec7490 4002561 eec7490 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 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<Props> = ({ translation, editorial, visible, activeLayers }) => {
if (!visible) return null
const showFr = !activeLayers || activeLayers.includes('translation_fr')
const showEn = !activeLayers || activeLayers.includes('translation_en')
return (
<div className="p-2">
<div className="flex items-center justify-between mb-2">
<span className="text-retro-xs font-bold">Traduction</span>
<RetroBadge variant={STATUS_VARIANTS[editorial.status]}>
{STATUS_LABELS[editorial.status]}
</RetroBadge>
</div>
{showFr && (
<div className="mb-2">
<div className="text-retro-xs font-bold text-retro-darkgray mb-1">FR</div>
{translation?.fr ? (
<p className="text-retro-sm whitespace-pre-wrap font-retro leading-relaxed">
{translation.fr}
</p>
) : (
<p className="text-retro-sm text-retro-darkgray">Traduction FR non disponible.</p>
)}
</div>
)}
{showEn && (
<div>
<div className="text-retro-xs font-bold text-retro-darkgray mb-1">EN</div>
{translation?.en ? (
<p className="text-retro-sm whitespace-pre-wrap font-retro leading-relaxed">
{translation.en}
</p>
) : (
<p className="text-retro-sm text-retro-darkgray">Traduction EN non disponible.</p>
)}
</div>
)}
{!showFr && !showEn && (
<p className="text-retro-sm text-retro-darkgray">Aucune couche de traduction active.</p>
)}
</div>
)
}
export default TranslationPanel
|