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