| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | import { MonitorIcon, MoonIcon, SunIcon, TerminalIcon } from "lucide-react"; |
| 2 | 2 | import { useCallback, useEffect, useMemo, useState } from "react"; |
| 3 | | import type { KeybindingsConfig } from "@t3tools/contracts"; |
| 4 | 3 | import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; |
| 5 | 4 | import { isElectron } from "../env"; |
| 6 | 5 | import { useTheme } from "../hooks/useTheme"; |
| ... | ... | @@ -20,7 +19,6 @@ import { serverConfigQueryOptions } from "../lib/serverReactQuery"; |
| 20 | 19 | import { formatWorktreePathForDisplay, getOrphanedWorktreePathForThread } from "../worktreeCleanup"; |
| 21 | 20 | |
| 22 | 21 | const THEME_CYCLE = { system: "light", light: "dark", dark: "system" } as const; |
| 23 | | const EMPTY_KEYBINDINGS: KeybindingsConfig = []; |
| 24 | 22 | |
| 25 | 23 | function formatRelativeTime(iso: string): string { |
| 26 | 24 | const diff = Date.now() - new Date(iso).getTime(); |
| ... | ... | @@ -117,13 +115,14 @@ function terminalStatusIndicator(thread: Thread): TerminalStatusIndicator | null |
| 117 | 115 | export default function Sidebar() { |
| 118 | 116 | const { state, dispatch } = useStore(); |
| 119 | 117 | const api = useNativeApi(); |
| 120 | | const keybindingsQuery = useQuery({ |
| 118 | const { data: keybindings = [] } = useQuery({ |
| 121 | 119 | ...serverConfigQueryOptions(api), |
| 122 | 120 | select: (config) => config.keybindings, |
| 123 | 121 | }); |
| 124 | | const keybindings = keybindingsQuery.data ?? EMPTY_KEYBINDINGS; |
| 125 | 122 | const queryClient = useQueryClient(); |
| 126 | | const removeWorktreeMutation = useMutation(gitRemoveWorktreeMutationOptions({ api, queryClient })); |
| 123 | const removeWorktreeMutation = useMutation( |
| 124 | gitRemoveWorktreeMutationOptions({ api, queryClient }), |
| 125 | ); |
| 127 | 126 | const { theme, setTheme } = useTheme(); |
| 128 | 127 | const [addingProject, setAddingProject] = useState(false); |
| 129 | 128 | const [newCwd, setNewCwd] = useState(""); |