diff --git a/public/icons/bale.svg b/public/icons/bale.svg new file mode 100644 index 0000000..5f9a22f --- /dev/null +++ b/public/icons/bale.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/eeta.svg b/public/icons/eeta.svg new file mode 100644 index 0000000..54905c9 --- /dev/null +++ b/public/icons/eeta.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/icons/instagram.svg b/public/icons/instagram.svg new file mode 100644 index 0000000..09d6792 --- /dev/null +++ b/public/icons/instagram.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/public/icons/telegram.svg b/public/icons/telegram.svg new file mode 100644 index 0000000..db3feae --- /dev/null +++ b/public/icons/telegram.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icons/whatsapp.svg b/public/icons/whatsapp.svg new file mode 100644 index 0000000..52bacc5 --- /dev/null +++ b/public/icons/whatsapp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx new file mode 100644 index 0000000..595d67c --- /dev/null +++ b/src/app/about/page.tsx @@ -0,0 +1,88 @@ +import Link from "next/link"; +import { getBusinessInfo, safe } from "@/lib/api"; +import { ShieldIcon, TagIcon, TruckIcon } from "@/components/icons"; + +const FALLBACK_ABOUT = + "فروشگاه اینترنتی کودکانه، تولیدکننده و عرضه‌کننده پوشاک بچگانه با جدیدترین طرح‌ها برای نوزادان، دختران و پسران است. تمام محصولات با پارچه‌های نرم و مناسب پوست حساس کودکان تولید می‌شوند و پیش از انتشار در سایت، از نظر کیفیت دوخت و اصالت بررسی می‌شوند تا خیالتان برای انتخاب لباس فرزندتان راحت باشد."; + +const points = [ + { + icon: ShieldIcon, + title: "ضمانت اصالت کالا", + desc: "تمامی محصولات پیش از ارسال از نظر کیفیت و اصالت بررسی می‌شوند.", + }, + { + icon: TruckIcon, + title: "ارسال سریع و رایگان", + desc: "ارسال به سراسر کشور با پیک و پست پیشتاز، رایگان برای خریدهای بالای سقف تعیین‌شده.", + }, + { + icon: TagIcon, + title: "قیمت مناسب و عمده", + desc: "خرید مستقیم از تولیدی با قیمت رقابتی برای مشتریان خرد و عمده.", + }, +]; + +export const metadata = { + title: "درباره ما | کودکانه", +}; + +export default async function AboutPage() { + const info = await safe(getBusinessInfo(), null); + const about = info?.about?.trim() || FALLBACK_ABOUT; + const vision = info?.vision?.trim(); + + return ( +
+
+
+ +
+ +
+ + About Us + +

درباره ما

+ + +

{about}

+ + {vision && ( + <> +

چشم‌انداز ما

+

+ {vision} +

+ + )} + +
+ {points.map((p) => ( +
+ + + +
+

{p.title}

+

{p.desc}

+
+
+ ))} +
+ + + تماس با ما + +
+
+
+ ); +} diff --git a/src/app/contact/page.tsx b/src/app/contact/page.tsx new file mode 100644 index 0000000..e317811 --- /dev/null +++ b/src/app/contact/page.tsx @@ -0,0 +1,92 @@ +import { getBusinessInfo, safe } from "@/lib/api"; +import { siteInfo } from "@/data/site"; +import { socialLinks } from "@/components/socialLinks"; +import ContactForm from "@/components/ContactForm"; +import { MailIcon, PhoneIcon, PinIcon } from "@/components/icons"; + +export const metadata = { + title: "تماس با ما | کودکانه", +}; + +// business-info's emails/phoneNumbers/addresses shape isn't documented — +// read either a plain string or a {value|number|email|address|...} object. +function toText(item: unknown): string { + if (typeof item === "string") return item; + if (item && typeof item === "object") { + const obj = item as Record; + const val = obj.value ?? obj.number ?? obj.email ?? obj.address ?? obj.text ?? obj.label; + if (typeof val === "string") return val; + } + return ""; +} + +export default async function ContactPage() { + const info = await safe(getBusinessInfo(), null); + + const phone = info?.phoneNumbers.map(toText).find(Boolean) || siteInfo.phone; + const email = info?.emails.map(toText).find(Boolean) || siteInfo.email; + const address = info?.addresses.map(toText).find(Boolean) || siteInfo.address; + + return ( +
+
+ + Contact Us + +

تماس با ما

+ +
+ +
+
+
+
    +
  • + + + + + {phone} + +
  • +
  • + + + + + {email} + +
  • +
  • + + + + {address} +
  • +
+
+ +
+

ما را دنبال کنید

+
+ {socialLinks.map(({ icon: Icon, label, href }) => ( + + + + ))} +
+
+
+ +
+ +
+
+
+ ); +} diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx new file mode 100644 index 0000000..e414ee4 --- /dev/null +++ b/src/components/ContactForm.tsx @@ -0,0 +1,111 @@ +"use client"; + +import { useState, type FormEvent } from "react"; +import { submitContactForm } from "@/lib/api"; +import { CheckIcon } from "./icons"; + +type Status = "idle" | "loading" | "success" | "error"; + +const inputClass = + "w-full rounded-lg border border-line bg-surface px-4 h-11 text-sm outline-none focus:border-brand transition-colors"; + +export default function ContactForm() { + const [status, setStatus] = useState("idle"); + + async function handleSubmit(e: FormEvent) { + e.preventDefault(); + const form = e.currentTarget; + const data = new FormData(form); + + const name = String(data.get("name") || "").trim(); + const title = String(data.get("title") || "").trim(); + const text = String(data.get("text") || "").trim(); + const email = String(data.get("email") || "").trim(); + const cellNumber = String(data.get("cellNumber") || "").trim(); + + if (!name || !title || !text) return; + + setStatus("loading"); + try { + await submitContactForm({ + name, + title, + text, + email: email || undefined, + cellNumber: cellNumber || undefined, + }); + setStatus("success"); + form.reset(); + } catch { + setStatus("error"); + } + } + + if (status === "success") { + return ( +
+ + + +

پیام شما با موفقیت ارسال شد.

+

به‌زودی با شما تماس می‌گیریم.

+
+ ); + } + + return ( +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +