🆙 Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.
TypeScript aielectronesrgangigapixelgigapixel-imagesimageimage-upscalingtopazupscaleupscalerimageupscayl
Add LanguageSwitcher component to OnboardingDialog and update its visibility logic
Nayam Amarshe4f39acfc6f88
diff --git a/renderer/components/main-content/onboarding-dialog.tsx b/renderer/components/main-content/onboarding-dialog.tsxindex c696461..54c72f5 100644--- a/renderer/components/main-content/onboarding-dialog.tsx+++ b/renderer/components/main-content/onboarding-dialog.tsx@@ -15,6 +15,7 @@ import {} from "@/atoms/user-settings-atom";import { useAtom } from "jotai";import useTranslation from "../hooks/use-translation";+import LanguageSwitcher from "../sidebar/settings-tab/language-switcher";type OnboardingStep = {title: string;@@ -44,6 +45,14 @@ export function OnboardingDialog() {title: t("ONBOARDING_DIALOG.STEP_1.TITLE"),description: t("ONBOARDING_DIALOG.STEP_1.DESCRIPTION"),type: "info",+ configurationOptions: [+ {+ type: "component",+ label: t("SETTINGS.LANGUAGE.TITLE"),+ component: <LanguageSwitcher hideLabel={true} />,+ key: "theme",+ },+ ],},{title: t("ONBOARDING_DIALOG.STEP_2.TITLE"),@@ -142,7 +151,7 @@ export function OnboardingDialog() {<divclassName={cn("flex h-full w-full flex-col rounded-sm bg-primary p-8",- currentStepData.type === "settings" && "h-auto w-auto gap-8",+ "h-auto w-auto gap-8",currentStepData.configurationOptions[0].type === "video" && "p-0",)}>diff --git a/renderer/components/sidebar/settings-tab/language-switcher.tsx b/renderer/components/sidebar/settings-tab/language-switcher.tsxindex c9785db..15dfb14 100644--- a/renderer/components/sidebar/settings-tab/language-switcher.tsx+++ b/renderer/components/sidebar/settings-tab/language-switcher.tsx@@ -13,27 +13,31 @@ const locales = {pt: "Português (Portugal)",};-const LanguageSwitcher = () => {+const LanguageSwitcher = ({ hideLabel = false }: { hideLabel?: boolean }) => {const setLocale = useSetAtom(localeAtom);const t = useAtomValue(translationAtom);return (<div><div className="flex flex-col gap-2">- <p className="text-sm font-medium">{t("SETTINGS.LANGUAGE.TITLE")}</p>+ {!hideLabel && (+ <p className="text-sm font-medium">{t("SETTINGS.LANGUAGE.TITLE")}</p>+ )}<selectdata-choose-themeclassName="select select-primary"onChange={(e) => setLocale(e.target.value as keyof typeof locales)}>- {Object.entries(locales).map((entry) => {- const [locale, label] = entry;- return (- <option value={locale} key={locale}>- {label.toLocaleUpperCase()}- </option>- );- })}+ {Object.entries(locales)+ .sort(([, a], [, b]) => a.localeCompare(b))+ .map((entry) => {+ const [locale, label] = entry;+ return (+ <option value={locale} key={locale}>+ {label.toLocaleUpperCase()}+ </option>+ );+ })}</select></div></div>