// Adapted from jalcoui (MIT) — github.com/jal-co/ui 'use client'; /* eslint-disable @next/next/no-img-element */ import * as React from 'react'; import { alpha } from '@djangocfg/ui-core/styles/palette'; import { ROW_HEIGHT, type GraphRow } from '../types'; import { formatRelativeDate, initials } from '../utils'; import { CommitDetail } from './CommitDetail'; import { Rails } from './Rails'; interface CommitRowProps { row: GraphRow; prevRow: GraphRow | null; railWidth: number; maxRails: number; truncateHash: number; laneColors: string[]; railColor: string; } /** * Single commit row: rails column, refs, message, hash + author + time. * Wrapped in a {@link CommitDetail} popover. */ export function CommitRow({ row, prevRow, railWidth, maxRails, truncateHash, laneColors, railColor, }: CommitRowProps) { const svgWidth = maxRails * railWidth; const refStyle = { borderColor: alpha(railColor, 0.25), backgroundColor: alpha(railColor, 0.0625), color: railColor, }; const tagStyle = { backgroundColor: alpha(railColor, 0.125), color: railColor, }; const initialsLabel = initials(row.commit.author.name); const shortHash = row.commit.hash.slice(0, truncateHash); const relativeDate = formatRelativeDate(row.commit.date); return ( ); }