Merge branch 'feature/profile-redesign' of github.com:hydralauncher/hydra into feature/profile-redesign

This commit is contained in:
Chubby Granny Chaser 2024-09-14 02:34:33 +01:00
commit 702b141f7b
No known key found for this signature in database

View File

@ -38,11 +38,9 @@ export function SettingsGeneral() {
const [defaultDownloadsPath, setDefaultDownloadsPath] = useState(""); const [defaultDownloadsPath, setDefaultDownloadsPath] = useState("");
useEffect(() => { useEffect(() => {
async function fetchdefaultDownloadsPath() { window.electron.getDefaultDownloadsPath().then((path) => {
setDefaultDownloadsPath(await window.electron.getDefaultDownloadsPath()); setDefaultDownloadsPath(path);
} });
fetchdefaultDownloadsPath();
setLanguageOptions( setLanguageOptions(
orderBy( orderBy(
@ -89,6 +87,15 @@ export function SettingsGeneral() {
function updateFormWithUserPreferences() { function updateFormWithUserPreferences() {
if (userPreferences) { if (userPreferences) {
const languageKeys = Object.keys(languageResources);
const language =
languageKeys.find((language) => {
return language === userPreferences.language;
}) ??
languageKeys.find((language) => {
return language.startsWith(userPreferences.language.split("-")[0]);
});
setForm((prev) => ({ setForm((prev) => ({
...prev, ...prev,
downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath, downloadsPath: userPreferences.downloadsPath ?? defaultDownloadsPath,
@ -96,7 +103,7 @@ export function SettingsGeneral() {
userPreferences.downloadNotificationsEnabled, userPreferences.downloadNotificationsEnabled,
repackUpdatesNotificationsEnabled: repackUpdatesNotificationsEnabled:
userPreferences.repackUpdatesNotificationsEnabled, userPreferences.repackUpdatesNotificationsEnabled,
language: userPreferences.language, language: language ?? "en",
})); }));
} }
} }