// Adapted from jalcoui (MIT) — github.com/jal-co/ui // // Topological git graph with rail lines showing branch forks, merges, and // commit ancestry. Renders the same visual as GitKraken / Fork / Tower. // // Composer only — heavy lifting lives in: // - hooks/useGraphLayout.ts topology pass // - hooks/useLaneColors.ts theme-aware categorical palette // - components/Rails.tsx SVG rails + dot // - components/CommitRow.tsx row body (refs, message, meta) // - components/CommitDetail.tsx popover detail // // Project rules exercised here: semantic tokens for chrome (no raw scales), // theme-derived hex colors for SVG strokes (no Tailwind classes inside // `stroke=`), no nested overlay providers, attribution header, lazy entry. 'use client'; import * as React from 'react'; import { cn } from '@djangocfg/ui-core/lib'; import type { CommitGraphProps } from './types'; import { useGraphLayout } from './hooks/useGraphLayout'; import { useLaneColors, pickLaneColor } from './hooks/useLaneColors'; import { CommitRow } from './components/CommitRow'; function CommitGraph({ commits, truncateHash = 7, railWidth = 24, className, ...props }: CommitGraphProps) { const laneColors = useLaneColors(); const { rows, maxRails } = useGraphLayout(commits, laneColors); const svgWidth = maxRails * railWidth; if (rows.length === 0) { return (