Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

feat: add resizable panels for file tree and chat

nash_su76dd97c152f1
diff --git a/package-lock.json b/package-lock.json
index e3c12af5..5f3e035b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,6 +20,7 @@
"lucide-react": "^1.7.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
+ "react-resizable-panels": "^4.9.0",
"shadcn": "^4.1.2",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.2.2",
@@ -7013,6 +7014,16 @@
"react": "^19.2.4"
}
},
+ "node_modules/react-resizable-panels": {
+ "version": "4.9.0",
+ "resolved": "https://registry.npmjs.org/react-resizable-panels/-/react-resizable-panels-4.9.0.tgz",
+ "integrity": "sha512-sEl+hA6y9/kxa0aPlrUC+G1lcShAf/PiIjoeC8kWXxa53RfAVplVCIxEl01Nwa4L2iRa5JXBXq1/mI8ch6qOZQ==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^18.0.0 || ^19.0.0",
+ "react-dom": "^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/recast": {
"version": "0.23.11",
"resolved": "https://registry.npmjs.org/recast/-/recast-0.23.11.tgz",
diff --git a/package.json b/package.json
index 7a32cc41..350e62ef 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"lucide-react": "^1.7.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
+ "react-resizable-panels": "^4.9.0",
"shadcn": "^4.1.2",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.2.2",
diff --git a/src/components/layout/app-layout.tsx b/src/components/layout/app-layout.tsx
index 79fdf32d..372e3e51 100644
--- a/src/components/layout/app-layout.tsx
+++ b/src/components/layout/app-layout.tsx
@@ -1,6 +1,11 @@
import { useCallback, useEffect } from "react"
import { useWikiStore } from "@/stores/wiki-store"
import { listDirectory } from "@/commands/fs"
+import {
+ ResizablePanelGroup,
+ ResizablePanel,
+ ResizableHandle,
+} from "@/components/ui/resizable"
import { IconSidebar } from "./icon-sidebar"
import { FileTree } from "./file-tree"
import { ContentArea } from "./content-area"
@@ -19,19 +24,22 @@ export function AppLayout() {
}
}, [project, setFileTree])
- useEffect(() => { loadFileTree() }, [loadFileTree])
+ useEffect(() => {
+ loadFileTree()
+ }, [loadFileTree])
return (
<div className="flex h-screen bg-background text-foreground">
<IconSidebar />
- <div className="flex flex-1 overflow-hidden">
- <div className="w-60 border-r">
+ <ResizablePanelGroup direction="horizontal" className="flex-1">
+ <ResizablePanel defaultSize={20} minSize={15} maxSize={40}>
<FileTree />
- </div>
- <div className="flex-1">
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel defaultSize={80}>
<ContentArea />
- </div>
- </div>
+ </ResizablePanel>
+ </ResizablePanelGroup>
</div>
)
}
diff --git a/src/components/layout/content-area.tsx b/src/components/layout/content-area.tsx
index a600d65b..b0d320d6 100644
--- a/src/components/layout/content-area.tsx
+++ b/src/components/layout/content-area.tsx
@@ -2,12 +2,18 @@ import { useEffect, useCallback, useRef } from "react"
import { useWikiStore } from "@/stores/wiki-store"
import { readFile, writeFile } from "@/commands/fs"
import { WikiEditor } from "@/components/editor/wiki-editor"
+import {
+ ResizablePanelGroup,
+ ResizablePanel,
+ ResizableHandle,
+} from "@/components/ui/resizable"
import { ChatBar } from "./chat-bar"
export function ContentArea() {
const selectedFile = useWikiStore((s) => s.selectedFile)
const fileContent = useWikiStore((s) => s.fileContent)
const setFileContent = useWikiStore((s) => s.setFileContent)
+ const chatExpanded = useWikiStore((s) => s.chatExpanded)
const saveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
useEffect(() => {
@@ -26,11 +32,11 @@ export function ContentArea() {
if (saveTimerRef.current) clearTimeout(saveTimerRef.current)
saveTimerRef.current = setTimeout(() => {
writeFile(selectedFile, markdown).catch((err) =>
- console.error("Failed to save:", err),
+ console.error("Failed to save:", err)
)
}, 1000)
},
- [selectedFile],
+ [selectedFile]
)
useEffect(() => {
@@ -41,33 +47,49 @@ export function ContentArea() {
const isMarkdown = selectedFile?.endsWith(".md")
- return (
- <div className="flex h-full flex-col">
- <div className="flex-1 overflow-auto">
- {selectedFile ? (
- isMarkdown ? (
- <WikiEditor
- key={selectedFile}
- content={fileContent}
- onSave={handleSave}
- />
- ) : (
- <div className="p-6">
- <div className="mb-4 text-xs text-muted-foreground">
- {selectedFile}
- </div>
- <pre className="whitespace-pre-wrap font-mono text-sm">
- {fileContent}
- </pre>
- </div>
- )
+ const editorContent = (
+ <div className="h-full overflow-auto">
+ {selectedFile ? (
+ isMarkdown ? (
+ <WikiEditor
+ key={selectedFile}
+ content={fileContent}
+ onSave={handleSave}
+ />
) : (
- <div className="flex h-full items-center justify-center text-muted-foreground">
- Select a file from the tree to view
+ <div className="p-6">
+ <div className="mb-4 text-xs text-muted-foreground">{selectedFile}</div>
+ <pre className="whitespace-pre-wrap font-mono text-sm">{fileContent}</pre>
</div>
- )}
+ )
+ ) : (
+ <div className="flex h-full items-center justify-center text-muted-foreground">
+ Select a file from the tree to view
+ </div>
+ )}
+ </div>
+ )
+
+ if (!chatExpanded) {
+ return (
+ <div className="flex h-full flex-col">
+ <div className="flex-1 overflow-hidden">{editorContent}</div>
+ <ChatBar />
</div>
- <ChatBar />
+ )
+ }
+
+ return (
+ <div className="flex h-full flex-col">
+ <ResizablePanelGroup direction="vertical" className="flex-1">
+ <ResizablePanel defaultSize={60} minSize={30}>
+ {editorContent}
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel defaultSize={40} minSize={20}>
+ <ChatBar />
+ </ResizablePanel>
+ </ResizablePanelGroup>
</div>
)
}
diff --git a/src/components/ui/resizable.tsx b/src/components/ui/resizable.tsx
new file mode 100644
index 00000000..8b139cc7
--- /dev/null
+++ b/src/components/ui/resizable.tsx
@@ -0,0 +1,48 @@
+import * as ResizablePrimitive from "react-resizable-panels"
+
+import { cn } from "@/lib/utils"
+
+function ResizablePanelGroup({
+ className,
+ ...props
+}: ResizablePrimitive.GroupProps) {
+ return (
+ <ResizablePrimitive.Group
+ data-slot="resizable-panel-group"
+ className={cn(
+ "flex h-full w-full aria-[orientation=vertical]:flex-col",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
+ return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
+}
+
+function ResizableHandle({
+ withHandle,
+ className,
+ ...props
+}: ResizablePrimitive.SeparatorProps & {
+ withHandle?: boolean
+}) {
+ return (
+ <ResizablePrimitive.Separator
+ data-slot="resizable-handle"
+ className={cn(
+ "relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
+ className
+ )}
+ {...props}
+ >
+ {withHandle && (
+ <div className="z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border" />
+ )}
+ </ResizablePrimitive.Separator>
+ )
+}
+
+export { ResizableHandle, ResizablePanel, ResizablePanelGroup }