Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

792 B
Raw Blame
import { ProportionBar } from "../shared/proportion-bar";
import { commitCategoryColor } from "../shared/series";

interface CommitCategorySparklineProps {
  categories: Record<string, number>;
}

const CATEGORY_LABEL: Record<string, string> = {
  feature: "Feature",
  fix: "Fix",
  refactor: "Refactor",
  dependency: "Dependency",
};

/** A file's commits by type, on the shared share bar, each type in its own colour. */
export function CommitCategorySparkline({ categories }: CommitCategorySparklineProps) {
  return (
    <ProportionBar
      label="Commits by type"
      size="sm"
      segments={Object.entries(CATEGORY_LABEL).map(([key, label]) => ({
        key,
        label,
        value: categories[key] || 0,
        color: commitCategoryColor(key),
      }))}
    />
  );
}