feat(ui): display laterality side in zone badges

Pass t() into describeZone and append (G/D or L/R) when z.side is set.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude committed 2026-05-23 22:18:37 +02:00
1 parent 5a19ae1f32
commit 3323d4e45d
1 file changed
+8 -1
@@ -46,6 +46,7 @@ function describeZone(
z: ObservationZone, z: ObservationZone,
bones: Map<string, Bone>, bones: Map<string, Bone>,
locale: Locale, locale: Locale,
t: (key: string) => string,
): string { ): string {
const label = boneLabel(bones.get(z.boneId), locale, z.boneId) const label = boneLabel(bones.get(z.boneId), locale, z.boneId)
if (z.vertebrae?.length) { if (z.vertebrae?.length) {
@@ -54,6 +55,12 @@ function describeZone(
.join(', ') .join(', ')
return `${label} (${vs})` return `${label} (${vs})`
} }
if (z.side) {
const sideLabel = t(
z.side === 'left' ? 'lateral.left_short' : 'lateral.right_short',
)
return `${label} (${sideLabel})`
}
return label return label
} }
@@ -245,7 +252,7 @@ export default function ObservationCard({
return ( return (
<li key={`${z.boneId}-${i}`}> <li key={`${z.boneId}-${i}`}>
<Badge tone="accent" className="gap-2"> <Badge tone="accent" className="gap-2">
{describeZone(z, bones, locale)} {describeZone(z, bones, locale, t)}
{supportsVertebrae && ( {supportsVertebrae && (
<button <button
type="button" type="button"