انتقال تمام محتوای متنی سایت به دیتابیس — همه متن‌های فرانت‌اند از GET /api/site خوانده می‌شوند

This commit is contained in:
MMD
2026-09-06 20:16:17 +03:30
parent 8bb303dda2
commit 1fde4e30fc
36 changed files with 1096 additions and 454 deletions
+17 -17
View File
@@ -7,7 +7,7 @@ import { useSite } from '../api'
import { API_URL } from '../config'
export function ContactSection() {
const { brand } = useSite()
const { brand, contact_section: content } = useSite()
const [form, setForm] = useState({ name: '', phone: '', note: '' })
const [sent, setSent] = useState(false)
const [sending, setSending] = useState(false)
@@ -96,12 +96,12 @@ export function ContactSection() {
<div className="border border-ivory/20 bg-char/45 p-8 backdrop-blur-[8px] md:p-10 lg:col-span-5">
<Reveal>
<p className="text-sm font-light text-copper">تماس با ما</p>
<p className="text-sm font-light text-copper">{content.label}</p>
<h2 id="contact-title" className="mt-5 text-section font-bold text-ivory">
پروژه‌تان را با ما در میان بگذارید
{content.title}
</h2>
<p className="mt-6 text-base font-light leading-9 text-ivory/75">
شماره‌تان را بگذارید؛ کارشناس ما در کمتر از یک روز کاری برای یک جلسه مشاوره رایگان تماس می‌گیرد.
{content.lead}
</p>
</Reveal>
@@ -110,14 +110,14 @@ export function ContactSection() {
<li className="flex items-start gap-4">
<MapPinIcon className="mt-1 h-5 w-5 shrink-0 text-copper" />
<div>
<p className="text-sm font-bold text-ivory">دفتر مرکزی</p>
<p className="text-sm font-bold text-ivory">{content.address_label}</p>
<p className="mt-1 text-sm font-light leading-7 text-ivory/70">{brand.address}</p>
</div>
</li>
<li className="flex items-start gap-4">
<PhoneIcon className="mt-1 h-5 w-5 shrink-0 text-copper" />
<div>
<p className="text-sm font-bold text-ivory">تلفن</p>
<p className="text-sm font-bold text-ivory">{content.phone_label}</p>
<a
href={brand.phone_href}
dir="ltr"
@@ -130,7 +130,7 @@ export function ContactSection() {
<li className="flex items-start gap-4">
<MailIcon className="mt-1 h-5 w-5 shrink-0 text-copper" />
<div>
<p className="text-sm font-bold text-ivory">ایمیل</p>
<p className="text-sm font-bold text-ivory">{content.email_label}</p>
<a
href={`mailto:${brand.email}`}
dir="ltr"
@@ -148,9 +148,9 @@ export function ContactSection() {
{sent ? (
<div className="flex h-full flex-col items-center justify-center py-14 text-center">
<CheckCircle2Icon className="h-12 w-12 text-copper" />
<h3 className="mt-6 text-xl font-bold text-ivory">درخواست شما ثبت شد</h3>
<h3 className="mt-6 text-xl font-bold text-ivory">{content.success_title}</h3>
<p className="mt-3 max-w-sm text-sm font-light leading-8 text-ivory/70">
از اعتماد شما سپاسگزاریم. کارشناسان ما به‌زودی با شما تماس می‌گیرند.
{content.success_text}
</p>
<Button
type="button"
@@ -161,28 +161,28 @@ export function ContactSection() {
setForm({ name: '', phone: '', note: '' })
}}
>
ثبت درخواست جدید
{content.success_button_label}
</Button>
</div>
) : (
<form onSubmit={submit} noValidate className="grid gap-6 md:grid-cols-2">
<div>
<label htmlFor="contact-name" className="block text-sm font-bold text-ivory/90">
نام
{content.name_label}
</label>
<input
id="contact-name"
type="text"
value={form.name}
onChange={(e) => setForm({ ...form, name: e.target.value })}
placeholder="نام و نام خانوادگی"
placeholder={content.name_placeholder}
className="mt-3 w-full border border-ivory/20 bg-ink/45 px-5 py-4 text-sm font-light text-ivory placeholder:text-ivory/40 transition-colors duration-200 ease-lux focus:border-copper focus:outline-none"
/>
</div>
<div>
<label htmlFor="contact-phone" className="block text-sm font-bold text-ivory/90">
شماره تلفن <span className="text-copper">*</span>
{content.phone_field_label} <span className="text-copper">*</span>
</label>
<input
id="contact-phone"
@@ -191,28 +191,28 @@ export function ContactSection() {
required
value={form.phone}
onChange={(e) => setForm({ ...form, phone: e.target.value })}
placeholder="09xx xxx xxxx"
placeholder={content.phone_placeholder}
className="mt-3 w-full border border-ivory/20 bg-ink/45 px-5 py-4 text-right text-sm font-light text-ivory placeholder:text-ivory/40 transition-colors duration-200 ease-lux focus:border-copper focus:outline-none"
/>
</div>
<div className="md:col-span-2">
<label htmlFor="contact-note" className="block text-sm font-bold text-ivory/90">
توضیحات <span className="font-light text-ivory/50">(اختیاری)</span>
{content.note_label} <span className="font-light text-ivory/50">{content.note_optional_label}</span>
</label>
<textarea
id="contact-note"
rows={6}
value={form.note}
onChange={(e) => setForm({ ...form, note: e.target.value })}
placeholder="درباره پروژه یا درخواست خود بنویسید…"
placeholder={content.note_placeholder}
className="mt-3 w-full resize-none border border-ivory/20 bg-ink/45 px-5 py-4 text-sm font-light leading-8 text-ivory placeholder:text-ivory/40 transition-colors duration-200 ease-lux focus:border-copper focus:outline-none"
/>
</div>
<div className="md:col-span-2">
<Button type="submit" variant="copper" className="w-full md:w-auto md:px-12" disabled={sending}>
{sending ? 'در حال ارسال…' : 'ارسال درخواست مشاوره'}
{sending ? content.sending_label : content.submit_label}
</Button>
</div>
</form>