mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
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:
@@ -2,21 +2,9 @@
|
|||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useAppStore } from "@/store/app-store";
|
import { useAppStore } from "@/store/app-store";
|
||||||
import {
|
|
||||||
Key,
|
|
||||||
Palette,
|
|
||||||
Terminal,
|
|
||||||
FlaskConical,
|
|
||||||
Trash2,
|
|
||||||
Settings2,
|
|
||||||
Volume2,
|
|
||||||
} from "lucide-react";
|
|
||||||
|
|
||||||
import {
|
import { useCliStatus, useSettingsView } from "./settings-view/hooks";
|
||||||
useCliStatus,
|
import { NAV_ITEMS } from "./settings-view/config/navigation";
|
||||||
useSettingsView,
|
|
||||||
type SettingsViewId,
|
|
||||||
} from "./settings-view/hooks";
|
|
||||||
import { SettingsHeader } from "./settings-view/components/settings-header";
|
import { SettingsHeader } from "./settings-view/components/settings-header";
|
||||||
import { KeyboardMapDialog } from "./settings-view/components/keyboard-map-dialog";
|
import { KeyboardMapDialog } from "./settings-view/components/keyboard-map-dialog";
|
||||||
import { DeleteProjectDialog } from "./settings-view/components/delete-project-dialog";
|
import { DeleteProjectDialog } from "./settings-view/components/delete-project-dialog";
|
||||||
@@ -34,17 +22,6 @@ import type {
|
|||||||
} from "./settings-view/shared/types";
|
} from "./settings-view/shared/types";
|
||||||
import type { Project as ElectronProject } from "@/lib/electron";
|
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() {
|
export function SettingsView() {
|
||||||
const {
|
const {
|
||||||
theme,
|
theme,
|
||||||
@@ -104,8 +81,6 @@ export function SettingsView() {
|
|||||||
// Render the active section based on current view
|
// Render the active section based on current view
|
||||||
const renderActiveSection = () => {
|
const renderActiveSection = () => {
|
||||||
switch (activeView) {
|
switch (activeView) {
|
||||||
case "api-keys":
|
|
||||||
return <ApiKeysSection />;
|
|
||||||
case "claude":
|
case "claude":
|
||||||
return (
|
return (
|
||||||
<ClaudeCliStatus
|
<ClaudeCliStatus
|
||||||
@@ -173,7 +148,7 @@ export function SettingsView() {
|
|||||||
navItems={NAV_ITEMS}
|
navItems={NAV_ITEMS}
|
||||||
activeSection={activeView}
|
activeSection={activeView}
|
||||||
currentProject={currentProject}
|
currentProject={currentProject}
|
||||||
onNavigate={(id) => navigateTo(id as SettingsViewId)}
|
onNavigate={navigateTo}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Content Panel - Shows only the active section */}
|
{/* Content Panel - Shows only the active section */}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function AudioSection({
|
|||||||
<Checkbox
|
<Checkbox
|
||||||
id="mute-done-sound"
|
id="mute-done-sound"
|
||||||
checked={muteDoneSound}
|
checked={muteDoneSound}
|
||||||
onCheckedChange={(checked) => onMuteDoneSoundChange(checked === true)}
|
onCheckedChange={onMuteDoneSoundChange}
|
||||||
className="mt-1"
|
className="mt-1"
|
||||||
data-testid="mute-done-sound-checkbox"
|
data-testid="mute-done-sound-checkbox"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import type { Project } from "@/lib/electron";
|
import type { Project } from "@/lib/electron";
|
||||||
import type { NavigationItem } from "../config/navigation";
|
import type { NavigationItem } from "../config/navigation";
|
||||||
|
import type { SettingsViewId } from "../hooks/use-settings-view";
|
||||||
|
|
||||||
interface SettingsNavigationProps {
|
interface SettingsNavigationProps {
|
||||||
navItems: NavigationItem[];
|
navItems: NavigationItem[];
|
||||||
activeSection: string;
|
activeSection: SettingsViewId;
|
||||||
currentProject: Project | null;
|
currentProject: Project | null;
|
||||||
onNavigate: (sectionId: string) => void;
|
onNavigate: (sectionId: SettingsViewId) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SettingsNavigation({
|
export function SettingsNavigation({
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import {
|
|||||||
FlaskConical,
|
FlaskConical,
|
||||||
Trash2,
|
Trash2,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
|
import type { SettingsViewId } from "../hooks/use-settings-view";
|
||||||
|
|
||||||
export interface NavigationItem {
|
export interface NavigationItem {
|
||||||
id: string;
|
id: SettingsViewId;
|
||||||
label: string;
|
label: string;
|
||||||
icon: LucideIcon;
|
icon: LucideIcon;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user