fix: address PR review comments

- Remove redundant case 'api-keys' from switch (handled by default)
- Improve type safety by using SettingsViewId in NavigationItem interface
- Simplify onCheckedChange callback in AudioSection
- Import NAV_ITEMS from config instead of duplicating locally
- Update SettingsNavigation props to use SettingsViewId type

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Cody Seibert
2025-12-15 23:11:12 -05:00
parent cc2ac3542d
commit 44b548c5c8
4 changed files with 9 additions and 32 deletions

View File

@@ -2,21 +2,9 @@
import { useState } from "react";
import { useAppStore } from "@/store/app-store";
import {
Key,
Palette,
Terminal,
FlaskConical,
Trash2,
Settings2,
Volume2,
} from "lucide-react";
import {
useCliStatus,
useSettingsView,
type SettingsViewId,
} from "./settings-view/hooks";
import { useCliStatus, useSettingsView } from "./settings-view/hooks";
import { NAV_ITEMS } from "./settings-view/config/navigation";
import { SettingsHeader } from "./settings-view/components/settings-header";
import { KeyboardMapDialog } from "./settings-view/components/keyboard-map-dialog";
import { DeleteProjectDialog } from "./settings-view/components/delete-project-dialog";
@@ -34,17 +22,6 @@ import type {
} from "./settings-view/shared/types";
import type { Project as ElectronProject } from "@/lib/electron";
// Navigation items for the side panel
const NAV_ITEMS = [
{ id: "api-keys", label: "API Keys", icon: Key },
{ id: "claude", label: "Claude", icon: Terminal },
{ id: "appearance", label: "Appearance", icon: Palette },
{ id: "keyboard", label: "Keyboard Shortcuts", icon: Settings2 },
{ id: "audio", label: "Audio", icon: Volume2 },
{ id: "defaults", label: "Feature Defaults", icon: FlaskConical },
{ id: "danger", label: "Danger Zone", icon: Trash2 },
];
export function SettingsView() {
const {
theme,
@@ -104,8 +81,6 @@ export function SettingsView() {
// Render the active section based on current view
const renderActiveSection = () => {
switch (activeView) {
case "api-keys":
return <ApiKeysSection />;
case "claude":
return (
<ClaudeCliStatus
@@ -173,7 +148,7 @@ export function SettingsView() {
navItems={NAV_ITEMS}
activeSection={activeView}
currentProject={currentProject}
onNavigate={(id) => navigateTo(id as SettingsViewId)}
onNavigate={navigateTo}
/>
{/* Content Panel - Shows only the active section */}

View File

@@ -39,7 +39,7 @@ export function AudioSection({
<Checkbox
id="mute-done-sound"
checked={muteDoneSound}
onCheckedChange={(checked) => onMuteDoneSoundChange(checked === true)}
onCheckedChange={onMuteDoneSoundChange}
className="mt-1"
data-testid="mute-done-sound-checkbox"
/>

View File

@@ -1,12 +1,13 @@
import { cn } from "@/lib/utils";
import type { Project } from "@/lib/electron";
import type { NavigationItem } from "../config/navigation";
import type { SettingsViewId } from "../hooks/use-settings-view";
interface SettingsNavigationProps {
navItems: NavigationItem[];
activeSection: string;
activeSection: SettingsViewId;
currentProject: Project | null;
onNavigate: (sectionId: string) => void;
onNavigate: (sectionId: SettingsViewId) => void;
}
export function SettingsNavigation({

View File

@@ -8,9 +8,10 @@ import {
FlaskConical,
Trash2,
} from "lucide-react";
import type { SettingsViewId } from "../hooks/use-settings-view";
export interface NavigationItem {
id: string;
id: SettingsViewId;
label: string;
icon: LucideIcon;
}