mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 05:08:02 +01:00
#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>
173 lines
5.6 KiB
TypeScript
173 lines
5.6 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import { InlineLoading } from '@/components/shared/LoadingSpinner';
|
|
import { DocumentStatusBadge } from '@/components/shared/DocumentStatusBadge';
|
|
import type { Document } from '@/types/document';
|
|
import type { CustomBot } from '@/lib/hooks/useDashboardStats';
|
|
|
|
interface RecentActivityProps {
|
|
documents: Document[];
|
|
bots: CustomBot[];
|
|
loading: boolean;
|
|
}
|
|
|
|
export function RecentActivity({ documents, bots, loading }: RecentActivityProps) {
|
|
const recentDocuments = documents.slice(0, 3);
|
|
const recentBots = bots.slice(0, 3);
|
|
|
|
return (
|
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
|
{/* Recent Documents */}
|
|
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
|
|
<div className="flex items-center justify-between mb-4">
|
|
<h2 className="text-lg font-semibold text-gray-900">Recent Documents</h2>
|
|
<Link href="/documents" className="text-action hover:text-action text-sm font-medium">
|
|
View all
|
|
</Link>
|
|
</div>
|
|
|
|
{loading ? (
|
|
<InlineLoading />
|
|
) : recentDocuments.length === 0 ? (
|
|
<EmptyState
|
|
icon={
|
|
<svg
|
|
className="w-12 h-12 text-gray-300"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
/>
|
|
</svg>
|
|
}
|
|
message="No documents yet"
|
|
action={
|
|
<Link href="/documents" className="text-action hover:text-action text-sm font-medium">
|
|
Upload your first document
|
|
</Link>
|
|
}
|
|
/>
|
|
) : (
|
|
<div className="space-y-3">
|
|
{recentDocuments.map((doc) => (
|
|
<DocumentRow key={doc.id} document={doc} />
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Recent Bots */}
|
|
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
|
|
<div className="flex items-center justify-between mb-4">
|
|
<h2 className="text-lg font-semibold text-gray-900">Your Custom Bots</h2>
|
|
<Link href="/bots/mine" className="text-action hover:text-action text-sm font-medium">
|
|
Manage bots
|
|
</Link>
|
|
</div>
|
|
|
|
{loading ? (
|
|
<InlineLoading />
|
|
) : recentBots.length === 0 ? (
|
|
<EmptyState
|
|
icon={<span className="text-5xl">🤖</span>}
|
|
message="No custom bots yet"
|
|
action={
|
|
<Link
|
|
href="/bots/create"
|
|
className="text-action hover:text-action text-sm font-medium"
|
|
>
|
|
Create your first bot
|
|
</Link>
|
|
}
|
|
/>
|
|
) : (
|
|
<div className="space-y-3">
|
|
{recentBots.map((bot) => (
|
|
<BotRow key={bot.id} bot={bot} />
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface EmptyStateProps {
|
|
icon: React.ReactNode;
|
|
message: string;
|
|
action?: React.ReactNode;
|
|
}
|
|
|
|
function EmptyState({ icon, message, action }: EmptyStateProps) {
|
|
return (
|
|
<div className="text-center py-8">
|
|
<div className="mx-auto mb-4">{icon}</div>
|
|
<p className="text-gray-500">{message}</p>
|
|
{action && <div className="mt-2">{action}</div>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function DocumentRow({ document }: { document: Document }) {
|
|
const formatSize = (bytes: number) => {
|
|
if (bytes < 1024) return `${bytes} B`;
|
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
};
|
|
|
|
return (
|
|
<div className="flex items-center justify-between p-3 border border-gray-100 rounded-lg hover:bg-gray-50 transition-colors">
|
|
<div className="flex items-center gap-3 min-w-0">
|
|
<svg
|
|
className="w-5 h-5 text-gray-400 flex-shrink-0"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
/>
|
|
</svg>
|
|
<div className="min-w-0">
|
|
<p className="font-medium text-gray-900 truncate">{document.name}</p>
|
|
<p className="text-xs text-gray-400">{formatSize(document.size_bytes || 0)}</p>
|
|
</div>
|
|
</div>
|
|
<DocumentStatusBadge status={document.status} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function BotRow({ bot }: { bot: CustomBot }) {
|
|
return (
|
|
<Link
|
|
href={`/bots/custom/${bot.slug}`}
|
|
className="flex items-center justify-between p-3 border border-gray-100 rounded-lg hover:bg-gray-50 transition-colors"
|
|
>
|
|
<div className="flex items-center gap-3 min-w-0">
|
|
<span className="text-2xl flex-shrink-0">{bot.emoji}</span>
|
|
<div className="min-w-0">
|
|
<p className="font-medium text-gray-900 truncate">{bot.title}</p>
|
|
<p className="text-xs text-gray-400">{bot.knowledge_count} knowledge chunks</p>
|
|
</div>
|
|
</div>
|
|
{bot.is_published ? (
|
|
<span className="px-2 py-0.5 text-xs bg-green-100 text-green-700 rounded-full">
|
|
Published
|
|
</span>
|
|
) : (
|
|
<span className="px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded-full">Draft</span>
|
|
)}
|
|
</Link>
|
|
);
|
|
}
|