Files
f04d13bf39 refactor(design): finish the colour sweep, and make it enforceable (#148)
#144 put the bot pages on the brand. This does the other 60 files, so the
whole product reads as one thing, and adds the guard that keeps it that way.

~410 raw palette classes became semantic tokens across the public marketing
surface (/try, /enterprise, /about, /knowledge, /personal, /professionals,
/bots, blog, navigation) and the app internals (dashboard, documents, chat,
conversations, onboarding, auth, settings, profile).

Gradient text is gone. Fifteen headings were
`bg-gradient-to-r from-X to-Y bg-clip-text text-transparent`; they are now
solid text-ink or text-action. globals.css says the identity is carried by
typography, and a serif display does not need a gradient to do that.

The 'B' mark was still a blue/purple gradient in BotNavigation's MOBILE menu.
#144 only fixed the desktop header. Both now render the shared <Logo>.

Three defects introduced mid-sweep and corrected, all caught by reading the
diff rather than trusting the regex:
  - degenerate gradients (`from-action-tint to-action-tint`) collapsed to solid
  - dead hovers (tint on tint) rebased to bg-surface + hover:bg-action-tint
  - `to-action\b` matched the prefix of `to-action-hover`, so a collapse left a
    stray `bg-action-hover` as a BASE background in 11 places -- those are the
    primary, not the hover shade

Deliberately NOT changed:
  - components/knowledge/Callout.tsx -- its blue is the `info` half of an
    info/warning/error triad. Semantic status colour is a separate scale from
    the brand accent, and warning is amber, so ochre-ing info would make the
    two nearly indistinguishable.
  - the custom-bot surfaces -- custom_bots.accent_color is a real column with
    a CHECK constraint and the owner picks it. User data, not a design token.

Never-twice: tests/__tests__/lib/design-tokens.test.ts refuses any raw
brand-palette class, and any bg-clip-text, outside those two documented
exceptions. Mutation-verified -- swap one token back to bg-blue-600 and it
fails and names the file. No allowlist debt: every other file was swept rather
than excused.

verify: format, lint, typecheck, 256 tests, build -- all green. Twelve pages
smoke-tested and checked visually against a local production build.


Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 09:53:41 +00:00

113 lines
3.7 KiB
TypeScript

'use client';
import { type FC } from 'react';
import Link from 'next/link';
import { AUTH_CTA_CONFIG, AUTH_CTA_DISMISSED_KEY } from '@/lib/config/auth-cta';
import { useLocalStorageFlag } from '@/lib/hooks/useLocalStorage';
interface ChatAuthCTAProps {
/** If true, the CTA is dismissible */
dismissible?: boolean;
/** Custom className for styling */
className?: string;
}
/**
* Call-to-action banner for guest users to register/sign in.
* Shows benefits of having an account. Dismissible with localStorage persistence.
*/
export const ChatAuthCTA: FC<ChatAuthCTAProps> = ({ dismissible = true, className = '' }) => {
const [isDismissed, setIsDismissed] = useLocalStorageFlag(AUTH_CTA_DISMISSED_KEY, true);
const config = AUTH_CTA_CONFIG.guest;
const handleDismiss = () => {
setIsDismissed(true);
};
if (isDismissed) {
return null;
}
return (
<div className={`relative bg-action-tint border border-edge rounded-xl p-4 ${className}`}>
{dismissible && (
<button
type="button"
onClick={handleDismiss}
className="absolute top-2 right-2 p-1 text-gray-400 hover:text-gray-600 transition-colors"
aria-label="Dismiss"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
)}
<div className="flex items-start gap-3">
<div className="flex-shrink-0 w-10 h-10 rounded-full bg-action-tint flex items-center justify-center">
<svg
className="w-5 h-5 text-action"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
/>
</svg>
</div>
<div className="flex-1 min-w-0">
<h3 className="font-semibold text-gray-900 mb-1">{config.headline}</h3>
<ul className="space-y-1 mb-3">
{config.benefits.slice(0, 3).map((benefit, i) => (
<li key={i} className="text-sm text-gray-600 flex items-center gap-1.5">
<svg
className="w-3.5 h-3.5 text-green-500 flex-shrink-0"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M5 13l4 4L19 7"
/>
</svg>
{benefit}
</li>
))}
</ul>
<div className="flex flex-wrap gap-2">
<Link
href={config.primaryAction.href}
className="inline-flex items-center px-4 py-2 bg-action text-white text-sm font-medium rounded-lg hover:bg-action-hover transition-colors"
>
{config.primaryAction.label}
</Link>
{config.secondaryAction && (
<Link
href={config.secondaryAction.href}
className="inline-flex items-center px-4 py-2 bg-white text-gray-700 text-sm font-medium rounded-lg border border-gray-200 hover:bg-gray-50 transition-colors"
>
{config.secondaryAction.label}
</Link>
)}
</div>
</div>
</div>
</div>
);
};