All files / src/components/badge AIGeneratedBadge.tsx

100% Statements 2/2
66.66% Branches 6/9
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35                          104x                 376x                        
import { Sparkles } from "lucide-react";
import React from "react";
 
/**
 * Marks one *event* as generated — a version in an edit history, a row in the
 * activity feed.
 *
 * Not for resources. A resource shows provenance with `GeneratedMark`, a
 * sparkle on its icon, because on a list page a pill reading "AI Generated"
 * competes with the name, the tags and the status badge for the same row.
 * An event has no icon to mark and no tags to compete with, so the pill is
 * still the right shape here.
 */
const AIGeneratedBadge: React.FC<{
  className?: string;
  compact?: boolean;
  title?: string;
}> = ({
  className = "",
  compact = false,
  title = "Created by AI during generative agent setup",
}) => (
  <span
    title={title}
    className={`inline-flex items-center gap-1 shrink-0 font-semibold rounded-full border bg-violet-100 dark:bg-violet-900/50 text-violet-700 dark:text-violet-300 border-violet-300 dark:border-violet-700 ${
      compact ? "text-[10px] px-1.5 py-px" : "text-[11px] px-2 py-0.5"
    } ${className}`}
  >
    <Sparkles className={compact ? "size-2.5" : "size-3"} />
    {compact ? "AI" : "AI Generated"}
  </span>
);
 
export default AIGeneratedBadge;