feat: show silent startup option only when launch on startup is enabled

Add conditional rendering with animated transition for the silent startup
toggle, so it only appears when the launch on startup option is checked.
This commit is contained in:
Jason
2026-02-26 21:25:14 +08:00
parent 3348b39089
commit 54876612b3
+20 -7
View File
@@ -2,6 +2,7 @@ import { useTranslation } from "react-i18next";
import type { SettingsFormState } from "@/hooks/useSettings";
import { AppWindow, MonitorUp, Power, EyeOff } from "lucide-react";
import { ToggleRow } from "@/components/ui/toggle-row";
import { AnimatePresence, motion } from "framer-motion";
interface WindowSettingsProps {
settings: SettingsFormState;
@@ -27,13 +28,25 @@ export function WindowSettings({ settings, onChange }: WindowSettingsProps) {
onCheckedChange={(value) => onChange({ launchOnStartup: value })}
/>
<ToggleRow
icon={<EyeOff className="h-4 w-4 text-green-500" />}
title={t("settings.silentStartup")}
description={t("settings.silentStartupDescription")}
checked={!!settings.silentStartup}
onCheckedChange={(value) => onChange({ silentStartup: value })}
/>
<AnimatePresence initial={false}>
{settings.launchOnStartup && (
<motion.div
key="silent-startup"
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 10 }}
transition={{ duration: 0.3 }}
>
<ToggleRow
icon={<EyeOff className="h-4 w-4 text-green-500" />}
title={t("settings.silentStartup")}
description={t("settings.silentStartupDescription")}
checked={!!settings.silentStartup}
onCheckedChange={(value) => onChange({ silentStartup: value })}
/>
</motion.div>
)}
</AnimatePresence>
<ToggleRow
icon={<MonitorUp className="h-4 w-4 text-purple-500" />}