--- 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}-pda-arrow-v`; const arrowA = `${uid}-pda-arrow-a`; // Labels inside the arch are too long for one line: split each in two. function twoLines(text: string): [string, string] { const words = text.split(' '); const split = Math.ceil(words.length / 2); return [words.slice(0, split).join(' '), words.slice(split).join(' ')]; } const ligamentLines = twoLines(t['diagram.label.ligamentum-arteriosum']); const ductLines = twoLines(t['diagram.label.open-duct']); const closedLines = twoLines(t['diagram.label.closed-duct']); // Normal-width flow shows normally and after treatment (no more extra blood to the lungs). const thin = [{ class: 'normal-only' }, { 'data-only': 'treated' }]; // The vessels are drawn in their own coordinates and shifted right by 150; the branch to the // right lung runs on into the left column, where its label sits. The aorta rises, arches over and // descends; the pulmonary trunk rises between its two limbs and divides under the arch. The duct // joins the underside of the arch to the start of the left pulmonary artery (the branch on the // viewer's right). const vessel = { aorta: 'M45,335 L45,150 C45,92 100,70 160,70 C215,70 260,95 260,150 L260,335', trunk: 'M150,335 L150,185', rightPa: 'M150,190 C150,174 130,170 100,170 L-130,170', leftPa: 'M150,190 C150,170 175,166 210,166 L320,166', // From the arch wall to the pulmonary artery wall (wall to wall, for the ligament and duct). duct: 'M219,101 L203,152', }; // Paths of the blood, shared by the arrows and the moving dashes on top of them. const flow = { aorta: 'M45,320 L45,150 C45,92 100,70 160,70 C215,70 260,95 260,150 L260,322', // Up the trunk, then into each branch. Split so the branch to the right lung can run behind // the ascending aorta and the branch to the left lung in front of the descending aorta. trunk: 'M150,320 L150,190', toRightLung: 'M150,190 C150,174 130,170 100,170 L-120,170', toLeftLung: 'M150,190 C150,170 175,166 210,166 L312,166', // The start of the right branch again, in front, up to the edge of the ascending aorta. rightStart: 'M150,190 C150,174 130,170 100,170 L64,170', // Patent duct: blood leaves the aorta and enters the pulmonary artery. shunt: 'M221,93 L200,160', }; --- {thin.map((only) => ( ))} {thin.map((only) => ( ))} {thin.map((only) => ( ))} {thin.map((only) => ( ))} {t['diagram.label.aorta']} {ligamentLines[0]} {ligamentLines[1]} {ductLines[0]} {ductLines[1]} {closedLines[0]} {closedLines[1]} {t['diagram.label.pulmonaryArtery']}