checkpoint: before i18n implementation

This commit is contained in:
Leon-in
2026-04-29 00:29:14 +08:00
parent ded6c67a36
commit 437dc976fb
41 changed files with 2167 additions and 1855 deletions
+27 -26
View File
@@ -6,14 +6,14 @@ import { z } from "zod"
import { useState } from "react"
const schema = z.object({
firstName: z.string().min(1, "First name is required"),
lastName: z.string().min(1, "Last name is required"),
email: z.string().email("Please enter a valid email"),
country: z.string().min(1, "Country is required"),
phone: z.string().min(1, "Phone number is required"),
company: z.string().min(1, "Company is required"),
companySize: z.string().min(1, "Please select company size"),
message: z.string().min(10, "Message must be at least 10 characters"),
firstName: z.string().min(1, "请填写名字"),
lastName: z.string().min(1, "请填写姓氏"),
email: z.string().email("请输入有效的邮箱地址"),
country: z.string().min(1, "请填写所在国家或地区"),
phone: z.string().min(1, "请填写联系方式"),
company: z.string().min(1, "请填写公司或项目名称"),
companySize: z.string().min(1, "请选择团队规模"),
message: z.string().min(10, "请至少写 10 个字符说明你的需求"),
})
type FormData = z.infer<typeof schema>
@@ -43,15 +43,15 @@ export default function ContactForm() {
if (status === "success") {
return (
<div className="contact-form-block w-form">
<div id="contact-form" className="contact-form-block w-form">
<div className="success-message-wrapper w-form-done" style={{ display: "block" }}>
<div className="contact-success-message">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 20 20" fill="none" className="contact-success-icon">
<path d="M7.20658 10.9311L9.24116 12.1209L12.7928 7.20696M1 10C1 5.02944 5.02944 1 10 1C14.9706 1 19 5.02944 19 10C19 14.9706 14.9706 19 10 19C5.02944 19 1 14.9706 1 10Z" stroke="currentColor" strokeWidth="1.5" strokeLinecap="square" />
</svg>
<h2 className="display-5">Thank you! We&apos;ll get back to you soon</h2>
<h2 className="display-5"></h2>
<div className="mg-top-4x-extra-small">
<p>We have received your message and will get back to you as soon as possible.</p>
<p></p>
</div>
</div>
</div>
@@ -60,20 +60,21 @@ export default function ContactForm() {
}
return (
<div className="contact-form-block w-form">
<div id="contact-form" className="contact-form-block w-form">
<form onSubmit={handleSubmit(onSubmit)} className="grid-2-columns contact-form-grid">
<input className={`input contact-form w-input`} maxLength={256} placeholder="First name" type="text" {...register("firstName")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="Last name" type="text" {...register("lastName")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="Email address" type="email" {...register("email")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="Country" type="text" {...register("country")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="(123) 456 - 7890" type="tel" {...register("phone")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="Company" type="text" {...register("company")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="名字" type="text" {...register("firstName")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="姓氏" type="text" {...register("lastName")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="工作邮箱" type="email" {...register("email")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="所在国家 / 地区" type="text" {...register("country")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="微信 / 电话" type="tel" {...register("phone")} />
<input className={`input contact-form w-input`} maxLength={256} placeholder="公司 / 项目名称" type="text" {...register("company")} />
<div className="select-wrapper">
<select className="input select-form w-select" {...register("companySize")}>
<option value="">Company size</option>
<option value="1-20 Employees">1-20 Employees</option>
<option value="20-100 Employees">20-100 Employees</option>
<option value="100+ Employees">100+ Employees</option>
<option value=""></option>
<option value="1-10">1-10 </option>
<option value="11-50">11-50 </option>
<option value="51-200">51-200 </option>
<option value="200+">200 </option>
</select>
<div className="select-icon-wrapper">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" viewBox="0 0 20 20" fill="none" className="select-icon">
@@ -81,21 +82,21 @@ export default function ContactForm() {
</svg>
</div>
</div>
<textarea maxLength={5000} placeholder="Enter your message" className="text-area contact-form w-input" {...register("message")} />
<textarea maxLength={5000} placeholder="介绍你的团队、当前流程、想解决的问题,以及希望 DAL Code 帮你完成什么。" className="text-area contact-form w-input" {...register("message")} />
<div className="contact-form-button-wrapper">
<button type="submit" className="form-button w-button" disabled={isSubmitting}>
{isSubmitting ? "Please wait..." : "Send message"}
{isSubmitting ? "提交中..." : "提交需求"}
</button>
</div>
</form>
{Object.keys(errors).length > 0 && (
<div className="error-message contact-form-error w-form-fail" style={{ display: "block" }}>
<div>Please fill in all required fields correctly.</div>
<div></div>
</div>
)}
{status === "error" && (
<div className="error-message contact-form-error w-form-fail" style={{ display: "block" }}>
<div>Oops! Something went wrong. Please try again.</div>
<div></div>
</div>
)}
</div>