Files
mcpedia/apps/web/app/create/page.tsx
T
asepharyana be923cb432
CI / typecheck + build (push) Canceled after 0s
CI / deploy to VPS (push) Canceled after 0s
fix: replace all hardcoded hex colors with CSS theme variables
Phase 15c — theme-consistent color system:

Replaced 63 instances of hardcoded hex colors (#5e6ad2, #7170ff, #4f46e5,
#6a75e0, #828fff, #94a3b8, etc.) with CSS variables from globals.css:
- #5e6ad2 → var(--brand) (light: #5e6ad2, dark: #5e6ad2)
- #7170ff → var(--accent) (light: #4f46e5, dark: #7170ff)
- #4f46e5 → var(--accent)
- #6a75e0 → var(--brand-hover) (new var, light: #6a75e0, dark: #7170ff)
- #828fff → var(--accent-hover)
- #868686 → var(--text-dim)
- Dark-mode-specific hex in Markdown.tsx → CSS variables

Added --brand-hover CSS variable (light: #6a75e0, dark: #7170ff)
Added dark:prose-invert instead of prose-invert (light mode now uses
default prose theme instead of forced dark)

Files changed: 15 component files + globals.css
2026-08-21 13:06:01 +07:00

60 lines
2.1 KiB
TypeScript

import Link from "next/link";
import { listDocuments, extractFoldersForSection, listSections } from "@mcpedia/core";
import { WEBHOOK_SECRET } from "@mcpedia/config";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import DocForm from "@/components/DocForm";
export const dynamic = "force-dynamic";
export default async function CreatePage() {
const cookieStore = await cookies();
const isAdmin = cookieStore.get("mcpedia_admin")?.value != null;
if (!isAdmin) redirect("/login");
const [all, sections] = await Promise.all([
listDocuments(),
listSections(),
]);
const docSlugs = all.map((d) => d.slug);
const sectionIds = Array.from(new Set([...sections.map((s) => s.id), ...all.map((d) => d.section)]));
return (
<div className="space-y-6">
{/* Breadcrumb */}
<nav className="flex items-center gap-2 text-xs text-[var(--text-dim)]">
<Link href="/" className="hover:text-[var(--text-primary)] transition-colors">
MCPedia
</Link>
<span>/</span>
<span className="text-[var(--text-muted)] font-medium">Create Document</span>
</nav>
{/* Header */}
<div className="flex items-center justify-between pb-4 border-b border-[var(--border-color)]">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-lg bg-[var(--brand)]/15 border border-[var(--brand)]/30 flex items-center justify-center text-xl text-[var(--brand)] dark:text-[var(--accent)]">
✏️
</div>
<div>
<h1 className="text-2xl font-bold text-[var(--text-primary)] tracking-tight">Create Document</h1>
<p className="text-xs text-[var(--text-muted)] mt-0.5">
Writes directly to PostgreSQL, records revision history, and computes vector embeddings.
</p>
</div>
</div>
</div>
<DocForm
mode="create"
secret={WEBHOOK_SECRET}
existingSections={sectionIds}
existingFolders={Object.fromEntries(
sectionIds.map((sid) => [sid, extractFoldersForSection(docSlugs, sid)])
)}
/>
</div>
);
}