Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Refactor Sidebar component to streamline keybindings handling
Julius Marminge8beba3e16b9b
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex cb2c059ad..e30bfc0c8 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -1,6 +1,5 @@import { MonitorIcon, MoonIcon, SunIcon, TerminalIcon } from "lucide-react";import { useCallback, useEffect, useMemo, useState } from "react";-import type { KeybindingsConfig } from "@t3tools/contracts";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { isElectron } from "../env";import { useTheme } from "../hooks/useTheme";@@ -20,7 +19,6 @@ import { serverConfigQueryOptions } from "../lib/serverReactQuery";import { formatWorktreePathForDisplay, getOrphanedWorktreePathForThread } from "../worktreeCleanup";const THEME_CYCLE = { system: "light", light: "dark", dark: "system" } as const;-const EMPTY_KEYBINDINGS: KeybindingsConfig = [];function formatRelativeTime(iso: string): string {const diff = Date.now() - new Date(iso).getTime();@@ -117,13 +115,14 @@ function terminalStatusIndicator(thread: Thread): TerminalStatusIndicator | nullexport default function Sidebar() {const { state, dispatch } = useStore();const api = useNativeApi();- const keybindingsQuery = useQuery({+ const { data: keybindings = [] } = useQuery({...serverConfigQueryOptions(api),select: (config) => config.keybindings,});- const keybindings = keybindingsQuery.data ?? EMPTY_KEYBINDINGS;const queryClient = useQueryClient();- const removeWorktreeMutation = useMutation(gitRemoveWorktreeMutationOptions({ api, queryClient }));+ const removeWorktreeMutation = useMutation(+ gitRemoveWorktreeMutationOptions({ api, queryClient }),+ );const { theme, setTheme } = useTheme();const [addingProject, setAddingProject] = useState(false);const [newCwd, setNewCwd] = useState("");