"use client"; import { useState, useMemo } from "react"; import Link from "next/link"; import { motion } from "framer-motion"; import { TopNav } from "@/components/layout/top-nav"; import { AmbientParticles } from "@/components/ui/ambient-particles"; import { useApp } from "@/lib/app-context"; import { staggerContainer, staggerItem } from "@/components/ui/motion-presets"; import type { StylePack } from "@/lib/types"; type SourceFilter = "all" | "preset" | "custom" | "community"; const ALL_KEYWORDS = ["写实", "二次元", "像素", "水墨", "赛博", "奇幻", "写意", "科幻", "复古"]; export default function StylesPage() { const { stylePacks } = useApp(); const [query, setQuery] = useState(""); const [source, setSource] = useState("all"); const [keyword, setKeyword] = useState(null); const filtered = useMemo(() => { let list = [...stylePacks]; if (source !== "all") list = list.filter((s) => s.source === source); if (keyword) list = list.filter((s) => s.keywords.includes(keyword)); if (query.trim()) { const q = query.trim().toLowerCase(); list = list.filter( (s) => s.name.toLowerCase().includes(q) || s.description.toLowerCase().includes(q) || s.keywords.some((k) => k.toLowerCase().includes(q)) ); } return list; }, [stylePacks, source, keyword, query]); return (
{/* 页面标题 */}

风格库

Phase 1

项目级风格集。每个风格包含关键词、参考集、Prompt 模板和(可选的)LoRA 绑定。

新建风格
{/* 工具栏 */}
setQuery(e.target.value)} placeholder="搜索风格名 / 描述 / 关键词..." className="flex-1 bg-transparent border-none text-sm text-[var(--text-primary)] placeholder:text-[var(--text-secondary)] focus:outline-none" />
{/* 来源筛选 */}
{(["all", "preset", "custom", "community"] as const).map((s) => ( ))}
{/* 分类筛选(关键词) */}
分类: {ALL_KEYWORDS.map((k) => { const active = keyword === k; return ( ); })}
{/* 卡片网格 */} {filtered.length === 0 ? (

没有匹配的风格

试试调整筛选条件或点击“新建风格”

) : ( {filtered.map((pack) => ( ))} {/* 新建卡片 */} 新建风格 )}
); } function StyleCard({ pack }: { pack: StylePack }) { const sourceLabel = pack.source === "preset" ? "预设" : pack.source === "custom" ? "自建" : "社区"; return ( {/* 代表图(占位) */}
{pack.name.slice(0, 2)}
代表图占位({pack.refImages.length} 张参考)
{/* 来源标签 */} {sourceLabel}
{pack.name}
{pack.keywords.slice(0, 3).map((k) => ( {k} ))}
使用 {pack.usageCount} 次 {pack.loraId && LoRA}
); }