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.

1.9 KB
Raw Blame
"use client";

import { Button } from "../ui/button";
import { formatNumber } from "../lib/format";
import { PositiveMark } from "../shared/empty-state";

export interface IndexCelebrationProps {
  repoName: string;
  /** Pages generated by the first index, when known. */
  pagesGenerated?: number;
  /** @deprecated Ignored; the moment no longer plays an animation. */
  lottieSrc?: string;
  /** "Start here" handoff content, e.g. a FirstFiveFiles card. */
  children?: React.ReactNode;
  exploreLabel?: string;
  onExplore?: () => void;
}

/**
 * First-index success moment: a quiet success check and one sentence of what
 * is now live, then the "start here" handoff. Good news stated plainly; no
 * animation to wait through before the reader can act.
 */
export function IndexCelebration({
  repoName,
  pagesGenerated,
  children,
  exploreLabel = "Explore the dashboard",
  onExplore,
}: IndexCelebrationProps) {
  return (
    <div className="rounded-lg border border-[var(--color-border-default)] px-4 py-8 text-center sm:px-8">
      <div role="status" className="flex flex-col items-center gap-3">
        <PositiveMark />
        <div className="max-w-[52ch] space-y-1">
          <h3 className="text-[18px] font-semibold text-[var(--color-text-primary)] [overflow-wrap:anywhere]">
            {repoName} is ready
          </h3>
          <p className="text-xs leading-relaxed text-[var(--color-text-secondary)] [text-wrap:pretty]">
            {pagesGenerated != null && pagesGenerated > 0
              ? `${formatNumber(pagesGenerated)} documentation pages generated. `
              : "The index is built. "}
            Search, health, and architecture views are live.
          </p>
        </div>
        {onExplore && (
          <Button size="sm" className="h-8" onClick={onExplore}>
            {exploreLabel}
          </Button>
        )}
      </div>

      {children && <div className="mt-6 text-left">{children}</div>}
    </div>
  );
}