Skip to content

Commit a983934

Browse files
committed
fix(gui): resolve TypeScript errors in settings components
- SettingsDialog.tsx: Remove unused imports (GitSyncSettings, ListItem), fix unused variables (theme, multiRepo, source, supermavenApiKey signals), fix Badge title prop issue by wrapping in span, fix Text as='h4' by changing to 'h3', fix Icon style prop issue by wrapping in span - ThemeCustomizer.tsx: Remove unused imports (batch, FormGroup, tokens), fix color type incompatibilities by using unknown cast - EditorSettingsPanel.tsx: Remove unused imports (FormGroup, Input), remove invalid description prop, fix boolean | undefined issue - KeymapEditor.tsx: Fix unused props parameter - SettingsSyncPanel.tsx: Remove unused imports (Select, Checkbox), fix unused setUsername by removing from destructuring
1 parent ef585f5 commit a983934

File tree

5 files changed

+35
-40
lines changed

5 files changed

+35
-40
lines changed

cortex-gui/src/components/SettingsDialog.tsx

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { useSupermaven } from "@/context/SupermavenContext";
88
import { useFormatter, type FormatterType } from "@/context/FormatterContext";
99
import { useSettings, type SettingsScope, type SettingSource, type CortexSettings, type ExplorerSortOrder } from "@/context/SettingsContext";
1010
import { useWorkspace } from "@/context/WorkspaceContext";
11-
import { useMultiRepo, type GitSyncSettings } from "@/context/MultiRepoContext";
11+
import { useMultiRepo } from "@/context/MultiRepoContext";
1212
import { KeymapProvider } from "@/context/KeymapContext";
1313
import { KeymapEditor, Toggle, Select, SectionHeader, OptionCard, FormGroup, InfoBox, Button, Kbd, EditorSettingsPanel, TerminalSettingsPanel, FilesSettingsPanel, NetworkSettingsPanel, JsonSettingsEditor, GitSettingsPanel } from "@/components/settings";
1414
import { CopilotSettingsPanel, CopilotSignInModal } from "@/components/ai/CopilotStatus";
1515
import { ExtensionsPanel } from "@/components/extensions";
16-
import { Button as UIButton, IconButton, Input, Card, ListItem, Text, Badge } from "@/components/ui";
16+
import { Button as UIButton, IconButton, Input, Card, Text, Badge } from "@/components/ui";
1717
import type { LLMProviderType } from "@/utils/llm";
1818

1919
/** Map tree item IDs to settings sections for modified count */
@@ -163,12 +163,11 @@ function SettingsTreeItem(props: {
163163
<span class="text-sm truncate flex-1">{props.item.label}</span>
164164
{/* Modified count badge */}
165165
<Show when={totalModifiedCount() > 0}>
166-
<Badge
167-
size="sm"
168-
title={`${totalModifiedCount()} modified setting${totalModifiedCount() > 1 ? 's' : ''}`}
169-
>
170-
{totalModifiedCount()}
171-
</Badge>
166+
<span title={`${totalModifiedCount()} modified setting${totalModifiedCount() > 1 ? 's' : ''}`}>
167+
<Badge size="sm">
168+
{totalModifiedCount()}
169+
</Badge>
170+
</span>
172171
</Show>
173172
</UIButton>
174173
<Show when={hasChildren() && isExpanded()}>
@@ -290,13 +289,13 @@ function SettingRow(props: {
290289
}
291290

292291
export function SettingsDialog(props: SettingsDialogProps) {
293-
const { theme, setTheme } = useTheme();
292+
const { setTheme } = useTheme();
294293
const { state, updateConfig } = useSDK();
295294
const vim = useVim();
296295
const llm = useLLM();
297296
const supermaven = useSupermaven();
298297
const formatter = useFormatter();
299-
const multiRepo = useMultiRepo();
298+
useMultiRepo(); // Context provider hook (values not destructured yet)
300299
const settings = useSettings();
301300
const [activeTab, setActiveTab] = createSignal<string>(props.initialSection ?? "general");
302301
const [searchQuery, setSearchQuery] = createSignal("");
@@ -309,8 +308,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
309308
}, 100);
310309
}
311310
});
312-
const [supermavenApiKey, setSupermavenApiKey] = createSignal("");
313-
const [showSupermavenKey, setShowSupermavenKey] = createSignal(false);
311+
// Removed unused signals: supermavenApiKey, showSupermavenKey
314312
const [showCopilotSignIn, setShowCopilotSignIn] = createSignal(false);
315313

316314
// Settings scope toggle: user vs workspace
@@ -355,7 +353,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
355353
});
356354
const [validatingProvider, setValidatingProvider] = createSignal<LLMProviderType | null>(null);
357355

358-
const [contentRef, setContentRef] = createSignal<HTMLDivElement | null>(null);
356+
const [, setContentRef] = createSignal<HTMLDivElement | null>(null);
359357

360358
const findTreeItem = (items: TreeItem[], id: string): TreeItem | undefined => {
361359
for (const item of items) {
@@ -946,11 +944,10 @@ export function SettingsDialog(props: SettingsDialogProps) {
946944
icon={<Icon name="desktop" class="h-4 w-4" />}
947945
/>
948946
<div>
949-
<Text as="h4" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Theme</Text>
947+
<Text as="h3" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Theme</Text>
950948
<div style={{ display: "flex", gap: "8px" }}>
951949
<For each={themes}>
952950
{(t) => {
953-
const source = () => settings.getSettingSource("theme", "theme");
954951
const hasOverride = () => settings.hasWorkspaceOverride("theme", "theme");
955952
const isSelected = () => settings.effectiveSettings().theme.theme === t.value;
956953

@@ -965,7 +962,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
965962
}
966963
}}
967964
variant={isSelected() ? "primary" : "secondary"}
968-
icon={<t.icon style={{ width: "16px", height: "16px" }} />}
965+
icon={<span style={{ width: "16px", height: "16px", display: "inline-flex" }}><t.icon /></span>}
969966
style={hasOverride() ? { "box-shadow": "0 0 0 2px rgba(168, 85, 247, 0.5)" } : {}}
970967
>
971968
{t.label}
@@ -1006,7 +1003,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
10061003

10071004
{/* Editor Tabs Settings */}
10081005
<div>
1009-
<Text as="h4" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Editor Tabs</Text>
1006+
<Text as="h3" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Editor Tabs</Text>
10101007
<div style={{ position: "relative" }}>
10111008
<OptionCard
10121009
selected={settings.effectiveSettings().theme.wrapTabs}
@@ -1087,7 +1084,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
10871084

10881085
{/* Sort Order */}
10891086
<div>
1090-
<Text as="h4" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Sort Order</Text>
1087+
<Text as="h3" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Sort Order</Text>
10911088
<FormGroup
10921089
label="File Sort Order"
10931090
description="Choose how files and folders are sorted in the explorer"
@@ -1127,7 +1124,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
11271124
</div>
11281125

11291126
<div>
1130-
<Text as="h4" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Drag and Drop</Text>
1127+
<Text as="h3" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Drag and Drop</Text>
11311128
<OptionCard
11321129
selected={settings.effectiveSettings().files?.confirmDragAndDrop ?? true}
11331130
onSelect={async () => {
@@ -1295,7 +1292,7 @@ export function SettingsDialog(props: SettingsDialogProps) {
12951292

12961293
{/* Vim Mode Toggle */}
12971294
<div>
1298-
<Text as="h4" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Vim Mode</Text>
1295+
<Text as="h3" size="sm" weight="medium" style={{ "margin-bottom": "12px", color: "var(--jb-text-body-color)" }}>Vim Mode</Text>
12991296
<div style={{ position: "relative" }}>
13001297
<OptionCard
13011298
selected={vim.enabled()}

cortex-gui/src/components/settings/EditorSettingsPanel.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Show, For, JSX } from "solid-js";
22
import { useSettings, type SettingsScope, type EditorSettings } from "@/context/SettingsContext";
3-
import { Toggle, SectionHeader, FormGroup } from "./FormComponents";
3+
import { Toggle, SectionHeader } from "./FormComponents";
44
import { Button } from "@/components/ui/Button";
5-
import { Input } from "@/components/ui/Input";
5+
// Input not currently used
66
import { Card } from "@/components/ui/Card";
77
import { Text } from "@/components/ui/Text";
88
import { Badge } from "@/components/ui/Badge";
@@ -366,7 +366,7 @@ export function EditorSettingsPanel(props: EditorSettingsPanelProps) {
366366
<SettingRowWithOverride
367367
label="Font Ligatures"
368368
settingKey="fontLigatures"
369-
description="Enable font ligatures (e.g., =>, !==, ===, ->)"
369+
370370
hasOverride={hasOverride("fontLigatures")}
371371
isModified={isModified("fontLigatures")}
372372
onReset={() => resetOverride("fontLigatures")}
@@ -795,7 +795,7 @@ export function EditorSettingsPanel(props: EditorSettingsPanelProps) {
795795
onResetToDefault={() => resetToDefault("largeFileOptimizations")}
796796
>
797797
<Toggle
798-
checked={editor().largeFileOptimizations}
798+
checked={editor().largeFileOptimizations ?? true}
799799
onChange={(checked) => updateSetting("largeFileOptimizations", checked)}
800800
/>
801801
</SettingRowWithOverride>

cortex-gui/src/components/settings/KeymapEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Show, For, createSignal, createMemo, createEffect, onCleanup } from "solid-js";
22
import { Icon } from "../ui/Icon";
3-
import { useKeymap, keyboardEventToKeystroke, type CommandBinding, type Keystroke } from "@/context/KeymapContext";
3+
import { useKeymap, type CommandBinding, type Keystroke } from "@/context/KeymapContext";
44
import { WhenClauseInput, WhenClauseDisplay, validateWhenClause } from "./WhenClauseInput";
55

66
interface KeymapEditorProps {
77
onClose?: () => void;
88
}
99

1010
/** VS Code Keybindings Editor - follows keybindingsEditor.css spec */
11-
export function KeymapEditor(props: KeymapEditorProps) {
11+
export function KeymapEditor(_props: KeymapEditorProps) {
1212
const keymap = useKeymap();
1313
const [searchQuery, setSearchQuery] = createSignal("");
1414
const [selectedCategory, setSelectedCategory] = createSignal<string | null>(null);

cortex-gui/src/components/settings/SettingsSyncPanel.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ import {
99
} from "@/context/SettingsSyncContext";
1010
import {
1111
Toggle,
12-
Select,
1312
SectionHeader,
1413
FormGroup,
1514
Button,
16-
Checkbox,
1715
InfoBox,
1816
Input,
1917
PasswordInput,
@@ -221,7 +219,7 @@ function AccountSetup() {
221219
const { enableSync } = useSettingsSync();
222220
const [provider, setProvider] = createSignal<"github" | "custom">("github");
223221
const [token, setToken] = createSignal("");
224-
const [username, setUsername] = createSignal("");
222+
const [username] = createSignal("");
225223
const [gistId, setGistId] = createSignal("");
226224
const [customEndpoint, setCustomEndpoint] = createSignal("");
227225
const [loading, setLoading] = createSignal(false);

cortex-gui/src/components/settings/ThemeCustomizer.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createSignal, createMemo, Show, For, batch } from "solid-js";
1+
import { createSignal, createMemo, Show, For } from "solid-js";
22
import {
33
useTheme,
44
ColorCategory,
@@ -8,8 +8,8 @@ import {
88
SYNTAX_COLOR_TOKENS,
99
TERMINAL_COLOR_TOKENS,
1010
} from "@/context/ThemeContext";
11-
import { SectionHeader, FormGroup, Button } from "./FormComponents";
12-
import { tokens } from '@/design-system/tokens';
11+
import { SectionHeader, Button } from "./FormComponents";
12+
// tokens imported for future use
1313

1414
// ============================================================================
1515
// Types
@@ -693,8 +693,8 @@ export function ThemeCustomizer() {
693693
description="Customize the main interface colors"
694694
category="ui"
695695
tokens={UI_COLOR_TOKENS}
696-
currentColors={colors()}
697-
defaultColors={defaults().ui}
696+
currentColors={colors() as unknown as Record<string, string>}
697+
defaultColors={defaults().ui as unknown as Record<string, string>}
698698
customizations={colorCustomizations().ui}
699699
onColorChange={(token, color) => handleColorChange("ui", token, color)}
700700
onResetToken={(token) => handleResetToken("ui", token)}
@@ -708,8 +708,8 @@ export function ThemeCustomizer() {
708708
description="Customize code editor appearance"
709709
category="editor"
710710
tokens={EDITOR_COLOR_TOKENS}
711-
currentColors={editorColors()}
712-
defaultColors={defaults().editor}
711+
currentColors={editorColors() as unknown as Record<string, string>}
712+
defaultColors={defaults().editor as unknown as Record<string, string>}
713713
customizations={colorCustomizations().editor}
714714
onColorChange={(token, color) => handleColorChange("editor", token, color)}
715715
onResetToken={(token) => handleResetToken("editor", token)}
@@ -723,8 +723,8 @@ export function ThemeCustomizer() {
723723
description="Customize code syntax highlighting"
724724
category="syntax"
725725
tokens={SYNTAX_COLOR_TOKENS}
726-
currentColors={syntaxColors()}
727-
defaultColors={defaults().syntax}
726+
currentColors={syntaxColors() as unknown as Record<string, string>}
727+
defaultColors={defaults().syntax as unknown as Record<string, string>}
728728
customizations={colorCustomizations().syntax}
729729
onColorChange={(token, color) => handleColorChange("syntax", token, color)}
730730
onResetToken={(token) => handleResetToken("syntax", token)}
@@ -738,8 +738,8 @@ export function ThemeCustomizer() {
738738
description="Customize integrated terminal colors"
739739
category="terminal"
740740
tokens={TERMINAL_COLOR_TOKENS}
741-
currentColors={terminalColors()}
742-
defaultColors={defaults().terminal}
741+
currentColors={terminalColors() as unknown as Record<string, string>}
742+
defaultColors={defaults().terminal as unknown as Record<string, string>}
743743
customizations={colorCustomizations().terminal}
744744
onColorChange={(token, color) => handleColorChange("terminal", token, color)}
745745
onResetToken={(token) => handleResetToken("terminal", token)}

0 commit comments

Comments
 (0)