--- 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}-ta-arrow-v`; const arrowA = `${uid}-ta-arrow-a`; const arrowMix = `${uid}-ta-arrow-mix`; const mixFill = `${uid}-ta-mix`; // 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 valveLines = twoLines(t['diagram.label.truncal-valve']); const lungFlowLines = twoLines(t['diagram.label.much-blood-to-lungs']); const mixedLines = twoLines(t['diagram.label.mixed-blood']); // The heart is drawn in its own coordinates and shifted right by 160, as in the tetralogy // diagram; labels sit in the free column on the left. Vessels are tubes: a wide stroke in the wall // colour under a narrower one in the blood colour, so branches join without seams. const vessel = { // Normal: a pulmonary trunk from the right ventricle that divides into two pulmonary arteries, // and a separate aorta from the left ventricle. pulmonaryTrunk: 'M100,176 V84', pulmonaryBranches: ['M100,100 L72,38', 'M100,100 L122,38'], aorta: 'M225,176 V26', // Truncus arteriosus, type I (Минздрав 737_2, 1.5; MSD): one wide trunk over the defect, with a // short pulmonary segment leaving it above the valve and dividing into two pulmonary arteries. trunk: 'M166,176 V26', // The segment and the left branch are one path so that the bend has no seam. pulmonary: ['M160,122 L104,100 L68,32', 'M104,100 L120,34'], }; const flow = { toPulmonaryLeft: 'M100,282 L100,98 L76,48', toPulmonaryRight: 'M100,282 L100,98 L118,48', toAorta: 'M225,282 L225,40', // Both ventricles empty into the trunk; above the single valve the blood is mixed and goes both // to the body and, in a large stream, to the lungs. fromRv: 'M100,282 C102,230 140,206 156,170', fromLv: 'M232,282 C230,230 192,206 176,170', toBody: 'M172,138 L172,40', toLungsLeft: 'M160,138 L146,118 L104,100 L75,46', toLungsRight: 'M160,138 L146,118 L104,100 L117,46', }; --- {vessel.pulmonaryBranches.map((d) => ( ))} {vessel.pulmonaryBranches.map((d) => ( ))} {vessel.pulmonary.map((d) => ( ))} {vessel.pulmonary.map((d) => ( ))} {vessel.pulmonary.map((d) => ( ))} {t['diagram.label.rv']} {t['diagram.label.lv']} {t['diagram.label.aorta']} {t['diagram.label.common-trunk']} {t['diagram.label.septum']} {t['diagram.label.defect']} {t['diagram.label.pulmonaryArtery']} {lungFlowLines[0]} {lungFlowLines[1]} {t['diagram.label.pulmonary-arteries']} {valveLines[0]} {valveLines[1]} {mixedLines[0]} {mixedLines[1]}