--- 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 arrow = `${uid}-taa-arrow`; // Long labels do not fit their free space on one line: split them in two at a word boundary. // A one-word label stays on one line. 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 ascendingLines = twoLines(t['diagram.label.ascending-aorta']); const descendingLines = twoLines(t['diagram.label.descending-aorta']); const aneurysmLines = twoLines(t['diagram.label.aneurysm']); // The thoracic aorta as in the coarctation diagram: it leaves the left ventricle (the root), // runs up (the ascending aorta), turns in the arch with its three branches and runs down (the // descending thoracic aorta). Vessels are wide strokes: the wall, then the lumen on top of it. const arch = 'L170,120 Q170,70 220,70 L300,70 Q350,70 350,120 L350,355'; // The wall starts at the top of the ventricle; the lumen reaches into its cavity. const aortaWall = `M170,250 ${arch}`; const aortaLumen = `M170,266 ${arch}`; const branches = [230, 262, 294]; // Aneurysm: the tubular ascending aorta above the root widens all round; the root (below y=212) // and the rest of the aorta keep their normal width. Outer edge of the wall, then the lumen 4 // units inside it. const sacWall = 'M153,212 C153,194 141,186 141,168 C141,150 153,142 153,124 L187,124 C187,142 199,150 199,168 C199,186 187,194 187,212 Z'; const sacLumen = 'M157,212 C157,195 145,186 145,168 C145,150 157,141 157,124 L183,124 C183,141 195,150 195,168 C195,186 183,195 183,212 Z'; // Blood flows the same way in both states: the aneurysm widens the vessel, it does not block it. const flow = { main: 'M170,240 L170,120 Q170,70 220,70 L300,70 Q350,70 350,120 L350,322', branch: (x: number) => `M${x},58 L${x},16`, }; --- {branches.map((x) => ( ))} {branches.map((x) => ( ))} {branches.map((x) => ( ))} {branches.map((x) => ( ))} {t['diagram.label.lv']} {t['diagram.label.aortic-root']} {ascendingLines[0]} {ascendingLines[1] && ( {ascendingLines[1]} )} {t['diagram.label.aortic-arch']} {descendingLines[0]} {descendingLines[1] && ( {descendingLines[1]} )} {aneurysmLines[0]} {aneurysmLines[1] && ( {aneurysmLines[1]} )}