Răsfoiți Sursa

refactor(nav): 隐藏拆文库和剧情框架库侧边栏入口

- 从侧边栏移除拆文库(dismantling)和剧情框架库(plotFrameworkLibrary)入口
- 从 content-area 路由中移除对应视图映射
- 从 sidebar-nav-preferences 默认排序中移除两项
- 从 interface-section 设置标签中移除两项
- 从 wiki-store activeView 类型中移除两项
- 更新 dismantling-view.spec.ts 以验证底层实现保留而非路由连接
- 修复 content-area.tsx 中未使用的 ChatPanel 导入
- 保留 dismantling-view.tsx、plot-framework-library-view.tsx 等底层实现代码
Mochocyang 2 luni în urmă
părinte
comite
f175ab3699

+ 0 - 29
src/components/layout/content-area.tsx

@@ -4,11 +4,6 @@ import { WritingWorkspace } from "./writing-workspace";
 import { SearchView } from "@/components/search/search-view";
 import { UnifiedSkillLibraryView } from "@/components/skill-library/unified-skill-library-view";
 
-const ChatPanel = lazy(async () => {
-  const mod = await import("@/components/chat/chat-panel");
-  return { default: mod.ChatPanel };
-});
-
 const AIChatTabContainer = lazy(async () => {
   const mod = await import("@/components/chat/ai-chat-tab-container");
   return { default: mod.AIChatTabContainer };
@@ -54,16 +49,6 @@ const BookAnalysisView = lazy(async () => {
   return { default: mod.BookAnalysisView };
 });
 
-const DismantlingView = lazy(async () => {
-  const mod = await import("@/components/novel/dismantling-view")
-  return { default: mod.DismantlingView }
-})
-
-const PlotFrameworkLibraryView = lazy(async () => {
-  const mod = await import("@/components/novel/plot-framework-library-view")
-  return { default: mod.PlotFrameworkLibraryView }
-})
-
 const StorySimulationView = lazy(async () => {
   const mod =
     await import("@/components/novel/story-simulation/story-simulation-view");
@@ -148,20 +133,6 @@ export function ContentArea() {
           </Suspense>
         );
         break;
-      case "dismantling":
-        content = (
-          <Suspense fallback={<LoadingView />}>
-            <DismantlingView />
-          </Suspense>
-        );
-        break;
-      case "plotFrameworkLibrary":
-        content = (
-          <Suspense fallback={<LoadingView />}>
-            <PlotFrameworkLibraryView />
-          </Suspense>
-        );
-        break;
       case "storySimulation":
         content = (
           <Suspense fallback={<LoadingView />}>

+ 1 - 3
src/components/layout/icon-sidebar.tsx

@@ -1,6 +1,6 @@
 import { useState, useRef, useEffect, useMemo } from "react"
 import {
-  FileText, FolderOpen, Search, Network, Brain, Settings, ArrowLeftRight, Sun, Moon, SunMoon, Check, Trash2, Sparkles, LayoutDashboard, BookOpen, BookOpenCheck, Drama, WandSparkles, Layers,
+  FileText, FolderOpen, Search, Network, Brain, Settings, ArrowLeftRight, Sun, Moon, SunMoon, Check, Trash2, Sparkles, LayoutDashboard, BookOpen, Drama, WandSparkles,
 } from "lucide-react"
 import { createPortal } from "react-dom"
 import {
@@ -47,8 +47,6 @@ const CONFIGURABLE_NAV_ITEMS: ConfigurableNavItem[] = [
   { id: "lint", view: "lint", icon: Brain, labelKey: "novel.nav.lint" },
   { id: "soul", view: "soul", icon: Sparkles, labelKey: "novel.nav.soul" },
   { id: "skillLibrary", view: "skillLibrary", icon: WandSparkles, labelKey: "novel.nav.skillLibrary" },
-  { id: "dismantling", view: "dismantling", icon: BookOpenCheck, labelKey: "novel.nav.dismantlingLibrary" },
-  { id: "plotFrameworkLibrary", view: "plotFrameworkLibrary", icon: Layers, labelKey: "novel.nav.plotFrameworkLibrary" },
   { id: "bookAnalysis", view: "bookAnalysis", icon: BookOpen, labelKey: "novel.nav.dismantling" },
   { id: "reviewCenter", view: "reviewCenter", icon: LayoutDashboard, labelKey: "novel.nav.reviewCenter" },
   { id: "storySimulation", view: "storySimulation", icon: Drama, labelKey: "novel.nav.storySimulation" },

+ 0 - 4
src/components/layout/sidebar-panel.tsx

@@ -1590,10 +1590,6 @@ export function SidebarPanel() {
 
   if (activeView === "bookAnalysis") {
     return <BookAnalysisSidebarPanel />;
-
-  if (activeView === "dismantling") {
-    return <DismantlingSidebarPanel />;
-  }
   }
 
   if (activeView === "search") {

+ 4 - 9
src/components/novel/dismantling-view.spec.ts

@@ -4,8 +4,8 @@ import { describe, expect, it } from "vitest"
 
 const root = resolve(__dirname, "../../..")
 
-describe("dismantling library navigation", () => {
-  it("verifies the dismantling library routing is connected", () => {
+describe("dismantling library implementation", () => {
+  it("keeps the book analysis routing connected", () => {
     const storeSource = readFileSync(resolve(root, "src/stores/wiki-store.ts"), "utf8")
     const sidebarSource = readFileSync(resolve(root, "src/components/layout/icon-sidebar.tsx"), "utf8")
     const contentSource = readFileSync(resolve(root, "src/components/layout/content-area.tsx"), "utf8")
@@ -15,20 +15,15 @@ describe("dismantling library navigation", () => {
     expect(sidebarSource).toContain("novel.nav.dismantling")
     expect(contentSource).toContain("BookAnalysisView")
     expect(contentSource).toContain("@/components/novel/book-analysis-view")
-    expect(contentSource).toContain("DismantlingView")
-    expect(contentSource).toContain("@/components/novel/dismantling-view")
   })
 
-  it("connects the dismantling sidebar to the dismantling view workspace", () => {
+  it("keeps the underlying dismantling implementation intact", () => {
     const viewSource = readFileSync(resolve(root, "src/components/novel/dismantling-view.tsx"), "utf8")
-    const sidebarSource = readFileSync(resolve(root, "src/components/layout/sidebar-panel.tsx"), "utf8")
 
-    expect(sidebarSource).toContain('activeView === "dismantling"')
-    expect(sidebarSource).toContain("DismantlingSidebarPanel")
     expect(viewSource).toContain("拆文结果")
   })
 
-  it("keeps the underlying dismantling implementation intact and up-to-date", () => {
+  it("keeps the dismantling sidebar helpers intact", () => {
     const sidebarSource = readFileSync(resolve(root, "src/components/layout/sidebar-panel.tsx"), "utf8")
 
     expect(sidebarSource).toContain("正在提取章节")

+ 0 - 2
src/components/settings/sections/interface-section.tsx

@@ -76,9 +76,7 @@ const SIDEBAR_NAV_LABEL_KEYS: Record<SidebarNavItemId, string> = {
   lint: "novel.nav.lint",
   soul: "novel.nav.soul",
   skillLibrary: "novel.nav.skillLibrary",
-  dismantling: "novel.nav.dismantlingLibrary",
   bookAnalysis: "novel.nav.dismantling",
-  plotFrameworkLibrary: "novel.nav.plotFrameworkLibrary",
   reviewCenter: "novel.nav.reviewCenter",
   storySimulation: "novel.nav.storySimulation",
   search: "novel.nav.search",

+ 0 - 4
src/lib/sidebar-nav-preferences.spec.ts

@@ -13,8 +13,6 @@ describe("sidebar nav preferences", () => {
       "sources",
       "graph",
       "lint",
-      "dismantling",
-      "plotFrameworkLibrary",
       "soul",
       "skillLibrary",
       "bookAnalysis",
@@ -38,8 +36,6 @@ describe("sidebar nav preferences", () => {
       "sources",
       "graph",
       "lint",
-      "dismantling",
-      "plotFrameworkLibrary",
       "soul",
       "skillLibrary",
       "bookAnalysis",

+ 0 - 2
src/lib/sidebar-nav-preferences.ts

@@ -3,8 +3,6 @@ export const DEFAULT_SIDEBAR_NAV_ORDER = [
   "sources",
   "graph",
   "lint",
-  "dismantling",
-  "plotFrameworkLibrary",
   "soul",
   "skillLibrary",
   "bookAnalysis",

+ 1 - 1
src/stores/wiki-store.ts

@@ -545,7 +545,7 @@ interface WikiState {
   chatExpanded: boolean
   chatDockPosition: ChatDockPosition
   searchPanelOpen: boolean
-  activeView: "wiki" | "sources" | "search" | "graph" | "lint" | "soul" | "skillLibrary" | "writingSkillLibrary" | "dismantling" | "bookAnalysis" | "plotFrameworkLibrary" | "settings" | "trash" | "reviewCenter" | "storySimulation"
+  activeView: "wiki" | "sources" | "search" | "graph" | "lint" | "soul" | "skillLibrary" | "writingSkillLibrary" | "bookAnalysis" | "settings" | "trash" | "reviewCenter" | "storySimulation"
   activeSettingsCategory: SettingsCategoryId | null
   selectedSoulId: string | null
   selectedSoulTab: "project" | "character"