aboutsummaryrefslogtreecommitdiffstats
path: root/renderer/src/components/SettingsPage.tsx
blob: 0c0c2e83a613c7c4f41cf7f1cd55deaabac36cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import React, { useState } from "react";
import { SystemPromptsSettings } from "./settings/SystemPromptsSettings";
import { GitSettings } from "./settings/GitSettings";
import { ModelSettings } from "./settings/ModelSettings";
import { McpSettings } from "./settings/McpSettings";

type Theme = "dark" | "light";
type SettingsSection = "appearance" | "model" | "mcp" | "system-prompts" | "git";

interface SettingsPageProps {
  onClose: () => void;
  theme: Theme;
  onToggleTheme: () => void;
}

export function SettingsPage({ onClose, theme, onToggleTheme }: SettingsPageProps) {
  const [activeSection, setActiveSection] =
    useState<SettingsSection>("appearance");

  return (
    <div className="settings-overlay">
      {/* Header — matches the main app header height/style */}
      <div className="settings-header">
        <div className="settings-header-left">
          <span className="settings-title">{'⚙'} Settings</span>
        </div>
        <button
          className="settings-close"
          onClick={onClose}
          title="Close settings"
        >
          {'×'}
        </button>
      </div>

      <div className="settings-body">
        {/* Side nav */}
        <nav className="settings-nav">
          <button
            className={`settings-nav-item${
              activeSection === "appearance" ? " active" : ""
            }`}
            onClick={() => setActiveSection("appearance")}
          >
            Appearance
          </button>
          <button
            className={`settings-nav-item${
              activeSection === "model" ? " active" : ""
            }`}
            onClick={() => setActiveSection("model")}
          >
            Model
          </button>
          <button
            className={`settings-nav-item${
              activeSection === "mcp" ? " active" : ""
            }`}
            onClick={() => setActiveSection("mcp")}
          >
            MCP Servers
          </button>
          <button
            className={`settings-nav-item${
              activeSection === "system-prompts" ? " active" : ""
            }`}
            onClick={() => setActiveSection("system-prompts")}
          >
            System Prompts
          </button>
          <button
            className={`settings-nav-item${
              activeSection === "git" ? " active" : ""
            }`}
            onClick={() => setActiveSection("git")}
          >
            Git
          </button>
        </nav>

        {/* Content */}
        <div className="settings-content">
          {activeSection === "appearance" && (
            <div>
              <div className="settings-section-title">Theme</div>
              <div className="settings-section-desc">
                Choose between light and dark mode.
              </div>
              <div className="settings-toggle-row">
                <span className="settings-toggle-label">
                  {theme === "dark" ? "Dark" : "Light"}
                </span>
                <button className="btn-secondary" onClick={onToggleTheme}>
                  Switch to {theme === "dark" ? "Light" : "Dark"} mode
                </button>
              </div>
            </div>
          )}
          {activeSection === "model" && <ModelSettings />}
          {activeSection === "mcp" && <McpSettings />}
          {activeSection === "system-prompts" && <SystemPromptsSettings />}
          {activeSection === "git" && <GitSettings />}
        </div>
      </div>
    </div>
  );
}