MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / SettingsDialog

Function SettingsDialog

ai-code-studio/src/components/SettingsDialog.tsx:60–567  ·  view source on GitHub ↗
({
  open,
  config,
  setConfig,
  isTestingConnection,
  connectionReport,
  setupChecklist,
  onSaveConfig,
  onTestConnection,
  onShutdownGateway,
  onRestartLauncher,
  onClose,
}: SettingsDialogProps)

Source from the content-addressed store, hash-verified

58}
59
60export function SettingsDialog({
61 open,
62 config,
63 setConfig,
64 isTestingConnection,
65 connectionReport,
66 setupChecklist,
67 onSaveConfig,
68 onTestConnection,
69 onShutdownGateway,
70 onRestartLauncher,
71 onClose,
72}: SettingsDialogProps) {
73 const [settingsTab, setSettingsTab] = useState<SettingsTab>('Provider');
74 const [saveState, setSaveState] = useState<'idle' | 'saving' | 'saved'>('idle');
75
76 useEffect(() => {
77 if (open) {
78 setSettingsTab('Provider');
79 }
80 }, [open]);
81
82 const currentPreset =
83 providerPresets.find(
84 preset =>
85 preset.id !== 'custom' &&
86 preset.upstreamBaseUrl === config.upstreamBaseUrl &&
87 preset.upstreamModel === config.upstreamModel,
88 ) || null;
89
90 if (!open) {
91 return null;
92 }
93
94 function applyPreset(preset: ProviderPreset) {
95 setConfig(current => ({
96 ...current,
97 upstreamBaseUrl: preset.upstreamBaseUrl,
98 upstreamModel: preset.upstreamModel,
99 clawModel: preset.clawModel,
100 textMode: preset.textMode,
101 }));
102 }
103
104 async function pickDirectory(target: 'workspaceDir' | 'clawProjectDir') {
105 const nextPath = await window.clawDesktop?.pickDirectory?.();
106 if (nextPath) {
107 setConfig(current => ({
108 ...current,
109 [target]: nextPath,
110 }));
111 }
112 }
113
114 async function pickBinaryPath() {
115 const nextPath = await window.clawDesktop?.pickFile?.([
116 { name: 'Executable', extensions: ['exe', 'bin', 'cmd'] },
117 { name: 'All Files', extensions: ['*'] },

Callers

nothing calls this directly

Calls 9

checklistToneFunction · 0.90
formatTimestampFunction · 0.90
connectionToneFunction · 0.90
labelForConnectionStatusFunction · 0.90
tabLabelFunction · 0.85
tabHintFunction · 0.85
applyPresetFunction · 0.85
pickDirectoryFunction · 0.70
pickBinaryPathFunction · 0.70

Tested by

no test coverage detected