--- 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 arrowV = `${uid}-tof-arrow-v`; const arrowA = `${uid}-tof-arrow-a`; // Labels too long for one line in the label column are split in two. 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 outflowLines = twoLines(t['diagram.label.rv-outflow-narrowing']); const widenedLines = twoLines(t['diagram.label.rv-outflow-widened']); const backflowLines = twoLines(t['diagram.label.pulmonary-backflow']); // Paths of the blood, shared by the arrows and the moving dashes on top of them. The heart is // drawn in its own coordinates and shifted right by 160; labels sit in the free column on the left. const flow = { // Normal: the right ventricle empties into a wide pulmonary artery, the left into the aorta. toPulmonary: 'M100,282 L100,46', toAorta: 'M225,282 L225,44', // Tetralogy: a thin stream through the narrowed outflow, and venous blood crossing the defect // into the aorta, which sits over the septum, next to the blood from the left ventricle. toPulmonaryNarrow: 'M105,262 L105,46', shunt: 'M130,262 Q150,215 158,170 L158,44', toOverridingAorta: 'M235,270 Q185,230 180,170 L180,44', // After repair: the patch over the defect leads the left ventricle into the aorta, and the // widened outflow lets the right ventricle empty into the pulmonary artery. Blood may leak back // from the pulmonary artery into the right ventricle (pulmonary regurgitation). toPulmonaryRepaired: 'M100,262 L100,46', toAortaRepaired: 'M232,270 Q184,236 172,190 L170,44', backflow: 'M116,60 L116,206', }; --- {t['diagram.label.rv']} {t['diagram.label.rv']} {t['diagram.label.rv']} {t['diagram.label.lv']} {t['diagram.label.aorta']} {t['diagram.label.overriding-aorta']} {t['diagram.label.aorta']} {t['diagram.label.septum']} {t['diagram.label.defect']} {t['diagram.label.vsd-patch']} {t['diagram.label.pulmonaryArtery']} {outflowLines[0]} {outflowLines[1]} {t['diagram.label.rv-hypertrophy']} {widenedLines[0]} {widenedLines[1]} {backflowLines[0]} {backflowLines[1]}