feat: monorepo with NestJS API, admin panel and DB-driven website

Restructure the repo into a pnpm + Turborepo monorepo:

- apps/web: Nuxt 4 site, now server-rendered and reading all content
  from the API; pages cached with SWR and purged on content changes
- apps/api: NestJS 12 + Prisma 7 + PostgreSQL. Auth with short-lived
  access tokens and rotating httpOnly refresh cookies, roles (ADMIN,
  EDITOR), catalog, editable site sections, media upload to S3-compatible
  storage (converted to WebP), contact messages, audit log
- apps/admin: Vue 3 admin panel (Ant Design Vue, Pinia, Tailwind) for
  products, categories, site sections, messages, media and users
- packages/shared: Zod schemas and types shared by API and admin

Also:
- seed script that loads the original 8 categories / 89 products and
  section content
- Docker images for api (with a one-off migrate service), web, admin,
  and an nginx gateway for both domains
- dev and production compose files, daily database backup service
- API e2e tests

Removes the committed static out/ build and the old root Dockerfile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
S. Esmaeili
2026-10-21 20:31:05 +03:30
co-authored by Claude Opus 5.5
parent 31076174e2
commit 789d224ea0
395 changed files with 19070 additions and 11592 deletions
+3
View File
@@ -0,0 +1,3 @@
NUXT_API_INTERNAL_URL=http://localhost:4000/api
NUXT_REVALIDATE_SECRET=change-me-revalidate-secret
NUXT_PUBLIC_SITE_URL=https://imenpishgaman.ir
+23
View File
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { ConfigProvider, StyleProvider } from "ant-design-vue";
import faIR from "ant-design-vue/es/locale/fa_IR";
import { antdTheme } from "~/design/theme";
import { organizationSchema, websiteSchema } from "#shared/seo/schema";
const { $antdCache } = useNuxtApp();
const site = useSiteStore();
await callOnce("site", () => site.load());
useSiteSeo();
const seo = useSeoContext();
useJsonLd([organizationSchema(seo), websiteSchema(seo)]);
</script>
<template>
<StyleProvider :cache="$antdCache">
<ConfigProvider :theme="antdTheme" direction="rtl" :locale="faIR">
<NuxtPage />
</ConfigProvider>
</StyleProvider>
</template>
+118
View File
@@ -0,0 +1,118 @@
/*
* Ant Design Vue ↔ project look.
* antd's CSS-in-JS is unlayered while Tailwind v4 lives in cascade layers, so Tailwind classes
* can't restyle antd elements. These unlayered rules pin antd form controls to the exact
* pre-migration styling (same values as the old Tailwind `inputCls` / submit button).
*/
/* ---- form shell ---- */
.contact-form.ant-form {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
/* antd resets items and their grid wrappers to 14px/1.5714; inherit like the original markup did
(the control line box decides the gap under the inline-block textarea) */
.contact-form .ant-form-item,
.contact-form .ant-form-item .ant-row,
.contact-form .ant-form-item .ant-col {
margin-bottom: 0;
font-size: inherit;
line-height: inherit;
}
.contact-form .ant-form-item .ant-form-item-label {
padding: 0 0 8px; /* mb-2 */
line-height: 16px;
}
.contact-form .ant-form-item-label > label {
width: 100%; /* original labels were full-width blocks */
height: auto;
font-size: 12px; /* text-xs */
line-height: 16px;
color: var(--color-muted);
}
.contact-form .ant-form-item-explain {
font-size: 12px;
line-height: 20px;
padding-top: 4px;
}
/* ---- inputs (= w-full rounded-lg border border-line bg-bg px-4 py-3.5 text-sm text-ink) ---- */
.contact-form .ant-input {
width: 100%;
border-radius: 8px;
border: 1px solid var(--color-line);
background-color: var(--color-bg);
padding: 14px 16px;
font-family: inherit;
font-size: 14px;
line-height: 20px;
color: var(--color-ink);
box-shadow: none;
transition-property: color, background-color, border-color;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
.contact-form .ant-input::placeholder {
color: color-mix(in oklab, var(--color-muted) 50%, transparent);
}
.contact-form .ant-input:hover {
border-color: var(--color-line);
}
.contact-form .ant-input:focus,
.contact-form .ant-input-focused {
border-color: var(--color-accent);
outline: none;
box-shadow: none;
}
/* antd's .ant-input-rtl forces direction:rtl; honour an explicit dir="ltr" (phone field) */
.contact-form .ant-input[dir="ltr"] {
direction: ltr;
text-align: left;
}
.contact-form textarea.ant-input {
resize: none;
min-height: 0;
vertical-align: baseline; /* native inline-block textarea alignment (antd sets bottom) */
}
/* ---- submit (= rounded-full bg-accent py-4 font-bold text-bg, hover:bg-accent-soft + glow) ---- */
.contact-form .ant-btn.contact-submit {
display: flex;
width: 100%;
height: auto;
align-items: center;
justify-content: center;
gap: 10px;
border: 0;
border-radius: calc(infinity * 1px); /* = tailwind rounded-full */
background-color: var(--color-accent);
padding: 16px 0;
font-family: inherit;
font-size: 16px;
line-height: 24px;
font-weight: 700;
color: var(--color-bg);
box-shadow: none;
cursor: default;
transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.contact-form .ant-btn.contact-submit > span {
display: inline;
}
@media (hover: hover) {
.contact-form .ant-btn.contact-submit:hover {
background-color: var(--color-accent-soft);
color: var(--color-bg);
box-shadow: 0 8px 45px rgba(255, 90, 0, 0.45);
}
}
.contact-form .ant-btn.contact-submit:disabled {
opacity: 0.6;
border: 0;
}
/* no click-wave ring (wasn't part of the original button) */
.contact-form .ant-btn.contact-submit::after,
.contact-form .ant-wave {
display: none;
}
+213
View File
@@ -0,0 +1,213 @@
@import "tailwindcss";
/* ---- local fonts ---- */
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum_UltraLight.woff2") format("woff2");
font-weight: 200;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum_Light.woff2") format("woff2");
font-weight: 300;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum_Medium.woff2") format("woff2");
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum_Bold.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "IRANSans";
src: url("/fonts/IRANSansWebFaNum_Black.woff2") format("woff2");
font-weight: 900;
font-style: normal;
font-display: swap;
}
:root {
--font-iransans: "IRANSans", sans-serif;
}
@theme {
--font-sans: var(--font-iransans);
--font-mono: var(--font-iransans);
--color-bg: #0b1224;
--color-panel: #101a32;
--color-panel-2: #152040;
--color-ink: #edede6;
--color-muted: #8e9ab0;
--color-accent: #ff5a00;
--color-accent-soft: #ff7a2a;
--color-hazard: #ffb800;
--color-line: #1e2d4d;
--animate-marquee: marquee 32s linear infinite;
--animate-spin-slow: spin-slow 18s linear infinite;
--animate-blink: blink 1.1s steps(2, start) infinite;
--animate-fade-up: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) both;
@keyframes marquee {
from {
transform: translateX(0);
}
to {
transform: translateX(-50%);
}
}
@keyframes spin-slow {
to {
transform: rotate(360deg);
}
}
@keyframes blink {
to {
visibility: hidden;
}
}
@keyframes fade-up {
from {
opacity: 0;
transform: translateY(44px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
}
/* added for migration: CSS-only entrance animation for Hero (no JS dependency, content visible in server HTML) */
.animate-fade-up-1 {
animation: var(--animate-fade-up);
animation-delay: 0.15s;
}
.animate-fade-up-2 {
animation: var(--animate-fade-up);
animation-delay: 0.28s;
}
.animate-fade-up-3 {
animation: var(--animate-fade-up);
animation-delay: 0.42s;
}
.animate-fade-up-4 {
animation: var(--animate-fade-up);
animation-delay: 0.55s;
}
.animate-fade-up-5 {
animation: var(--animate-fade-up);
animation-delay: 0.68s;
}
.animate-fade-up-6 {
animation: var(--animate-fade-up);
animation-delay: 0.7s;
}
.animate-fade-up-7 {
animation: var(--animate-fade-up);
animation-delay: 0.82s;
}
.animate-fade-up-8 {
animation: var(--animate-fade-up);
animation-delay: 0.9s;
}
.animate-fade-up-9 {
animation: var(--animate-fade-up);
animation-delay: 1s;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--color-bg);
color: var(--color-ink);
overflow-x: hidden;
}
::selection {
background: var(--color-accent);
color: var(--color-bg);
}
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
background: #253558;
border-radius: 8px;
border: 2px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover {
background: var(--color-accent);
}
/* ---- hazard tape (yellow/black diagonal stripes) ---- */
.hazard {
background-image: repeating-linear-gradient(
-45deg,
#ffb800 0 14px,
#0b1224 14px 28px
);
}
/* ---- blueprint grid ---- */
.bg-grid {
background-image:
linear-gradient(to left, rgba(237, 237, 230, 0.045) 1px, transparent 1px),
linear-gradient(to bottom, rgba(237, 237, 230, 0.045) 1px, transparent 1px);
background-size: 72px 72px;
}
.bg-grid-fine {
background-image:
linear-gradient(to left, rgba(237, 237, 230, 0.03) 1px, transparent 1px),
linear-gradient(to bottom, rgba(237, 237, 230, 0.03) 1px, transparent 1px);
background-size: 28px 28px;
}
/* ---- film grain ---- */
.noise {
position: fixed;
inset: 0;
z-index: 90;
pointer-events: none;
opacity: 0.05;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* ---- outlined display text ---- */
.text-outline {
color: transparent;
-webkit-text-stroke: 1px rgba(237, 237, 230, 0.16);
}
/* ---- vertical safety tape strip ---- */
.tape-v {
background-image: repeating-linear-gradient(
45deg,
#ffb800 0 10px,
#0b1224 10px 20px
);
}
@@ -0,0 +1,24 @@
<script setup lang="ts">
import { AnimatePresence } from "motion-v";
import Preloader from "./Preloader.vue";
import Cursor from "./Cursor.vue";
import Header from "./Header.vue";
import BackToTop from "./BackToTop.vue";
const ui = useUiStore();
</script>
<template>
<AnimatePresence>
<Preloader v-if="!ui.ready" @complete="ui.setReady" />
</AnimatePresence>
<Cursor />
<div class="noise" aria-hidden="true" />
<Header />
<slot />
<BackToTop />
</template>
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { AnimatePresence, motion } from "motion-v";
import { ArrowUp } from "lucide-vue-next";
const show = useScrolledPast(700);
</script>
<template>
<AnimatePresence>
<motion.a
v-if="show"
href="#home"
aria-label="بازگشت به بالا"
:initial="{ opacity: 0, y: 24 }"
:animate="{ opacity: 1, y: 0 }"
:exit="{ opacity: 0, y: 24 }"
class="fixed bottom-6 left-6 z-[70] flex size-12 items-center justify-center rounded-full border border-line bg-panel/90 text-ink shadow-[0_10px_40px_rgba(0,0,0,0.5)] backdrop-blur transition-colors hover:border-accent hover:text-accent"
>
<ArrowUp class="size-5" />
</motion.a>
</AnimatePresence>
</template>
+52
View File
@@ -0,0 +1,52 @@
<script setup lang="ts">
import { motion, useMotionValue, useSpring } from "motion-v";
const x = useMotionValue(-100);
const y = useMotionValue(-100);
const sx = useSpring(x, { stiffness: 550, damping: 45, mass: 0.4 });
const sy = useSpring(y, { stiffness: 550, damping: 45, mass: 0.4 });
const hover = ref(false);
const visible = ref(false);
const move = (e: MouseEvent) => {
x.set(e.clientX);
y.set(e.clientY);
visible.value = true;
};
const over = (e: MouseEvent) => {
const t = e.target as HTMLElement | null;
hover.value = !!t?.closest?.(
"a, button, input, textarea, select, label, [data-hover]",
);
};
onMounted(() => {
window.addEventListener("mousemove", move, { passive: true });
window.addEventListener("mouseover", over, { passive: true });
});
onBeforeUnmount(() => {
window.removeEventListener("mousemove", move);
window.removeEventListener("mouseover", over);
});
</script>
<template>
<div class="pointer-events-none fixed inset-0 z-[120] hidden [@media(pointer:fine)]:block">
<motion.div :style="{ x: sx, y: sy }" class="absolute -left-4 -top-4 size-8">
<motion.div
:animate="{
scale: hover ? 1.9 : 1,
opacity: visible ? 1 : 0,
rotate: hover ? 45 : 0,
}"
:transition="{ type: 'spring', stiffness: 320, damping: 24 }"
class="size-8 rounded-md border-2 border-accent/80"
/>
<div
:class="`absolute inset-0 m-auto size-1 rounded-full bg-accent transition-opacity duration-300 ${
visible ? 'opacity-100' : 'opacity-0'
}`"
/>
</motion.div>
</div>
</template>
+148
View File
@@ -0,0 +1,148 @@
<script setup lang="ts">
import type { SocialType } from "@imen/shared";
import {
AtSign,
Globe,
Instagram,
Linkedin,
MessageCircle,
Phone,
Send,
Youtube,
} from "lucide-vue-next";
import type { Component } from "vue";
import Logo from "~/components/ui/Logo.vue";
const QUICK_LINKS = [
{ href: "/#home", label: "خانه" },
{ href: "/#products", label: "محصولات" },
{ href: "/#about", label: "درباره ما" },
{ href: "/#services", label: "خدمات" },
{ href: "/#standards", label: "استانداردها" },
{ href: "/#industries", label: "صنایع" },
];
const SOCIAL_META: Record<SocialType, { icon: Component; label: string }> = {
website: { icon: Globe, label: "وب‌سایت" },
telegram: { icon: Send, label: "تلگرام" },
instagram: { icon: Instagram, label: "اینستاگرام" },
linkedin: { icon: Linkedin, label: "لینکدین" },
whatsapp: { icon: MessageCircle, label: "واتساپ" },
bale: { icon: MessageCircle, label: "بله" },
eitaa: { icon: MessageCircle, label: "ایتا" },
aparat: { icon: Youtube, label: "آپارات" },
youtube: { icon: Youtube, label: "یوتیوب" },
email: { icon: AtSign, label: "ایمیل" },
phone: { icon: Phone, label: "تماس" },
};
const site = useSiteStore();
const footer = computed(() => site.sections.footer);
const settings = computed(() => site.settings);
const PRODUCT_LINKS = computed(() =>
site.categories.map((c) => ({ label: c.name, href: `/categories/${c.slug}` })),
);
const SOCIALS = computed(() =>
settings.value.socials.map((s) => ({
...SOCIAL_META[s.type],
href: s.url,
external: /^https?:\/\//.test(s.url),
})),
);
</script>
<template>
<footer class="relative overflow-hidden border-t border-line">
<div class="hazard h-2.5" />
<div class="mx-auto max-w-[1480px] px-5 md:px-8">
<div class="grid gap-12 py-16 md:grid-cols-12 md:py-20">
<!-- brand -->
<div class="md:col-span-5">
<Logo />
<p class="mt-6 max-w-sm text-sm leading-8 text-muted">
{{ footer.about }}
</p>
<div class="mt-7 flex gap-3">
<a
v-for="s in SOCIALS"
:key="s.href"
:href="s.href"
:aria-label="s.label"
:target="s.external ? '_blank' : undefined"
:rel="s.external ? 'noopener' : undefined"
class="flex size-10 items-center justify-center rounded-lg border border-line text-muted transition-all duration-300 hover:border-accent hover:bg-accent hover:text-bg"
>
<component :is="s.icon" class="size-4" />
</a>
</div>
</div>
<!-- quick links -->
<div class="md:col-span-2">
<div class="font-mono text-xs tracking-[0.25em] text-accent">// دسترسی</div>
<ul class="mt-5 space-y-3">
<li v-for="l in QUICK_LINKS" :key="l.href">
<a :href="l.href" class="text-sm text-muted transition-colors hover:text-ink">
{{ l.label }}
</a>
</li>
</ul>
</div>
<!-- products -->
<div class="md:col-span-2">
<div class="font-mono text-xs tracking-[0.25em] text-accent">// محصولات</div>
<ul class="mt-5 space-y-3">
<li v-for="p in PRODUCT_LINKS" :key="p.href">
<NuxtLink :to="p.href" class="text-sm text-muted transition-colors hover:text-ink">
{{ p.label }}
</NuxtLink>
</li>
</ul>
</div>
<!-- contact -->
<div class="md:col-span-3">
<div class="font-mono text-xs tracking-[0.25em] text-accent">// ارتباط</div>
<address class="mt-5 space-y-3 text-sm text-muted not-italic">
<p class="leading-7">
{{ settings.address.locality }}، {{ settings.address.street }}
</p>
<p class="font-mono tracking-wider" dir="ltr">
<a :href="`tel:${settings.phone}`" class="transition-colors hover:text-ink">{{ settings.phoneDisplay }}</a>
</p>
<p class="font-mono tracking-wider" dir="ltr">
<a :href="`mailto:${settings.email}`" class="transition-colors hover:text-ink">{{ settings.email }}</a>
</p>
<p class="pt-2 text-xs leading-6">
{{ settings.workingHours }}
<template v-if="footer.emergencyNote">
<br />
{{ footer.emergencyNote }}
</template>
</p>
</address>
</div>
</div>
<!-- giant wordmark -->
<div aria-hidden="true" class="pointer-events-none select-none pb-6">
<div class="text-outline text-center text-[17vw] font-black leading-[0.85] md:text-[11vw]">
{{ settings.name }}
</div>
</div>
<div
class="flex flex-wrap items-center justify-between gap-4 border-t border-line py-6 text-xs text-muted"
>
<div>{{ footer.copyright }}</div>
<div v-if="footer.certLine" class="font-mono text-[10px] tracking-[0.25em]">
{{ footer.certLine }}
</div>
</div>
</div>
</footer>
</template>
+136
View File
@@ -0,0 +1,136 @@
<script setup lang="ts">
import { AnimatePresence, motion } from "motion-v";
import { Menu, Phone, X } from "lucide-vue-next";
import Logo from "~/components/ui/Logo.vue";
const LINKS = [
{ href: "/#home", label: "خانه" },
{ href: "/#products", label: "محصولات" },
{ href: "/#about", label: "درباره ما" },
{ href: "/#services", label: "خدمات" },
{ href: "/#standards", label: "استانداردها" },
{ href: "/#industries", label: "صنایع" },
{ href: "/#contact", label: "تماس" },
];
const ui = useUiStore();
const settings = computed(() => useSiteStore().settings);
const scrolled = useScrolledPast(40);
const { time, shift } = useTehranClock();
watch(
() => ui.menuOpen,
(open) => {
document.body.style.overflow = open ? "hidden" : "";
},
);
onBeforeUnmount(() => {
document.body.style.overflow = "";
});
</script>
<template>
<motion.header
:initial="{ y: -90, opacity: 0 }"
:animate="ui.ready ? { y: 0, opacity: 1 } : {}"
:transition="{ duration: 0.9, delay: 0.15, ease: EASE }"
:class="`fixed inset-x-0 top-0 z-[80] transition-all duration-500 ${
scrolled ? 'border-b border-line bg-bg/85 py-3 backdrop-blur-xl' : 'py-5'
}`"
>
<div class="mx-auto flex max-w-[1480px] items-center justify-between px-5 md:px-8">
<Logo />
<nav class="hidden items-center gap-7 lg:flex">
<a
v-for="l in LINKS"
:key="l.href"
:href="l.href"
class="group relative py-2 text-sm text-ink/75 transition-colors hover:text-ink"
>
{{ l.label }}
<span
class="absolute bottom-0 start-0 h-0.5 w-full origin-right scale-x-0 bg-accent transition-transform duration-300 group-hover:scale-x-100"
/>
</a>
</nav>
<div class="flex items-center gap-3">
<div
class="hidden items-center gap-2.5 rounded-full border border-line px-4 py-2 text-[11px] text-muted xl:flex"
>
<span class="size-1.5 animate-pulse rounded-full bg-emerald-400" />
<span class="font-mono">{{ time }}</span>
<span class="text-muted/50">|</span>
<span>تهران — شیفت {{ shift }}</span>
</div>
<a
href="/#contact"
class="hidden items-center gap-2 rounded-full bg-accent px-5 py-2.5 text-sm font-bold text-bg transition-all duration-300 hover:bg-accent-soft hover:shadow-[0_0_30px_rgba(255,90,0,0.4)] md:flex"
>
<Phone class="size-4" />
درخواست مشاوره
</a>
<button
aria-label="باز کردن منو"
class="flex size-11 items-center justify-center rounded-lg border border-line text-ink transition-colors hover:border-accent hover:text-accent lg:hidden"
@click="ui.openMenu"
>
<Menu class="size-5" />
</button>
</div>
</div>
</motion.header>
<AnimatePresence>
<motion.div
v-if="ui.menuOpen"
:initial="{ opacity: 0 }"
:animate="{ opacity: 1 }"
:exit="{ opacity: 0 }"
:transition="{ duration: 0.35 }"
class="fixed inset-0 z-[110] flex flex-col bg-bg/95 backdrop-blur-2xl"
>
<div class="flex items-center justify-between border-b border-line px-5 py-4 md:px-8">
<Logo />
<button
aria-label="بستن منو"
class="flex size-11 items-center justify-center rounded-lg border border-line transition-colors hover:border-accent hover:text-accent"
@click="ui.closeMenu"
>
<X class="size-5" />
</button>
</div>
<nav class="flex flex-1 flex-col justify-center gap-1 overflow-y-auto px-8">
<motion.a
v-for="(l, i) in LINKS"
:key="l.href"
:href="l.href"
:initial="{ opacity: 0, x: 44 }"
:animate="{ opacity: 1, x: 0 }"
:transition="{ delay: 0.08 + i * 0.055, duration: 0.55, ease: EASE }"
class="group flex items-baseline gap-5 border-b border-line/60 py-4"
@click="ui.closeMenu"
>
<span class="font-mono text-xs text-accent">
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
<span class="text-3xl font-black transition-colors group-hover:text-accent">
{{ l.label }}
</span>
</motion.a>
</nav>
<div class="flex items-center justify-between border-t border-line p-8 text-sm">
<div class="flex items-center gap-3 text-muted">
<Phone class="size-4 text-accent" />
<a :href="`tel:${settings.phone}`" class="font-mono" dir="ltr">{{ settings.phoneDisplay }}</a>
</div>
<div class="text-xs text-muted">تهران — شیفت {{ shift }}، {{ time }}</div>
</div>
</motion.div>
</AnimatePresence>
</template>
@@ -0,0 +1,78 @@
<script setup lang="ts">
import { motion } from "motion-v";
import { ShieldCheck } from "lucide-vue-next";
const STEPS = [
"بررسی سیستم‌های ایمنی",
"تأیید استانداردهای بین‌المللی",
"بارگذاری تجهیزات حفاظت فردی",
"محیط کاری آماده است",
];
const emit = defineEmits<{ complete: [] }>();
const progress = ref(0);
let done = false;
let t: ReturnType<typeof setInterval> | undefined;
onMounted(() => {
let v = 0;
t = setInterval(() => {
v += Math.floor(Math.random() * 11) + 7;
if (v >= 100) {
v = 100;
clearInterval(t);
if (!done) {
done = true;
setTimeout(() => emit("complete"), 450);
}
}
progress.value = v;
}, 140);
});
onBeforeUnmount(() => clearInterval(t));
const step = computed(
() =>
STEPS[
Math.min(STEPS.length - 1, Math.floor((progress.value / 100) * STEPS.length))
],
);
</script>
<template>
<motion.div
:exit="{ y: '-100%' }"
:transition="{ duration: 0.85, ease: [0.76, 0, 0.24, 1] }"
class="fixed inset-0 z-[200] flex flex-col items-center justify-center bg-bg"
>
<div class="hazard absolute inset-x-0 top-0 h-3" />
<div class="hazard absolute inset-x-0 bottom-0 h-3" />
<div class="flex items-center gap-4">
<span class="flex size-12 items-center justify-center rounded-xl bg-accent text-bg">
<ShieldCheck class="size-7" />
</span>
<span class="font-mono text-xs tracking-[0.35em] text-muted">
IMEN PISHGAMAN CO.
</span>
</div>
<div class="mt-12 font-mono text-7xl font-semibold tabular-nums md:text-8xl">
{{ progress.toLocaleString("fa-IR") }}<span class="text-accent">٪</span>
</div>
<div class="mt-8 h-[3px] w-64 overflow-hidden rounded-full bg-line md:w-80">
<div
class="h-full bg-accent transition-all duration-200"
:style="{ width: `${progress}%` }"
/>
</div>
<div class="mt-6 flex items-center gap-3 text-xs text-muted">
<span class="size-1.5 animate-pulse rounded-full bg-accent" />
{{ step }}
<span class="animate-blink text-accent">▍</span>
</div>
</motion.div>
</template>
@@ -0,0 +1,81 @@
<script setup lang="ts">
import DynamicIcon from "~/components/ui/DynamicIcon.vue";
import Lines from "~/components/ui/Lines.vue";
import Reveal from "~/components/ui/Reveal.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
const about = computed(() => useSiteStore().sections.about);
</script>
<template>
<section
id="about"
aria-labelledby="about-title"
class="relative overflow-hidden border-t border-line py-24 md:py-32"
>
<div class="absolute inset-0 bg-grid-fine opacity-50" />
<div class="relative mx-auto max-w-[1480px] px-5 md:px-8">
<div class="grid items-center gap-14 lg:grid-cols-2">
<!-- ---- image ---- -->
<Reveal class="relative order-2 lg:order-1" :delay="0.1">
<div class="relative overflow-hidden rounded-2xl border border-line">
<img
:src="about.image.url"
:alt="about.image.alt"
width="800"
height="600"
loading="lazy"
decoding="async"
class="aspect-[4/3] w-full object-cover"
/>
<div class="absolute inset-0 bg-gradient-to-t from-bg/80 via-transparent to-transparent" />
<div
class="absolute bottom-5 start-5 flex items-center gap-4 rounded-xl border border-line bg-bg/80 px-5 py-4 backdrop-blur-md"
>
<span class="font-mono text-3xl font-bold text-accent">{{ about.badge.value }}</span>
<span class="text-xs leading-5 text-muted">
<Lines :text="about.badge.label" />
</span>
</div>
</div>
<div class="hazard absolute -top-3 -end-3 h-6 w-28 rounded-full opacity-90" />
</Reveal>
<!-- ---- text ---- -->
<div class="order-1 lg:order-2">
<SectionHead heading-id="about-title" v-bind="about.head" />
<Reveal :delay="0.2">
<p class="mt-6 leading-9 text-muted">
{{ about.body }}
</p>
</Reveal>
<div class="mt-10 space-y-1">
<Reveal v-for="(t, i) in about.timeline" :key="t.year" :delay="0.25 + i * 0.07">
<div
class="group border-s-2 border-accent/30 ps-6 transition-colors duration-300 hover:border-accent"
>
<span class="font-mono text-sm font-bold text-accent">{{ t.year }}</span>
<p class="mt-1 pb-5 text-sm leading-7 text-ink/75">{{ t.text }}</p>
</div>
</Reveal>
</div>
<Reveal :delay="0.5">
<div class="mt-4 flex flex-wrap gap-3">
<span
v-for="f in about.features"
:key="f.label"
class="inline-flex items-center gap-2 rounded-full border border-line bg-panel/60 px-4 py-2 text-xs text-ink/80 transition-colors hover:border-accent/50 hover:text-ink"
>
<DynamicIcon :name="f.icon" class="size-4 text-accent" />
{{ f.label }}
</span>
</div>
</Reveal>
</div>
</div>
</div>
</section>
</template>
@@ -0,0 +1,195 @@
<script setup lang="ts">
import { Button as AButton, Form as AForm, FormItem as AFormItem, Input as AInput, Textarea as ATextarea } from "ant-design-vue";
import type { Rule } from "ant-design-vue/es/form";
import {
CheckCircle2,
Clock,
Loader2,
Mail,
MapPin,
Phone,
Send,
Siren,
} from "lucide-vue-next";
import Lines from "~/components/ui/Lines.vue";
import Reveal from "~/components/ui/Reveal.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
const site = useSiteStore();
const content = computed(() => site.sections.contact);
const INFO = computed(() => {
const s = site.settings;
return [
{ icon: MapPin, label: "نشانی", value: `${s.address.locality}، ${s.address.street}` },
{ icon: Phone, label: "تلفن تماس", value: s.phoneDisplay, ltr: true, href: `tel:${s.phone}` },
{ icon: Mail, label: "ایمیل", value: s.email, ltr: true, href: `mailto:${s.email}` },
{ icon: Clock, label: "ساعات کاری", value: s.workingHours },
];
});
const required = (message: string): Rule[] => [
{ required: true, whitespace: true, message, trigger: "blur" },
];
const rules: Record<string, Rule[]> = {
name: required("لطفاً نام و نام خانوادگی را وارد کنید"),
org: required("لطفاً نام سازمان را وارد کنید"),
phone: required("لطفاً شماره تماس را وارد کنید"),
};
const contact = useContactStore();
</script>
<template>
<section
id="contact"
aria-labelledby="contact-title"
class="relative overflow-hidden border-t border-line py-24 md:py-32"
>
<div class="absolute inset-0 bg-grid-fine opacity-40" />
<div class="relative mx-auto max-w-[1480px] px-5 md:px-8">
<div class="grid gap-14 lg:grid-cols-2">
<!-- ---- info ---- -->
<div>
<SectionHead heading-id="contact-title" v-bind="content.head" />
<div class="mt-10 space-y-1">
<Reveal v-for="(item, i) in INFO" :key="item.label" :delay="0.15 + i * 0.06">
<div class="group flex items-center gap-4 border-b border-line/70 py-4">
<span
class="flex size-11 shrink-0 items-center justify-center rounded-lg border border-line text-accent transition-colors duration-300 group-hover:border-accent/50"
>
<component :is="item.icon" class="size-5" />
</span>
<div class="min-w-0">
<div class="text-xs text-muted">{{ item.label }}</div>
<component
:is="item.href ? 'a' : 'div'"
:href="item.href"
:class="`mt-1 block text-sm font-medium ${item.ltr ? 'font-mono tracking-wider' : ''}`"
:dir="item.ltr ? 'ltr' : 'rtl'"
>
{{ item.value }}
</component>
</div>
</div>
</Reveal>
</div>
<Reveal :delay="0.45">
<div class="mt-8 flex items-start gap-4 rounded-xl border border-hazard/30 bg-hazard/5 p-5">
<Siren class="size-6 shrink-0 text-hazard" />
<div>
<div class="font-bold text-hazard">{{ content.emergencyTitle }}</div>
<p class="mt-1.5 text-sm leading-7 text-muted">
{{ content.emergencyText }}
</p>
</div>
</div>
</Reveal>
</div>
<!-- ---- form ---- -->
<Reveal :delay="0.15">
<div class="rounded-2xl border border-line bg-panel/60 p-6 backdrop-blur md:p-9">
<div v-if="content.formTag" class="font-mono text-xs tracking-[0.25em] text-accent">
{{ content.formTag }}
</div>
<h3 class="mt-3 text-2xl font-black leading-snug">
<Lines :text="content.formTitle" />
</h3>
<div
v-if="contact.status === 'success'"
class="mt-10 flex flex-col items-center rounded-xl border border-emerald-500/30 bg-emerald-500/5 p-10 text-center"
>
<CheckCircle2 class="size-14 text-emerald-400" />
<div class="mt-5 text-xl font-black">{{ content.successTitle }}</div>
<p class="mt-2.5 max-w-sm text-sm leading-7 text-muted">
{{ content.successText }}
</p>
<button
type="button"
class="mt-7 rounded-full border border-line px-7 py-3 text-sm transition-colors hover:border-accent hover:text-accent"
@click="contact.reset"
>
ثبت درخواست جدید
</button>
</div>
<AForm
v-else
class="contact-form"
layout="vertical"
:model="contact.form"
:rules="rules"
hide-required-mark
@finish="contact.submit"
>
<!-- honeypot: hidden from people, bots tend to fill it -->
<div class="absolute -start-[9999px] h-px w-px overflow-hidden" aria-hidden="true">
<label for="f-website">وب‌سایت</label>
<input id="f-website" v-model="contact.form.website" type="text" tabindex="-1" autocomplete="off" />
</div>
<div class="mt-8 grid gap-5 sm:grid-cols-2">
<AFormItem name="name" label="نام و نام خانوادگی *" html-for="f-name">
<AInput id="f-name" v-model:value="contact.form.name" placeholder="مثلاً: علی رضایی" />
</AFormItem>
<AFormItem name="org" label="نام سازمان *" html-for="f-org">
<AInput
id="f-org"
v-model:value="contact.form.org"
placeholder="مثلاً: شرکت پتروشیمی خلیج"
/>
</AFormItem>
<AFormItem class="sm:col-span-2" name="phone" label="شماره تماس *" html-for="f-phone">
<AInput
id="f-phone"
v-model:value="contact.form.phone"
type="tel"
dir="ltr"
placeholder="0912 000 0000"
/>
</AFormItem>
<AFormItem class="sm:col-span-2" name="message" label="شرح درخواست" html-for="f-msg">
<ATextarea
id="f-msg"
v-model:value="contact.form.message"
:rows="4"
placeholder="تجهیزات موردنیاز، تعداد پرسنل یا هر نکته‌ای که لازم است بدانیم..."
/>
</AFormItem>
<p
v-if="contact.status === 'error'"
class="rounded-lg border border-accent/40 bg-accent/10 px-4 py-3 text-sm leading-7 text-accent sm:col-span-2"
role="alert"
>
{{ contact.error }}
</p>
<div class="sm:col-span-2">
<AButton
type="primary"
html-type="submit"
class="contact-submit"
:disabled="contact.status === 'loading'"
>
<template v-if="contact.status === 'loading'">
<Loader2 class="size-5 animate-spin" />
در حال ارسال...
</template>
<template v-else>
<Send class="size-5" />
ارسال درخواست مشاوره
</template>
</AButton>
</div>
</div>
</AForm>
</div>
</Reveal>
</div>
</div>
</section>
</template>
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { useInView } from "motion-v";
const props = withDefaults(
defineProps<{ end: number; suffix?: string; duration?: number }>(),
{ suffix: "", duration: 1800 },
);
const el = ref<HTMLSpanElement | null>(null);
const inView = useInView(el, { once: true, margin: "-60px" });
const val = ref(0);
let raf = 0;
watch(inView, (v) => {
if (!v) return;
const t0 = performance.now();
const tick = (t: number) => {
const p = Math.min(1, (t - t0) / props.duration);
val.value = Math.round(props.end * (1 - Math.pow(1 - p, 3)));
if (p < 1) raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
});
onBeforeUnmount(() => cancelAnimationFrame(raf));
</script>
<template>
<span ref="el" class="tabular-nums">{{ val.toLocaleString("fa-IR") }}<span v-if="suffix" class="text-accent">{{ suffix }}</span></span>
</template>
+173
View File
@@ -0,0 +1,173 @@
<script setup lang="ts">
import { ArrowLeft, ChevronDown, HardHat } from "lucide-vue-next";
import DynamicIcon from "~/components/ui/DynamicIcon.vue";
const hero = computed(() => useSiteStore().sections.hero);
</script>
<template>
<section id="home" class="relative flex min-h-screen flex-col overflow-hidden">
<!-- ---- background ---- -->
<div class="absolute inset-0">
<img
:src="hero.image.url"
:alt="hero.image.alt"
width="1792"
height="1008"
fetchpriority="high"
decoding="async"
class="absolute inset-0 size-full object-cover"
/>
<div class="absolute inset-0 bg-gradient-to-l from-bg via-bg/80 to-bg/25" />
<div class="absolute inset-0 bg-gradient-to-t from-bg via-transparent to-bg/60" />
<div class="absolute inset-0 bg-grid opacity-50" />
</div>
<!-- ---- side tape ---- -->
<div class="tape-v absolute bottom-0 end-0 z-10 h-44 w-1.5 opacity-70" />
<!-- ---- content ---- -->
<div
class="relative z-10 mx-auto flex w-full max-w-[1480px] flex-1 items-center px-5 pb-24 pt-36 md:px-8"
>
<div class="grid w-full items-center gap-12 lg:grid-cols-12">
<div class="lg:col-span-7">
<div
class="animate-fade-up-1 inline-flex items-center gap-2.5 rounded-full border border-accent/30 bg-accent/10 px-4 py-2 backdrop-blur"
>
<span class="size-1.5 animate-pulse rounded-full bg-accent" />
<span class="text-xs font-medium text-accent">
{{ hero.badge }}
</span>
</div>
<h1
class="animate-fade-up-2 mt-7 text-5xl font-black leading-[1.15] md:text-7xl md:leading-[1.1]"
>
{{ hero.title }}
<br />
<span
class="mt-3 inline-block -rotate-1 rounded-lg bg-hazard px-4 py-1.5 text-bg shadow-[0_10px_50px_rgba(255,184,0,0.25)]"
>
{{ hero.titleHighlight }}
</span>
</h1>
<p
class="animate-fade-up-3 mt-7 max-w-xl text-base leading-9 text-ink/70 md:text-lg md:leading-10"
>
{{ hero.intro }}
</p>
<div class="animate-fade-up-4 mt-9 flex flex-wrap items-center gap-4">
<a
:href="hero.primaryCta.href"
class="group inline-flex items-center gap-2.5 rounded-full bg-accent px-7 py-4 font-bold text-bg transition-all duration-300 hover:bg-accent-soft hover:shadow-[0_8px_45px_rgba(255,90,0,0.5)]"
>
{{ hero.primaryCta.label }}
<ArrowLeft
class="size-5 transition-transform duration-300 group-hover:-translate-x-1.5"
/>
</a>
<a
:href="hero.secondaryCta.href"
class="inline-flex items-center gap-2.5 rounded-full border border-ink/25 px-7 py-4 font-bold text-ink backdrop-blur transition-colors duration-300 hover:border-accent hover:text-accent"
>
{{ hero.secondaryCta.label }}
</a>
</div>
<div class="animate-fade-up-5 mt-10 flex flex-wrap gap-3">
<span
v-for="c in hero.chips"
:key="c.label"
class="inline-flex items-center gap-2 rounded-full border border-ink/15 bg-bg/50 px-4 py-2 font-mono text-[11px] tracking-wider text-ink/70 backdrop-blur transition-colors hover:border-accent/50 hover:text-ink"
>
<DynamicIcon :name="c.icon" class="size-4 text-accent" />
{{ c.label }}
</span>
</div>
</div>
<!-- ---- rotating badge + status card ---- -->
<div class="hidden flex-col items-center gap-10 lg:col-span-5 lg:flex">
<div class="animate-fade-up-6 relative">
<div class="relative size-44">
<div class="animate-spin-slow absolute inset-0">
<svg viewBox="0 0 120 120" class="size-full">
<defs>
<path
id="badge-circle"
d="M60,60 m-47,0 a47,47 0 1,1 94,0 a47,47 0 1,1 -94,0"
/>
</defs>
<text font-size="9" letter-spacing="2.6" class="fill-ink/60 font-mono">
<textPath href="#badge-circle">
IMEN PISHGAMAN SAFETY • ISO 9001 • CE CERTIFIED • EST 2007 •
</textPath>
</text>
</svg>
</div>
<div class="absolute inset-0 flex items-center justify-center">
<span
class="flex size-20 items-center justify-center rounded-full border border-accent/30 bg-accent/10"
>
<HardHat class="size-9 text-accent" />
</span>
</div>
</div>
</div>
<div
class="animate-fade-up-7 w-full max-w-sm border border-line bg-bg/70 p-5 backdrop-blur-md"
>
<div class="flex items-center justify-between font-mono text-[11px]">
<span class="text-muted">SITE STATUS</span>
<span class="flex items-center gap-2 text-emerald-400">
<span class="size-1.5 animate-pulse rounded-full bg-emerald-400" />
SECURE
</span>
</div>
<div class="mt-3.5 flex items-center justify-between font-mono text-[11px]">
<span class="text-muted">PPE COMPLIANCE</span>
<span class="font-semibold text-accent">۱۰۰٪</span>
</div>
<div
v-if="hero.lastInspection"
class="mt-3.5 flex items-center justify-between font-mono text-[11px]"
>
<span class="text-muted">آخرین بازرسی</span>
<span>{{ hero.lastInspection }}</span>
</div>
<div class="my-4 h-px bg-line" />
<div class="font-mono text-[11px] leading-6 text-muted">
سیستم پایش حرفه‌ای ایمن پیشگامان<span class="animate-blink text-accent">▍</span>
</div>
</div>
</div>
</div>
</div>
<!-- ---- scroll hint ---- -->
<div class="animate-fade-up-9 absolute bottom-28 left-1/2 z-10 hidden md:block">
<div class="-translate-x-1/2 flex flex-col items-center gap-2">
<span class="font-mono text-[10px] tracking-[0.35em] text-muted">SCROLL</span>
<ChevronDown class="size-4 animate-bounce text-accent" />
</div>
</div>
<!-- ---- bottom bar ---- -->
<div class="animate-fade-up-8 relative z-10 border-t border-ink/10 backdrop-blur-sm">
<div class="mx-auto grid max-w-[1480px] grid-cols-1 gap-px bg-ink/10 sm:grid-cols-3">
<div
v-for="s in hero.miniStats"
:key="s.label"
class="flex items-baseline gap-4 bg-bg/60 px-6 py-5 backdrop-blur-md md:px-8"
>
<span class="text-2xl font-black text-ink md:text-3xl">{{ s.value }}</span>
<span class="text-xs leading-5 text-muted md:text-sm">{{ s.label }}</span>
</div>
</div>
</div>
</section>
</template>
@@ -0,0 +1,101 @@
<script setup lang="ts">
import { AnimatePresence, motion, useMotionValue, useSpring } from "motion-v";
import { ArrowLeft } from "lucide-vue-next";
import SectionHead from "~/components/ui/SectionHead.vue";
const industries = computed(() => useSiteStore().sections.industries);
const INDUSTRIES = computed(() => industries.value.items);
const hovered = ref<number | null>(null);
const x = useMotionValue(0);
const y = useMotionValue(0);
const sx = useSpring(x, { stiffness: 220, damping: 26, mass: 0.6 });
const sy = useSpring(y, { stiffness: 220, damping: 26, mass: 0.6 });
const onMove = (e: MouseEvent) => {
x.set(e.clientX);
y.set(e.clientY);
};
</script>
<template>
<section
id="industries"
aria-labelledby="industries-title"
class="relative border-t border-line py-24 md:py-32"
@mousemove="onMove"
>
<div class="mx-auto max-w-[1480px] px-5 md:px-8">
<SectionHead heading-id="industries-title" v-bind="industries.head" />
<div class="mt-16" @mouseleave="hovered = null">
<motion.div
v-for="(ind, i) in INDUSTRIES"
:key="ind.name"
v-bind="fade(i * 0.05)"
data-hover
:class="`group relative flex cursor-pointer items-center justify-between gap-4 border-t border-line px-2 py-7 transition-colors duration-300 hover:bg-panel/40 md:px-4 md:py-9 ${
i === INDUSTRIES.length - 1 ? 'border-b' : ''
}`"
@mouseenter="hovered = i"
>
<div class="flex min-w-0 items-baseline gap-5 md:gap-8">
<span class="shrink-0 font-mono text-xs text-muted">
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
<h3
class="truncate text-2xl font-black transition-all duration-300 group-hover:-translate-x-2 group-hover:text-accent md:text-5xl"
>
{{ ind.name }}
</h3>
<span
class="hidden shrink-0 font-mono text-[10px] tracking-[0.3em] text-muted/60 md:inline"
>
{{ ind.nameEn }}
</span>
</div>
<div class="flex shrink-0 items-center gap-4 md:gap-8">
<span v-if="ind.count" class="text-xs text-muted md:text-sm">{{ ind.count }} پروژه</span>
<span
class="flex size-10 items-center justify-center rounded-full border border-line text-muted transition-all duration-300 group-hover:-translate-x-1.5 group-hover:border-accent group-hover:text-accent md:size-12"
>
<ArrowLeft class="size-4 md:size-5" />
</span>
</div>
</motion.div>
</div>
</div>
<!-- ---- floating preview (desktop) ---- -->
<motion.div
:style="{ x: sx, y: sy }"
class="pointer-events-none fixed left-0 top-0 z-40 hidden lg:block"
>
<AnimatePresence>
<motion.div
v-if="hovered !== null"
:key="hovered"
:initial="{ opacity: 0, scale: 0.82, rotate: -3 }"
:animate="{ opacity: 1, scale: 1, rotate: 0 }"
:exit="{ opacity: 0, scale: 0.9, rotate: 2 }"
:transition="{ duration: 0.35, ease: EASE }"
class="relative -ml-40 -mt-28 h-56 w-80 overflow-hidden rounded-xl border border-accent/40 shadow-[0_25px_80px_rgba(0,0,0,0.6)]"
>
<img
:src="INDUSTRIES[hovered]!.image.url"
:alt="INDUSTRIES[hovered]!.image.alt || INDUSTRIES[hovered]!.name"
decoding="async"
class="absolute inset-0 size-full object-cover grayscale-[35%] transition-all duration-500"
/>
<div class="absolute inset-0 bg-accent/15 mix-blend-multiply" />
<div class="absolute inset-0 bg-gradient-to-t from-bg/70 to-transparent" />
<div
class="absolute bottom-3 start-3 rounded-md border border-line bg-bg/80 px-3 py-1.5 font-mono text-[10px] tracking-widest text-ink backdrop-blur"
>
{{ INDUSTRIES[hovered]!.nameEn }}
</div>
</motion.div>
</AnimatePresence>
</motion.div>
</section>
</template>
@@ -0,0 +1,146 @@
<script setup lang="ts">
import { ArrowLeft } from "lucide-vue-next";
import DynamicIcon from "~/components/ui/DynamicIcon.vue";
import Reveal from "~/components/ui/Reveal.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
const site = useSiteStore();
const intro = computed(() => site.sections.productsIntro);
const categories = computed(() => site.categories);
const active = ref(0);
</script>
<template>
<section id="products" aria-labelledby="products-title" class="relative py-24 md:py-32">
<div class="mx-auto max-w-[1480px] px-5 md:px-8">
<div class="flex flex-wrap items-end justify-between gap-6">
<SectionHead heading-id="products-title" v-bind="intro.head" />
<Reveal :delay="0.2" class="hidden md:block">
<a
href="/#contact"
class="group inline-flex items-center gap-2 rounded-full border border-line px-6 py-3 text-sm text-muted transition-colors hover:border-accent hover:text-accent"
>
{{ intro.ctaLabel }}
<ArrowLeft class="size-4 transition-transform group-hover:-translate-x-1" />
</a>
</Reveal>
</div>
</div>
<!-- ---- mobile: card grid ---- -->
<div class="mx-auto mt-14 max-w-[1480px] px-5 md:hidden">
<div class="grid grid-cols-2 gap-3">
<Reveal v-for="(cat, i) in categories" :key="cat.code" :delay="i * 0.05">
<NuxtLink
:to="`/categories/${cat.slug}`"
class="group relative block aspect-[3/4] overflow-hidden rounded-xl border border-line transition-colors duration-300 active:border-accent/60"
>
<img
v-if="cat.coverImage"
:src="cat.coverImage"
:alt="cat.name"
loading="lazy"
decoding="async"
class="absolute inset-0 size-full object-cover transition-transform duration-500 group-active:scale-105"
/>
<div v-else class="absolute inset-0 bg-panel" />
<div class="absolute inset-0 bg-gradient-to-t from-bg via-bg/50 to-transparent" />
<div class="absolute inset-x-0 top-0 flex items-center justify-between p-3">
<span class="font-mono text-[9px] tracking-widest text-ink/50">{{ cat.code }}</span>
<span class="font-mono text-[10px] text-accent">
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
</div>
<div class="absolute inset-x-0 bottom-0 p-3">
<h3 class="text-sm font-black leading-6">{{ cat.name }}</h3>
<p class="mt-0.5 font-mono text-[8px] tracking-[0.15em] text-muted">{{ cat.nameEn }}</p>
</div>
</NuxtLink>
</Reveal>
</div>
</div>
<!-- ---- desktop: accordion panels ---- -->
<div class="mx-auto mt-14 hidden max-w-[1480px] px-8 md:block">
<div class="flex h-[74vh] min-h-[580px] flex-row gap-2">
<NuxtLink
v-for="(cat, i) in categories"
:key="cat.code"
:to="`/categories/${cat.slug}`"
data-hover
:class="`group relative cursor-pointer overflow-hidden rounded-xl border transition-all duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] ${
active === i
? 'flex-[3.4] border-accent/60'
: 'flex-[1] border-line hover:border-ink/30'
}`"
@mouseenter="active = i"
>
<img
v-if="cat.coverImage"
:src="cat.coverImage"
:alt="cat.name"
loading="lazy"
decoding="async"
:class="`absolute inset-0 size-full object-cover transition-all duration-700 ${
active === i ? 'scale-100 grayscale-0' : 'scale-110 grayscale group-hover:grayscale-0'
}`"
/>
<div
v-else
class="absolute inset-0 bg-panel"
/>
<div
:class="`absolute inset-0 transition-opacity duration-700 ${
active === i
? 'bg-gradient-to-t from-bg via-bg/35 to-bg/5'
: 'bg-gradient-to-t from-bg/95 via-bg/30 to-transparent'
}`"
/>
<div class="absolute inset-x-0 top-0 flex items-center justify-between p-5">
<span class="font-mono text-[10px] tracking-widest text-ink/60">{{ cat.code }}</span>
<span
:class="`font-mono text-xs transition-colors duration-500 ${
active === i ? 'text-accent' : 'text-ink/40'
}`"
>
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
</div>
<div class="absolute inset-x-0 bottom-0 p-6">
<h3
:class="`font-black transition-all duration-500 ${
active === i ? 'text-2xl' : 'text-sm'
}`"
>
{{ cat.name }}
</h3>
<p class="mt-1 font-mono text-[10px] tracking-[0.2em] text-muted">{{ cat.nameEn }}</p>
</div>
</NuxtLink>
</div>
</div>
<div
class="mx-auto mt-10 grid max-w-[1480px] gap-px overflow-hidden rounded-xl border border-line bg-line md:grid-cols-3"
>
<Reveal v-for="(t, i) in intro.trust" :key="t.title" :delay="i * 0.08">
<div class="flex h-full items-center gap-4 bg-panel/60 p-6">
<span
class="flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent/10 text-accent"
>
<DynamicIcon :name="t.icon" class="size-6" />
</span>
<div>
<div class="font-bold">{{ t.title }}</div>
<div class="mt-1 text-xs leading-6 text-muted">{{ t.desc }}</div>
</div>
</div>
</Reveal>
</div>
</section>
</template>
@@ -0,0 +1,93 @@
<script setup lang="ts">
import { AnimatePresence, motion } from "motion-v";
import { Plus } from "lucide-vue-next";
import DynamicIcon from "~/components/ui/DynamicIcon.vue";
import Reveal from "~/components/ui/Reveal.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
import { serviceSchema } from "#shared/seo/schema";
const services = computed(() => useSiteStore().sections.services);
const seo = useSeoContext();
useJsonLd(
services.value.items.map((s) => serviceSchema(seo, { name: s.title, description: s.desc })),
"services",
);
const open = ref(0);
</script>
<template>
<section id="services" aria-labelledby="services-title" class="border-t border-line py-24 md:py-32">
<div class="mx-auto max-w-[1480px] px-5 md:px-8">
<SectionHead heading-id="services-title" v-bind="services.head" />
<div class="mt-16">
<Reveal v-for="(s, i) in services.items" :key="s.title" :delay="i * 0.05">
<div :class="`border-t border-line ${i === services.items.length - 1 ? 'border-b' : ''}`">
<button
class="group flex w-full items-center gap-5 py-7 text-start md:gap-10 md:py-9"
@click="open = open === i ? -1 : i"
>
<span
:class="`font-mono text-sm transition-colors duration-300 md:text-base ${
open === i ? 'text-accent' : 'text-muted'
}`"
>
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
<span
:class="`flex-1 text-2xl font-black transition-colors duration-300 md:text-4xl ${
open === i ? 'text-accent' : 'text-ink group-hover:text-accent'
}`"
>
{{ s.title }}
</span>
<span
:class="`hidden size-12 shrink-0 items-center justify-center rounded-full border transition-all duration-500 md:flex ${
open === i
? 'rotate-45 border-accent bg-accent text-bg'
: 'border-line text-muted group-hover:border-accent/50 group-hover:text-accent'
}`"
>
<Plus class="size-5" />
</span>
</button>
<AnimatePresence :initial="false">
<motion.div
v-if="open === i"
:initial="{ height: 0, opacity: 0 }"
:animate="{ height: 'auto', opacity: 1 }"
:exit="{ height: 0, opacity: 0 }"
:transition="{ duration: 0.55, ease: EASE }"
class="overflow-hidden"
>
<div class="grid gap-8 pb-10 md:grid-cols-2 md:ps-16">
<div class="flex items-start gap-4">
<span
class="flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent/10 text-accent"
>
<DynamicIcon :name="s.icon" class="size-6" />
</span>
<p class="text-sm leading-8 text-muted">{{ s.desc }}</p>
</div>
<ul class="space-y-3.5">
<li
v-for="it in s.items"
:key="it"
class="flex items-center gap-3 text-sm text-ink/80"
>
<span class="size-1.5 shrink-0 rounded-full bg-accent" />
{{ it }}
</li>
</ul>
</div>
</motion.div>
</AnimatePresence>
</div>
</Reveal>
</div>
</div>
</section>
</template>
@@ -0,0 +1,79 @@
<script setup lang="ts">
import { FileSearch, ShieldCheck } from "lucide-vue-next";
import Reveal from "~/components/ui/Reveal.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
const standards = computed(() => useSiteStore().sections.standards);
</script>
<template>
<section
id="standards"
aria-labelledby="standards-title"
class="relative overflow-hidden border-t border-line py-24 md:py-32"
>
<!-- watermark -->
<div
aria-hidden="true"
class="text-outline pointer-events-none absolute -bottom-14 -start-8 select-none font-mono text-[24vw] font-bold leading-none opacity-60"
>
CE
</div>
<div class="relative mx-auto max-w-[1480px] px-5 md:px-8">
<div class="grid items-center gap-14 lg:grid-cols-12">
<div class="lg:col-span-5">
<SectionHead heading-id="standards-title" v-bind="standards.head" />
<Reveal v-if="standards.note" :delay="0.25">
<div class="mt-8 flex items-start gap-4 rounded-xl border border-accent/25 bg-accent/5 p-5">
<FileSearch class="size-6 shrink-0 text-accent" />
<p class="text-sm leading-8 text-ink/80">
{{ standards.note }}
</p>
</div>
</Reveal>
<Reveal :delay="0.35">
<a
href="#contact"
class="group mt-8 inline-flex items-center gap-2.5 rounded-full border border-line px-6 py-3.5 text-sm font-bold transition-colors hover:border-accent hover:text-accent"
>
<ShieldCheck class="size-4 text-accent" />
{{ standards.ctaLabel }}
</a>
</Reveal>
</div>
<div class="grid gap-4 sm:grid-cols-2 lg:col-span-7 xl:grid-cols-3">
<Reveal v-for="(s, i) in standards.items" :key="s.code" :delay="i * 0.06">
<div
data-hover
class="group relative h-full border border-line bg-panel/50 p-6 text-center transition-all duration-500 hover:-translate-y-1.5 hover:border-accent/50 hover:bg-panel"
>
<span class="absolute end-3 top-3 font-mono text-[9px] tracking-[0.2em] text-muted/50">
CERT
</span>
<div
class="mx-auto flex size-24 items-center justify-center rounded-full border border-dashed border-ink/20 transition-all duration-500 group-hover:rotate-12 group-hover:border-accent/60"
>
<div>
<div
class="font-mono text-base font-bold text-ink transition-colors duration-300 group-hover:text-accent"
>
{{ s.code }}
</div>
<div
class="mx-auto mt-1.5 h-px w-8 bg-line transition-colors duration-300 group-hover:bg-accent/50"
/>
<div class="mt-1.5 font-mono text-[8px] tracking-[0.25em] text-muted">
EURO NORM
</div>
</div>
</div>
<div class="mt-4 text-sm font-medium text-ink/85">{{ s.label }}</div>
</div>
</Reveal>
</div>
</div>
</div>
</section>
</template>
@@ -0,0 +1,33 @@
<script setup lang="ts">
import Reveal from "~/components/ui/Reveal.vue";
import CountUp from "./CountUp.vue";
const stats = computed(() => useSiteStore().sections.stats.items);
</script>
<template>
<section class="relative" aria-label="آمار و دستاوردهای ایمن پیشگامان">
<div class="grid grid-cols-2 gap-px border-y border-line bg-line lg:grid-cols-4">
<div
v-for="(s, i) in stats"
:key="s.label"
class="group relative bg-bg p-8 transition-colors duration-500 hover:bg-panel md:p-10"
>
<span
class="absolute end-5 top-5 font-mono text-[10px] tracking-[0.25em] text-muted/50 transition-colors duration-500 group-hover:text-accent/70"
>
{{ s.note }}
</span>
<Reveal :delay="i * 0.08">
<div class="text-4xl font-black md:text-6xl">
<CountUp :end="s.end" :suffix="s.suffix" />
</div>
<div class="mt-3 text-sm text-muted">{{ s.label }}</div>
</Reveal>
<span
class="absolute bottom-0 start-0 h-0.5 w-0 bg-accent transition-all duration-500 group-hover:w-full"
/>
</div>
</div>
</section>
</template>
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { ShieldCheck } from "lucide-vue-next";
const items = computed(() => useSiteStore().sections.tape.items);
</script>
<template>
<section aria-hidden="true" class="pointer-events-none relative z-20 overflow-hidden py-10">
<div class="-rotate-[1.6deg] scale-[1.04]">
<div class="hazard h-2.5" />
<div dir="ltr" class="overflow-hidden bg-hazard py-3.5 text-bg">
<div class="animate-marquee flex w-max">
<span
v-for="(item, i) in [...items, ...items]"
:key="i"
class="flex items-center gap-7 px-7 text-sm font-extrabold whitespace-nowrap"
>
{{ item }}
<ShieldCheck class="size-4 shrink-0" :stroke-width="2.5" />
</span>
</div>
</div>
<div class="hazard h-2.5" />
</div>
</section>
</template>
@@ -0,0 +1,76 @@
<script setup lang="ts">
import { AnimatePresence, motion } from "motion-v";
import { Quote } from "lucide-vue-next";
import SectionHead from "~/components/ui/SectionHead.vue";
const testimonials = computed(() => useSiteStore().sections.testimonials);
const QUOTES = computed(() => testimonials.value.items);
const idx = ref(0);
const q = computed(() => QUOTES.value[idx.value]);
let t: ReturnType<typeof setInterval> | undefined;
onMounted(() => {
t = setInterval(() => (idx.value = (idx.value + 1) % Math.max(1, QUOTES.value.length)), 7000);
});
onBeforeUnmount(() => clearInterval(t));
</script>
<template>
<section
v-if="QUOTES.length"
aria-labelledby="testimonials-title"
class="relative overflow-hidden border-t border-line py-24 md:py-32"
>
<div class="absolute inset-0 bg-grid opacity-40" />
<div
class="pointer-events-none absolute -top-10 -end-10 select-none font-mono text-[18vw] font-bold leading-none text-outline opacity-50"
>
"
</div>
<div class="relative mx-auto max-w-4xl px-5 text-center md:px-8">
<SectionHead heading-id="testimonials-title" center v-bind="testimonials.head" />
<div class="mt-14 flex min-h-[320px] flex-col items-center md:min-h-[280px]">
<span
class="flex size-16 items-center justify-center rounded-full border border-accent/30 bg-accent/10"
>
<Quote class="size-7 text-accent" />
</span>
<AnimatePresence mode="wait">
<motion.blockquote
v-if="q"
:key="idx"
:initial="{ opacity: 0, y: 26 }"
:animate="{ opacity: 1, y: 0 }"
:exit="{ opacity: 0, y: -26 }"
:transition="{ duration: 0.55, ease: EASE }"
class="mt-8"
>
<p class="text-xl font-bold leading-[2.1] text-ink/90 md:text-2xl md:leading-[2]">
«{{ q.text }}»
</p>
<footer class="mt-8">
<div class="text-lg font-black">{{ q.name }}</div>
<div class="mt-2 font-mono text-xs text-muted">{{ q.role }}</div>
</footer>
</motion.blockquote>
</AnimatePresence>
</div>
<div class="mt-12 flex items-center justify-center gap-3">
<button
v-for="(_, i) in QUOTES"
:key="i"
:aria-label="`نظر شماره ${faNum(i + 1)}`"
:class="`h-1.5 rounded-full transition-all duration-500 ${
i === idx ? 'w-12 bg-accent' : 'w-4 bg-line hover:bg-muted'
}`"
@click="idx = i"
/>
</div>
</div>
</section>
</template>
+112
View File
@@ -0,0 +1,112 @@
<script setup lang="ts">
import type { IconName } from "@imen/shared";
import {
Award,
BadgeCheck,
Building2,
ClipboardCheck,
Clock,
Construction,
Ear,
Factory,
FileCheck,
FileSearch,
Flame,
Footprints,
Fuel,
Gauge,
Glasses,
Globe,
GraduationCap,
Hand,
Handshake,
HardHat,
Headset,
HeartPulse,
Leaf,
Lock,
Mail,
MapPin,
Medal,
Microscope,
Package,
PackageCheck,
Phone,
Pickaxe,
ShieldAlert,
ShieldCheck,
ShieldPlus,
Shirt,
Siren,
Star,
Target,
ThumbsUp,
TrafficCone,
TriangleAlert,
Truck,
Users,
Warehouse,
Wind,
Wrench,
Zap,
} from "lucide-vue-next";
import type { Component } from "vue";
/** Explicit registry (matches ICON_NAMES in @imen/shared) so only these icons are bundled */
const ICONS: Record<IconName, Component> = {
ShieldCheck,
ShieldPlus,
ShieldAlert,
BadgeCheck,
Award,
Medal,
PackageCheck,
Package,
Truck,
Warehouse,
Globe,
Users,
Handshake,
Headset,
ClipboardCheck,
FileCheck,
FileSearch,
GraduationCap,
Gauge,
Microscope,
Wrench,
HardHat,
Shirt,
Footprints,
Hand,
Glasses,
Ear,
Wind,
TriangleAlert,
Siren,
TrafficCone,
Construction,
Factory,
Building2,
Fuel,
Pickaxe,
Flame,
Zap,
Leaf,
HeartPulse,
Clock,
Phone,
Mail,
MapPin,
Star,
ThumbsUp,
Target,
Lock,
};
defineProps<{ name: string }>();
</script>
<template>
<component :is="ICONS[name as IconName] ?? ShieldCheck" />
</template>
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { ImageOff } from "lucide-vue-next";
withDefaults(
defineProps<{
label?: string;
aspectClass?: string;
}>(),
{
label: "تصویر محصول",
aspectClass: "aspect-[4/3]",
},
);
</script>
<template>
<div
:class="`flex flex-col items-center justify-center border border-dashed border-line bg-panel ${aspectClass}`"
>
<ImageOff class="size-10 text-muted/30" />
<span class="mt-2 font-mono text-[10px] tracking-wider text-muted/40">{{ label }}</span>
</div>
</template>
+9
View File
@@ -0,0 +1,9 @@
<script setup lang="ts">
/** Renders editor text where "\n" means a line break */
const props = defineProps<{ text: string }>();
const lines = computed(() => props.text.split("\n"));
</script>
<template>
<template v-for="(line, i) in lines" :key="i"><br v-if="i > 0" />{{ line }}</template>
</template>
+24
View File
@@ -0,0 +1,24 @@
<script setup lang="ts">
</script>
<template>
<NuxtLink to="/" class="flex items-center gap-3" aria-label="ایمن پیشگامان">
<span
class="flex size-10 items-center justify-center rounded-xl bg-white shadow-[0_0_28px_rgba(10,30,92,0.45)]"
>
<img
src="/images/logo.png"
alt="ایمن پیشگامان"
width="28"
height="28"
class="size-7 object-contain"
/>
</span>
<span class="leading-tight">
<span class="block text-lg font-black">ایمن پیشگامان</span>
<span class="block font-mono text-[9px] tracking-[0.32em] text-muted">
IMEN PISHGAMAN CO.
</span>
</span>
</NuxtLink>
</template>
+12
View File
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { motion } from "motion-v";
const props = withDefaults(defineProps<{ delay?: number }>(), { delay: 0 });
const motionProps = computed(() => fade(props.delay, 34));
</script>
<template>
<motion.div v-bind="motionProps">
<slot />
</motion.div>
</template>
@@ -0,0 +1,51 @@
<script setup lang="ts">
import Lines from "./Lines.vue";
import Reveal from "./Reveal.vue";
withDefaults(
defineProps<{
tag: string;
/** title text; "\n" = line break. Use the #title slot for custom markup */
title?: string;
/** optional accented last line of the title */
highlight?: string;
desc?: string;
center?: boolean;
headingId?: string;
}>(),
{ center: false },
);
</script>
<template>
<div :class="center ? 'text-center' : ''">
<Reveal>
<div :class="`flex items-center gap-3 ${center ? 'justify-center' : ''}`">
<span class="font-mono text-sm text-accent">//</span>
<span class="font-mono text-xs tracking-[0.25em] text-muted">
{{ tag }}
</span>
<span class="h-px w-14 bg-line" />
</div>
</Reveal>
<Reveal :delay="0.08">
<h2
:id="headingId"
class="mt-5 text-3xl font-black leading-[1.25] md:text-5xl md:leading-[1.2]"
>
<slot name="title">
<Lines v-if="title" :text="title" />
<template v-if="highlight">
<br />
<span class="text-accent">{{ highlight }}</span>
</template>
</slot>
</h2>
</Reveal>
<Reveal v-if="desc" :delay="0.16">
<p :class="`mt-5 max-w-xl leading-8 text-muted ${center ? 'mx-auto' : ''}`">
{{ desc }}
</p>
</Reveal>
</div>
</template>
+16
View File
@@ -0,0 +1,16 @@
import { toJsonLd } from "#shared/seo/schema";
type Ld = Record<string, unknown>;
/** Renders JSON-LD <script> tags at the start of <body> (replaces the React <JsonLd> component). */
export function useJsonLd(data: Ld | Ld[], id = "site") {
const items = Array.isArray(data) ? data : [data];
useHead({
script: items.map((item, i) => ({
key: `ld-${id}-${i}`,
type: "application/ld+json",
innerHTML: toJsonLd(item),
tagPosition: "bodyOpen" as const,
})),
});
}
+13
View File
@@ -0,0 +1,13 @@
/** Reactive `window.scrollY > threshold`, evaluated after mount (passive listener). */
export function useScrolledPast(threshold: number) {
const past = ref(false);
const on = () => (past.value = window.scrollY > threshold);
onMounted(() => {
on();
window.addEventListener("scroll", on, { passive: true });
});
onBeforeUnmount(() => window.removeEventListener("scroll", on));
return past;
}
+13
View File
@@ -0,0 +1,13 @@
import type { SeoContext } from "#shared/seo/schema";
/** Absolute URL on the production domain. "/" → "https://domain/" (matches the sitemap entry). */
export const useAbsUrl = () => {
const { siteUrl } = useRuntimeConfig().public;
return (p: string) => new URL(p, siteUrl).toString();
};
/** Settings + site URL for the JSON-LD builders in #shared/seo/schema */
export const useSeoContext = (): SeoContext => ({
settings: useSiteStore().settings,
siteUrl: useRuntimeConfig().public.siteUrl,
});
+46
View File
@@ -0,0 +1,46 @@
import { siteConfig } from "#shared/config/site";
/** Used when the API is unreachable (the error page must still render) */
const FALLBACK = {
name: "ایمن پیشگامان",
title: "ایمن پیشگامان | تجهیزات ایمنی و حفاظت فردی صنعتی",
description: "ایمن پیشگامان — تأمین‌کننده تخصصی تجهیزات حفاظت فردی (PPE) و راهکارهای ایمنی صنعتی.",
};
/** Site-wide <head> defaults shared by the app shell and the error page. */
export function useSiteSeo() {
const site = useSiteStore();
const absUrl = useAbsUrl();
const s = site.data?.sections.settings;
const name = s?.name ?? FALLBACK.name;
const title = s?.title ?? FALLBACK.title;
const description = s?.description ?? FALLBACK.description;
const ogImage = s?.ogImage;
useHead({
titleTemplate: (t) => (t ? `${t} | ${name}` : title),
});
useSeoMeta({
description,
themeColor: siteConfig.themeColor,
formatDetection: "telephone=no",
ogType: "website",
ogSiteName: name,
ogLocale: siteConfig.locale,
ogTitle: title,
ogDescription: description,
twitterCard: "summary_large_image",
twitterTitle: title,
twitterDescription: description,
...(ogImage && {
ogImage: absUrl(ogImage.url),
ogImageWidth: ogImage.width ?? undefined,
ogImageHeight: ogImage.height ?? undefined,
ogImageAlt: ogImage.alt,
twitterImage: absUrl(ogImage.url),
twitterImageAlt: ogImage.alt,
}),
});
}
@@ -0,0 +1,36 @@
/* Starts with "--:--" on the server so the first client render matches,
then sets the real Tehran time only after mount (avoids a hydration mismatch on the clock text) */
export function useTehranClock() {
const now = ref<Date | null>(null);
let t: ReturnType<typeof setInterval> | undefined;
onMounted(() => {
now.value = new Date();
t = setInterval(() => (now.value = new Date()), 15000);
});
onBeforeUnmount(() => clearInterval(t));
const time = computed(() =>
now.value
? new Intl.DateTimeFormat("fa-IR", {
hour: "2-digit",
minute: "2-digit",
timeZone: "Asia/Tehran",
}).format(now.value)
: "--:--",
);
const shift = computed(() => {
if (!now.value) return "";
const hour = Number(
new Intl.DateTimeFormat("en-US", {
hour: "numeric",
hour12: false,
timeZone: "Asia/Tehran",
}).format(now.value),
);
return hour >= 6 && hour < 14 ? "صبح" : hour >= 14 && hour < 22 ? "عصر" : "شب";
});
return { time, shift };
}
+44
View File
@@ -0,0 +1,44 @@
import { theme } from "ant-design-vue";
import type { ThemeConfig } from "ant-design-vue/es/config-provider/context";
/**
* Design-system palette — mirrors the Tailwind `@theme` tokens in assets/css/main.css.
* Keep both in sync: Tailwind drives layout/sections, Ant Design drives form controls.
*/
export const palette = {
bg: "#0b1224",
panel: "#101a32",
panel2: "#152040",
ink: "#edede6",
muted: "#8e9ab0",
accent: "#ff5a00",
accentSoft: "#ff7a2a",
hazard: "#ffb800",
line: "#1e2d4d",
success: "#34d399", // tailwind emerald-400
} as const;
export const antdTheme: ThemeConfig = {
algorithm: theme.darkAlgorithm,
token: {
colorPrimary: palette.accent,
colorInfo: palette.accent,
colorWarning: palette.hazard,
colorSuccess: palette.success,
colorBgBase: palette.bg,
colorBgContainer: palette.bg,
colorBgElevated: palette.panel,
colorBorder: palette.line,
colorBorderSecondary: palette.line,
colorText: palette.ink,
colorTextDescription: palette.muted,
colorTextPlaceholder: "rgba(142, 154, 176, 0.5)",
colorTextLightSolid: palette.bg,
fontFamily: "var(--font-sans)",
fontSize: 14,
borderRadius: 8,
controlOutlineWidth: 0,
motionDurationMid: "0.15s",
wireframe: false,
},
};
+37
View File
@@ -0,0 +1,37 @@
<script setup lang="ts">
import type { NuxtError } from "#app";
import { ShieldAlert } from "lucide-vue-next";
const props = defineProps<{ error: NuxtError }>();
const notFound = computed(() => props.error.statusCode === 404);
useSiteSeo();
useHead({ title: () => (notFound.value ? "صفحه پیدا نشد" : "خطا") });
useSeoMeta({ robots: "noindex, follow" });
const goHome = () => clearError({ redirect: "/" });
</script>
<template>
<main class="flex min-h-screen flex-col items-center justify-center px-5 text-center">
<div class="hazard absolute inset-x-0 top-0 h-2.5" />
<ShieldAlert class="size-16 text-accent" />
<h1 class="mt-8 text-4xl font-black md:text-6xl">
{{ notFound ? "صفحه مورد نظر پیدا نشد" : "خطایی رخ داد" }}
</h1>
<p class="mt-5 max-w-md leading-8 text-muted">
{{
notFound
? "ممکن است آدرس اشتباه وارد شده باشد یا این صفحه جابه‌جا شده باشد."
: "لطفاً چند لحظه بعد دوباره تلاش کنید."
}}
</p>
<a
href="/"
class="mt-9 inline-flex items-center gap-2.5 rounded-full bg-accent px-7 py-4 font-bold text-bg transition-all duration-300 hover:bg-accent-soft"
@click.prevent="goHome"
>
بازگشت به صفحه اصلی
</a>
</main>
</template>
+245
View File
@@ -0,0 +1,245 @@
<script setup lang="ts">
import type { PublicCategory } from "@imen/shared";
import { ArrowRight, Phone } from "lucide-vue-next";
import { categoryPageSchema } from "#shared/seo/schema";
import AppShell from "~/components/layout/AppShell.vue";
import Footer from "~/components/layout/Footer.vue";
import SectionHead from "~/components/ui/SectionHead.vue";
import Reveal from "~/components/ui/Reveal.vue";
const route = useRoute();
const slug = route.params.slug as string;
const { $api } = useNuxtApp();
const site = useSiteStore();
const { data, error } = await useAsyncData(`category:${slug}`, () =>
$api<PublicCategory>(`/public/categories/${encodeURIComponent(slug)}`),
);
if (error.value || !data.value) {
const notFound = error.value?.statusCode === 404;
throw createError({
statusCode: notFound ? 404 : 500,
statusMessage: notFound ? "دسته‌بندی یافت نشد" : "خطا در دریافت اطلاعات",
fatal: true,
});
}
const category = data.value;
const categoryIndex = site.categories.findIndex((c) => c.slug === slug);
const canonical = useAbsUrl()(`/categories/${slug}`);
const description = category.seoDescription || category.fullDesc;
// the site-wide titleTemplate appends the brand name
useHead({
title: category.seoTitle || category.name,
link: [{ rel: "canonical", href: canonical }],
});
useSeoMeta({
description,
robots: "index, follow",
ogUrl: canonical,
ogTitle: `${category.seoTitle || category.name} | ${site.settings.name}`,
ogDescription: description,
});
useJsonLd(categoryPageSchema(useSeoContext(), category), `category-${slug}`);
const activeGroup = ref<string | null>(null);
const visibleProducts = computed(() =>
activeGroup.value
? category.products.filter((p) => p.group === activeGroup.value)
: category.products,
);
const activeGroupDesc = computed(
() => category.groups?.find((g) => g.slug === activeGroup.value)?.desc,
);
const groupCount = (g: string) => category.products.filter((p) => p.group === g).length;
</script>
<template>
<AppShell>
<main>
<!-- ---- hero banner ---- -->
<section class="relative overflow-hidden pt-32 pb-20 md:pt-40 md:pb-28">
<div class="absolute inset-0">
<img
v-if="category.coverImage"
:src="category.coverImage"
:alt="category.name"
class="absolute inset-0 size-full object-cover"
fetchpriority="high"
decoding="async"
/>
<div class="absolute inset-0 bg-gradient-to-l from-bg via-bg/85 to-bg/40" />
<div class="absolute inset-0 bg-gradient-to-t from-bg via-bg/50 to-bg/30" />
<div class="absolute inset-0 bg-grid opacity-40" />
</div>
<div class="tape-v absolute bottom-0 end-0 z-10 h-32 w-1.5 opacity-70" />
<div class="relative z-10 mx-auto max-w-[1480px] px-5 md:px-8">
<Reveal>
<nav class="flex items-center gap-2 text-sm text-muted" aria-label="مسیر">
<NuxtLink to="/" class="transition-colors hover:text-accent">خانه</NuxtLink>
<span class="text-line">/</span>
<NuxtLink to="/#products" class="transition-colors hover:text-accent">
محصولات
</NuxtLink>
<span class="text-line">/</span>
<span class="text-ink">{{ category.name }}</span>
</nav>
</Reveal>
<div class="mt-8">
<SectionHead
:tag="`${faNum(String(categoryIndex + 1).padStart(2, '0'))} — محصولات`"
:desc="category.fullDesc"
>
<template #title>{{ category.name }}</template>
</SectionHead>
</div>
<Reveal :delay="0.2">
<div class="mt-8 flex flex-wrap items-center gap-4">
<span
class="rounded-full border border-accent/40 bg-accent/10 px-4 py-1.5 font-mono text-xs text-accent backdrop-blur"
>
{{ faNum(category.products.length) }} محصول
</span>
<span class="font-mono text-xs tracking-[0.25em] text-muted/60">
{{ category.nameEn }}
</span>
</div>
</Reveal>
</div>
</section>
<!-- ---- products grid ---- -->
<section class="relative py-16 md:py-24">
<div class="absolute inset-0 bg-grid-fine opacity-30" />
<div class="relative mx-auto max-w-[1480px] px-5 md:px-8">
<div v-if="category.groups?.length" class="mb-10">
<div class="flex flex-wrap gap-2" role="tablist" aria-label="فیلتر زیردسته">
<button
type="button"
role="tab"
:aria-selected="activeGroup === null"
class="rounded-full border px-4 py-2 text-sm transition-colors"
:class="
activeGroup === null
? 'border-accent bg-accent text-bg font-bold'
: 'border-line text-muted hover:border-accent/60 hover:text-accent'
"
@click="activeGroup = null"
>
همه
<span class="ms-1 font-mono text-xs opacity-70">{{ faNum(category.products.length) }}</span>
</button>
<button
v-for="g in category.groups"
:key="g.slug"
type="button"
role="tab"
:aria-selected="activeGroup === g.slug"
class="rounded-full border px-4 py-2 text-sm transition-colors"
:class="
activeGroup === g.slug
? 'border-accent bg-accent text-bg font-bold'
: 'border-line text-muted hover:border-accent/60 hover:text-accent'
"
@click="activeGroup = g.slug"
>
{{ g.name }}
<span class="ms-1 font-mono text-xs opacity-70">{{ faNum(groupCount(g.slug)) }}</span>
</button>
</div>
<p v-if="activeGroupDesc" class="mt-4 text-sm text-muted">{{ activeGroupDesc }}</p>
</div>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
<Reveal v-for="(product, i) in visibleProducts" :key="product.code" :delay="i * 0.06">
<div
class="group h-full overflow-hidden rounded-xl border border-line bg-panel/80 backdrop-blur transition-all duration-500 hover:border-accent/40 hover:shadow-[0_8px_40px_rgba(255,90,0,0.08)]"
>
<div
class="relative aspect-[4/3] overflow-hidden"
:class="product.image && 'bg-[radial-gradient(circle_at_center,rgba(255,255,255,0.14),transparent_70%)]'"
>
<img
:src="product.image ?? category.coverImage ?? undefined"
:alt="product.name"
loading="lazy"
decoding="async"
class="size-full transition-transform duration-700 group-hover:scale-105"
:class="product.image ? 'object-contain p-8' : 'object-cover'"
/>
<div v-if="!product.image" class="absolute inset-0 bg-gradient-to-t from-bg/60 to-transparent" />
<div class="absolute inset-x-0 top-0 flex items-center justify-between p-4">
<span class="rounded-full bg-bg/60 px-3 py-1 font-mono text-[10px] tracking-widest text-ink/70 backdrop-blur">
{{ product.code }}
</span>
<span class="font-mono text-xs text-accent">
{{ faNum(String(i + 1).padStart(2, "0")) }}
</span>
</div>
</div>
<div class="p-5 md:p-6">
<h3 class="text-xl font-black">{{ product.name }}</h3>
<p class="mt-1 font-mono text-[10px] tracking-[0.2em] text-muted">
{{ product.nameEn }}
</p>
<p class="mt-3 text-sm leading-8 text-muted">{{ product.desc }}</p>
<div class="mt-4 flex flex-wrap gap-2">
<span
v-for="s in product.specs"
:key="s"
class="rounded-full border border-accent/40 bg-accent/10 px-3 py-1 font-mono text-[10px] text-accent"
>
{{ s }}
</span>
</div>
<div v-if="product.variants?.length" class="mt-4">
<div class="mb-2 text-xs text-muted">مدل‌ها / رنگ‌ها:</div>
<div class="flex flex-wrap gap-1.5">
<span
v-for="v in product.variants"
:key="v"
class="rounded-md border border-line bg-panel-2 px-2.5 py-1 text-[11px] text-ink/70"
>
{{ v }}
</span>
</div>
</div>
</div>
</div>
</Reveal>
</div>
</div>
</section>
<!-- ---- bottom CTA ---- -->
<section class="border-t border-line py-12 md:py-16">
<div class="mx-auto flex max-w-[1480px] flex-wrap items-center justify-between gap-6 px-5 md:px-8">
<NuxtLink
to="/#products"
class="group inline-flex items-center gap-2 text-muted transition-colors hover:text-accent"
>
<ArrowRight class="size-4 transition-transform group-hover:translate-x-1" />
بازگشت به دسته‌بندی‌ها
</NuxtLink>
<a
href="/#contact"
class="inline-flex items-center gap-2 rounded-full bg-accent px-6 py-3 text-sm font-bold text-bg transition-all hover:bg-accent-soft hover:shadow-[0_8px_45px_rgba(255,90,0,0.5)]"
>
<Phone class="size-4" />
درخواست قیمت
</a>
</div>
</section>
</main>
<Footer />
</AppShell>
</template>
+46
View File
@@ -0,0 +1,46 @@
<script setup lang="ts">
import AppShell from "~/components/layout/AppShell.vue";
import Footer from "~/components/layout/Footer.vue";
import Hero from "~/components/sections/Hero.vue";
import TapeMarquee from "~/components/sections/TapeMarquee.vue";
import Stats from "~/components/sections/Stats.vue";
import Products from "~/components/sections/Products.vue";
import About from "~/components/sections/About.vue";
import Services from "~/components/sections/Services.vue";
import Standards from "~/components/sections/Standards.vue";
import Industries from "~/components/sections/Industries.vue";
import Testimonials from "~/components/sections/Testimonials.vue";
import Contact from "~/components/sections/Contact.vue";
const canonical = useAbsUrl()("/");
const { hero } = useSiteStore().sections;
useHead({
link: [
{ rel: "canonical", href: canonical },
{ rel: "preload", as: "image", href: hero.image.url, fetchpriority: "high" },
],
});
useSeoMeta({
robots: "index, follow",
ogUrl: canonical,
});
</script>
<template>
<AppShell>
<main>
<Hero />
<TapeMarquee />
<Stats />
<Products />
<About />
<Services />
<Standards />
<Industries />
<Testimonials />
<Contact />
</main>
<Footer />
</AppShell>
</template>
+22
View File
@@ -0,0 +1,22 @@
import { createCache, extractStyle } from "ant-design-vue";
/**
* Ant Design Vue uses CSS-in-JS. During SSR/SSG we collect the generated styles into a cache
* and inline them into <head>, so prerendered HTML is fully styled before hydration (no FOUC).
*/
export default defineNuxtPlugin((nuxtApp) => {
const cache = createCache();
if (import.meta.server) {
nuxtApp.hook("app:rendered", ({ ssrContext }) => {
const css = extractStyle(cache, true);
if (css && ssrContext) {
ssrContext.head.push({
style: [{ key: "antd-cssinjs", innerHTML: css }],
});
}
});
}
return { provide: { antdCache: cache } };
});
+12
View File
@@ -0,0 +1,12 @@
/**
* `$api` — $fetch bound to the backend. During SSR it calls the API directly over the internal
* network; in the browser it uses the same-origin `/api` path.
*/
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig();
const api = $fetch.create({
baseURL: import.meta.server ? config.apiInternalUrl : config.public.apiBase,
retry: import.meta.server ? 1 : 0,
});
return { provide: { api } };
});
+41
View File
@@ -0,0 +1,41 @@
import { defineStore } from "pinia";
export type ContactStatus = "idle" | "loading" | "success" | "error";
/** `website` is a honeypot field, hidden from people and left empty */
const emptyForm = () => ({ name: "", org: "", phone: "", message: "", website: "" });
interface ApiError {
statusCode?: number;
data?: { message?: string };
}
export const useContactStore = defineStore("contact", {
state: () => ({
form: emptyForm(),
status: "idle" as ContactStatus,
error: "",
}),
actions: {
async submit() {
this.status = "loading";
this.error = "";
try {
await useNuxtApp().$api("/public/contact", { method: "POST", body: this.form });
this.status = "success";
} catch (e) {
const err = e as ApiError;
this.error =
err.statusCode === 429
? "تعداد درخواست‌ها زیاد است؛ لطفاً چند دقیقه بعد دوباره تلاش کنید."
: (err.data?.message ?? "ارسال درخواست انجام نشد؛ لطفاً دوباره تلاش کنید یا تماس بگیرید.");
this.status = "error";
}
},
reset() {
this.form = emptyForm();
this.status = "idle";
this.error = "";
},
},
});
+19
View File
@@ -0,0 +1,19 @@
import type { PublicSite } from "@imen/shared";
import { defineStore } from "pinia";
/** Website content from the API (`GET /api/public/site`), loaded once per SSR render in app.vue */
export const useSiteStore = defineStore("site", {
state: () => ({
data: null as PublicSite | null,
}),
getters: {
sections: (s) => s.data!.sections,
settings: (s) => s.data!.sections.settings,
categories: (s) => s.data!.categories,
},
actions: {
async load() {
this.data = await useNuxtApp().$api<PublicSite>("/public/site");
},
},
});
+21
View File
@@ -0,0 +1,21 @@
import { defineStore } from "pinia";
export const useUiStore = defineStore("ui", {
state: () => ({
/** true once the preloader has finished */
ready: false,
/** mobile navigation overlay */
menuOpen: false,
}),
actions: {
setReady() {
this.ready = true;
},
openMenu() {
this.menuOpen = true;
},
closeMenu() {
this.menuOpen = false;
},
},
});
+13
View File
@@ -0,0 +1,13 @@
export const EASE: [number, number, number, number] = [0.22, 1, 0.36, 1];
/** Convert latin digits to Persian digits */
export const faNum = (v: number | string): string =>
String(v).replace(/\d/g, (d) => "۰۱۲۳۴۵۶۷۸۹"[Number(d)]!);
/** While-in-view fade-up props for motion elements (spread with v-bind) */
export const fade = (delay = 0, y = 36) => ({
initial: { opacity: 0, y },
whileInView: { opacity: 1, y: 0 },
inViewOptions: { once: true, margin: "-60px" as const },
transition: { duration: 0.8, delay, ease: EASE },
});
+77
View File
@@ -0,0 +1,77 @@
import tailwindcss from "@tailwindcss/vite";
import { siteConfig } from "./shared/config/site";
/** Pages are server-rendered and cached; the cache is dropped by the API after content changes. */
const PAGE_CACHE_SECONDS = 60;
export default defineNuxtConfig({
compatibilityDate: "2026-10-01",
ssr: true,
devtools: { enabled: false },
modules: ["@pinia/nuxt"],
css: ["~/assets/css/main.css", "~/assets/css/antd-overrides.css"],
app: {
head: {
htmlAttrs: { lang: siteConfig.lang, dir: siteConfig.dir },
bodyAttrs: {
class: "relative min-h-screen bg-bg font-sans text-ink antialiased",
},
charset: "utf-8",
viewport: "width=device-width, initial-scale=1",
link: [
{
rel: "preload",
href: "/fonts/IRANSansWebFaNum.woff2",
as: "font",
type: "font/woff2",
crossorigin: "",
},
{
rel: "preload",
href: "/fonts/IRANSansWebFaNum_Bold.woff2",
as: "font",
type: "font/woff2",
crossorigin: "",
},
{ rel: "icon", type: "image/svg+xml", href: siteConfig.favicon },
{ rel: "manifest", href: "/manifest.webmanifest" },
],
},
},
// overridable at runtime with NUXT_API_INTERNAL_URL, NUXT_REVALIDATE_SECRET, NUXT_PUBLIC_SITE_URL ...
runtimeConfig: {
/** API base URL used during server-side rendering (inside Docker: http://api:4000/api) */
apiInternalUrl: "http://localhost:4000/api",
/** shared secret the API sends to /_internal/revalidate */
revalidateSecret: "",
public: {
/** API base URL used by the browser (same origin, routed by nginx / the dev proxy) */
apiBase: "/api",
siteUrl: siteConfig.url,
},
},
routeRules: {
"/": { swr: PAGE_CACHE_SECONDS },
"/categories/**": { swr: PAGE_CACHE_SECONDS },
"/sitemap.xml": { swr: 3600 },
"/manifest.webmanifest": { swr: 3600 },
},
nitro: {
// in production nginx routes these paths; in dev the Nuxt server forwards them
devProxy: {
"/api": { target: "http://localhost:4000/api", changeOrigin: true },
"/media": { target: "http://localhost:9000/imen-media", changeOrigin: true },
},
},
vite: {
plugins: [tailwindcss()],
ssr: { noExternal: ["ant-design-vue", "@ant-design/icons-vue"] },
},
typescript: { strict: true },
});
+33
View File
@@ -0,0 +1,33 @@
{
"name": "@imen/web",
"private": true,
"version": "0.3.0",
"type": "module",
"scripts": {
"dev": "nuxt dev --port 3000",
"build": "nuxt build",
"generate": "nuxt generate",
"start": "node .output/server/index.mjs",
"typecheck": "nuxt typecheck",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@imen/shared": "workspace:*",
"@pinia/nuxt": "^1.0.2",
"@vueuse/core": "^15.0.0",
"ant-design-vue": "^4.2.6",
"lucide-vue-next": "^0.475.0",
"motion-v": "^2.6.0",
"nuxt": "^4.5.2",
"pinia": "^4.0.3",
"vue": "^3.5.43",
"vue-router": "^5.3.1"
},
"devDependencies": {
"@tailwindcss/vite": "^4.1.17",
"@types/node": "^24.0.0",
"tailwindcss": "^4.1.17",
"typescript": "~5.9.3",
"vue-tsc": "^3.3.12"
}
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect width='100' height='100' rx='22' fill='#FF5A00'/><path d='M50 20 L72 28 V48 C72 66 62 76 50 82 C38 76 28 66 28 48 V28 Z' fill='#0A0A0C'/><path d='M40 50 L47 57 L62 42' stroke='#FF5A00' stroke-width='7' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

@@ -0,0 +1,25 @@
import { timingSafeEqual } from "node:crypto";
/**
* Called by the API after content changes: drops all cached pages so the next request
* renders fresh HTML. Protected by a shared secret (NUXT_REVALIDATE_SECRET).
*/
export default defineEventHandler(async (event) => {
const expected = useRuntimeConfig().revalidateSecret;
const given = getHeader(event, "x-revalidate-secret") ?? "";
if (!expected || !safeEqual(given, expected)) {
throw createError({ statusCode: 401, statusMessage: "Unauthorized" });
}
// route-rule caches (swr) are stored as cache:nitro:routes:*
const storage = useStorage("cache");
const keys = await storage.getKeys("nitro:routes");
await Promise.all(keys.map((k) => storage.removeItem(k)));
return { cleared: keys.length };
});
function safeEqual(a: string, b: string) {
const ab = Buffer.from(a);
const bb = Buffer.from(b);
return ab.length === bb.length && timingSafeEqual(ab, bb);
}
@@ -0,0 +1,27 @@
import { siteConfig } from "../../shared/config/site";
export default defineEventHandler(async (event) => {
const name = await fetchSite()
.then((s) => s.sections.settings.name)
.catch(() => "ایمن پیشگامان");
setHeader(event, "Content-Type", "application/manifest+json; charset=utf-8");
return {
name,
short_name: name,
lang: siteConfig.lang,
dir: siteConfig.dir,
start_url: "/",
display: "standalone",
background_color: siteConfig.themeColor,
theme_color: siteConfig.themeColor,
icons: [
{
src: siteConfig.favicon,
sizes: "any",
type: "image/svg+xml",
purpose: "any",
},
],
};
});
+13
View File
@@ -0,0 +1,13 @@
export default defineEventHandler((event) => {
const { siteUrl } = useRuntimeConfig().public;
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
return [
"User-Agent: *",
"Allow: /",
"Disallow: /_internal/",
"",
`Host: ${siteUrl}`,
`Sitemap: ${absUrl("/sitemap.xml")}`,
"",
].join("\n");
});
+22
View File
@@ -0,0 +1,22 @@
interface SitemapEntry {
loc: string;
priority: string;
}
export default defineEventHandler(async (event) => {
const categories = await fetchCategories();
const pages: SitemapEntry[] = [
{ loc: "/", priority: "1" },
...categories.map((c) => ({ loc: `/categories/${c.slug}`, priority: "0.8" })),
];
setHeader(event, "Content-Type", "application/xml; charset=utf-8");
const lastmod = new Date().toISOString();
const urls = pages
.map(
(p) =>
`<url>\n<loc>${absUrl(p.loc)}</loc>\n<lastmod>${lastmod}</lastmod>\n<changefreq>weekly</changefreq>\n<priority>${p.priority}</priority>\n</url>`,
)
.join("\n");
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls}\n</urlset>\n`;
});
+11
View File
@@ -0,0 +1,11 @@
import type { PublicCategorySummary, PublicSite } from "@imen/shared";
/** Server-side call to the backend API (internal network address) */
export const serverApi = <T>(path: string) =>
$fetch<T>(path, { baseURL: useRuntimeConfig().apiInternalUrl, retry: 1 });
export const fetchCategories = () => serverApi<PublicCategorySummary[]>("/public/categories");
export const fetchSite = () => serverApi<PublicSite>("/public/site");
/** Absolute URL on the production domain */
export const absUrl = (p: string) => new URL(p, useRuntimeConfig().public.siteUrl).toString();
+15
View File
@@ -0,0 +1,15 @@
/**
* Fixed, deploy-level site settings. Editable content (name, contact info, SEO texts, socials)
* lives in the database and is managed from the admin panel ("settings" section).
*/
export const siteConfig = {
/** default production URL; override at runtime with NUXT_PUBLIC_SITE_URL */
url: "https://imenpishgaman.ir",
locale: "fa_IR",
lang: "fa",
dir: "rtl" as const,
logo: "/images/logo.png",
favicon: "/favicon.svg",
themeColor: "#0b1224",
areaServed: "IR",
};
+108
View File
@@ -0,0 +1,108 @@
import type { PublicCategory, SiteSettings } from "@imen/shared";
import { siteConfig } from "../config/site";
type Json = Record<string, unknown>;
/** Values every schema builder needs: editable settings + the absolute site URL */
export interface SeoContext {
settings: SiteSettings;
siteUrl: string;
}
const abs = (ctx: SeoContext, p: string) => new URL(p, ctx.siteUrl).toString();
/** Social profile links worth listing in `sameAs` (not mail/phone/own site) */
const PROFILE_TYPES = new Set(["telegram", "instagram", "linkedin", "whatsapp", "bale", "eitaa", "aparat", "youtube"]);
const clean = <T extends object>(o: T): Json =>
JSON.parse(
JSON.stringify(o, (_, v) =>
v === "" || (Array.isArray(v) && !v.length) ? undefined : v,
),
);
export const organizationSchema = (ctx: SeoContext) => {
const s = ctx.settings;
return clean({
"@context": "https://schema.org",
"@type": "LocalBusiness",
"@id": `${ctx.siteUrl}/#organization`,
name: s.name,
alternateName: s.nameEn,
url: abs(ctx, "/"),
logo: abs(ctx, siteConfig.logo),
image: abs(ctx, s.ogImage.url),
description: s.description,
email: s.email,
telephone: s.phone,
foundingDate: s.foundingDate,
areaServed: siteConfig.areaServed,
address: {
"@type": "PostalAddress",
streetAddress: s.address.street,
addressLocality: s.address.locality,
addressCountry: s.address.country,
},
openingHoursSpecification: {
"@type": "OpeningHoursSpecification",
dayOfWeek: s.openingHours.days,
opens: s.openingHours.opens,
closes: s.openingHours.closes,
},
sameAs: s.socials.filter((x) => PROFILE_TYPES.has(x.type)).map((x) => x.url),
});
};
export const websiteSchema = (ctx: SeoContext) => ({
"@context": "https://schema.org",
"@type": "WebSite",
"@id": `${ctx.siteUrl}/#website`,
url: abs(ctx, "/"),
name: ctx.settings.name,
inLanguage: siteConfig.lang,
publisher: { "@id": `${ctx.siteUrl}/#organization` },
});
export const serviceSchema = (
ctx: SeoContext,
opts: { name: string; description: string; areaServed?: string },
) =>
clean({
"@context": "https://schema.org",
"@type": "Service",
name: opts.name,
description: opts.description,
areaServed: opts.areaServed ?? siteConfig.areaServed,
provider: { "@id": `${ctx.siteUrl}/#organization` },
});
export const categoryPageSchema = (ctx: SeoContext, category: PublicCategory) =>
clean({
"@context": "https://schema.org",
"@type": "CollectionPage",
"@id": `${ctx.siteUrl}/categories/${category.slug}`,
name: category.name,
description: category.seoDescription || category.fullDesc,
url: abs(ctx, `/categories/${category.slug}`),
isPartOf: { "@id": `${ctx.siteUrl}/#website` },
provider: { "@id": `${ctx.siteUrl}/#organization` },
mainEntity: {
"@type": "ItemList",
numberOfItems: category.products.length,
itemListElement: category.products.map((p, i) => ({
"@type": "ListItem",
position: i + 1,
item: {
"@type": "Product",
name: p.name,
description: p.desc,
sku: p.code,
...(p.image && { image: abs(ctx, p.image) }),
},
})),
},
});
/** Serialize JSON-LD safely for an inline <script> (escape "<"). */
export const toJsonLd = (data: Json) =>
JSON.stringify(data).replace(/</g, "\\u003c");
+9
View File
@@ -0,0 +1,9 @@
{
"files": [],
"references": [
{ "path": "./.nuxt/tsconfig.app.json" },
{ "path": "./.nuxt/tsconfig.server.json" },
{ "path": "./.nuxt/tsconfig.shared.json" },
{ "path": "./.nuxt/tsconfig.node.json" }
]
}