rm reexport shi
This commit is contained in:
1 parent
7b0c9c0a9d
commit
da0eaff9d4
12 files changed
+19
-67
No files matched your search
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* App Settings - Backward-compatible shim.
|
||||
*
|
||||
* Re-exports the unified settings hook (`useSettings` / `useUpdateSettings`)
|
||||
* as `useAppSettings()` so existing consumers continue to work without
|
||||
* modification. New code should import from `~/hooks/useSettings` directly.
|
||||
*
|
||||
* Also re-exports type aliases and schema constants consumed by components
|
||||
* that only need the type (e.g. `TimestampFormat`).
|
||||
*/
|
||||
import { useSettings, useUpdateSettings, type UnifiedSettings } from "./hooks/useSettings";
|
||||
import {
|
||||
type TimestampFormat,
|
||||
type SidebarProjectSortOrder,
|
||||
type SidebarThreadSortOrder,
|
||||
DEFAULT_TIMESTAMP_FORMAT,
|
||||
DEFAULT_SIDEBAR_PROJECT_SORT_ORDER,
|
||||
DEFAULT_SIDEBAR_THREAD_SORT_ORDER,
|
||||
} from "./clientSettings";
|
||||
|
||||
// ── Re-exports for downstream type consumers ─────────────────────────
|
||||
|
||||
export type { TimestampFormat, SidebarProjectSortOrder, SidebarThreadSortOrder };
|
||||
export {
|
||||
DEFAULT_TIMESTAMP_FORMAT,
|
||||
DEFAULT_SIDEBAR_PROJECT_SORT_ORDER,
|
||||
DEFAULT_SIDEBAR_THREAD_SORT_ORDER,
|
||||
};
|
||||
export type { UnifiedSettings };
|
||||
|
||||
// ── Backward-compat type alias ───────────────────────────────────────
|
||||
|
||||
export type AppSettings = UnifiedSettings;
|
||||
|
||||
// ── Backward-compat hook ─────────────────────────────────────────────
|
||||
|
||||
export function useAppSettings() {
|
||||
const settings = useSettings();
|
||||
const { updateSettings, resetSettings, defaults } = useUpdateSettings();
|
||||
|
||||
return {
|
||||
settings,
|
||||
updateSettings: (patch: Partial<AppSettings>) => updateSettings(patch),
|
||||
resetSettings,
|
||||
defaults,
|
||||
} as const;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ import {
|
||||
import { SidebarTrigger } from "./ui/sidebar";
|
||||
import { newCommandId, newMessageId, newThreadId } from "~/lib/utils";
|
||||
import { readNativeApi } from "~/nativeApi";
|
||||
import { useAppSettings } from "../appSettings";
|
||||
import { useSettings } from "../hooks/useSettings";
|
||||
import { getCustomModelOptionsByProvider, resolveAppModelSelection } from "../modelSelection";
|
||||
import { isTerminalFocused } from "../lib/terminalFocus";
|
||||
import {
|
||||
@@ -245,7 +245,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
|
||||
const syncServerReadModel = useStore((store) => store.syncServerReadModel);
|
||||
const setStoreThreadError = useStore((store) => store.setError);
|
||||
const setStoreThreadBranch = useStore((store) => store.setThreadBranch);
|
||||
const { settings } = useAppSettings();
|
||||
const settings = useSettings();
|
||||
const setStickyComposerModelSelection = useComposerDraftStore(
|
||||
(store) => store.setStickyModelSelection,
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ import { buildPatchCacheKey } from "../lib/diffRendering";
|
||||
import { resolveDiffThemeName } from "../lib/diffRendering";
|
||||
import { useTurnDiffSummaries } from "../hooks/useTurnDiffSummaries";
|
||||
import { useStore } from "../store";
|
||||
import { useAppSettings } from "../appSettings";
|
||||
import { useSettings } from "../hooks/useSettings";
|
||||
import { formatShortTimestamp } from "../timestampFormat";
|
||||
import { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from "./DiffPanelShell";
|
||||
import { ToggleGroup, Toggle } from "./ui/toggle-group";
|
||||
@@ -166,7 +166,7 @@ export { DiffWorkerPoolProvider } from "./DiffWorkerPoolProvider";
|
||||
export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
|
||||
const navigate = useNavigate();
|
||||
const { resolvedTheme } = useTheme();
|
||||
const { settings } = useAppSettings();
|
||||
const settings = useSettings();
|
||||
const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>("stacked");
|
||||
const [diffWordWrap, setDiffWordWrap] = useState(settings.diffWordWrap);
|
||||
const patchViewportRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { memo, useState, useCallback } from "react";
|
||||
import { type TimestampFormat } from "../appSettings";
|
||||
import { type TimestampFormat } from "../clientSettings";
|
||||
import { Badge } from "./ui/badge";
|
||||
import { Button } from "./ui/button";
|
||||
import { ScrollArea } from "./ui/scroll-area";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../appSettings";
|
||||
import type { SidebarProjectSortOrder, SidebarThreadSortOrder } from "../clientSettings";
|
||||
import type { Thread } from "../types";
|
||||
import { cn } from "../lib/utils";
|
||||
import {
|
||||
|
||||
@@ -38,11 +38,7 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useLocation, useNavigate, useParams } from "@tanstack/react-router";
|
||||
import {
|
||||
type SidebarProjectSortOrder,
|
||||
type SidebarThreadSortOrder,
|
||||
useAppSettings,
|
||||
} from "../appSettings";
|
||||
import { type SidebarProjectSortOrder, type SidebarThreadSortOrder } from "../clientSettings";
|
||||
import { isElectron } from "../env";
|
||||
import { APP_STAGE_LABEL, APP_VERSION } from "../branding";
|
||||
import { isLinuxPlatform, isMacPlatform, newCommandId, newProjectId } from "../lib/utils";
|
||||
@@ -102,6 +98,7 @@ import {
|
||||
sortThreadsForSidebar,
|
||||
} from "./Sidebar.logic";
|
||||
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
|
||||
import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
|
||||
|
||||
const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
|
||||
const THREAD_PREVIEW_LIMIT = 6;
|
||||
@@ -381,7 +378,8 @@ export default function Sidebar() {
|
||||
);
|
||||
const navigate = useNavigate();
|
||||
const isOnSettings = useLocation({ select: (loc) => loc.pathname === "/settings" });
|
||||
const { settings: appSettings, updateSettings } = useAppSettings();
|
||||
const appSettings = useSettings();
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const { handleNewThread } = useHandleNewThread();
|
||||
const routeThreadId = useParams({
|
||||
strict: false,
|
||||
|
||||
@@ -48,7 +48,7 @@ import {
|
||||
type ParsedTerminalContextEntry,
|
||||
} from "~/lib/terminalContext";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { type TimestampFormat } from "../../appSettings";
|
||||
import { type TimestampFormat } from "../../clientSettings";
|
||||
import { formatTimestamp } from "../../timestampFormat";
|
||||
import {
|
||||
buildInlineTerminalContextText,
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
import { create } from "zustand";
|
||||
import { createJSONStorage, persist } from "zustand/middleware";
|
||||
import { createDebouncedStorage, createMemoryStorage } from "./lib/storage";
|
||||
import { UnifiedSettings } from "./appSettings";
|
||||
import { UnifiedSettings } from "./hooks/useSettings";
|
||||
|
||||
export const COMPOSER_DRAFT_STORAGE_KEY = "t3code:composer-drafts:v1";
|
||||
const COMPOSER_DRAFT_STORAGE_VERSION = 3;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
resolveSelectableModel,
|
||||
} from "@t3tools/shared/model";
|
||||
import { getComposerProviderState } from "./components/chat/composerProviderRegistry";
|
||||
import { UnifiedSettings } from "./appSettings";
|
||||
import { UnifiedSettings } from "./hooks/useSettings";
|
||||
|
||||
const MAX_CUSTOM_MODEL_COUNT = 32;
|
||||
export const MAX_CUSTOM_MODEL_LENGTH = 256;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ChevronDownIcon, PlusIcon, RotateCcwIcon, Undo2Icon, XIcon } from "luci
|
||||
import { type ReactNode, useCallback, useState } from "react";
|
||||
import { type ProviderKind } from "@t3tools/contracts";
|
||||
import { getModelOptions, normalizeModelSlug } from "@t3tools/shared/model";
|
||||
import { useAppSettings } from "../appSettings";
|
||||
import { useSettings, useUpdateSettings } from "../hooks/useSettings";
|
||||
import {
|
||||
getCustomModelOptionsByProvider,
|
||||
MAX_CUSTOM_MODEL_LENGTH,
|
||||
@@ -184,7 +184,8 @@ function SettingResetButton({ label, onClick }: { label: string; onClick: () =>
|
||||
|
||||
function SettingsRouteView() {
|
||||
const { theme, setTheme } = useTheme();
|
||||
const { settings, defaults, updateSettings, resetSettings } = useAppSettings();
|
||||
const settings = useSettings();
|
||||
const { updateSettings, resetSettings, defaults } = useUpdateSettings();
|
||||
const serverConfigQuery = useQuery(serverConfigQueryOptions());
|
||||
const [isOpeningKeybindings, setIsOpeningKeybindings] = useState(false);
|
||||
const [openKeybindingsError, setOpenKeybindingsError] = useState<string | null>(null);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { resolveShortcutCommand } from "../keybindings";
|
||||
import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore";
|
||||
import { useThreadSelectionStore } from "../threadSelectionStore";
|
||||
import { resolveSidebarNewThreadEnvMode } from "~/components/Sidebar.logic";
|
||||
import { useAppSettings } from "~/appSettings";
|
||||
import { useSettings } from "~/hooks/useSettings";
|
||||
import { Sidebar, SidebarProvider, SidebarRail } from "~/components/ui/sidebar";
|
||||
|
||||
const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = [];
|
||||
@@ -31,7 +31,7 @@ function ChatRouteGlobalShortcuts() {
|
||||
? selectThreadTerminalState(state.terminalStateByThreadId, routeThreadId).terminalOpen
|
||||
: false,
|
||||
);
|
||||
const { settings: appSettings } = useAppSettings();
|
||||
const appSettings = useSettings();
|
||||
|
||||
useEffect(() => {
|
||||
const onWindowKeyDown = (event: KeyboardEvent) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type TimestampFormat } from "./appSettings";
|
||||
import { type TimestampFormat } from "./clientSettings";
|
||||
|
||||
export function getTimestampFormatOptions(
|
||||
timestampFormat: TimestampFormat,
|
||||
|
||||
Reference in new issue
Block a user