--- 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}-coa-arrow`; // Long labels do not fit their free space on one line: split them in two at a word boundary. 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 subclavianLines = twoLines(t['diagram.label.left-subclavian']); const headLines = twoLines(t['diagram.label.to-head-and-arms']); const legsLines = twoLines(t['diagram.label.to-abdomen-and-legs']); const hypertrophyLines = twoLines(t['diagram.label.lv-hypertrophy']); const reducedLines = twoLines(t['diagram.label.reduced-blood-flow']); const repairedLines = twoLines(t['diagram.label.repaired-narrowing']); // The full stream down the aorta shows normally and after treatment. const fullFlow = [{ class: 'normal-only' }, { 'data-only': 'treated' }]; // The aorta runs up from the left ventricle, turns in an arch and goes down. The three branches // to the head and arms leave the top of the arch; the last one is the left subclavian artery. const arch = 'L110,120 Q110,70 160,70 L250,70 Q300,70 300,120 L300,355'; // The wall starts at the top of the ventricle; the lumen reaches into its cavity. const aortaWall = `M110,250 ${arch}`; const aortaLumen = `M110,266 ${arch}`; const branches = [150, 195, 240]; const flow = { // Normal: one stream round the arch and down the descending aorta, and one up each branch. main: 'M110,240 L110,120 Q110,70 160,70 L250,70 Q300,70 300,120 L300,322', // Coarctation: the same stream up to the narrowing, and a thin one below it. aboveNarrowing: 'M110,240 L110,120 Q110,70 160,70 L250,70 Q300,70 300,104', belowNarrowing: 'M300,104 L300,322', branch: (x: number) => `M${x},58 L${x},16`, }; --- {[{ class: 'disease-only' }, { 'data-only': 'treated' }].map((only) => ( ))} {branches.map((x) => ( ))} {branches.map((x) => ( ))} {branches.map((x) => ( ))} {fullFlow.map((only) => ( ))} {branches.map((x) => ( ))} {fullFlow.map((only) => ( ))} {t['diagram.label.lv']} {t['diagram.label.aorta']} {headLines[0]} {headLines[1]} {subclavianLines[0]} {subclavianLines[1]} {legsLines[0]} {legsLines[1]} {t['diagram.label.high-pressure']} {t['diagram.label.aortic-narrowing']} {repairedLines[0]} {repairedLines[1]} {reducedLines[0]} {reducedLines[1]} {hypertrophyLines[0]} {hypertrophyLines[1]}