mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-24 14:04:54 +03:00
linter
This commit is contained in:
parent
72aa822655
commit
653afa7210
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from "react";
|
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 { useTranslation } from "react-i18next";
|
||||||
@ -18,29 +18,29 @@ export function SettingsGeneral({
|
|||||||
userPreferences,
|
userPreferences,
|
||||||
updateUserPreferences,
|
updateUserPreferences,
|
||||||
}: SettingsGeneralProps) {
|
}: SettingsGeneralProps) {
|
||||||
|
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
|
||||||
const [form, setForm] = useState(
|
const [form, setForm] = useState({
|
||||||
{
|
downloadsPath: "",
|
||||||
downloadsPath: '',
|
|
||||||
downloadNotificationsEnabled: false,
|
downloadNotificationsEnabled: false,
|
||||||
repackUpdatesNotificationsEnabled: false,
|
repackUpdatesNotificationsEnabled: false,
|
||||||
language: '',
|
language: "",
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
const [defaultDownloadsPath, setdefaultDownloadsPath] = useState('');
|
const [defaultDownloadsPath, setdefaultDownloadsPath] = useState("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchdefaultDownloadsPath() {
|
async function fetchdefaultDownloadsPath() {
|
||||||
setdefaultDownloadsPath(await window.electron.getDefaultDownloadsPath())
|
setdefaultDownloadsPath(await window.electron.getDefaultDownloadsPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchdefaultDownloadsPath();
|
fetchdefaultDownloadsPath();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(updateFormWithUserPreferences, [userPreferences, defaultDownloadsPath]);
|
useEffect(updateFormWithUserPreferences, [
|
||||||
|
userPreferences,
|
||||||
|
defaultDownloadsPath,
|
||||||
|
]);
|
||||||
|
|
||||||
const handleLanguageChange = (event) => {
|
const handleLanguageChange = (event) => {
|
||||||
const value = event.target.value;
|
const value = event.target.value;
|
||||||
@ -74,9 +74,11 @@ export function SettingsGeneral({
|
|||||||
setForm((prev) => ({
|
setForm((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath,
|
downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath,
|
||||||
downloadNotificationsEnabled: userPreferences.downloadNotificationsEnabled,
|
downloadNotificationsEnabled:
|
||||||
repackUpdatesNotificationsEnabled: userPreferences.repackUpdatesNotificationsEnabled,
|
userPreferences.downloadNotificationsEnabled,
|
||||||
language: userPreferences.language
|
repackUpdatesNotificationsEnabled:
|
||||||
|
userPreferences.repackUpdatesNotificationsEnabled,
|
||||||
|
language: userPreferences.language,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,8 +105,10 @@ export function SettingsGeneral({
|
|||||||
<h3>{t("language")}</h3>
|
<h3>{t("language")}</h3>
|
||||||
<>
|
<>
|
||||||
<Select value={form.language} onChange={handleLanguageChange}>
|
<Select value={form.language} onChange={handleLanguageChange}>
|
||||||
{Object.keys(languageResources).map(language => (
|
{Object.keys(languageResources).map((language) => (
|
||||||
<option key={language} value={language}>{ISO6391.getName(language)}</option>
|
<option key={language} value={language}>
|
||||||
|
{ISO6391.getName(language)}
|
||||||
|
</option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user