Handy/src/components/settings/StartHidden.tsx
2025-11-10 11:39:14 +08:00

29 lines
894 B
TypeScript

import React from "react";
import { ToggleSwitch } from "../ui/ToggleSwitch";
import { useSettings } from "../../hooks/useSettings";
interface StartHiddenProps {
descriptionMode?: "inline" | "tooltip";
grouped?: boolean;
}
export const StartHidden: React.FC<StartHiddenProps> = React.memo(
({ descriptionMode = "tooltip", grouped = false }) => {
const { getSetting, updateSetting, isUpdating } = useSettings();
const startHidden = getSetting("start_hidden") ?? false;
return (
<ToggleSwitch
checked={startHidden}
onChange={(enabled) => updateSetting("start_hidden", enabled)}
isUpdating={isUpdating("start_hidden")}
label="Start Hidden"
description="Launch to system tray without opening the window."
descriptionMode={descriptionMode}
grouped={grouped}
tooltipPosition="bottom"
/>
);
},
);