使用openai对UI进行了重构

This commit is contained in:
2026-02-24 11:50:51 +08:00
parent 0c97f02e51
commit 317b9c7c26
15 changed files with 695 additions and 583 deletions
+84
View File
@@ -66,11 +66,95 @@
body {
background-color: hsl(var(--background));
color: hsl(var(--foreground));
background-image:
radial-gradient(circle at 10% 10%, hsl(var(--primary) / 0.05), transparent 35%),
radial-gradient(circle at 90% 0%, hsl(var(--accent-foreground) / 0.04), transparent 25%);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
@layer components {
.ui-card {
@apply rounded-2xl border border-border/70 bg-card/95 shadow-sm backdrop-blur-sm;
}
.ui-input {
@apply w-full rounded-xl border border-input bg-background/75 px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground focus:border-ring focus:ring-2 focus:ring-ring/20;
}
.ui-select {
@apply w-full rounded-xl border border-input bg-background/75 px-3 py-2 text-sm outline-none transition-colors focus:border-ring focus:ring-2 focus:ring-ring/20;
}
.ui-btn {
@apply inline-flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-sm font-medium transition-all active:scale-[0.98];
}
.ui-btn-primary {
@apply ui-btn bg-primary text-primary-foreground hover:opacity-90 shadow-sm;
}
.ui-btn-secondary {
@apply ui-btn bg-secondary text-secondary-foreground hover:bg-secondary/80;
}
.ui-btn-danger {
@apply ui-btn bg-destructive text-destructive-foreground hover:opacity-90;
}
.ui-icon-btn {
@apply inline-flex h-9 w-9 items-center justify-center rounded-lg border border-transparent text-muted-foreground transition-colors hover:border-border hover:bg-muted/60 hover:text-foreground;
}
.ui-kbd {
@apply inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground;
}
.ui-enter {
animation: ui-enter 220ms ease-out both;
}
.ui-enter-delayed {
animation: ui-enter 300ms ease-out both;
}
.ui-float {
animation: ui-float 4s ease-in-out infinite;
}
}
@keyframes ui-enter {
from {
opacity: 0;
transform: translateY(6px) scale(0.99);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes ui-float {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-4px);
}
}
@media (prefers-reduced-motion: reduce) {
.ui-enter,
.ui-enter-delayed,
.ui-float,
.animate-in {
animation: none !important;
transition: none !important;
}
}
/* Editor Specific Styles for Notion-like feel */
.ProseMirror {
outline: none;
+4 -9
View File
@@ -1,4 +1,4 @@
import type { Metadata } from "next";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
@@ -7,8 +7,8 @@ import { ConfirmProvider } from "@/components/confirm-provider";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "NoteAI - 轻量级个人笔记网站",
description: "基于 Next.js 的 AI 驱动笔记应用",
title: "NoteAI - 轻量级个人笔记应用",
description: "基于 Next.js 的 AI 驱动笔记工具",
};
export default function RootLayout({
@@ -19,12 +19,7 @@ export default function RootLayout({
return (
<html lang="zh-CN" suppressHydrationWarning>
<body className={inter.className}>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
<ConfirmProvider>{children}</ConfirmProvider>
</ThemeProvider>
</body>
+5 -5
View File
@@ -39,9 +39,9 @@ export default function LoginPage() {
return (
<div className="min-h-screen flex items-center justify-center bg-background p-4">
<div className="w-full max-w-md space-y-8 bg-card border p-8 rounded-2xl shadow-xl animate-in fade-in zoom-in-95 duration-500">
<div className="ui-card ui-enter w-full max-w-md space-y-8 p-8 shadow-xl">
<div className="text-center space-y-2">
<div className="inline-flex items-center justify-center w-16 h-16 bg-primary rounded-2xl text-primary-foreground mb-4">
<div className="ui-float inline-flex items-center justify-center w-16 h-16 bg-primary rounded-2xl text-primary-foreground mb-4 shadow-sm">
<Sparkles size={32} />
</div>
<h1 className="text-3xl font-bold tracking-tight"></h1>
@@ -57,7 +57,7 @@ export default function LoginPage() {
placeholder="访问密码"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="w-full pl-10 pr-4 py-3 bg-muted/50 border rounded-xl focus:ring-2 focus:ring-primary outline-none transition-all"
className="ui-input pl-10 pr-4 py-3"
required
/>
</div>
@@ -79,7 +79,7 @@ export default function LoginPage() {
<select
value={duration}
onChange={(e) => setDuration(e.target.value)}
className="bg-transparent border-none outline-none text-muted-foreground hover:text-foreground cursor-pointer text-xs"
className="ui-select w-auto py-1 text-xs"
>
<option value="1">1</option>
<option value="7">7</option>
@@ -90,7 +90,7 @@ export default function LoginPage() {
<button
type="submit"
className="w-full py-3 bg-primary text-primary-foreground font-semibold rounded-xl hover:opacity-90 active:scale-[0.98] transition-all shadow-lg"
className="ui-btn-primary w-full py-3 font-semibold shadow-md"
>
</button>
+173 -195
View File
@@ -1,117 +1,118 @@
"use client";
"use client";
import { SidebarContent, ResizableSidebar } from "@/components/sidebar";
import { Editor } from "@/components/editor";
import { useEditorStore } from "@/lib/store";
import { Hash, X, Plus, ChevronLeft, ChevronRight, Sparkles, Lock, Unlock } from "lucide-react";
import { Hash, X, Plus, ChevronLeft, ChevronRight, Sparkles, Lock, Unlock, FolderOpen } from "lucide-react";
import { useSettingsStore } from "@/lib/settings-store";
import { exportPageAsMarkdown } from "@/lib/export";
import { useState } from "react";
import { useMemo, useState } from "react";
import { cn, getTagColor } from "@/lib/utils";
import { useSearchStore } from "@/lib/search-store";
import { type Editor as TiptapEditor } from "@tiptap/react";
import { ImportProvider } from "@/components/import-context";
import { AIChatPanel } from "@/components/chat/ai-chat-panel";
const ICONS = [
"📄", "📝", "📒", "📘", "📙", "📕", "📗", "📚",
"💡", "🔥", "✅", "❗", "⭐", "📌", "📎", "🧠",
"🎯", "🚀", "⚙️", "🧪", "💼", "📊", "📈", "🧩",
"🌱", "🌟", "🎨", "🎵", "🎬", "📷", "💬", "🔖",
"⌛", "🗂️", "📦", "🏷️", "🗓️", "🕒", "🔍", "🧾",
];
export default function Home() {
const { activePageId, pages, updatePage } = useEditorStore();
const { openSearchWithTag } = useSearchStore();
const activePage = pages.find(p => p.id === activePageId);
const { timezone } = useSettingsStore();
const activePage = pages.find((p) => p.id === activePageId);
const [isChatOpen, setIsChatOpen] = useState(false);
const [editor, setEditor] = useState<TiptapEditor | null>(null);
const [isAddingTag, setIsAddingTag] = useState(false);
const [tagInput, setTagInput] = useState("");
const [isIconPickerOpen, setIsIconPickerOpen] = useState(false);
const breadcrumbs = useMemo(() => {
if (!activePage) return [];
const result = [] as typeof pages;
let current = activePage;
while (current) {
result.unshift(current);
if (!current.parentId) break;
const parent = pages.find((p) => p.id === current.parentId);
if (!parent) break;
current = parent;
}
return result;
}, [activePage, pages]);
const addTag = () => {
if (!activePage) return;
const next = tagInput.trim();
if (!next) return;
const merged = Array.from(new Set([...(activePage.tags || []), next]));
updatePage(activePage.id, { tags: merged });
setTagInput("");
setIsAddingTag(false);
};
return (
<ImportProvider>
<div className="flex h-[100dvh] w-full bg-background overflow-hidden relative">
{/* Mobile: Sidebar List View (Only visible when no page is active) */}
<div className={cn(
activePageId ? "hidden" : "flex-1 h-full md:hidden block"
)}>
<div className="relative flex h-[100dvh] w-full overflow-hidden bg-background">
<div className={cn(activePageId ? "hidden" : "block h-full flex-1 md:hidden")}>
<SidebarContent />
</div>
{/* Desktop: Sidebar (Resizable) */}
<ResizableSidebar />
{/* Main Content Area */}
<main className={cn(
"flex-1 h-full overflow-hidden flex flex-col relative z-0",
// Mobile: Hidden when no page active (showing list instead)
!activePageId && "hidden md:flex"
)}>
<main className={cn("relative z-0 flex h-full flex-1 flex-col overflow-hidden", !activePageId && "hidden md:flex")}>
{activePage ? (
<div className="flex-1 overflow-y-auto scroll-smooth">
<div className="max-w-7xl mx-auto px-4 md:px-16 py-6 min-h-screen content-start">
<div className="mx-auto min-h-screen max-w-7xl px-4 py-6 md:px-16">
<div className="ui-enter group relative mb-8">
<button
className="absolute -top-12 left-0 flex items-center gap-1 py-2 text-sm text-muted-foreground transition-colors hover:text-foreground md:hidden"
onClick={() => useEditorStore.getState().setActivePageId(null)}
>
<ChevronLeft size={18} />
</button>
<div className="group mb-8 relative">
{/* Mobile Back Button Integration in Header */}
<div className="md:hidden absolute -top-12 left-0 flex items-center gap-1 py-2 text-muted-foreground hover:text-foreground cursor-pointer"
onClick={() => useEditorStore.getState().setActivePageId(null)}>
<ChevronLeft size={20} />
<span></span>
</div>
{/* Breadcrumb Navigation */}
<div className="flex items-center flex-wrap gap-1 text-sm text-muted-foreground mb-4">
{(() => {
const breadcrumbs = [];
let current: typeof activePage | undefined = activePage;
while (current) {
breadcrumbs.unshift(current);
if (current.parentId) {
current = pages.find(p => p.id === current?.parentId);
} else {
current = undefined;
}
}
return breadcrumbs.map((crumb, index) => (
<div key={crumb.id} className="flex items-center gap-1">
{index > 0 && <ChevronRight size={14} className="opacity-50" />}
<button
onClick={() => useEditorStore.getState().setActivePageId(crumb.id)}
className={cn(
"hover:underline hover:text-foreground transition-colors flex items-center gap-1",
crumb.id === activePage.id && "font-medium text-foreground pointer-events-none"
)}
>
{crumb.icon && <span>{crumb.icon}</span>}
<span>{crumb.title || "无标题"}</span>
</button>
</div>
));
})()}
<div className="mb-4 flex flex-wrap items-center gap-1 text-sm text-muted-foreground">
{breadcrumbs.map((crumb, index) => (
<div key={crumb.id} className="flex items-center gap-1">
{index > 0 && <ChevronRight size={14} className="opacity-50" />}
<button
onClick={() => useEditorStore.getState().setActivePageId(crumb.id)}
className={cn(
"flex items-center gap-1 transition-colors hover:text-foreground hover:underline",
crumb.id === activePage.id && "pointer-events-none font-medium text-foreground"
)}
>
{crumb.icon && <span>{crumb.icon}</span>}
<span>{crumb.title || "无标题"}</span>
</button>
</div>
))}
</div>
<div className="flex items-center gap-2">
{activePage.icon && (
<span className="text-3xl select-none animate-in fade-in zoom-in-75 duration-300">
{activePage.icon}
</span>
)}
{activePage.icon && <span className="select-none text-3xl">{activePage.icon}</span>}
<input
value={activePage.title}
onChange={(e) => updatePage(activePage.id, { title: e.target.value })}
placeholder="无标题"
disabled={activePage.isLocked}
className={cn(
"w-full text-3xl font-bold bg-transparent border-none outline-none placeholder:text-muted-foreground/20 text-foreground transition-colors",
activePage.isLocked && "opacity-80 cursor-not-allowed select-none"
"w-full border-none bg-transparent text-3xl font-bold text-foreground outline-none placeholder:text-muted-foreground/30",
activePage.isLocked && "cursor-not-allowed select-none opacity-80"
)}
/>
</div>
{/* Last Updated Info moved */}
<div className="absolute right-0 top-1/2 -translate-y-1/2 flex items-center gap-1 transition-opacity">
{/* Buttons moved to Editors Toolbar */}
</div>
</div>
{/* Tags Section */}
<div className="flex flex-wrap items-center gap-2 mb-6 animate-in fade-in slide-in-from-top-2 duration-300">
<div className="ui-enter-delayed mb-6 flex flex-wrap items-center gap-2">
{activePage.tags?.map((tag) => {
const colors = getTagColor(tag);
return (
@@ -119,151 +120,127 @@ export default function Home() {
key={tag}
onClick={() => openSearchWithTag(tag)}
className={cn(
"inline-flex items-center gap-1 px-2.5 py-1 rounded-[3px] text-[11px] font-medium transition-colors border shadow-sm",
colors.bg, colors.text, colors.border
)}>
"group/tag inline-flex items-center gap-1 rounded-[4px] border px-2.5 py-1 text-[11px] font-medium shadow-sm",
colors.bg,
colors.text,
colors.border
)}
>
<Hash size={10} className="opacity-70" />
{tag}
<button
onClick={(e) => {
e.stopPropagation();
const newTags = activePage.tags?.filter(t => t !== tag) || [];
const newTags = activePage.tags?.filter((t) => t !== tag) || [];
updatePage(activePage.id, { tags: newTags });
}}
className="ml-1 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 opacity-0 group-hover:opacity-100 transition-all"
className="ml-1 rounded-full p-0.5 opacity-0 transition-all group-hover/tag:opacity-100 hover:bg-black/10 dark:hover:bg-white/10"
title="移除标签"
>
<X size={10} />
</button>
</span>
);
})}
<div className="relative">
{isAddingTag ? (
<input
autoFocus
type="text"
value={tagInput}
onChange={(e) => setTagInput(e.target.value)}
onBlur={() => {
if (tagInput.trim()) {
const newTags = [...(activePage.tags || []), tagInput.trim()];
updatePage(activePage.id, { tags: Array.from(new Set(newTags)) });
}
{isAddingTag ? (
<input
autoFocus
type="text"
value={tagInput}
onChange={(e) => setTagInput(e.target.value)}
onBlur={addTag}
onKeyDown={(e) => {
if (e.key === "Enter") {
e.preventDefault();
addTag();
}
if (e.key === "Escape") {
setTagInput("");
setIsAddingTag(false);
}}
onKeyDown={(e) => {
if (e.key === 'Enter') {
e.preventDefault();
if (tagInput.trim()) {
const newTags = [...(activePage.tags || []), tagInput.trim()];
updatePage(activePage.id, { tags: Array.from(new Set(newTags)) });
}
setTagInput("");
setIsAddingTag(false);
}
if (e.key === 'Escape') {
setTagInput("");
setIsAddingTag(false);
}
}}
className="w-24 px-2 py-0.5 text-xs bg-transparent border border-primary rounded-sm outline-none animate-in fade-in zoom-in-95 duration-200"
placeholder="输入标签..."
/>
) : (
<div className="flex items-center gap-2">
<button
onClick={() => setIsAddingTag(true)}
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-sm text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground transition-all border border-transparent hover:border-border"
>
<Plus size={12} />
</button>
}
}}
className="w-28 rounded-md border border-primary/40 bg-background px-2 py-1 text-xs outline-none focus:ring-2 focus:ring-primary/20"
placeholder="输入标签"
/>
) : (
<button
onClick={() => setIsAddingTag(true)}
className="ui-btn-secondary px-2 py-1 text-xs text-muted-foreground"
>
<Plus size={12} />
</button>
)}
{/* Icon Picker */}
<div className="relative group/icon-picker">
<div className="relative">
<button
onClick={() => setIsIconPickerOpen((v) => !v)}
className="ui-btn-secondary px-2 py-1 text-xs text-muted-foreground"
>
<Sparkles size={12} /> {activePage.icon ? "更换图标" : "添加图标"}
</button>
{isIconPickerOpen && (
<div className="ui-card absolute left-0 top-full z-50 mt-1 w-80 p-2 shadow-xl animate-in fade-in zoom-in-95">
<div className="grid h-48 grid-cols-8 gap-1 overflow-y-auto pr-1">
{ICONS.map((icon) => (
<button
key={icon}
onClick={() => {
updatePage(activePage.id, { icon });
setIsIconPickerOpen(false);
}}
className={cn(
"flex h-8 w-8 items-center justify-center rounded-md text-lg transition-colors hover:bg-accent",
activePage.icon === icon && "bg-accent"
)}
>
{icon}
</button>
))}
<button
className="inline-flex items-center gap-1 px-2 py-0.5 rounded-sm text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground transition-all border border-transparent hover:border-border"
onClick={() => {
updatePage(activePage.id, { icon: null });
setIsIconPickerOpen(false);
}}
className="flex h-8 w-8 items-center justify-center rounded-md text-destructive transition-colors hover:bg-destructive/10"
title="清除图标"
>
<Sparkles size={12} />
{activePage.icon ? '更改图标' : '添加图标'}
<X size={14} />
</button>
<div className="absolute left-0 top-full mt-1 z-50 hidden group-hover/icon-picker:block w-80 p-2 bg-popover border shadow-md rounded-md animate-in fade-in zoom-in-95">
<div className="grid grid-cols-8 gap-1 h-64 overflow-y-auto p-1">
{[
"📄", "📝", "📁", "📂", "📊", "📈", "📉", "📅", "✅", "❌", "📌", "📍", "📎", "🗑️", "⚙️", "🔒",
"✨", "💡", "🔥", "🚀", "🎨", "🎯", "🏆", "💎", "❤️", "👍", "👋", "🎉", "🌟", "⭐", "🌈", "⚡",
"🤖", "🧠", "💻", "⌨️", "📱", "⌚", "📷", "🎥", "🎧", "🎮", "🕹️", "🎲", "🧩", "🎳", "🥋", "🥊",
"🚗", "✈️", "🛸", "🌍", "🪐", "☀️", "🌙", "☁️", "🌧️", "❄️", "🌊", "💧", "🌀",
"🏠", "🏢", "🏥", "🏫", "🏰", "🏯", "⛺", "🏕️", "🌲", "🌳", "🌴", "🌵", "🌷", "🌸", "🌹", "🌻",
"🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐸", "🐵", "🐔",
"🍎", "🍌", "🍇", "🍉", "🍊", "🍋", "🍍", "🥭", "🍓", "🍒", "🍑", "🥝", "🍅", "🥑", "🍆", "🥔",
"🍔", "🍟", "🍕", "🌭", "🥪", "🌮", "🌯", "🥗", "🥘", "🍝", "🍜", "🍲", "🍛", "🍣", "🍱", "🥟",
"🍺", "🍻", "🥂", "🍷", "🥃", "🍸", "🍹", "🍾", "☕", "🍵", "🥤", "🧃", "🧊", "🥄", "🍴", "🍽️"
].map(icon => (
<button
key={icon}
onClick={(e) => {
e.stopPropagation();
updatePage(activePage.id, { icon });
}}
className={cn(
"w-8 h-8 flex items-center justify-center rounded-sm hover:bg-accent text-lg transition-colors",
activePage.icon === icon && "bg-accent/50 ring-1 ring-primary/20"
)}
>
{icon}
</button>
))}
<button
onClick={(e) => {
e.stopPropagation();
updatePage(activePage.id, { icon: null });
}}
className="w-8 h-8 flex items-center justify-center rounded-sm hover:bg-red-50 text-red-500 hover:text-red-600 transition-colors col-span-1"
title="清除图标"
>
<X size={14} />
</button>
</div>
</div>
</div>
{/* Lock Button */}
<button
onClick={() => updatePage(activePage.id, { isLocked: !activePage.isLocked })}
className={cn(
"inline-flex items-center gap-1 px-2 py-0.5 rounded-sm text-xs font-medium transition-all border border-transparent hover:border-border",
activePage.isLocked
? "text-orange-600 bg-orange-50 hover:bg-orange-100 border-orange-200"
: "text-muted-foreground hover:bg-muted hover:text-foreground"
)}
title={activePage.isLocked ? "解锁编辑" : "锁定编辑 (防止误触)"}
>
{activePage.isLocked ? <Lock size={12} /> : <Unlock size={12} />}
{activePage.isLocked ? "已锁定" : "锁定"}
</button>
{/* Last Updated Info */}
{activePage.updatedAt && (
<div className="text-xs text-muted-foreground/40 select-none flex items-center gap-1 border-l pl-2 ml-1 h-4">
<span>
{new Date(activePage.updatedAt).toLocaleString('zh-CN', {
timeZone: useSettingsStore.getState().timezone || 'Asia/Shanghai',
hour12: false
})}
</span>
</div>
)}
</div>
)}
</div>
<button
onClick={() => updatePage(activePage.id, { isLocked: !activePage.isLocked })}
className={cn(
"ui-btn-secondary px-2 py-1 text-xs",
activePage.isLocked ? "border-orange-200 bg-orange-50 text-orange-600 dark:bg-orange-900/20 dark:text-orange-300" : "text-muted-foreground"
)}
title={activePage.isLocked ? "解锁编辑" : "锁定编辑,防止误触"}
>
{activePage.isLocked ? <Lock size={12} /> : <Unlock size={12} />}
{activePage.isLocked ? "已锁定" : "锁定"}
</button>
{activePage.updatedAt && (
<div className="ml-1 h-4 border-l pl-2 text-xs text-muted-foreground/50">
{new Date(activePage.updatedAt).toLocaleString("zh-CN", {
timeZone: timezone || "Asia/Shanghai",
hour12: false,
})}
</div>
)}
</div>
{/* Editor Area or Folder Placeholder */}
{activePage.type === 'folder' ? (
<div className="flex flex-col items-center justify-center h-[50vh] text-muted-foreground animate-in fade-in duration-500">
{/* ... folder icon ... */}
{activePage.type === "folder" ? (
<div className="ui-card ui-enter flex h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground">
<div className="ui-float rounded-2xl border border-border/70 bg-muted/40 p-4">
<FolderOpen size={34} className="text-primary/80" />
</div>
<p className="text-base font-medium text-foreground"></p>
<p className="text-sm text-muted-foreground"></p>
</div>
) : (
<div className="min-h-[60vh] pb-24">
@@ -280,17 +257,18 @@ export default function Home() {
</div>
</div>
) : (
<div className="h-full flex flex-col items-center justify-center text-muted-foreground gap-4 animate-in fade-in zoom-in-95 duration-500">
<div className="w-16 h-16 bg-muted/50 rounded-2xl flex items-center justify-center">
<span className="text-4xl">👋</span>
<div className="ui-enter flex h-full flex-col items-center justify-center gap-4 text-muted-foreground">
<div className="ui-float rounded-2xl border border-border/70 bg-muted/40 p-4">
<span className="text-4xl">🧠</span>
</div>
<div className="text-center space-y-1">
<div className="space-y-1 text-center">
<h3 className="text-lg font-semibold text-foreground">使 NoteAI</h3>
<p className="text-sm text-muted-foreground/80"></p>
<p className="text-sm text-muted-foreground/90"></p>
</div>
</div>
)}
</main>
<AIChatPanel editor={editor} isOpen={isChatOpen} onClose={() => setIsChatOpen(false)} />
</div>
</ImportProvider>
+20 -20
View File
@@ -66,12 +66,12 @@ export default function SettingsPage() {
<ResizableSidebar />
<main className="flex-1 h-full overflow-y-auto p-4 md:p-10">
<div className="mx-auto max-w-3xl space-y-8 pb-16">
<header className="space-y-2">
<header className="ui-enter space-y-2">
<h1 className="text-3xl font-bold tracking-tight"></h1>
<p className="text-muted-foreground">AI</p>
</header>
<section className="rounded-xl border bg-card p-6 space-y-5">
<section className="ui-card ui-enter-delayed p-6 space-y-5">
<div className="flex items-center gap-2 border-b pb-2">
<Type size={18} className="text-primary" />
<h2 className="text-xl font-semibold"></h2>
@@ -83,7 +83,7 @@ export default function SettingsPage() {
<select
value={fontFamily}
onChange={(e) => setFontFamily(e.target.value)}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-select"
>
{fontOptions.map((opt) => (
<option key={opt.value} value={opt.value}>
@@ -102,7 +102,7 @@ export default function SettingsPage() {
step="1"
value={fontSize}
onChange={(e) => setFontSize(parseInt(e.target.value, 10))}
className="w-full"
className="w-full accent-primary"
/>
</label>
@@ -115,7 +115,7 @@ export default function SettingsPage() {
step="0.1"
value={lineHeight}
onChange={(e) => setLineHeight(parseFloat(e.target.value))}
className="w-full"
className="w-full accent-primary"
/>
</label>
@@ -128,7 +128,7 @@ export default function SettingsPage() {
step="0.1"
value={tableLineHeight}
onChange={(e) => setTableLineHeight(parseFloat(e.target.value))}
className="w-full"
className="w-full accent-primary"
/>
</label>
</div>
@@ -138,7 +138,7 @@ export default function SettingsPage() {
<select
value={timezone}
onChange={(e) => setTimezone(e.target.value)}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-select"
>
{timezoneOptions.map((opt) => (
<option key={opt.value} value={opt.value}>
@@ -149,7 +149,7 @@ export default function SettingsPage() {
</label>
</section>
<section className="rounded-xl border bg-card p-6 space-y-5">
<section className="ui-card ui-enter-delayed p-6 space-y-5">
<div className="flex items-center gap-2 border-b pb-2">
<Sparkles size={18} className="text-primary" />
<h2 className="text-xl font-semibold">AI </h2>
@@ -162,7 +162,7 @@ export default function SettingsPage() {
type="text"
value={aiConfig.baseURL}
onChange={(e) => setAIConfig({ baseURL: e.target.value })}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="https://api.openai.com/v1"
/>
</label>
@@ -173,7 +173,7 @@ export default function SettingsPage() {
type="password"
value={aiConfig.apiKey}
onChange={(e) => setAIConfig({ apiKey: e.target.value })}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="sk-..."
/>
</label>
@@ -184,18 +184,18 @@ export default function SettingsPage() {
type="text"
value={aiConfig.model}
onChange={(e) => setAIConfig({ model: e.target.value })}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="gpt-4o-mini"
/>
</label>
</div>
</section>
<section className="rounded-xl border bg-card p-6">
<section className="ui-card ui-enter-delayed p-6">
<PromptManagement />
</section>
<section className="rounded-xl border bg-card p-6 space-y-5">
<section className="ui-card ui-enter-delayed p-6 space-y-5">
<div className="flex items-center gap-2 border-b pb-2">
<Lock size={18} className="text-primary" />
<h2 className="text-xl font-semibold"></h2>
@@ -206,7 +206,7 @@ export default function SettingsPage() {
type="password"
value={currentPassword}
onChange={(e) => setCurrentPassword(e.target.value)}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="当前密码"
required
/>
@@ -214,7 +214,7 @@ export default function SettingsPage() {
type="password"
value={newPassword}
onChange={(e) => setNewPassword(e.target.value)}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="新密码"
required
/>
@@ -222,7 +222,7 @@ export default function SettingsPage() {
type="password"
value={confirmPassword}
onChange={(e) => setConfirmPassword(e.target.value)}
className="w-full rounded-lg border bg-muted/40 px-3 py-2"
className="ui-input"
placeholder="确认新密码"
required
/>
@@ -235,7 +235,7 @@ export default function SettingsPage() {
<button
type="submit"
className="inline-flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90"
className="ui-btn-primary"
>
<Save size={14} />
@@ -243,7 +243,7 @@ export default function SettingsPage() {
</form>
</section>
<section className="rounded-xl border bg-card p-6 space-y-4">
<section className="ui-card ui-enter-delayed p-6 space-y-4">
<h2 className="text-xl font-semibold"></h2>
<p className="text-sm text-muted-foreground"></p>
@@ -254,13 +254,13 @@ export default function SettingsPage() {
const { exportAllPagesAsZip } = await import("@/lib/export");
await exportAllPagesAsZip(pages);
}}
className="inline-flex items-center justify-center gap-2 rounded-lg bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground hover:bg-secondary/80"
className="ui-btn-secondary"
>
<Download size={14} />
(Zip)
</button>
<label className="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/20">
<label className="ui-btn inline-flex cursor-pointer border border-destructive/30 bg-destructive/10 text-destructive hover:bg-destructive/20">
<Upload size={14} />
<input