--- import { getMessages } from '../../i18n/messages.ts'; interface Props { locale: string; /** Unique per diagram on the page; prefixes ids inside the SVG. */ uid: string; } const { locale, uid } = Astro.props; const t = getMessages(locale); const arrowId = `${uid}-pfo-arrow`; // Long labels do not fit their place on one line: split them in two at a word boundary. // A one-word label leaves the second line empty, and it is then not rendered. function twoLines(label: string): [string, string] { const words = label.split(' '); const split = Math.ceil(words.length / 2); return [words.slice(0, split).join(' '), words.slice(split).join(' ')]; } const secundumLines = twoLines(t['diagram.label.septum-secundum']); const primumLines = twoLines(t['diagram.label.septum-primum']); const strainingLines = twoLines(t['diagram.label.shunt-on-straining']); // A close-up of the two atria with the septum between them; the right atrium is on the viewer's // left. Normal: one septum with a shallow oval depression (the fossa ovalis) on the right atrial // side. Patent foramen ovale: the septum is two overlapping layers, the septum secundum above on // the right atrial side and the septum primum below on the left atrial side, with a narrow slanted // slit between them that is usually closed. A dashed arrow shows that blood may pass from right to // left on straining. There is no round hole in the middle and the chambers keep their size: that // would be an atrial septal defect, a separate diagram. const septum = { left: 196, right: 224, top: 50, bottom: 270 }; // The slit runs up and to the left atrium: it opens into the right atrium at its lower end and // into the left atrium at its upper end. The gap is a little wider than the thin dashed arrow // through it, so the slit stays visible with the arrow drawn. const slitRa = { x: septum.left, y: 188 }; const slitLa = { x: septum.right, y: 124 }; const gap = 10; const secundum = `${septum.left},${septum.top} ${septum.right},${septum.top} ${slitLa.x},${slitLa.y - gap / 2} ${slitRa.x},${slitRa.y - gap / 2}`; const primum = `${septum.left},${septum.bottom} ${septum.right},${septum.bottom} ${slitLa.x},${slitLa.y + gap / 2} ${slitRa.x},${slitRa.y + gap / 2}`; const shuntPath = `M150,206 L${slitRa.x - 2},${slitRa.y} L${slitLa.x + 2},${slitLa.y} L258,116`; --- {t['diagram.label.fossa-ovalis']} {secundumLines[0]} {secundumLines[1] && ( {secundumLines[1]} )} {primumLines[0]} {primumLines[1] && ( {primumLines[1]} )} {strainingLines[0]} {strainingLines[1] && ( {strainingLines[1]} )} {t['diagram.label.interatrial-septum']} {t['diagram.label.ra']} {t['diagram.label.la']}