Skip to the content

Capsid menu

app/components/history/draft-links.tsx

29 lines and 2 functions in DrDustinEdwards/carrel, at commit d5d5e82 on 2026-10-24. This file on GitHub.

Functions

The functions of draft-links.tsx
FunctionLinesComplexityCoveredCRAPMutation
DraftLinks9 to 3240%WatchCRAP 20No data: mutation testing has not run on this repo yet
<anonymous:20>20 to 2910%OkCRAP 2No data: mutation testing has not run on this repo yet

Imports

It imports no other module of this repo. Imported by app/components/history/history-panel.tsx, app/routes/book.history.tsx, app/routes/history.tsx.

Source

// The comparisons that need the person's own working draft: against the site's text, and against
// each AI draft saved beside it. Links to the history page, which does the comparing.

import { Link } from "react-router";
import { Time } from "capsomer/react/time";

export type AiDraftLink = { id: number; client: string; createdAt: string };

export function DraftLinks({ historyPath, againstSite, aiDrafts }: { historyPath: string; againstSite: boolean; aiDrafts: AiDraftLink[] }) {
  if (!againstSite && aiDrafts.length === 0) return null;
  return (
    <ul className="app-flags" aria-label="Compare your draft">
      {againstSite ? (
        <li>
          <span>
            <Link to={`${historyPath}?compare=site`}>Your working draft against the site's version</Link>
          </span>
        </li>
      ) : null}
      {aiDrafts.map((d) => (
        <li key={d.id}>
          <span>
            <Link to={`${historyPath}?compare=ai&ai=${d.id}`}>Your draft against the AI draft from {d.client}</Link>{" "}
            <span className="cap-muted">
              <Time at={d.createdAt} />
            </span>
          </span>
        </li>
      ))}
    </ul>
  );
}