diff --git a/src/renderer/src/pages/settings/settings-general.tsx b/src/renderer/src/pages/settings/settings-general.tsx index ad5ff6c0..7e3ffc39 100644 --- a/src/renderer/src/pages/settings/settings-general.tsx +++ b/src/renderer/src/pages/settings/settings-general.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; -import ISO6391 from 'iso-639-1' +import ISO6391 from "iso-639-1"; -import { TextField, Button, CheckboxField, Select} from "@renderer/components"; +import { TextField, Button, CheckboxField, Select } from "@renderer/components"; import { useTranslation } from "react-i18next"; import * as styles from "./settings-general.css"; import type { UserPreferences } from "@types"; @@ -18,29 +18,29 @@ export function SettingsGeneral({ userPreferences, updateUserPreferences, }: SettingsGeneralProps) { - const { t } = useTranslation("settings"); - const [form, setForm] = useState( - { - downloadsPath: '', - downloadNotificationsEnabled: false, - repackUpdatesNotificationsEnabled: false, - language: '', - } - ); - - const [defaultDownloadsPath, setdefaultDownloadsPath] = useState(''); - + const [form, setForm] = useState({ + downloadsPath: "", + downloadNotificationsEnabled: false, + repackUpdatesNotificationsEnabled: false, + language: "", + }); + + const [defaultDownloadsPath, setdefaultDownloadsPath] = useState(""); + useEffect(() => { async function fetchdefaultDownloadsPath() { - setdefaultDownloadsPath(await window.electron.getDefaultDownloadsPath()) + setdefaultDownloadsPath(await window.electron.getDefaultDownloadsPath()); } - + fetchdefaultDownloadsPath(); }, []); - - useEffect(updateFormWithUserPreferences, [userPreferences, defaultDownloadsPath]); + + useEffect(updateFormWithUserPreferences, [ + userPreferences, + defaultDownloadsPath, + ]); const handleLanguageChange = (event) => { const value = event.target.value; @@ -69,14 +69,16 @@ export function SettingsGeneral({ } }; - function updateFormWithUserPreferences(){ + function updateFormWithUserPreferences() { if (userPreferences) { setForm((prev) => ({ ...prev, downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath, - downloadNotificationsEnabled: userPreferences.downloadNotificationsEnabled, - repackUpdatesNotificationsEnabled: userPreferences.repackUpdatesNotificationsEnabled, - language: userPreferences.language + downloadNotificationsEnabled: + userPreferences.downloadNotificationsEnabled, + repackUpdatesNotificationsEnabled: + userPreferences.repackUpdatesNotificationsEnabled, + language: userPreferences.language, })); } } @@ -103,8 +105,10 @@ export function SettingsGeneral({