Add resizable chat sidebar (#1347)
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
e11fb6e778
commit
2b08d86696
1 file changed
+11
-1
@@ -10,11 +10,14 @@ import { serverConfigQueryOptions } from "../lib/serverReactQuery";
|
||||
import { resolveShortcutCommand } from "../keybindings";
|
||||
import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore";
|
||||
import { useThreadSelectionStore } from "../threadSelectionStore";
|
||||
import { Sidebar, SidebarProvider } from "~/components/ui/sidebar";
|
||||
import { resolveSidebarNewThreadEnvMode } from "~/components/Sidebar.logic";
|
||||
import { useAppSettings } from "~/appSettings";
|
||||
import { Sidebar, SidebarProvider, SidebarRail } from "~/components/ui/sidebar";
|
||||
|
||||
const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
|
||||
const THREAD_SIDEBAR_WIDTH_STORAGE_KEY = "chat_thread_sidebar_width";
|
||||
const THREAD_SIDEBAR_MIN_WIDTH = 13 * 16;
|
||||
const THREAD_MAIN_CONTENT_MIN_WIDTH = 40 * 16;
|
||||
|
||||
function ChatRouteGlobalShortcuts() {
|
||||
const clearSelection = useThreadSelectionStore((state) => state.clearSelection);
|
||||
@@ -116,8 +119,15 @@ function ChatRouteLayout() {
|
||||
side="left"
|
||||
collapsible="offcanvas"
|
||||
className="border-r border-border bg-card text-foreground"
|
||||
resizable={{
|
||||
minWidth: THREAD_SIDEBAR_MIN_WIDTH,
|
||||
shouldAcceptWidth: ({ nextWidth, wrapper }) =>
|
||||
wrapper.clientWidth - nextWidth >= THREAD_MAIN_CONTENT_MIN_WIDTH,
|
||||
storageKey: THREAD_SIDEBAR_WIDTH_STORAGE_KEY,
|
||||
}}
|
||||
>
|
||||
<ThreadSidebar />
|
||||
<SidebarRail />
|
||||
</Sidebar>
|
||||
<Outlet />
|
||||
</SidebarProvider>
|
||||
|
||||
Reference in new issue
Block a user