import { Link } from 'react-router-dom' import { GEN1, GEN2, GEN3, getAncestorAtPath, formatManualAncestorDisplay } from '../lib/pedigree' function AncestorNodeView({ path, label, ancestors }) { const node = getAncestorAtPath(ancestors, path) if (!node) { return (
{label} Unknown
) } if (node.id != null) { return ( {label} {node.name} {node.farm ? ` (${node.farm})` : ''} {node.ear_number ? ( Ear #{node.ear_number} ) : null} ) } return (
{label} {formatManualAncestorDisplay(node.name)}
) } function Generation({ entries, ancestors }) { return (
{entries.map(({ path, slot, label }) => ( ))}
) } // `generations` controls how many ancestor columns to render. The detail page // uses 2 (parents + grandparents) to keep the inline tree compact; the full // 3-generation tree lives on the dedicated print page. function PedigreeTreeReadOnly({ subjectName, ancestors, generations = 3 }) { // Each generation column is ~176px (incl. gap); narrower min-width for fewer // generations lets the tree fit its column without horizontal scrolling. const minWidth = generations >= 3 ? 720 : 544 return ( // The scroll container fills (and shrinks with) its column; the tree scrolls // horizontally inside it rather than forcing the page wider and pushing the // timeline column off-screen.
{subjectName}
{generations >= 2 && } {generations >= 3 && }
) } export default PedigreeTreeReadOnly