'use client';
/**
* The Pro badge — the switch into the workbench, worn on the wordmark's
* shoulder like a trademark. `role="switch"` rather than a button, because it
* has an on state that outlives the click.
*
* Ported from the spike's `ProBadge` (S9): it states the mode of the whole
* page, which is exactly what a badge on the logo does and what a chip in a
* toolbar cannot. Small, hairline, silent when off.
*/
import { motion, useReducedMotion } from 'motion/react';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { useI18n } from '@/lib/hooks/use-i18n';
import { cn } from '@/lib/utils/cn';
import './pro-swap.css';
export interface ProBadgeProps {
active: boolean;
onToggle?: () => void;
className?: string;
/**
* Override the default `pro-mode-exit` / `pro-mode-enter` testid.
*
* The workspace hero wears its own interactive badge while the rail keeps
* the persistent switch. A distinct id keeps both controls addressable.
*/
testId?: string;
}
export function ProBadge({ active, onToggle, className, testId }: ProBadgeProps) {
const { t } = useI18n();
const reduceMotion = useReducedMotion();
const interactive = !!onToggle;
const badge = (
{/* The negative right margin pays back the trailing letter-space that
`tracking` adds after the O, so the word sits centred in the pill. */}
Pro
);
if (!interactive) return badge;
return (
{badge}
{active ? t('proMode.badgeExit') : t('proMode.badgeEnter')}
);
}