Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): migrate signup email field (#40990)

yyh0f1536585e8c
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index ff3bb9e8481..e0e68e08639 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -5189,11 +5189,6 @@
"count": 1
}
},
- "web/app/signup/components/input-mail.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"web/app/signup/layout.tsx": {
"typescript/no-explicit-any": {
"count": 1
diff --git a/web/app/signup/components/input-mail.spec.tsx b/web/app/signup/components/input-mail.spec.tsx
index d93c6f26a24..cc517e386c6 100644
--- a/web/app/signup/components/input-mail.spec.tsx
+++ b/web/app/signup/components/input-mail.spec.tsx
@@ -6,7 +6,7 @@ import { useLocale } from '@/context/i18n'
import { useSearchParams } from '@/next/navigation'
import { useSendMail } from '@/service/use-common'
import { renderWithConsoleQuery } from '@/test/console/query-data'
-import Form from './input-mail'
+import SignupEmailForm from './input-mail'
const mockSubmitMail = vi.fn()
const mockOnSuccess = vi.fn()
@@ -61,7 +61,7 @@ const renderForm = ({
mutateAsync: mockSubmitMail,
isPending,
} as unknown as UseSendMailResult)
- return renderWithConsoleQuery(<Form onSuccess={mockOnSuccess} />, {
+ return renderWithConsoleQuery(<SignupEmailForm onSuccess={mockOnSuccess} />, {
systemFeatures: { branding: { enabled: brandingEnabled } },
})
}
diff --git a/web/app/signup/components/input-mail.tsx b/web/app/signup/components/input-mail.tsx
index 36af8562859..8312e837747 100644
--- a/web/app/signup/components/input-mail.tsx
+++ b/web/app/signup/components/input-mail.tsx
@@ -1,11 +1,13 @@
'use client'
import type { MailSendResponse } from '@/service/use-common'
import { Button } from '@langgenius/dify-ui/button'
+import { Field, FieldLabel } from '@langgenius/dify-ui/field'
+import { Form } from '@langgenius/dify-ui/form'
+import { Input } from '@langgenius/dify-ui/input'
import { toast } from '@langgenius/dify-ui/toast'
import { useSuspenseQuery } from '@tanstack/react-query'
import { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import Input from '@/app/components/base/input'
import Split from '@/app/signin/split'
import { emailRegex } from '@/config'
import { useLocale } from '@/context/i18n'
@@ -17,7 +19,7 @@ import { useSendMail } from '@/service/use-common'
type Props = {
onSuccess: (email: string, payload: string) => void
}
-export default function Form({ onSuccess }: Props) {
+export default function SignupEmailForm({ onSuccess }: Props) {
const { t } = useTranslation()
const [email, setEmail] = useState('')
const locale = useLocale()
@@ -45,29 +47,25 @@ export default function Form({ onSuccess }: Props) {
}, [email, locale, submitMail, t, isPending, onSuccess])
return (
- <form
+ <Form
onSubmit={(e) => {
e.preventDefault()
handleSubmit()
}}
>
- <div className="mb-3">
- <label htmlFor="email" className="my-2 system-md-semibold text-text-secondary">
+ <Field name="email" className="mb-3">
+ <FieldLabel className="py-0 text-[14px] leading-5 font-semibold text-text-secondary">
{t(($) => $.email, { ns: 'login' })}
- </label>
- <div className="mt-1">
- <Input
- value={email}
- onChange={(e) => setEmail(e.target.value)}
- id="email"
- name="email"
- type="email"
- autoComplete="email"
- spellCheck={false}
- placeholder={t(($) => $.emailPlaceholder, { ns: 'login' }) || ''}
- />
- </div>
- </div>
+ </FieldLabel>
+ <Input
+ value={email}
+ onValueChange={setEmail}
+ type="email"
+ autoComplete="email"
+ spellCheck={false}
+ placeholder={t(($) => $.emailPlaceholder, { ns: 'login' }) || ''}
+ />
+ </Field>
<div className="mb-2">
<Button variant="primary" type="submit" disabled={isPending || !email} className="w-full">
{t(($) => $['signup.verifyMail'], { ns: 'login' })}
@@ -107,6 +105,6 @@ export default function Form({ onSuccess }: Props) {
</div>
</>
)}
- </form>
+ </Form>
)
}