MCPcopy Index your code
hub / github.com/winfunc/opcode / Settings

Function Settings

src/components/Settings.tsx:60–1081  ·  view source on GitHub ↗
({
  className,
})

Source from the content-addressed store, hash-verified

58 * Provides a no-code interface for editing the settings.json file
59 */
60export const Settings: React.FC<SettingsProps> = ({
61 className,
62}) => {
63 const [settings, setSettings] = useState<ClaudeSettings | null>(null);
64 const [loading, setLoading] = useState(true);
65 const [saving, setSaving] = useState(false);
66 const [error, setError] = useState<string | null>(null);
67 const [activeTab, setActiveTab] = useState("general");
68 const [currentBinaryPath, setCurrentBinaryPath] = useState<string | null>(null);
69 const [selectedInstallation, setSelectedInstallation] = useState<ClaudeInstallation | null>(null);
70 const [binaryPathChanged, setBinaryPathChanged] = useState(false);
71 const [toast, setToast] = useState<{ message: string; type: 'success' | 'error' } | null>(null);
72
73 // Permission rules state
74 const [allowRules, setAllowRules] = useState<PermissionRule[]>([]);
75 const [denyRules, setDenyRules] = useState<PermissionRule[]>([]);
76
77 // Environment variables state
78 const [envVars, setEnvVars] = useState<EnvironmentVariable[]>([]);
79
80 // Hooks state
81 const [userHooksChanged, setUserHooksChanged] = useState(false);
82 const getUserHooks = React.useRef<(() => any) | null>(null);
83
84 // Theme hook
85 const { theme, setTheme, customColors, setCustomColors } = useTheme();
86
87 // Proxy state
88 const [proxySettingsChanged, setProxySettingsChanged] = useState(false);
89 const saveProxySettings = React.useRef<(() => Promise<void>) | null>(null);
90
91 // Analytics state
92 const [analyticsEnabled, setAnalyticsEnabled] = useState(false);
93 const trackEvent = useTrackEvent();
94
95 // Tab persistence state
96 const [tabPersistenceEnabled, setTabPersistenceEnabled] = useState(true);
97 // Startup intro preference
98 const [startupIntroEnabled, setStartupIntroEnabled] = useState(true);
99
100 // Load settings on mount
101 useEffect(() => {
102 loadSettings();
103 loadClaudeBinaryPath();
104 loadAnalyticsSettings();
105 // Load tab persistence setting
106 setTabPersistenceEnabled(TabPersistenceService.isEnabled());
107 // Load startup intro setting (default to true if not set)
108 (async () => {
109 const pref = await api.getSetting('startup_intro_enabled');
110 setStartupIntroEnabled(pref === null ? true : pref === 'true');
111 })();
112 }, []);
113
114 /**
115 * Loads analytics settings
116 */
117 const loadAnalyticsSettings = async () => {

Callers

nothing calls this directly

Calls 15

useThemeFunction · 0.90
useTrackEventFunction · 0.90
cnFunction · 0.90
loadClaudeBinaryPathFunction · 0.85
loadAnalyticsSettingsFunction · 0.85
updateSettingFunction · 0.85
addPermissionRuleFunction · 0.85
updatePermissionRuleFunction · 0.85
removePermissionRuleFunction · 0.85
enableMethod · 0.80
disableMethod · 0.80
setEnabledMethod · 0.80

Tested by

no test coverage detected