mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-03-25 10:08:01 +08:00
Add a new setting to automatically skip Claude Code's onboarding screen by writing hasCompletedOnboarding=true to ~/.claude.json. The setting defaults to enabled for better user experience. - Add set/clear_has_completed_onboarding functions in claude_mcp.rs - Add Tauri commands and frontend API integration - Add toggle in WindowSettings with i18n support (en/zh/ja) - Fix hardcoded Chinese text in tests to use i18n keys
98 lines
3.2 KiB
TypeScript
98 lines
3.2 KiB
TypeScript
import { Switch } from "@/components/ui/switch";
|
|
import { useTranslation } from "react-i18next";
|
|
import type { SettingsFormState } from "@/hooks/useSettings";
|
|
import { AppWindow, MonitorUp, Power } from "lucide-react";
|
|
|
|
interface WindowSettingsProps {
|
|
settings: SettingsFormState;
|
|
onChange: (updates: Partial<SettingsFormState>) => void;
|
|
}
|
|
|
|
export function WindowSettings({ settings, onChange }: WindowSettingsProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<section className="space-y-4">
|
|
<div className="flex items-center gap-2 pb-2 border-b border-border/40">
|
|
<AppWindow className="h-4 w-4 text-primary" />
|
|
<h3 className="text-sm font-medium">{t("settings.windowBehavior")}</h3>
|
|
</div>
|
|
|
|
<div className="space-y-3">
|
|
<ToggleRow
|
|
icon={<Power className="h-4 w-4 text-orange-500" />}
|
|
title={t("settings.launchOnStartup")}
|
|
description={t("settings.launchOnStartupDescription")}
|
|
checked={!!settings.launchOnStartup}
|
|
onCheckedChange={(value) => onChange({ launchOnStartup: value })}
|
|
/>
|
|
|
|
<ToggleRow
|
|
icon={<AppWindow className="h-4 w-4 text-blue-500" />}
|
|
title={t("settings.minimizeToTray")}
|
|
description={t("settings.minimizeToTrayDescription")}
|
|
checked={settings.minimizeToTrayOnClose}
|
|
onCheckedChange={(value) =>
|
|
onChange({ minimizeToTrayOnClose: value })
|
|
}
|
|
/>
|
|
|
|
<ToggleRow
|
|
icon={<MonitorUp className="h-4 w-4 text-purple-500" />}
|
|
title={t("settings.enableClaudePluginIntegration")}
|
|
description={t("settings.enableClaudePluginIntegrationDescription")}
|
|
checked={!!settings.enableClaudePluginIntegration}
|
|
onCheckedChange={(value) =>
|
|
onChange({ enableClaudePluginIntegration: value })
|
|
}
|
|
/>
|
|
|
|
<ToggleRow
|
|
icon={<MonitorUp className="h-4 w-4 text-cyan-500" />}
|
|
title={t("settings.skipClaudeOnboarding")}
|
|
description={t("settings.skipClaudeOnboardingDescription")}
|
|
checked={!!settings.skipClaudeOnboarding}
|
|
onCheckedChange={(value) => onChange({ skipClaudeOnboarding: value })}
|
|
/>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|
|
|
|
interface ToggleRowProps {
|
|
icon: React.ReactNode;
|
|
title: string;
|
|
description?: string;
|
|
checked: boolean;
|
|
onCheckedChange: (value: boolean) => void;
|
|
}
|
|
|
|
function ToggleRow({
|
|
icon,
|
|
title,
|
|
description,
|
|
checked,
|
|
onCheckedChange,
|
|
}: ToggleRowProps) {
|
|
return (
|
|
<div className="flex items-center justify-between gap-4 rounded-xl border border-border bg-card/50 p-4 transition-colors hover:bg-muted/50">
|
|
<div className="flex items-center gap-3">
|
|
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-background ring-1 ring-border">
|
|
{icon}
|
|
</div>
|
|
<div className="space-y-1">
|
|
<p className="text-sm font-medium leading-none">{title}</p>
|
|
{description ? (
|
|
<p className="text-xs text-muted-foreground">{description}</p>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
<Switch
|
|
checked={checked}
|
|
onCheckedChange={onCheckedChange}
|
|
aria-label={title}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|