From a8f6475ef2cb23367d8d0be2b464b60309b095d4 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 11 Jul 2025 12:49:36 +0800 Subject: [PATCH] feat: login form styles --- .../layer/renderer/src/modules/auth/Form.tsx | 5 +++++ .../src/modules/auth/LoginModalContent.tsx | 4 +++- .../renderer/src/modules/auth/ReferralForm.tsx | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/auth/Form.tsx b/apps/desktop/layer/renderer/src/modules/auth/Form.tsx index 274327bf3..8379d386a 100644 --- a/apps/desktop/layer/renderer/src/modules/auth/Form.tsx +++ b/apps/desktop/layer/renderer/src/modules/auth/Form.tsx @@ -19,11 +19,13 @@ import { useTranslation } from "react-i18next" import { toast } from "sonner" import { z } from "zod" +import { useServerConfigs } from "~/atoms/server-configs" import { useModalStack } from "~/components/ui/modal/stacked/hooks" import { loginHandler, signUp, twoFactor } from "~/lib/auth" import { handleSessionChanges } from "~/queries/auth" import { TOTPForm } from "../profile/two-factor" +import { ReferralForm } from "./ReferralForm" const formSchema = z.object({ email: z.string().email(), @@ -190,6 +192,8 @@ export function RegisterForm({ mode: "all", }) + const serverConfigs = useServerConfigs() + const captchaRef = useRef(null) async function onSubmit(values: z.infer) { @@ -256,6 +260,7 @@ export function RegisterForm({ )} /> + {serverConfigs?.REFERRAL_ENABLED && } {!import.meta.env.DEV && ( )} diff --git a/apps/desktop/layer/renderer/src/modules/auth/LoginModalContent.tsx b/apps/desktop/layer/renderer/src/modules/auth/LoginModalContent.tsx index 04f93cb0f..72a2c9529 100644 --- a/apps/desktop/layer/renderer/src/modules/auth/LoginModalContent.tsx +++ b/apps/desktop/layer/renderer/src/modules/auth/LoginModalContent.tsx @@ -136,6 +136,9 @@ export const LoginModalContent = (props: LoginModalContentProps) => { ))} + {isRegister && serverConfigs?.REFERRAL_ENABLED && ( + + )} )} - {isRegister && serverConfigs?.REFERRAL_ENABLED && } {!isEmail && ( <> diff --git a/apps/desktop/layer/renderer/src/modules/auth/ReferralForm.tsx b/apps/desktop/layer/renderer/src/modules/auth/ReferralForm.tsx index 4d5f78cb1..dbea5e7d2 100644 --- a/apps/desktop/layer/renderer/src/modules/auth/ReferralForm.tsx +++ b/apps/desktop/layer/renderer/src/modules/auth/ReferralForm.tsx @@ -40,7 +40,13 @@ async function getReferralCycleDays(code: string) { return apiClient.referrals.days.$get({ query: { code } }) } -export function ReferralForm({ className }: { className?: string }) { +export function ReferralForm({ + className, + align = "center", +}: { + className?: string + align?: "left" | "center" +}) { const { t } = useTranslation() const form = useForm>({ resolver: zodResolver(formSchema), @@ -73,7 +79,7 @@ export function ReferralForm({ className }: { className?: string }) { return (
- + {t("register.referral.label")} - + {days || !referral