Unified · Split
| @@ -1,47 +0,0 @@ | ||
| 1 | −/** | |
| 2 | − * App Settings - Backward-compatible shim. | |
| 3 | − * | |
| 4 | − * Re-exports the unified settings hook (`useSettings` / `useUpdateSettings`) | |
| 5 | − * as `useAppSettings()` so existing consumers continue to work without | |
| 6 | − * modification. New code should import from `~/hooks/useSettings` directly. | |
| 7 | − * | |
| 8 | − * Also re-exports type aliases and schema constants consumed by components | |
| 9 | − * that only need the type (e.g. `TimestampFormat`). | |
| 10 | − */ | |
| 11 | −import { useSettings, useUpdateSettings, type UnifiedSettings } from "./hooks/useSettings"; | |
| 12 | −import { | |
| 13 | − type TimestampFormat, | |
| 14 | − type SidebarProjectSortOrder, | |
| 15 | − type SidebarThreadSortOrder, | |
| 16 | − DEFAULT_TIMESTAMP_FORMAT, | |
| 17 | − DEFAULT_SIDEBAR_PROJECT_SORT_ORDER, | |
| 18 | − DEFAULT_SIDEBAR_THREAD_SORT_ORDER, | |
| 19 | −} from "./clientSettings"; | |
| 20 | − | |
| 21 | −// ── Re-exports for downstream type consumers ───────────────────────── | |
| 22 | − | |
| 23 | −export type { TimestampFormat, SidebarProjectSortOrder, SidebarThreadSortOrder }; | |
| 24 | −export { | |
| 25 | − DEFAULT_TIMESTAMP_FORMAT, | |
| 26 | − DEFAULT_SIDEBAR_PROJECT_SORT_ORDER, | |
| 27 | − DEFAULT_SIDEBAR_THREAD_SORT_ORDER, | |
| 28 | −}; | |
| 29 | −export type { UnifiedSettings }; | |
| 30 | − | |
| 31 | −// ── Backward-compat type alias ─────────────────────────────────────── | |
| 32 | − | |
| 33 | −export type AppSettings = UnifiedSettings; | |
| 34 | − | |
| 35 | −// ── Backward-compat hook ───────────────────────────────────────────── | |
| 36 | − | |
| 37 | −export function useAppSettings() { | |
| 38 | − const settings = useSettings(); | |
| 39 | − const { updateSettings, resetSettings, defaults } = useUpdateSettings(); | |
| 40 | − | |
| 41 | − return { | |
| 42 | − settings, | |
| 43 | − updateSettings: (patch: Partial<AppSettings>) => updateSettings(patch), | |
| 44 | − resetSettings, | |
| 45 | − defaults, | |
| 46 | − } as const; | |
| 47 | −} | |
| @@ -120,7 +120,7 @@ import { · 119 unmodified lines | ||
| 120 | 120 | import { SidebarTrigger } from "./ui/sidebar"; |
| 121 | 121 | import { newCommandId, newMessageId, newThreadId } from "~/lib/utils"; |
| 122 | 122 | import { readNativeApi } from "~/nativeApi"; |
| 123 | −import { useAppSettings } from "../appSettings"; | |
| 123 | +import { useSettings } from "../hooks/useSettings"; | |
| 124 | 124 | import { getCustomModelOptionsByProvider, resolveAppModelSelection } from "../modelSelection"; |
| 125 | 125 | import { isTerminalFocused } from "../lib/terminalFocus"; |
| 126 | 126 | import { |
| @@ -245,7 +245,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 118 unmodified lines | ||
| 245 | 245 | const syncServerReadModel = useStore((store) => store.syncServerReadModel); |
| 246 | 246 | const setStoreThreadError = useStore((store) => store.setError); |
| 247 | 247 | const setStoreThreadBranch = useStore((store) => store.setThreadBranch); |
| 248 | − const { settings } = useAppSettings(); | |
| 248 | + const settings = useSettings(); | |
| 249 | 249 | const setStickyComposerModelSelection = useComposerDraftStore( |
| 250 | 250 | (store) => store.setStickyModelSelection, |
| 251 | 251 | ); |
| @@ -30,7 +30,7 @@ import { buildPatchCacheKey } from "../lib/diffRendering"; · 29 unmodified lines | ||
| 30 | 30 | import { resolveDiffThemeName } from "../lib/diffRendering"; |
| 31 | 31 | import { useTurnDiffSummaries } from "../hooks/useTurnDiffSummaries"; |
| 32 | 32 | import { useStore } from "../store"; |
| 33 | −import { useAppSettings } from "../appSettings"; | |
| 33 | +import { useSettings } from "../hooks/useSettings"; | |
| 34 | 34 | import { formatShortTimestamp } from "../timestampFormat"; |
| 35 | 35 | import { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from "./DiffPanelShell"; |
| 36 | 36 | import { ToggleGroup, Toggle } from "./ui/toggle-group"; |
| @@ -166,7 +166,7 @@ export { DiffWorkerPoolProvider } from "./DiffWorkerPoolProvider"; · 129 unmodified lines | ||
| 166 | 166 | export default function DiffPanel({ mode = "inline" }: DiffPanelProps) { |
| 167 | 167 | const navigate = useNavigate(); |
| 168 | 168 | const { resolvedTheme } = useTheme(); |
| 169 | − const { settings } = useAppSettings(); | |
| 169 | + const settings = useSettings(); | |
| 170 | 170 | const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>("stacked"); |
| 171 | 171 | const [diffWordWrap, setDiffWordWrap] = useState(settings.diffWordWrap); |
| 172 | 172 | const patchViewportRef = useRef<HTMLDivElement>(null); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | import { memo, useState, useCallback } from "react"; |
| 2 | −import { type TimestampFormat } from "../appSettings"; | |
| 2 | +import { type TimestampFormat } from "../clientSettings"; | |
| 3 | 3 | import { Badge } from "./ui/badge"; |
| 4 | 4 | import { Button } from "./ui/button"; |
| 5 | 5 | import { ScrollArea } from "./ui/scroll-area"; |
| @@ -1,4 +1,4 @@ | ||
| 1 | −import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../appSettings"; | |
| 1 | +import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../clientSettings"; | |
| 2 | 2 | import type { Thread } from "../types"; |
| 3 | 3 | import { cn } from "../lib/utils"; |
| 4 | 4 | import { |
| @@ -38,11 +38,7 @@ import { · 37 unmodified lines | ||
| 38 | 38 | } from "@t3tools/contracts"; |
| 39 | 39 | import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query"; |
| 40 | 40 | import { useLocation, useNavigate, useParams } from "@tanstack/react-router"; |
| 41 | −import { | |
| 42 | − type SidebarProjectSortOrder, | |
| 43 | − type SidebarThreadSortOrder, | |
| 44 | − useAppSettings, | |
| 45 | −} from "../appSettings"; | |
| 41 | +import { type SidebarProjectSortOrder, type SidebarThreadSortOrder } from "../clientSettings"; | |
| 46 | 42 | import { isElectron } from "../env"; |
| 47 | 43 | import { APP_STAGE_LABEL, APP_VERSION } from "../branding"; |
| 48 | 44 | import { isLinuxPlatform, isMacPlatform, newCommandId, newProjectId } from "../lib/utils"; |
| @@ -102,6 +98,7 @@ import { · 53 unmodified lines | ||
| 102 | 98 | sortThreadsForSidebar, |
| 103 | 99 | } from "./Sidebar.logic"; |
| 104 | 100 | import { useCopyToClipboard } from "~/hooks/useCopyToClipboard"; |
| 101 | +import { useSettings, useUpdateSettings } from "~/hooks/useSettings"; | |
| 105 | 102 | |
| 106 | 103 | const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = []; |
| 107 | 104 | const THREAD_PREVIEW_LIMIT = 6; |
| @@ -381,7 +378,8 @@ export default function Sidebar() { · 273 unmodified lines | ||
| 381 | 378 | ); |
| 382 | 379 | const navigate = useNavigate(); |
| 383 | 380 | const isOnSettings = useLocation({ select: (loc) => loc.pathname === "/settings" }); |
| 384 | − const { settings: appSettings, updateSettings } = useAppSettings(); | |
| 381 | + const appSettings = useSettings(); | |
| 382 | + const { updateSettings } = useUpdateSettings(); | |
| 385 | 383 | const { handleNewThread } = useHandleNewThread(); |
| 386 | 384 | const routeThreadId = useParams({ |
| 387 | 385 | strict: false, |
| @@ -48,7 +48,7 @@ import { · 47 unmodified lines | ||
| 48 | 48 | type ParsedTerminalContextEntry, |
| 49 | 49 | } from "~/lib/terminalContext"; |
| 50 | 50 | import { cn } from "~/lib/utils"; |
| 51 | −import { type TimestampFormat } from "../../appSettings"; | |
| 51 | +import { type TimestampFormat } from "../../clientSettings"; | |
| 52 | 52 | import { formatTimestamp } from "../../timestampFormat"; |
| 53 | 53 | import { |
| 54 | 54 | buildInlineTerminalContextText, |
| @@ -31,7 +31,7 @@ import { · 30 unmodified lines | ||
| 31 | 31 | import { create } from "zustand"; |
| 32 | 32 | import { createJSONStorage, persist } from "zustand/middleware"; |
| 33 | 33 | import { createDebouncedStorage, createMemoryStorage } from "./lib/storage"; |
| 34 | −import { UnifiedSettings } from "./appSettings"; | |
| 34 | +import { UnifiedSettings } from "./hooks/useSettings"; | |
| 35 | 35 | |
| 36 | 36 | export const COMPOSER_DRAFT_STORAGE_KEY = "t3code:composer-drafts:v1"; |
| 37 | 37 | const COMPOSER_DRAFT_STORAGE_VERSION = 3; |
| @@ -10,7 +10,7 @@ import { · 9 unmodified lines | ||
| 10 | 10 | resolveSelectableModel, |
| 11 | 11 | } from "@t3tools/shared/model"; |
| 12 | 12 | import { getComposerProviderState } from "./components/chat/composerProviderRegistry"; |
| 13 | −import { UnifiedSettings } from "./appSettings"; | |
| 13 | +import { UnifiedSettings } from "./hooks/useSettings"; | |
| 14 | 14 | |
| 15 | 15 | const MAX_CUSTOM_MODEL_COUNT = 32; |
| 16 | 16 | export const MAX_CUSTOM_MODEL_LENGTH = 256; |
| @@ -4,7 +4,7 @@ import { ChevronDownIcon, PlusIcon, RotateCcwIcon, Undo2Icon, XIcon } from "luci · 3 unmodified lines | ||
| 4 | 4 | import { type ReactNode, useCallback, useState } from "react"; |
| 5 | 5 | import { type ProviderKind } from "@t3tools/contracts"; |
| 6 | 6 | import { getModelOptions, normalizeModelSlug } from "@t3tools/shared/model"; |
| 7 | −import { useAppSettings } from "../appSettings"; | |
| 7 | +import { useSettings, useUpdateSettings } from "../hooks/useSettings"; | |
| 8 | 8 | import { |
| 9 | 9 | getCustomModelOptionsByProvider, |
| 10 | 10 | MAX_CUSTOM_MODEL_LENGTH, |
| @@ -184,7 +184,8 @@ function SettingResetButton({ label, onClick }: { label: string; onClick: () => · 173 unmodified lines | ||
| 184 | 184 | |
| 185 | 185 | function SettingsRouteView() { |
| 186 | 186 | const { theme, setTheme } = useTheme(); |
| 187 | − const { settings, defaults, updateSettings, resetSettings } = useAppSettings(); | |
| 187 | + const settings = useSettings(); | |
| 188 | + const { updateSettings, resetSettings, defaults } = useUpdateSettings(); | |
| 188 | 189 | const serverConfigQuery = useQuery(serverConfigQueryOptions()); |
| 189 | 190 | const [isOpeningKeybindings, setIsOpeningKeybindings] = useState(false); |
| 190 | 191 | const [openKeybindingsError, setOpenKeybindingsError] = useState<string | null>(null); |
| @@ -11,7 +11,7 @@ import { resolveShortcutCommand } from "../keybindings"; · 10 unmodified lines | ||
| 11 | 11 | import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore"; |
| 12 | 12 | import { useThreadSelectionStore } from "../threadSelectionStore"; |
| 13 | 13 | import { resolveSidebarNewThreadEnvMode } from "~/components/Sidebar.logic"; |
| 14 | −import { useAppSettings } from "~/appSettings"; | |
| 14 | +import { useSettings } from "~/hooks/useSettings"; | |
| 15 | 15 | import { Sidebar, SidebarProvider, SidebarRail } from "~/components/ui/sidebar"; |
| 16 | 16 | |
| 17 | 17 | const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = []; |
| @@ -31,7 +31,7 @@ function ChatRouteGlobalShortcuts() { · 13 unmodified lines | ||
| 31 | 31 | ? selectThreadTerminalState(state.terminalStateByThreadId, routeThreadId).terminalOpen |
| 32 | 32 | : false, |
| 33 | 33 | ); |
| 34 | − const { settings: appSettings } = useAppSettings(); | |
| 34 | + const appSettings = useSettings(); | |
| 35 | 35 | |
| 36 | 36 | useEffect(() => { |
| 37 | 37 | const onWindowKeyDown = (event: KeyboardEvent) => { |
| @@ -1,4 +1,4 @@ | ||
| 1 | −import { type TimestampFormat } from "./appSettings"; | |
| 1 | +import { type TimestampFormat } from "./clientSettings"; | |
| 2 | 2 | |
| 3 | 3 | export function getTimestampFormatOptions( |
| 4 | 4 | timestampFormat: TimestampFormat, |