History

rm reexport shi

Julius Marminge committed 7 months ago

Commit da0eaff1 parent 7b0c9c012 files · +19 −67Browse files

Unified · Split

12 files
  1. apps/web/src/appSettings.ts +0 −47
  2. apps/web/src/components/ChatView.tsx +2 −2
  3. apps/web/src/components/DiffPanel.tsx +2 −2
  4. apps/web/src/components/PlanSidebar.tsx +1 −1
  5. apps/web/src/components/Sidebar.logic.ts +1 −1
  6. apps/web/src/components/Sidebar.tsx +4 −6
  7. apps/web/src/components/chat/MessagesTimeline.tsx +1 −1
  8. apps/web/src/composerDraftStore.ts +1 −1
  9. apps/web/src/modelSelection.ts +1 −1
  10. apps/web/src/routes/_chat.settings.tsx +3 −2
  11. apps/web/src/routes/_chat.tsx +2 −2
  12. apps/web/src/timestampFormat.ts +1 −1
apps/web/src/appSettings.ts+0−47
@@ -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−}
apps/web/src/components/ChatView.tsx+2−2
@@ -120,7 +120,7 @@ import { · 119 unmodified lines
120120 import { SidebarTrigger } from "./ui/sidebar";
121121 import { newCommandId, newMessageId, newThreadId } from "~/lib/utils";
122122 import { readNativeApi } from "~/nativeApi";
123−import { useAppSettings } from "../appSettings";
123+import { useSettings } from "../hooks/useSettings";
124124 import { getCustomModelOptionsByProvider, resolveAppModelSelection } from "../modelSelection";
125125 import { isTerminalFocused } from "../lib/terminalFocus";
126126 import {
@@ -245,7 +245,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 118 unmodified lines
245245 const syncServerReadModel = useStore((store) => store.syncServerReadModel);
246246 const setStoreThreadError = useStore((store) => store.setError);
247247 const setStoreThreadBranch = useStore((store) => store.setThreadBranch);
248− const { settings } = useAppSettings();
248+ const settings = useSettings();
249249 const setStickyComposerModelSelection = useComposerDraftStore(
250250 (store) => store.setStickyModelSelection,
251251 );
apps/web/src/components/DiffPanel.tsx+2−2
@@ -30,7 +30,7 @@ import { buildPatchCacheKey } from "../lib/diffRendering"; · 29 unmodified lines
3030 import { resolveDiffThemeName } from "../lib/diffRendering";
3131 import { useTurnDiffSummaries } from "../hooks/useTurnDiffSummaries";
3232 import { useStore } from "../store";
33−import { useAppSettings } from "../appSettings";
33+import { useSettings } from "../hooks/useSettings";
3434 import { formatShortTimestamp } from "../timestampFormat";
3535 import { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from "./DiffPanelShell";
3636 import { ToggleGroup, Toggle } from "./ui/toggle-group";
@@ -166,7 +166,7 @@ export { DiffWorkerPoolProvider } from "./DiffWorkerPoolProvider"; · 129 unmodified lines
166166 export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
167167 const navigate = useNavigate();
168168 const { resolvedTheme } = useTheme();
169− const { settings } = useAppSettings();
169+ const settings = useSettings();
170170 const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>("stacked");
171171 const [diffWordWrap, setDiffWordWrap] = useState(settings.diffWordWrap);
172172 const patchViewportRef = useRef<HTMLDivElement>(null);
apps/web/src/components/PlanSidebar.tsx+1−1
@@ -1,5 +1,5 @@
11 import { memo, useState, useCallback } from "react";
2−import { type TimestampFormat } from "../appSettings";
2+import { type TimestampFormat } from "../clientSettings";
33 import { Badge } from "./ui/badge";
44 import { Button } from "./ui/button";
55 import { ScrollArea } from "./ui/scroll-area";
apps/web/src/components/Sidebar.logic.ts+1−1
@@ -1,4 +1,4 @@
1−import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../appSettings";
1+import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../clientSettings";
22 import type { Thread } from "../types";
33 import { cn } from "../lib/utils";
44 import {
apps/web/src/components/Sidebar.tsx+4−6
@@ -38,11 +38,7 @@ import { · 37 unmodified lines
3838 } from "@t3tools/contracts";
3939 import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
4040 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";
4642 import { isElectron } from "../env";
4743 import { APP_STAGE_LABEL, APP_VERSION } from "../branding";
4844 import { isLinuxPlatform, isMacPlatform, newCommandId, newProjectId } from "../lib/utils";
@@ -102,6 +98,7 @@ import { · 53 unmodified lines
10298 sortThreadsForSidebar,
10399 } from "./Sidebar.logic";
104100 import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
101+import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
105102
106103 const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
107104 const THREAD_PREVIEW_LIMIT = 6;
@@ -381,7 +378,8 @@ export default function Sidebar() { · 273 unmodified lines
381378 );
382379 const navigate = useNavigate();
383380 const isOnSettings = useLocation({ select: (loc) => loc.pathname === "/settings" });
384− const { settings: appSettings, updateSettings } = useAppSettings();
381+ const appSettings = useSettings();
382+ const { updateSettings } = useUpdateSettings();
385383 const { handleNewThread } = useHandleNewThread();
386384 const routeThreadId = useParams({
387385 strict: false,
apps/web/src/components/chat/MessagesTimeline.tsx+1−1
@@ -48,7 +48,7 @@ import { · 47 unmodified lines
4848 type ParsedTerminalContextEntry,
4949 } from "~/lib/terminalContext";
5050 import { cn } from "~/lib/utils";
51−import { type TimestampFormat } from "../../appSettings";
51+import { type TimestampFormat } from "../../clientSettings";
5252 import { formatTimestamp } from "../../timestampFormat";
5353 import {
5454 buildInlineTerminalContextText,
apps/web/src/composerDraftStore.ts+1−1
@@ -31,7 +31,7 @@ import { · 30 unmodified lines
3131 import { create } from "zustand";
3232 import { createJSONStorage, persist } from "zustand/middleware";
3333 import { createDebouncedStorage, createMemoryStorage } from "./lib/storage";
34−import { UnifiedSettings } from "./appSettings";
34+import { UnifiedSettings } from "./hooks/useSettings";
3535
3636 export const COMPOSER_DRAFT_STORAGE_KEY = "t3code:composer-drafts:v1";
3737 const COMPOSER_DRAFT_STORAGE_VERSION = 3;
apps/web/src/modelSelection.ts+1−1
@@ -10,7 +10,7 @@ import { · 9 unmodified lines
1010 resolveSelectableModel,
1111 } from "@t3tools/shared/model";
1212 import { getComposerProviderState } from "./components/chat/composerProviderRegistry";
13−import { UnifiedSettings } from "./appSettings";
13+import { UnifiedSettings } from "./hooks/useSettings";
1414
1515 const MAX_CUSTOM_MODEL_COUNT = 32;
1616 export const MAX_CUSTOM_MODEL_LENGTH = 256;
apps/web/src/routes/_chat.settings.tsx+3−2
@@ -4,7 +4,7 @@ import { ChevronDownIcon, PlusIcon, RotateCcwIcon, Undo2Icon, XIcon } from "luci · 3 unmodified lines
44 import { type ReactNode, useCallback, useState } from "react";
55 import { type ProviderKind } from "@t3tools/contracts";
66 import { getModelOptions, normalizeModelSlug } from "@t3tools/shared/model";
7−import { useAppSettings } from "../appSettings";
7+import { useSettings, useUpdateSettings } from "../hooks/useSettings";
88 import {
99 getCustomModelOptionsByProvider,
1010 MAX_CUSTOM_MODEL_LENGTH,
@@ -184,7 +184,8 @@ function SettingResetButton({ label, onClick }: { label: string; onClick: () => · 173 unmodified lines
184184
185185 function SettingsRouteView() {
186186 const { theme, setTheme } = useTheme();
187− const { settings, defaults, updateSettings, resetSettings } = useAppSettings();
187+ const settings = useSettings();
188+ const { updateSettings, resetSettings, defaults } = useUpdateSettings();
188189 const serverConfigQuery = useQuery(serverConfigQueryOptions());
189190 const [isOpeningKeybindings, setIsOpeningKeybindings] = useState(false);
190191 const [openKeybindingsError, setOpenKeybindingsError] = useState<string | null>(null);
apps/web/src/routes/_chat.tsx+2−2
@@ -11,7 +11,7 @@ import { resolveShortcutCommand } from "../keybindings"; · 10 unmodified lines
1111 import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore";
1212 import { useThreadSelectionStore } from "../threadSelectionStore";
1313 import { resolveSidebarNewThreadEnvMode } from "~/components/Sidebar.logic";
14−import { useAppSettings } from "~/appSettings";
14+import { useSettings } from "~/hooks/useSettings";
1515 import { Sidebar, SidebarProvider, SidebarRail } from "~/components/ui/sidebar";
1616
1717 const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
@@ -31,7 +31,7 @@ function ChatRouteGlobalShortcuts() { · 13 unmodified lines
3131 ? selectThreadTerminalState(state.terminalStateByThreadId, routeThreadId).terminalOpen
3232 : false,
3333 );
34− const { settings: appSettings } = useAppSettings();
34+ const appSettings = useSettings();
3535
3636 useEffect(() => {
3737 const onWindowKeyDown = (event: KeyboardEvent) => {
apps/web/src/timestampFormat.ts+1−1
@@ -1,4 +1,4 @@
1−import { type TimestampFormat } from "./appSettings";
1+import { type TimestampFormat } from "./clientSettings";
22
33 export function getTimestampFormatOptions(
44 timestampFormat: TimestampFormat,