feat: add option to start minimized in user settings

This commit is contained in:
Hachi-R 2024-10-30 15:03:46 -03:00
parent 6dd454a982
commit 7af56cd7cc
3 changed files with 22 additions and 2 deletions

View File

@ -253,7 +253,8 @@
"must_be_valid_url": "The source must be a valid URL",
"blocked_users": "Blocked users",
"user_unblocked": "User has been unblocked",
"enable_achievement_notifications": "When an achievement in unlocked"
"enable_achievement_notifications": "When an achievement in unlocked",
"launch_minimized": "Launch Hydra minimized"
},
"notifications": {
"download_complete": "Download complete",

View File

@ -249,7 +249,8 @@
"must_be_valid_url": "A fonte deve ser uma URL válida",
"blocked_users": "Usuários bloqueados",
"user_unblocked": "Usuário desbloqueado",
"enable_achievement_notifications": "Quando uma conquista é desbloqueada"
"enable_achievement_notifications": "Quando uma conquista é desbloqueada",
"launch_minimized": "Iniciar o Hydra minimizado"
},
"notifications": {
"download_complete": "Download concluído",

View File

@ -17,6 +17,7 @@ export function SettingsBehavior() {
const [form, setForm] = useState({
preferQuitInsteadOfHiding: false,
runAtStartup: false,
startMinimized: false,
});
const { t } = useTranslation("settings");
@ -26,10 +27,13 @@ export function SettingsBehavior() {
setForm({
preferQuitInsteadOfHiding: userPreferences.preferQuitInsteadOfHiding,
runAtStartup: userPreferences.runAtStartup,
startMinimized: userPreferences.startMinimized,
});
}
}, [userPreferences]);
console.log(userPreferences?.startMinimized);
useEffect(() => {
window.electron.isPortableVersion().then((isPortableVersion) => {
setShowRunAtStartup(!isPortableVersion);
@ -63,6 +67,20 @@ export function SettingsBehavior() {
checked={form.runAtStartup}
/>
)}
{showRunAtStartup && (
<div style={{ opacity: form.runAtStartup ? 1 : 0.5 }}>
<CheckboxField
label={t("launch_minimized")}
style={{ cursor: form.runAtStartup ? "pointer" : "not-allowed" }}
checked={form.runAtStartup && form.startMinimized}
disabled={!form.runAtStartup}
onChange={() => {
handleChange({ startMinimized: !form.startMinimized });
}}
/>
</div>
)}
</>
);
}