2026-08-10 19:33:52 +08:00
|
|
|
import { SettingsPage } from "@/components/settings/SettingsPage";
|
2026-09-10 11:10:51 +08:00
|
|
|
import type { SettingsExitGuard, SettingsSectionKey } from "@/components/settings/contracts";
|
2026-08-10 19:33:52 +08:00
|
|
|
import { useSettingsController } from "@/components/settings/useSettingsController";
|
2026-09-12 16:32:46 +08:00
|
|
|
import type { SendAttachment, SendOptions } from "@/hooks/useNanobotStream";
|
2026-08-10 19:33:52 +08:00
|
|
|
import type { SettingsPayload, SkillSummary } from "@/lib/types";
|
2026-04-25 18:05:06 +00:00
|
|
|
|
2026-08-10 19:33:52 +08:00
|
|
|
export type { SettingsSectionKey } from "@/components/settings/contracts";
|
2026-05-24 13:38:37 +08:00
|
|
|
|
2026-04-25 18:05:06 +00:00
|
|
|
interface SettingsViewProps {
|
2026-09-10 11:10:51 +08:00
|
|
|
registerExitGuard?: (guard: SettingsExitGuard | null) => void;
|
2026-04-25 18:05:06 +00:00
|
|
|
theme: "light" | "dark";
|
2026-05-25 20:07:02 +08:00
|
|
|
initialSection?: SettingsSectionKey;
|
2026-06-06 19:49:33 +08:00
|
|
|
initialSettings?: SettingsPayload | null;
|
2026-05-25 20:07:02 +08:00
|
|
|
showSidebar?: boolean;
|
2026-09-13 03:38:39 +08:00
|
|
|
mainNavigationExpanded?: boolean;
|
2026-04-25 18:05:06 +00:00
|
|
|
onToggleTheme: () => void;
|
|
|
|
|
onBackToChat: () => void;
|
|
|
|
|
onModelNameChange: (modelName: string | null) => void;
|
2026-05-29 03:42:53 +08:00
|
|
|
onSettingsChange?: (payload: SettingsPayload) => void;
|
2026-06-06 19:49:33 +08:00
|
|
|
skills?: SkillSummary[];
|
2026-09-12 16:32:46 +08:00
|
|
|
onStartAutomationChat?: (
|
|
|
|
|
content: string,
|
|
|
|
|
images?: SendAttachment[],
|
|
|
|
|
options?: SendOptions,
|
|
|
|
|
modelPreset?: string | null,
|
|
|
|
|
) => boolean | void | Promise<boolean | void>;
|
2026-09-11 19:10:15 +08:00
|
|
|
titleOverrides?: Record<string, string>;
|
2026-06-02 11:29:18 +08:00
|
|
|
onSectionChange?: (section: SettingsSectionKey) => void;
|
2026-05-06 23:15:18 +08:00
|
|
|
onLogout?: () => void;
|
2026-05-08 09:40:15 +00:00
|
|
|
onRestart?: () => void;
|
2026-06-06 19:49:33 +08:00
|
|
|
onNativeEngineRestart?: () => Promise<string>;
|
2026-05-08 15:31:52 +00:00
|
|
|
isRestarting?: boolean;
|
2026-05-29 03:42:53 +08:00
|
|
|
hostChromeInset?: boolean;
|
2026-04-25 18:05:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function SettingsView({
|
2026-09-10 11:10:51 +08:00
|
|
|
registerExitGuard,
|
2026-05-08 15:31:52 +00:00
|
|
|
theme,
|
2026-05-25 20:07:02 +08:00
|
|
|
initialSection = "overview",
|
2026-06-06 19:49:33 +08:00
|
|
|
initialSettings = null,
|
2026-05-25 20:07:02 +08:00
|
|
|
showSidebar = true,
|
2026-09-13 03:38:39 +08:00
|
|
|
mainNavigationExpanded = false,
|
2026-05-08 15:31:52 +00:00
|
|
|
onToggleTheme,
|
2026-04-25 18:05:06 +00:00
|
|
|
onBackToChat,
|
|
|
|
|
onModelNameChange,
|
2026-05-29 03:42:53 +08:00
|
|
|
onSettingsChange,
|
2026-06-06 19:49:33 +08:00
|
|
|
skills = [],
|
2026-09-12 16:32:46 +08:00
|
|
|
onStartAutomationChat,
|
2026-09-11 19:10:15 +08:00
|
|
|
titleOverrides,
|
2026-06-02 11:29:18 +08:00
|
|
|
onSectionChange,
|
2026-05-06 23:15:18 +08:00
|
|
|
onLogout,
|
2026-05-08 09:40:15 +00:00
|
|
|
onRestart,
|
2026-06-06 19:49:33 +08:00
|
|
|
onNativeEngineRestart,
|
2026-05-08 15:31:52 +00:00
|
|
|
isRestarting = false,
|
2026-05-29 03:42:53 +08:00
|
|
|
hostChromeInset = false,
|
2026-04-25 18:05:06 +00:00
|
|
|
}: SettingsViewProps) {
|
2026-08-10 19:33:52 +08:00
|
|
|
const controller = useSettingsController({
|
|
|
|
|
initialSection,
|
|
|
|
|
initialSettings,
|
|
|
|
|
onModelNameChange,
|
|
|
|
|
onSettingsChange,
|
|
|
|
|
onSectionChange,
|
|
|
|
|
onRestart,
|
|
|
|
|
onNativeEngineRestart,
|
2026-07-23 18:18:34 +08:00
|
|
|
});
|
2026-07-22 22:35:39 +08:00
|
|
|
|
2026-05-08 15:31:52 +00:00
|
|
|
return (
|
2026-08-10 19:33:52 +08:00
|
|
|
<SettingsPage
|
2026-09-10 11:10:51 +08:00
|
|
|
registerExitGuard={registerExitGuard}
|
2026-08-10 19:33:52 +08:00
|
|
|
controller={controller}
|
|
|
|
|
theme={theme}
|
|
|
|
|
showSidebar={showSidebar}
|
2026-09-13 03:38:39 +08:00
|
|
|
mainNavigationExpanded={mainNavigationExpanded}
|
2026-08-10 19:33:52 +08:00
|
|
|
onToggleTheme={onToggleTheme}
|
|
|
|
|
onBackToChat={onBackToChat}
|
|
|
|
|
skills={skills}
|
2026-09-12 16:32:46 +08:00
|
|
|
onStartAutomationChat={onStartAutomationChat}
|
2026-09-11 19:10:15 +08:00
|
|
|
titleOverrides={titleOverrides}
|
2026-08-10 19:33:52 +08:00
|
|
|
onLogout={onLogout}
|
|
|
|
|
isRestarting={isRestarting}
|
|
|
|
|
hostChromeInset={hostChromeInset}
|
2026-07-13 13:11:46 +08:00
|
|
|
/>
|
2026-04-25 18:05:06 +00:00
|
|
|
);
|
|
|
|
|
}
|