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:
co-authored by
Claude Opus 5.5
parent
31076174e2
commit
789d224ea0
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user