diff --git a/apps/dokploy/components/dashboard/settings/appearance-form.tsx b/apps/dokploy/components/dashboard/settings/appearance-form.tsx index b7fe20e8..f0b2e680 100644 --- a/apps/dokploy/components/dashboard/settings/appearance-form.tsx +++ b/apps/dokploy/components/dashboard/settings/appearance-form.tsx @@ -4,28 +4,28 @@ import * as z from "zod"; import { Button } from "@/components/ui/button"; import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, } from "@/components/ui/card"; import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, } from "@/components/ui/form"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, } from "@/components/ui/select"; import useLocale from "@/utils/hooks/use-locale"; import { useTranslation } from "next-i18next"; @@ -34,167 +34,226 @@ import { useEffect } from "react"; import { toast } from "sonner"; const appearanceFormSchema = z.object({ - theme: z.enum(["light", "dark", "system"], { - required_error: "Please select a theme.", - }), - language: z.enum(["en", "pl", "ru", "de", "zh-Hant", "zh-Hans"], { - required_error: "Please select a language.", - }), + theme: z.enum(["light", "dark", "system"], { + required_error: "Please select a theme.", + }), + language: z.enum(["en", "pl", "ru", "de", "zh-Hant", "zh-Hans", "fa"], { + required_error: "Please select a language.", + }), }); type AppearanceFormValues = z.infer; // This can come from your database or API. const defaultValues: Partial = { - theme: "system", - language: "en", + theme: "system", + language: "en", }; export function AppearanceForm() { - const { setTheme, theme } = useTheme(); - const { locale, setLocale } = useLocale(); - const { t } = useTranslation("settings"); + const { setTheme, theme } = useTheme(); + const { locale, setLocale } = useLocale(); + const { t } = useTranslation("settings"); - const form = useForm({ - resolver: zodResolver(appearanceFormSchema), - defaultValues, - }); + const form = useForm({ + resolver: zodResolver(appearanceFormSchema), + defaultValues, + }); - useEffect(() => { - form.reset({ - theme: (theme ?? "system") as AppearanceFormValues["theme"], - language: locale, - }); - }, [form, theme, locale]); - function onSubmit(data: AppearanceFormValues) { - setTheme(data.theme); - setLocale(data.language); - toast.success("Preferences Updated"); - } + useEffect(() => { + form.reset({ + theme: (theme ?? "system") as AppearanceFormValues["theme"], + language: locale, + }); + }, [form, theme, locale]); + function onSubmit(data: AppearanceFormValues) { + setTheme(data.theme); + setLocale(data.language); + toast.success("Preferences Updated"); + } - return ( - - - - {t("settings.appearance.title")} - - - {t("settings.appearance.description")} - - - -
- - { - return ( - - {t("settings.appearance.theme")} - - {t("settings.appearance.themeDescription")} - - - - - - - - -
- light -
- - {t("settings.appearance.themes.light")} - -
-
- - - - - -
- dark -
- - {t("settings.appearance.themes.dark")} - -
-
- - - - - -
- system -
- - {t("settings.appearance.themes.system")} - -
-
-
-
- ); - }} - /> + return ( + + + + {t("settings.appearance.title")} + + + {t("settings.appearance.description")} + + + + + + { + return ( + + + {t("settings.appearance.theme")} + + + {t( + "settings.appearance.themeDescription" + )} + + + + + + + + +
+ light +
+ + {t( + "settings.appearance.themes.light" + )} + +
+
+ + + + + +
+ dark +
+ + {t( + "settings.appearance.themes.dark" + )} + +
+
+ + + + + +
+ system +
+ + {t( + "settings.appearance.themes.system" + )} + +
+
+
+
+ ); + }} + /> - { - return ( - - {t("settings.appearance.language")} - - {t("settings.appearance.languageDescription")} - - - - - ); - }} - /> + { + return ( + + + {t("settings.appearance.language")} + + + {t( + "settings.appearance.languageDescription" + )} + + + + + ); + }} + /> - - - -
-
- ); + + + +
+
+ ); } diff --git a/apps/dokploy/next-i18next.config.cjs b/apps/dokploy/next-i18next.config.cjs index 30f82e64..f8be0f2d 100644 --- a/apps/dokploy/next-i18next.config.cjs +++ b/apps/dokploy/next-i18next.config.cjs @@ -1,10 +1,10 @@ /** @type {import('next-i18next').UserConfig} */ module.exports = { - i18n: { - defaultLocale: "en", - locales: ["en", "pl", "ru", "de", "zh-Hant", "zh-Hans"], - localeDetection: false, - }, - fallbackLng: "en", - keySeparator: false, + i18n: { + defaultLocale: "en", + locales: ["en", "pl", "ru", "de", "zh-Hant", "zh-Hans", "fa"], + localeDetection: false, + }, + fallbackLng: "en", + keySeparator: false, }; diff --git a/apps/dokploy/pages/_app.tsx b/apps/dokploy/pages/_app.tsx index d1d95123..517dcd89 100644 --- a/apps/dokploy/pages/_app.tsx +++ b/apps/dokploy/pages/_app.tsx @@ -14,68 +14,70 @@ import type { ReactElement, ReactNode } from "react"; const inter = Inter({ subsets: ["latin"] }); export type NextPageWithLayout

= NextPage & { - getLayout?: (page: ReactElement) => ReactNode; - // session: Session | null; - theme?: string; + getLayout?: (page: ReactElement) => ReactNode; + // session: Session | null; + theme?: string; }; type AppPropsWithLayout = AppProps & { - Component: NextPageWithLayout; + Component: NextPageWithLayout; }; const MyApp = ({ - Component, - pageProps: { ...pageProps }, + Component, + pageProps: { ...pageProps }, }: AppPropsWithLayout) => { - const getLayout = Component.getLayout ?? ((page) => page); + const getLayout = Component.getLayout ?? ((page) => page); - return ( - <> - - - Dokploy - - {process.env.NEXT_PUBLIC_UMAMI_HOST && - process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID && ( -