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

fix: replace react-resizable-panels with custom drag-to-resize implementation

nash_su45ec9581534d
diff --git a/src/components/layout/app-layout.tsx b/src/components/layout/app-layout.tsx
index a4c3dfc1..edd9f168 100644
--- a/src/components/layout/app-layout.tsx
+++ b/src/components/layout/app-layout.tsx
@@ -1,5 +1,4 @@
-import { useCallback, useEffect } from "react"
-import { Group, Panel, Separator } from "react-resizable-panels"
+import { useCallback, useEffect, useRef, useState } from "react"
import { useWikiStore } from "@/stores/wiki-store"
import { listDirectory } from "@/commands/fs"
import { IconSidebar } from "./icon-sidebar"
@@ -9,6 +8,9 @@ import { ContentArea } from "./content-area"
export function AppLayout() {
const project = useWikiStore((s) => s.project)
const setFileTree = useWikiStore((s) => s.setFileTree)
+ const [sidebarWidth, setSidebarWidth] = useState(260)
+ const isDragging = useRef(false)
+ const containerRef = useRef<HTMLDivElement>(null)
const loadFileTree = useCallback(async () => {
if (!project) return
@@ -24,19 +26,50 @@ export function AppLayout() {
loadFileTree()
}, [loadFileTree])
+ const handleMouseDown = useCallback((e: React.MouseEvent) => {
+ e.preventDefault()
+ isDragging.current = true
+ document.body.style.cursor = "col-resize"
+ document.body.style.userSelect = "none"
+
+ const handleMouseMove = (e: MouseEvent) => {
+ if (!isDragging.current || !containerRef.current) return
+ const containerRect = containerRef.current.getBoundingClientRect()
+ const newWidth = e.clientX - containerRect.left
+ const minWidth = 150
+ const maxWidth = containerRect.width * 0.5
+ setSidebarWidth(Math.max(minWidth, Math.min(maxWidth, newWidth)))
+ }
+
+ const handleMouseUp = () => {
+ isDragging.current = false
+ document.body.style.cursor = ""
+ document.body.style.userSelect = ""
+ document.removeEventListener("mousemove", handleMouseMove)
+ document.removeEventListener("mouseup", handleMouseUp)
+ }
+
+ document.addEventListener("mousemove", handleMouseMove)
+ document.addEventListener("mouseup", handleMouseUp)
+ }, [])
+
return (
<div className="flex h-screen bg-background text-foreground">
<IconSidebar />
- <div className="min-w-0 flex-1 overflow-hidden">
- <Group orientation="horizontal">
- <Panel defaultSize={25} minSize={15} maxSize={40}>
- <FileTree />
- </Panel>
- <Separator className="w-1.5 cursor-col-resize bg-border/40 transition-colors hover:bg-primary/30" />
- <Panel defaultSize={75}>
- <ContentArea />
- </Panel>
- </Group>
+ <div ref={containerRef} className="flex min-w-0 flex-1 overflow-hidden">
+ <div
+ className="shrink-0 overflow-hidden border-r"
+ style={{ width: sidebarWidth }}
+ >
+ <FileTree />
+ </div>
+ <div
+ className="w-1.5 shrink-0 cursor-col-resize bg-border/40 transition-colors hover:bg-primary/30 active:bg-primary/40"
+ onMouseDown={handleMouseDown}
+ />
+ <div className="min-w-0 flex-1 overflow-hidden">
+ <ContentArea />
+ </div>
</div>
</div>
)