Apply the public site UI checklist.
Align header, footer, brand, homepage course preview, faculty links, and the course catalog with the documented changes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8886aa8640
commit
de800d27b1
139 files changed
+3311
-1547
No files matched your search
@@ -3,14 +3,9 @@ import { notFound } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { FormCard } from "@/components/molecules/FormCard";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { ContactInterestForm } from "@/components/organisms/ContactInterestForm";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { getLegalPage } from "@/lib/data/site";
|
||||
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
@@ -38,26 +33,21 @@ export default async function LegalSlugPage({ params }: Props) {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={page.title} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-2">
|
||||
<div className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10">
|
||||
<Section tone="subtle">
|
||||
<Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
|
||||
<div className="min-w-0 space-y-5">
|
||||
{page.body.map((paragraph) => (
|
||||
<p key={paragraph} className="leading-8 text-foreground/90">
|
||||
<p key={paragraph} className="text-base leading-8 text-foreground/90">
|
||||
{paragraph}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
<Card className="rounded-2xl border-border/70 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle>ارسال پیام</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<FormCard title="ارسال پیام">
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</FormCard>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { AboutTemplate } from "@/components/templates/AboutTemplate";
|
||||
import { getTopics } from "@/lib/data/site";
|
||||
import { aboutFocusAreas, siteMission } from "@/lib/site-config";
|
||||
import { aboutContent } from "@/lib/site-config";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return { title: t("aboutTitle"), description: siteMission };
|
||||
return {
|
||||
title: t("aboutTitle"),
|
||||
description: aboutContent.intro,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function AboutPage() {
|
||||
@@ -21,50 +17,7 @@ export default async function AboutPage() {
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
eyebrow="درباره مرکز آموزشهای آزاد"
|
||||
title="آموزش مدیریت با پشتوانه امیرکبیر"
|
||||
intro="مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر، بر آموزش مدیران و تیمهای مدیریتی برای تحول در صنعت تمرکز دارد. دورههای ما به تصمیمگیری دادهمحور، بهکارگیری هوش مصنوعی در کسبوکار و مدیریت اجرای تغییر در سازمان میپردازند."
|
||||
/>
|
||||
<Section className="relative overflow-hidden">
|
||||
<Container>
|
||||
<p className="text-xs font-bold text-primary">آنچه میآموزید</p><Heading level={2} className="mt-2 text-3xl sm:text-4xl">توانمندیهای مدیریتی برای تحول در صنعت</Heading>
|
||||
<div className="mt-8 grid gap-4 sm:grid-cols-2">
|
||||
{aboutFocusAreas.map((area) => (
|
||||
<SurfaceCard key={area.title}>
|
||||
<Heading as="h3" level={4}>
|
||||
{area.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
{area.description}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<p className="text-xs font-bold text-primary">حوزههای آموزشی</p><Heading level={2} className="mt-2 text-3xl sm:text-4xl">موضوع مورد نیاز خود را پیدا کنید</Heading>
|
||||
<div className="mt-6 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{topics.map((topic) => (
|
||||
<SurfaceCard key={topic.id} padded="sm" className="h-full">
|
||||
<Link href={topic.href} className="block">
|
||||
<span className="font-semibold hover:text-primary">
|
||||
{topic.title}
|
||||
</span>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
{topic.description}
|
||||
</p>
|
||||
</Link>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
<Link href="/programs" className={cn(buttonVariants(), "mt-8")}>
|
||||
مشاهده برنامههای آموزشی
|
||||
</Link>
|
||||
</Container>
|
||||
</Section>
|
||||
<AboutTemplate topics={topics} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -21,26 +21,26 @@ export default async function AlumniPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("alumniTitle")} intro={t("alumniIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-8 md:grid-cols-3">
|
||||
<div className="grid gap-5 md:grid-cols-3">
|
||||
{stories.map((story) => (
|
||||
<SurfaceCard
|
||||
key={story.id}
|
||||
id={story.id}
|
||||
padded={false}
|
||||
className="group scroll-mt-24 overflow-hidden rounded-2xl"
|
||||
className="scroll-mt-24"
|
||||
>
|
||||
<div className="relative aspect-[16/10]">
|
||||
<div className="relative aspect-[16/10] bg-muted">
|
||||
<Image
|
||||
src={story.imageUrl}
|
||||
alt={story.name}
|
||||
fill
|
||||
className="object-cover transition-transform duration-500 group-hover:scale-[1.03]"
|
||||
className="object-cover"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-5">
|
||||
<div className="p-6">
|
||||
<BadgeLabel>{story.program}</BadgeLabel>
|
||||
<Heading as="h2" level={4} className="mt-3">
|
||||
{story.title}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { ContactDetails } from "@/components/molecules/ContactDetails";
|
||||
import { FormCard } from "@/components/molecules/FormCard";
|
||||
import { ContactInterestForm } from "@/components/organisms/ContactInterestForm";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { siteAddress } from "@/lib/site-config";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
@@ -24,49 +18,15 @@ export default async function ContactPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("contactTitle")} intro={t("contactIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-2">
|
||||
<div className="space-y-5 lg:pt-4">
|
||||
<Heading level={2}>اطلاعات تماس</Heading>
|
||||
<div className="space-y-3 text-sm leading-7 text-muted-foreground">
|
||||
<p>
|
||||
<span className="font-semibold text-foreground">آدرس: </span>
|
||||
{siteAddress.line}
|
||||
</p>
|
||||
<p dir="ltr">
|
||||
<span className="font-semibold text-foreground">تلفن: </span>
|
||||
{siteAddress.phone}
|
||||
</p>
|
||||
<p>
|
||||
<span className="font-semibold text-foreground">ایمیل: </span>
|
||||
<a
|
||||
href={`mailto:${siteAddress.email}`}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{siteAddress.email}
|
||||
</a>
|
||||
</p>
|
||||
<a
|
||||
href={siteAddress.mapUrl}
|
||||
className="inline-block text-primary hover:underline"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
مشاهده روی نقشه
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<Card className="rounded-2xl border-border/70 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle>ارسال پیام</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.2fr)] lg:items-start">
|
||||
<ContactDetails />
|
||||
<FormCard title="ارسال پیام">
|
||||
<ContactInterestForm
|
||||
submitLabel={t("submit")}
|
||||
successLabel={t("registerSuccess")}
|
||||
/>
|
||||
</FormCard>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -1,35 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ErrorState } from "@/components/organisms/ErrorState";
|
||||
|
||||
export default function MainError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
export default function MainError(props: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex min-h-[50vh] w-full max-w-7xl flex-col items-start justify-center px-5 py-20 sm:px-8 lg:px-12">
|
||||
<p className="text-sm font-semibold text-primary">خطا</p>
|
||||
<h1 className="mt-3 text-2xl font-bold tracking-tight sm:text-3xl">
|
||||
بارگذاری صفحه ناموفق بود
|
||||
</h1>
|
||||
<p className="mt-3 max-w-md text-base leading-relaxed text-muted-foreground">
|
||||
لطفاً دوباره تلاش کنید. اگر مشکل ادامه داشت، چند لحظه بعد بازگردید.
|
||||
</p>
|
||||
<div className="mt-8 flex flex-wrap gap-4">
|
||||
<Button type="button" onClick={reset}>
|
||||
تلاش مجدد
|
||||
</Button>
|
||||
<DotCta href="/">بازگشت به خانه</DotCta>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return <ErrorState {...props} />;
|
||||
}
|
||||
@@ -1,14 +1,23 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { CalendarDays, MapPin } from "lucide-react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { getEventById } from "@/lib/data/events";
|
||||
|
||||
type Props = { params: Promise<{ id: string }> };
|
||||
|
||||
const dateFormat: Intl.DateTimeFormatOptions = {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
};
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const event = await getEventById(id);
|
||||
@@ -21,36 +30,37 @@ export default async function EventDetailPage({ params }: Props) {
|
||||
const event = await getEventById(id);
|
||||
if (!event) notFound();
|
||||
|
||||
const start = new Date(event.startDate).toLocaleDateString("fa-IR", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
});
|
||||
const start = new Date(event.startDate).toLocaleDateString("fa-IR", dateFormat);
|
||||
const end = event.endDate
|
||||
? new Date(event.endDate).toLocaleDateString("fa-IR", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})
|
||||
? new Date(event.endDate).toLocaleDateString("fa-IR", dateFormat)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={event.title} intro={event.summary} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container narrow className="space-y-5 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border sm:p-10">
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">زمان: </span>
|
||||
{start}
|
||||
{end ? ` تا ${end}` : ""}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مکان: </span>
|
||||
{event.location}
|
||||
</p>
|
||||
<Heading level={3}>درباره رویداد</Heading>
|
||||
<p className="leading-8 text-foreground/90">{event.summary}</p>
|
||||
<TextLink href="/events">بازگشت به رویدادها</TextLink>
|
||||
<Section tone="subtle">
|
||||
<Container narrow className="space-y-6">
|
||||
<SurfaceCard padded as="div">
|
||||
<DetailList
|
||||
items={[
|
||||
{
|
||||
icon: CalendarDays,
|
||||
label: "زمان",
|
||||
value: end ? `${start} تا ${end}` : start,
|
||||
},
|
||||
{ icon: MapPin, label: "مکان", value: event.location },
|
||||
]}
|
||||
/>
|
||||
</SurfaceCard>
|
||||
<section className="space-y-4">
|
||||
<Heading level={3} as="h2">
|
||||
درباره رویداد
|
||||
</Heading>
|
||||
<p className="text-base leading-8 text-foreground/90">{event.summary}</p>
|
||||
</section>
|
||||
<TextLink href="/events" className="inline-block text-sm">
|
||||
بازگشت به رویدادها
|
||||
</TextLink>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function EventsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("eventsTitle")} intro={t("eventsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{events.map((event) => (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
|
||||
export default function FacultyPage() {
|
||||
redirect("https://mst.aut.ac.ir/content/31094/شبکه-اساتید");
|
||||
redirect(facultyNetworkUrl);
|
||||
}
|
||||
@@ -2,11 +2,9 @@ import type { Metadata } from "next";
|
||||
import Image from "next/image";
|
||||
import { notFound } from "next/navigation";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { BadgeLabel } from "@/components/atoms/BadgeLabel";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { getArticleById } from "@/lib/data/articles";
|
||||
import { JsonLd } from "@/lib/seo/json-ld";
|
||||
|
||||
@@ -39,21 +37,14 @@ export default async function InsightDetailPage({ params }: Props) {
|
||||
image: article.imageUrl,
|
||||
}}
|
||||
/>
|
||||
<Section tone="dark" className="relative overflow-hidden pb-16 pt-16 sm:pb-20 sm:pt-20">
|
||||
<MetamorphField tone="dark" density="sparse" className="opacity-35" />
|
||||
<Container narrow className="relative z-[1]">
|
||||
<BadgeLabel>{article.category}</BadgeLabel>
|
||||
<Heading as="h1" level={1} className="mt-4 text-background">
|
||||
{article.title}
|
||||
</Heading>
|
||||
<p className="mt-3 text-sm text-background/60">
|
||||
{article.author} · {date}
|
||||
</p>
|
||||
</Container>
|
||||
</Section>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40 pt-10">
|
||||
<PageHero
|
||||
eyebrow={article.category}
|
||||
title={article.title}
|
||||
intro={`${article.author} · ${date}`}
|
||||
/>
|
||||
<Section tone="subtle">
|
||||
<Container narrow>
|
||||
<div className="relative mb-10 aspect-[16/9] overflow-hidden rounded-2xl bg-muted shadow-xl">
|
||||
<div className="relative mb-10 aspect-[16/9] overflow-hidden rounded-2xl bg-muted ring-1 ring-foreground/10">
|
||||
<Image
|
||||
src={article.imageUrl}
|
||||
alt={article.title}
|
||||
@@ -63,8 +54,10 @@ export default async function InsightDetailPage({ params }: Props) {
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
<p className="text-lg leading-9 text-foreground/90">{article.body}</p>
|
||||
<TextLink href="/insights" className="mt-10 inline-block">
|
||||
<p className="text-base leading-8 text-foreground/90 sm:text-lg sm:leading-9">
|
||||
{article.body}
|
||||
</p>
|
||||
<TextLink href="/insights" className="mt-10 inline-block text-sm">
|
||||
بازگشت به مقالات
|
||||
</TextLink>
|
||||
</Container>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default async function InsightsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("insightsTitle")} intro={t("insightsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="mx-auto max-w-5xl">
|
||||
{articles.map((article) => (
|
||||
|
||||
@@ -7,7 +7,11 @@ import { getCourses } from "@/lib/data/courses";
|
||||
import { listPublishedCourseTags } from "@/lib/data/taxonomy";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import { getCampaignBanners } from "@/lib/data/site";
|
||||
import { siteShortName } from "@/lib/site-config";
|
||||
import {
|
||||
facultyNetworkUrl,
|
||||
facultySiteUrl,
|
||||
siteShortName,
|
||||
} from "@/lib/site-config";
|
||||
|
||||
// Public CMS pages must read Postgres at request time — static bake at Docker
|
||||
// build often has no DATABASE_URL and ships empty lists.
|
||||
@@ -42,12 +46,9 @@ export default async function MainLayout({
|
||||
<SiteHeader
|
||||
items={navItems}
|
||||
searchLabel={t("nav.search")}
|
||||
contactLabel={t("nav.contact")}
|
||||
brandTitle={siteShortName}
|
||||
brandSubtitle={t("nav.brandSubtitle")}
|
||||
academicsLabel={t("nav.academics")}
|
||||
programSelectorTitle={t("home.programSelectorTitle")}
|
||||
executiveLabel={t("home.executiveLabel")}
|
||||
exploreLabel={t("home.exploreOurPrograms")}
|
||||
variant="home"
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
@@ -58,6 +59,8 @@ export default async function MainLayout({
|
||||
copyright={t("footer.copyright", { year })}
|
||||
linksTitle={t("footer.links")}
|
||||
links={[
|
||||
{ label: t("footer.facultySite"), href: facultySiteUrl },
|
||||
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
|
||||
{ label: t("footer.press"), href: "/press" },
|
||||
{ label: t("footer.careers"), href: "/careers" },
|
||||
]}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import Link from "next/link";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<main id="main-content" className="bg-background">
|
||||
<Container className="flex min-h-[60vh] flex-col items-start justify-center py-20">
|
||||
<p className="text-sm font-bold text-primary sm:text-base">۴۰۴</p>
|
||||
<Heading as="h1" level={2} className="mt-3">
|
||||
صفحه مورد نظر یافت نشد
|
||||
</Heading>
|
||||
<p className="mt-4 max-w-md text-base leading-8 text-muted-foreground">
|
||||
ممکن است این صفحه جابهجا یا حذف شده باشد.
|
||||
</p>
|
||||
<div className="mt-8 flex flex-wrap gap-3">
|
||||
<Link href="/" className={cn(buttonVariants({ size: "lg" }), "font-bold")}>
|
||||
بازگشت به خانه
|
||||
</Link>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={buttonVariants({ variant: "outline", size: "lg" })}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
</div>
|
||||
</Container>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
+45
-71
@@ -1,14 +1,14 @@
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import {
|
||||
HomeEvents,
|
||||
HomeApproach,
|
||||
HomeCourseSearch,
|
||||
HomeHero,
|
||||
HomeIdeas,
|
||||
HomeRest,
|
||||
type HomeLabels,
|
||||
} from "@/components/templates/HomeTemplate";
|
||||
import { getFeaturedArticle } from "@/lib/data/articles";
|
||||
import { getEvents } from "@/lib/data/events";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import { getLatestCourses } from "@/lib/data/courses";
|
||||
import { getSiteStats, getTopics } from "@/lib/data/site";
|
||||
|
||||
async function getLabels(): Promise<HomeLabels> {
|
||||
@@ -31,84 +31,57 @@ async function getLabels(): Promise<HomeLabels> {
|
||||
findUsTitle: t("home.findUsTitle"),
|
||||
ideasEyebrow: t("home.ideasEyebrow"),
|
||||
linksTitle: t("footer.links"),
|
||||
exploreCourses: t("nav.exploreCourses"),
|
||||
};
|
||||
}
|
||||
|
||||
async function HeroSection() {
|
||||
async function orFallback<T>(
|
||||
label: string,
|
||||
load: () => Promise<T>,
|
||||
fallback: T,
|
||||
): Promise<T> {
|
||||
try {
|
||||
const [featured, labels] = await Promise.all([
|
||||
getFeaturedArticle(),
|
||||
getLabels(),
|
||||
]);
|
||||
return <HomeHero featured={featured} eyebrow={labels.ideasEyebrow} />;
|
||||
return await load();
|
||||
} catch (err) {
|
||||
console.error("[home] HeroSection failed:", err);
|
||||
const labels = await getLabels();
|
||||
return <HomeHero featured={null} eyebrow={labels.ideasEyebrow} />;
|
||||
console.error(`[home] ${label} failed:`, err);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
async function EventsSection() {
|
||||
try {
|
||||
const [events, labels] = await Promise.all([getEvents(), getLabels()]);
|
||||
return (
|
||||
<HomeEvents
|
||||
events={events}
|
||||
title={labels.eventsTitle}
|
||||
seeAllLabel={labels.seeAllEvents}
|
||||
/>
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[home] EventsSection failed:", err);
|
||||
const labels = await getLabels();
|
||||
return (
|
||||
<HomeEvents
|
||||
events={[]}
|
||||
title={labels.eventsTitle}
|
||||
seeAllLabel={labels.seeAllEvents}
|
||||
/>
|
||||
);
|
||||
}
|
||||
async function HeroSection() {
|
||||
const [featured, labels] = await Promise.all([
|
||||
orFallback("featured article", getFeaturedArticle, null),
|
||||
getLabels(),
|
||||
]);
|
||||
return <HomeHero featured={featured} eyebrow={labels.ideasEyebrow} />;
|
||||
}
|
||||
|
||||
async function CourseSearchSection() {
|
||||
const data = await orFallback(
|
||||
"latest courses",
|
||||
() =>
|
||||
Promise.all([getLatestCourses(6), getLabels()]),
|
||||
null,
|
||||
);
|
||||
if (!data) return null;
|
||||
const [courses, labels] = data;
|
||||
return (
|
||||
<HomeCourseSearch
|
||||
courses={courses}
|
||||
exploreLabel={labels.exploreCourses}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
async function RestSection() {
|
||||
try {
|
||||
const [programs, intersections, stats, labels] = await Promise.all([
|
||||
getPrograms(),
|
||||
getTopics(),
|
||||
getSiteStats(),
|
||||
getLabels(),
|
||||
]);
|
||||
const carouselPrograms = programs.filter((p) =>
|
||||
[
|
||||
"management-core",
|
||||
"evening-management",
|
||||
"executive",
|
||||
"leadership-fellows",
|
||||
"business-analytics",
|
||||
"finance",
|
||||
].includes(p.slug),
|
||||
);
|
||||
return (
|
||||
<HomeRest
|
||||
labels={labels}
|
||||
carouselPrograms={carouselPrograms}
|
||||
intersections={intersections}
|
||||
stats={stats}
|
||||
/>
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("[home] RestSection failed:", err);
|
||||
const labels = await getLabels();
|
||||
return (
|
||||
<HomeRest
|
||||
labels={labels}
|
||||
carouselPrograms={[]}
|
||||
intersections={[]}
|
||||
stats={[]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
const [intersections, stats, labels] = await Promise.all([
|
||||
orFallback("topics", getTopics, []),
|
||||
orFallback("site stats", getSiteStats, []),
|
||||
getLabels(),
|
||||
]);
|
||||
return (
|
||||
<HomeRest labels={labels} intersections={intersections} stats={stats} />
|
||||
);
|
||||
}
|
||||
|
||||
export default function HomePage() {
|
||||
@@ -116,7 +89,8 @@ export default function HomePage() {
|
||||
<main id="main-content">
|
||||
<HeroSection />
|
||||
<HomeIdeas />
|
||||
<EventsSection />
|
||||
<CourseSearchSection />
|
||||
<HomeApproach />
|
||||
<RestSection />
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -6,7 +6,10 @@ import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { CheckList } from "@/components/molecules/CheckList";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -43,66 +46,68 @@ export default async function ProgramDetailPage({ params }: Props) {
|
||||
intro={program.blurb}
|
||||
eyebrow={program.tagline}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]">
|
||||
<div>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="min-w-0 space-y-10">
|
||||
<p className="text-base leading-8 text-foreground/90">{program.body}</p>
|
||||
<Heading level={2} className="mt-10">
|
||||
{t("highlights")}
|
||||
</Heading>
|
||||
<ul className="mt-4 list-disc space-y-2 ps-5 text-sm leading-7">
|
||||
{program.highlights.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
{program.highlights.length > 0 ? (
|
||||
<section className="space-y-4">
|
||||
<Heading level={3} as="h2">
|
||||
{t("highlights")}
|
||||
</Heading>
|
||||
<CheckList items={program.highlights} />
|
||||
</section>
|
||||
) : null}
|
||||
</div>
|
||||
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مخاطب: </span>
|
||||
{program.audience}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">مدت: </span>
|
||||
{program.durationLabel}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
<span className="font-semibold">فرمت: </span>
|
||||
{program.formatLabel}
|
||||
</p>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants(), "w-full")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
<TextLink href="/programs" className="block text-sm">
|
||||
<aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
|
||||
<SurfaceCard padded as="div">
|
||||
<DetailList
|
||||
items={[
|
||||
{ label: "مخاطب", value: program.audience },
|
||||
{ label: "مدت", value: program.durationLabel },
|
||||
{ label: "فرمت", value: program.formatLabel },
|
||||
]}
|
||||
/>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "mt-6 w-full font-bold")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
</SurfaceCard>
|
||||
<TextLink href="/programs" className="block px-1 text-sm">
|
||||
{t("backToPrograms")}
|
||||
</TextLink>
|
||||
</aside>
|
||||
</Container>
|
||||
</Section>
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<Heading level={2}>{t("relatedCourses")}</Heading>
|
||||
<ul className="mt-6 grid gap-4 sm:grid-cols-3">
|
||||
{related.map((course) => (
|
||||
<li key={course.id}>
|
||||
<SurfaceCard padded="sm" as="div" className="h-full">
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="font-semibold hover:text-primary"
|
||||
>
|
||||
{course.title}
|
||||
{related.length > 0 ? (
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<SectionHeader title={t("relatedCourses")} />
|
||||
<ul className="grid gap-4 sm:grid-cols-3">
|
||||
{related.map((course) => (
|
||||
<li key={course.id}>
|
||||
<Link href={course.registrationUrl} className="group block h-full">
|
||||
<SurfaceCard padded as="div" interactive className="h-full">
|
||||
<Heading
|
||||
as="h3"
|
||||
level={4}
|
||||
className="transition-colors group-hover:text-primary"
|
||||
>
|
||||
{course.title}
|
||||
</Heading>
|
||||
<p className="mt-2 line-clamp-3 text-sm leading-7 text-muted-foreground">
|
||||
{course.summary}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</Link>
|
||||
<p className="mt-2 line-clamp-3 text-sm text-muted-foreground">
|
||||
{course.summary}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Container>
|
||||
</Section>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Container>
|
||||
</Section>
|
||||
) : null}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { BadgeLabel } from "@/components/atoms/BadgeLabel";
|
||||
import { DetailList } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -28,8 +30,8 @@ export default async function ProgramsPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("programsTitle")} intro={t("programsIntro")} />
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="space-y-10">
|
||||
<Section tone="subtle">
|
||||
<Container className="space-y-16">
|
||||
<ProgramGroup title={t("standardGroup")} items={standard} />
|
||||
<ProgramGroup title={t("executiveGroup")} items={executive} />
|
||||
</Container>
|
||||
@@ -45,40 +47,35 @@ function ProgramGroup({
|
||||
title: string;
|
||||
items: Awaited<ReturnType<typeof getPrograms>>;
|
||||
}) {
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<div>
|
||||
<Heading level={2} className="mb-6">
|
||||
{title}
|
||||
</Heading>
|
||||
<div className="grid gap-5 md:grid-cols-2">
|
||||
<SectionHeader title={title} className="mb-6 sm:mb-8" />
|
||||
<div className="grid gap-5 md:grid-cols-2">
|
||||
{items.map((program) => (
|
||||
<SurfaceCard key={program.id} className="flex flex-col rounded-2xl p-6 sm:p-7">
|
||||
<BadgeLabel className="w-fit">{program.tagline}</BadgeLabel>
|
||||
<SurfaceCard key={program.id} padded className="flex flex-col">
|
||||
{program.tagline ? (
|
||||
<BadgeLabel className="w-fit">{program.tagline}</BadgeLabel>
|
||||
) : null}
|
||||
<Heading as="h3" level={3} className="mt-3">
|
||||
<Link href={program.href} className="hover:text-primary">
|
||||
<Link href={program.href} className="transition-colors hover:text-primary">
|
||||
{program.title}
|
||||
</Link>
|
||||
</Heading>
|
||||
<p className="mt-2 flex-1 text-sm leading-relaxed text-muted-foreground">
|
||||
<p className="mt-2 flex-1 text-sm leading-7 text-muted-foreground">
|
||||
{program.blurb}
|
||||
</p>
|
||||
<dl className="mt-4 grid grid-cols-2 gap-2 text-xs text-muted-foreground">
|
||||
<div>
|
||||
<dt className="font-semibold text-foreground">مخاطب</dt>
|
||||
<dd>{program.audience}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold text-foreground">مدت</dt>
|
||||
<dd>{program.durationLabel}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="font-semibold text-foreground">فرمت</dt>
|
||||
<dd>{program.formatLabel}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<DetailList
|
||||
className="mt-5 border-t border-border pt-4"
|
||||
items={[
|
||||
{ label: "مخاطب", value: program.audience },
|
||||
{ label: "مدت", value: program.durationLabel },
|
||||
{ label: "فرمت", value: program.formatLabel },
|
||||
]}
|
||||
/>
|
||||
<Link
|
||||
href={program.href}
|
||||
className={cn(buttonVariants({ variant: "outline" }), "mt-5 w-fit")}
|
||||
className={cn(buttonVariants({ variant: "outline" }), "mt-6 w-fit")}
|
||||
>
|
||||
جزئیات برنامه
|
||||
</Link>
|
||||
|
||||
@@ -4,9 +4,10 @@ import { notFound } from "next/navigation";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { CheckList } from "@/components/molecules/CheckList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getTopicBySlug } from "@/lib/data/site";
|
||||
|
||||
@@ -31,25 +32,27 @@ export default async function TopicPage({ params }: Props) {
|
||||
intro={topic.description}
|
||||
imageUrl={topic.imageUrl}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid gap-10 lg:grid-cols-[2fr_1fr]">
|
||||
<div>
|
||||
<p className="text-base leading-8">{topic.body}</p>
|
||||
<ul className="mt-8 list-disc space-y-2 ps-5 text-sm">
|
||||
{topic.highlights.map((h) => (
|
||||
<li key={h}>{h}</li>
|
||||
))}
|
||||
</ul>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="min-w-0 space-y-8">
|
||||
<p className="text-base leading-8 text-foreground/90">{topic.body}</p>
|
||||
{topic.highlights.length > 0 ? (
|
||||
<CheckList items={topic.highlights} />
|
||||
) : null}
|
||||
</div>
|
||||
<aside className="h-fit space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
دورههای مرتبط با این موضوع را در فهرست دورههای کوتاه ببینید.
|
||||
</p>
|
||||
<Link href="/professional" className={cn(buttonVariants())}>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
<Separator />
|
||||
<TextLink href="/" className="block text-sm">
|
||||
<aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
|
||||
<SurfaceCard padded as="div">
|
||||
<p className="text-sm leading-7 text-muted-foreground">
|
||||
دورههای مرتبط با این موضوع را در فهرست دورههای کوتاه ببینید.
|
||||
</p>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "mt-5 w-full font-bold")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
</SurfaceCard>
|
||||
<TextLink href="/" className="block px-1 text-sm">
|
||||
بازگشت به خانه
|
||||
</TextLink>
|
||||
</aside>
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { valuesContent } from "@/lib/site-config";
|
||||
|
||||
const FA_INDEX = ["۱", "۲", "۳", "۴", "۵", "۶"] as const;
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return { title: t("valuesTitle"), description: valuesContent.intro };
|
||||
@@ -15,24 +21,57 @@ export default async function ValuesPage() {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
eyebrow="ارزشهای آموزشی ما"
|
||||
eyebrow={valuesContent.eyebrow}
|
||||
title={valuesContent.title}
|
||||
intro={valuesContent.intro}
|
||||
/>
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-5 sm:grid-cols-2">
|
||||
{valuesContent.items.map((item) => (
|
||||
<Card key={item.title} className="rounded-2xl border-border/70 shadow-sm transition-[box-shadow,border-color] hover:border-primary/20 hover:shadow-md">
|
||||
<CardHeader>
|
||||
<CardTitle>{item.title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm leading-7 text-muted-foreground">
|
||||
{item.text}
|
||||
<div className="grid gap-4 sm:grid-cols-2 xl:grid-cols-3">
|
||||
{valuesContent.items.map((item, index) => (
|
||||
<SurfaceCard key={item.title} padded>
|
||||
<p className="text-xs font-semibold text-primary/80">
|
||||
{FA_INDEX[index] ?? String(index + 1)}
|
||||
</p>
|
||||
<Heading as="h2" level={4} className="mt-2">
|
||||
{item.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{item.text}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<Container>
|
||||
<SectionHeader
|
||||
title={valuesContent.inPractice.title}
|
||||
description={valuesContent.inPractice.description}
|
||||
/>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{valuesContent.inPractice.examples.map((example) => (
|
||||
<Link
|
||||
key={example.href}
|
||||
href={example.href}
|
||||
className="group block min-w-0 rounded-xl focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50"
|
||||
>
|
||||
<SurfaceCard padded interactive className="h-full transition-shadow">
|
||||
<Heading as="h3" level={4} className="group-hover:text-primary">
|
||||
{example.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{example.text}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<span className="mt-4 inline-flex items-center gap-1.5 text-sm font-semibold text-primary">
|
||||
مشاهده دوره
|
||||
<ArrowLeft className="size-3.5 transition-transform group-hover:-translate-x-0.5" />
|
||||
</span>
|
||||
</SurfaceCard>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ENTITIES } from "@/lib/admin/entities";
|
||||
import { isAdminEntityEnabled } from "@/lib/admin/disabled-entities";
|
||||
import { GenericFilters } from "@/components/organisms/admin/generic/GenericFilters";
|
||||
import { GenericTable } from "@/components/organisms/admin/generic/GenericTable";
|
||||
import { FacultySyncButton } from "@/components/organisms/admin/FacultySyncButton";
|
||||
import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -32,15 +34,37 @@ export default async function AdminEntityListPage({
|
||||
|
||||
const rows = await spec.list({ search, published });
|
||||
|
||||
const description =
|
||||
entity === "faculty" ? (
|
||||
<>
|
||||
{rows.length} مورد
|
||||
{search ? ` مطابق فیلتر «${search}»` : ""}
|
||||
{" — "}
|
||||
<a
|
||||
href={facultyNetworkUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline-offset-4 hover:underline"
|
||||
>
|
||||
منبع: شبکه اساتید دانشکده
|
||||
</a>
|
||||
</>
|
||||
) : (
|
||||
`${rows.length} مورد${search ? ` مطابق فیلتر «${search}»` : ""}`
|
||||
);
|
||||
|
||||
return (
|
||||
<AdminPage>
|
||||
<AdminPageHeader
|
||||
title={spec.navLabel}
|
||||
description={`${rows.length} مورد${search ? ` مطابق فیلتر «${search}»` : ""}`}
|
||||
description={description}
|
||||
actions={
|
||||
<Link href={`/admin/${entity}/new`} className={cn(buttonVariants())}>
|
||||
+ {spec.noun} جدید
|
||||
</Link>
|
||||
<>
|
||||
{entity === "faculty" ? <FacultySyncButton /> : null}
|
||||
<Link href={`/admin/${entity}/new`} className={cn(buttonVariants())}>
|
||||
+ {spec.noun} جدید
|
||||
</Link>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { listAdminFaculty } from "@/lib/data/admin/cms";
|
||||
import {
|
||||
listAdminCourseCategories,
|
||||
listAdminCourseTags,
|
||||
@@ -18,10 +19,11 @@ export default async function EditCoursePage({
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
const [course, categories, tags] = await Promise.all([
|
||||
const [course, categories, tags, faculty] = await Promise.all([
|
||||
getAdminCourseById(id),
|
||||
listAdminCourseCategories(),
|
||||
listAdminCourseTags(),
|
||||
listAdminFaculty(),
|
||||
]);
|
||||
if (!course) notFound();
|
||||
|
||||
@@ -33,7 +35,16 @@ export default async function EditCoursePage({
|
||||
backHref="/admin/courses"
|
||||
backLabel="بازگشت به دورهها"
|
||||
/>
|
||||
<CourseForm initial={course} categories={categories} tags={tags} />
|
||||
<CourseForm
|
||||
initial={course}
|
||||
categories={categories}
|
||||
tags={tags}
|
||||
faculty={faculty.map((f) => ({
|
||||
id: f.id,
|
||||
name: f.name,
|
||||
title: f.title,
|
||||
}))}
|
||||
/>
|
||||
</AdminPage>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
AdminPage,
|
||||
AdminPageHeader,
|
||||
} from "@/components/organisms/admin/AdminPage";
|
||||
import { listAdminFaculty } from "@/lib/data/admin/cms";
|
||||
import {
|
||||
listAdminCourseCategories,
|
||||
listAdminCourseTags,
|
||||
@@ -11,9 +12,10 @@ import {
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function NewCoursePage() {
|
||||
const [categories, tags] = await Promise.all([
|
||||
const [categories, tags, faculty] = await Promise.all([
|
||||
listAdminCourseCategories(),
|
||||
listAdminCourseTags(),
|
||||
listAdminFaculty(),
|
||||
]);
|
||||
|
||||
return (
|
||||
@@ -24,7 +26,15 @@ export default async function NewCoursePage() {
|
||||
backHref="/admin/courses"
|
||||
backLabel="بازگشت به دورهها"
|
||||
/>
|
||||
<CourseForm categories={categories} tags={tags} />
|
||||
<CourseForm
|
||||
categories={categories}
|
||||
tags={tags}
|
||||
faculty={faculty.map((f) => ({
|
||||
id: f.id,
|
||||
name: f.name,
|
||||
title: f.title,
|
||||
}))}
|
||||
/>
|
||||
</AdminPage>
|
||||
);
|
||||
}
|
||||
@@ -12,7 +12,15 @@ export default async function AdminGuardLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await verifySession();
|
||||
let session: Awaited<ReturnType<typeof verifySession>> = null;
|
||||
try {
|
||||
session = await verifySession();
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"[admin/guard] session check failed:",
|
||||
err instanceof Error ? err.message : err,
|
||||
);
|
||||
}
|
||||
if (!session) {
|
||||
redirect("/admin/login");
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ function LoginForm() {
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
<div className="mx-auto relative size-14">
|
||||
<Image
|
||||
src="/brand/amirkabir.png"
|
||||
src="/brand/mst-faculty.png"
|
||||
alt="دانشگاه صنعتی امیرکبیر"
|
||||
fill
|
||||
sizes="56px"
|
||||
|
||||
@@ -8,6 +8,7 @@ import { revalidateSite } from "@/lib/api/revalidate";
|
||||
import { getAdminCourseById } from "@/lib/data/admin/courses";
|
||||
import {
|
||||
setCourseCategories,
|
||||
setCourseFaculty,
|
||||
setCourseTags,
|
||||
} from "@/lib/data/admin/taxonomy";
|
||||
|
||||
@@ -68,7 +69,7 @@ export async function PATCH(
|
||||
return errorResponse(parsed.error.issues[0]?.message ?? "داده نادرست", 400);
|
||||
}
|
||||
|
||||
const { categoryIds, tagIds, ...rest } = parsed.data;
|
||||
const { categoryIds, tagIds, facultyIds, ...rest } = parsed.data;
|
||||
const sets: string[] = [];
|
||||
const values: unknown[] = [];
|
||||
for (const [key, column] of Object.entries(COURSE_COLUMNS)) {
|
||||
@@ -83,7 +84,12 @@ export async function PATCH(
|
||||
}
|
||||
}
|
||||
|
||||
if (sets.length === 0 && categoryIds === undefined && tagIds === undefined) {
|
||||
if (
|
||||
sets.length === 0 &&
|
||||
categoryIds === undefined &&
|
||||
tagIds === undefined &&
|
||||
facultyIds === undefined
|
||||
) {
|
||||
return errorResponse("حداقل یک فیلد برای ویرایش لازم است", 400);
|
||||
}
|
||||
|
||||
@@ -106,6 +112,9 @@ export async function PATCH(
|
||||
if (tagIds !== undefined) {
|
||||
await setCourseTags(id, tagIds);
|
||||
}
|
||||
if (facultyIds !== undefined) {
|
||||
await setCourseFaculty(id, facultyIds);
|
||||
}
|
||||
|
||||
const course = await getAdminCourseById(id);
|
||||
revalidateSite();
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
} from "@/lib/data/admin/courses";
|
||||
import {
|
||||
setCourseCategories,
|
||||
setCourseFaculty,
|
||||
setCourseTags,
|
||||
} from "@/lib/data/admin/taxonomy";
|
||||
|
||||
@@ -83,6 +84,7 @@ export async function POST(request: NextRequest) {
|
||||
);
|
||||
await setCourseCategories(id, d.categoryIds ?? []);
|
||||
await setCourseTags(id, d.tagIds ?? []);
|
||||
await setCourseFaculty(id, d.facultyIds ?? []);
|
||||
const course = await getAdminCourseById(id);
|
||||
revalidateSite();
|
||||
return NextResponse.json({ ok: true, data: course }, { status: 201 });
|
||||
|
||||
@@ -21,6 +21,7 @@ const FACULTY_COLUMNS: Record<string, string> = {
|
||||
department: "department",
|
||||
linkedinUrl: "linkedin_url",
|
||||
scholarUrl: "scholar_url",
|
||||
profileUrl: "profile_url",
|
||||
published: "published",
|
||||
};
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ export async function POST(request: NextRequest) {
|
||||
[
|
||||
"id", "name", "title", "focus", "bio", "image_url",
|
||||
"email", "office", "phone", "department", "linkedin_url", "scholar_url",
|
||||
"published",
|
||||
"profile_url", "published",
|
||||
],
|
||||
[
|
||||
id, d.name, d.title, d.focus, d.bio, d.imageUrl,
|
||||
d.email || null, d.office || null, d.phone || null, d.department || null,
|
||||
d.linkedinUrl || null, d.scholarUrl || null,
|
||||
d.linkedinUrl || null, d.scholarUrl || null, d.profileUrl || null,
|
||||
d.published,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { requireAdmin } from "@/lib/auth/admin";
|
||||
import { errorResponse } from "@/lib/api/response";
|
||||
import { syncFacultyFromMstNetwork } from "@/lib/faculty/sync-mst-network";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const maxDuration = 60;
|
||||
|
||||
/**
|
||||
* POST /api/admin/faculty/sync
|
||||
* Pull the live «شبکه اساتید» page (same URL as header nav) and upsert rows.
|
||||
*/
|
||||
export async function POST() {
|
||||
const session = await requireAdmin();
|
||||
if (!session) return errorResponse("عدم دسترسی — ورود لازم است", 401);
|
||||
|
||||
try {
|
||||
const result = await syncFacultyFromMstNetwork();
|
||||
return NextResponse.json({
|
||||
ok: true,
|
||||
data: {
|
||||
...result,
|
||||
url: facultyNetworkUrl,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
const message =
|
||||
err instanceof Error ? err.message : "همگامسازی اساتید ناموفق بود";
|
||||
console.error("faculty sync error:", err);
|
||||
return errorResponse(message, 502);
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,13 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.json({ ok: true, user: { id: user.id, email: user.email, name: user.name, role: user.role } });
|
||||
} catch (error) {
|
||||
console.error("admin login error:", error);
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
if (/timeout|ECONNREFUSED|ECONNRESET|Connection terminated/i.test(message)) {
|
||||
return NextResponse.json(
|
||||
{ error: "اتصال به پایگاهداده برقرار نشد. چند ثانیه بعد دوباره تلاش کنید." },
|
||||
{ status: 503 },
|
||||
);
|
||||
}
|
||||
return NextResponse.json({ error: "خطای سرور" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
+15
-2
@@ -12,8 +12,8 @@
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-iransans);
|
||||
--font-heading: var(--font-iransans);
|
||||
--font-sans: var(--font-vazirmatn);
|
||||
--font-heading: var(--font-vazirmatn);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
@@ -220,6 +220,19 @@
|
||||
radial-gradient(circle at 90% 80%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 25%);
|
||||
}
|
||||
|
||||
/* Neural-field signal pulse along active synapses (MetamorphField) */
|
||||
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
|
||||
@keyframes metamorph-pulse {
|
||||
to {
|
||||
stroke-dashoffset: -126;
|
||||
}
|
||||
}
|
||||
|
||||
.metamorph-pulse {
|
||||
animation: metamorph-pulse 2.8s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scroll-driven reveals: desktop only — expensive while scrolling on phones */
|
||||
@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
|
||||
@supports (animation-timeline: view()) {
|
||||
|
||||
+15
-50
@@ -1,5 +1,5 @@
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import localFont from "next/font/local";
|
||||
import { Vazirmatn } from "next/font/google";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages, getTranslations } from "next-intl/server";
|
||||
import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld";
|
||||
@@ -11,51 +11,11 @@ export const viewport: Viewport = {
|
||||
viewportFit: "cover",
|
||||
};
|
||||
|
||||
const iranSans = localFont({
|
||||
src: [
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansUltraLight.woff2",
|
||||
weight: "200",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansLight.woff2",
|
||||
weight: "300",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSans.woff2",
|
||||
weight: "400",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansMedium.woff2",
|
||||
weight: "500",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansBold.woff2",
|
||||
weight: "600",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansBold.woff2",
|
||||
weight: "700",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansBold.woff2",
|
||||
weight: "800",
|
||||
style: "normal",
|
||||
},
|
||||
{
|
||||
path: "../fonts/iransans/IRANSansBold.woff2",
|
||||
weight: "900",
|
||||
style: "normal",
|
||||
},
|
||||
],
|
||||
variable: "--font-iransans",
|
||||
display: "optional",
|
||||
const vazirmatn = Vazirmatn({
|
||||
subsets: ["arabic", "latin"],
|
||||
variable: "--font-vazirmatn",
|
||||
display: "swap",
|
||||
weight: ["200", "300", "400", "500", "600", "700", "800", "900"],
|
||||
});
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@@ -70,8 +30,11 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
},
|
||||
description: t("homeDescription"),
|
||||
icons: {
|
||||
icon: [{ url: "/brand/amirkabir.png", type: "image/png" }],
|
||||
apple: [{ url: "/brand/amirkabir.png", type: "image/png" }],
|
||||
icon: [
|
||||
{ url: "/favicon.ico", sizes: "any" },
|
||||
{ url: "/brand/mst-faculty-icon.png", type: "image/png", sizes: "256x256" },
|
||||
],
|
||||
apple: [{ url: "/brand/mst-faculty-icon.png", type: "image/png" }],
|
||||
},
|
||||
openGraph: {
|
||||
type: "website",
|
||||
@@ -79,7 +42,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
siteName: t("homeTitle"),
|
||||
title: t("homeTitle"),
|
||||
description: t("homeDescription"),
|
||||
images: [{ url: "/brand/amirkabir.png", alt: "دانشگاه صنعتی امیرکبیر" }],
|
||||
images: [
|
||||
{ url: "/brand/mst-faculty.png", alt: "دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر" },
|
||||
],
|
||||
},
|
||||
alternates: {
|
||||
canonical: "/",
|
||||
@@ -98,7 +63,7 @@ export default async function RootLayout({
|
||||
const t = await getTranslations("nav");
|
||||
|
||||
return (
|
||||
<html lang={locale} dir="rtl" className={`${iranSans.variable} h-full`}>
|
||||
<html lang={locale} dir="rtl" className={`${vazirmatn.variable} h-full`}>
|
||||
<body className="flex min-h-full min-w-0 flex-col font-sans">
|
||||
<NextIntlClientProvider messages={messages}>
|
||||
<a
|
||||
|
||||
@@ -1,40 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ErrorState } from "@/components/organisms/ErrorState";
|
||||
|
||||
export default function ProfessionalError({
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
export default function ProfessionalError(props: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex min-h-[50vh] w-full max-w-7xl flex-col items-start justify-center bg-chart-3 px-5 py-20 text-background sm:px-8 lg:px-12">
|
||||
<p className="text-sm font-semibold text-accent">خطا</p>
|
||||
<h1 className="mt-3 text-2xl font-bold tracking-tight text-background sm:text-3xl">
|
||||
بارگذاری صفحه ناموفق بود
|
||||
</h1>
|
||||
<p className="mt-3 max-w-md text-background/70">لطفاً دوباره تلاش کنید.</p>
|
||||
<div className="mt-8 flex flex-wrap gap-4">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="border-background/60 bg-transparent text-background hover:bg-background hover:text-foreground"
|
||||
onClick={reset}
|
||||
>
|
||||
تلاش مجدد
|
||||
</Button>
|
||||
<DotCta href="/professional" onDark>
|
||||
بازگشت
|
||||
</DotCta>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return <ErrorState {...props} homeHref="/professional" />;
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import { listPublishedCourseTags } from "@/lib/data/taxonomy";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import {
|
||||
courseNavParentTag,
|
||||
facultyNetworkUrl,
|
||||
facultySiteUrl,
|
||||
professionalNav,
|
||||
siteShortName,
|
||||
} from "@/lib/site-config";
|
||||
@@ -47,12 +49,9 @@ export default async function ProfessionalLayout({
|
||||
<SiteHeader
|
||||
items={navItems}
|
||||
searchLabel={t("nav.search")}
|
||||
contactLabel={t("nav.contact")}
|
||||
brandTitle={siteShortName}
|
||||
brandSubtitle={t("nav.brandSubtitle")}
|
||||
academicsLabel={t("nav.academics")}
|
||||
programSelectorTitle={t("home.programSelectorTitle")}
|
||||
executiveLabel={t("home.executiveLabel")}
|
||||
exploreLabel={t("home.exploreOurPrograms")}
|
||||
variant="professional"
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
@@ -63,6 +62,8 @@ export default async function ProfessionalLayout({
|
||||
copyright={t("footer.copyright", { year })}
|
||||
linksTitle={t("footer.links")}
|
||||
links={[
|
||||
{ label: t("footer.facultySite"), href: facultySiteUrl },
|
||||
{ label: t("footer.facultyNetwork"), href: facultyNetworkUrl },
|
||||
{ label: t("footer.press"), href: "/press" },
|
||||
{ label: t("footer.careers"), href: "/careers" },
|
||||
]}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
listPublishedCourseCategories,
|
||||
listPublishedCourseTags,
|
||||
} from "@/lib/data/taxonomy";
|
||||
import { getSiteStats, getTestimonials } from "@/lib/data/site";
|
||||
import { getSiteStats } from "@/lib/data/site";
|
||||
import { courseJsonLd, JsonLd } from "@/lib/seo/json-ld";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@@ -33,14 +33,12 @@ export default async function ProfessionalPage({
|
||||
const { tag: tagRaw, category: categoryRaw } = await searchParams;
|
||||
const initialTag = tagRaw?.trim() ?? "";
|
||||
const initialCategory = categoryRaw?.trim() ?? "";
|
||||
const [courses, stats, testimonials, filterCategories, filterTags] =
|
||||
await Promise.all([
|
||||
getCourses(),
|
||||
getSiteStats(),
|
||||
getTestimonials(),
|
||||
listPublishedCourseCategories({ filterOnly: true }),
|
||||
listPublishedCourseTags({ filterOnly: true }),
|
||||
]);
|
||||
const [courses, stats, filterCategories, filterTags] = await Promise.all([
|
||||
getCourses(),
|
||||
getSiteStats(),
|
||||
listPublishedCourseCategories({ filterOnly: true }),
|
||||
listPublishedCourseTags({ filterOnly: true }),
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -59,11 +57,9 @@ export default async function ProfessionalPage({
|
||||
dppBody: t("professional.dppBody"),
|
||||
statsTitle: t("professional.statsTitle"),
|
||||
rankTitle: t("professional.rankTitle"),
|
||||
testimonialsTitle: t("professional.testimonialsTitle"),
|
||||
}}
|
||||
courses={courses}
|
||||
stats={stats}
|
||||
testimonials={testimonials}
|
||||
filterCategories={filterCategories}
|
||||
filterTags={filterTags}
|
||||
initialTag={initialTag}
|
||||
|
||||
@@ -2,7 +2,8 @@ import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const LOGO_SRC = "/brand/amirkabir.png";
|
||||
/** Faculty seal mark (transparent). Source: MST icon with side text removed. */
|
||||
const LOGO_SRC = "/brand/mst-faculty.png";
|
||||
|
||||
type BrandLogoProps = {
|
||||
href?: string;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const levels = {
|
||||
1: "text-3xl font-bold tracking-tight sm:text-4xl lg:text-5xl",
|
||||
2: "text-2xl font-bold tracking-tight sm:text-3xl",
|
||||
3: "text-lg font-semibold sm:text-xl",
|
||||
4: "text-base font-semibold sm:text-lg",
|
||||
1: "text-[1.65rem] font-bold leading-[1.45] tracking-tight text-pretty sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]",
|
||||
2: "text-2xl font-bold leading-snug tracking-tight text-pretty sm:text-3xl lg:text-4xl",
|
||||
3: "text-lg font-semibold leading-snug sm:text-xl",
|
||||
4: "text-base font-semibold leading-snug sm:text-lg",
|
||||
} as const;
|
||||
|
||||
type HeadingProps = React.ComponentProps<"h1"> & {
|
||||
|
||||
@@ -1,73 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type MetamorphFieldProps = {
|
||||
className?: string;
|
||||
/** `dark` = light strokes on navy/hero; `light` = ink strokes on sand/muted */
|
||||
tone?: "dark" | "light";
|
||||
/** Visual density of the constellation */
|
||||
/** Visual density of the neural field */
|
||||
density?: "sparse" | "normal";
|
||||
};
|
||||
|
||||
type Node = { x: number; y: number; r?: number };
|
||||
type Edge = [number, number];
|
||||
type Point = { x: number; y: number };
|
||||
|
||||
/** Landscape constellation — matches typical flex section bands (≈ 2.5∶1) */
|
||||
const NODES_NORMAL: Node[] = [
|
||||
{ x: 40, y: 60, r: 2.1 },
|
||||
{ x: 130, y: 36, r: 1.7 },
|
||||
{ x: 220, y: 88, r: 2.4 },
|
||||
{ x: 100, y: 140, r: 1.5 },
|
||||
{ x: 190, y: 168, r: 2.0 },
|
||||
{ x: 310, y: 110, r: 1.6 },
|
||||
{ x: 400, y: 48, r: 2.2 },
|
||||
{ x: 480, y: 130, r: 1.8 },
|
||||
{ x: 560, y: 70, r: 2.5 },
|
||||
{ x: 650, y: 150, r: 1.6 },
|
||||
{ x: 740, y: 40, r: 1.9 },
|
||||
{ x: 830, y: 120, r: 2.1 },
|
||||
{ x: 920, y: 64, r: 1.7 },
|
||||
{ x: 1010, y: 140, r: 2.0 },
|
||||
{ x: 1100, y: 90, r: 1.5 },
|
||||
{ x: 70, y: 240, r: 2.3 },
|
||||
{ x: 170, y: 280, r: 1.6 },
|
||||
{ x: 280, y: 230, r: 2.0 },
|
||||
{ x: 370, y: 300, r: 1.8 },
|
||||
{ x: 470, y: 250, r: 2.2 },
|
||||
{ x: 570, y: 310, r: 1.7 },
|
||||
{ x: 680, y: 260, r: 2.4 },
|
||||
{ x: 780, y: 320, r: 1.6 },
|
||||
{ x: 880, y: 270, r: 2.0 },
|
||||
{ x: 980, y: 330, r: 1.8 },
|
||||
{ x: 1080, y: 280, r: 2.1 },
|
||||
{ x: 120, y: 380, r: 1.5 },
|
||||
{ x: 250, y: 410, r: 2.2 },
|
||||
{ x: 390, y: 390, r: 1.7 },
|
||||
{ x: 530, y: 430, r: 2.0 },
|
||||
{ x: 670, y: 400, r: 1.9 },
|
||||
{ x: 810, y: 440, r: 1.6 },
|
||||
{ x: 950, y: 410, r: 2.3 },
|
||||
{ x: 1090, y: 450, r: 1.8 },
|
||||
];
|
||||
type Node = {
|
||||
id: number;
|
||||
x: number;
|
||||
y: number;
|
||||
r: number;
|
||||
layer: number;
|
||||
active: boolean;
|
||||
};
|
||||
|
||||
const EDGES_NORMAL: Edge[] = [
|
||||
[0, 1], [1, 2], [0, 3], [1, 3], [2, 4], [3, 4], [2, 5], [4, 5],
|
||||
[5, 6], [5, 7], [6, 7], [6, 8], [7, 8], [8, 9], [7, 9],
|
||||
[8, 10], [9, 11], [10, 11], [10, 12], [11, 12], [12, 13], [11, 13], [13, 14],
|
||||
[3, 15], [4, 16], [5, 17], [7, 18], [8, 19], [9, 20], [11, 21], [12, 22], [13, 23], [14, 24],
|
||||
[15, 16], [16, 17], [17, 18], [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25],
|
||||
[15, 26], [16, 27], [18, 28], [19, 29], [21, 30], [22, 31], [24, 32], [25, 33],
|
||||
[26, 27], [27, 28], [28, 29], [29, 30], [30, 31], [31, 32], [32, 33],
|
||||
];
|
||||
|
||||
const NODES_SPARSE = NODES_NORMAL.filter((_, i) => i % 2 === 0);
|
||||
const EDGES_SPARSE: Edge[] = [
|
||||
[0, 1], [1, 2], [0, 3], [2, 4], [3, 4], [3, 5], [4, 6], [5, 6],
|
||||
[5, 7], [6, 8], [7, 8], [7, 9], [8, 10], [9, 10], [9, 11], [10, 12],
|
||||
[11, 12], [11, 13], [12, 14], [13, 14], [13, 15], [14, 16], [15, 16],
|
||||
];
|
||||
type Synapse = {
|
||||
d: string;
|
||||
from: number;
|
||||
to: number;
|
||||
active: boolean;
|
||||
weight: number;
|
||||
};
|
||||
|
||||
const VIEW_W = 1200;
|
||||
const VIEW_H = 480;
|
||||
@@ -75,9 +36,123 @@ const VIEW_H = 480;
|
||||
const ENABLE_MQ =
|
||||
"(min-width: 768px) and (prefers-reduced-motion: no-preference)";
|
||||
|
||||
/** Deterministic pseudo-random in [0, 1) from a seed */
|
||||
function rand(seed: number) {
|
||||
const x = Math.sin(seed * 12.9898 + 78.233) * 43758.5453;
|
||||
return x - Math.floor(x);
|
||||
}
|
||||
|
||||
/** Organic cubic link between two nodes (not a straight chord). */
|
||||
function synapsePath(a: Point, b: Point, seed: number): string {
|
||||
const dx = b.x - a.x;
|
||||
const dy = b.y - a.y;
|
||||
const dist = Math.hypot(dx, dy) || 1;
|
||||
const nx = -dy / dist;
|
||||
const ny = dx / dist;
|
||||
const bulge = (rand(seed) - 0.5) * Math.min(90, dist * 0.45);
|
||||
const c1x = a.x + dx * 0.35 + nx * bulge;
|
||||
const c1y = a.y + dy * 0.35 + ny * bulge;
|
||||
const c2x = a.x + dx * 0.7 - nx * bulge * 0.55;
|
||||
const c2y = a.y + dy * 0.7 - ny * bulge * 0.55;
|
||||
return `M ${a.x.toFixed(1)} ${a.y.toFixed(1)} C ${c1x.toFixed(1)} ${c1y.toFixed(1)}, ${c2x.toFixed(1)} ${c2y.toFixed(1)}, ${b.x.toFixed(1)} ${b.y.toFixed(1)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorative constellation. Mounted only on desktop with motion allowed —
|
||||
* SMIL/CSS motion was too expensive on phones.
|
||||
* Soft layered neural net: nodes in columns, curved synapses between
|
||||
* adjacent layers — reads as an AI network while staying organic.
|
||||
*/
|
||||
function buildNetwork(density: "sparse" | "normal"): {
|
||||
nodes: Node[];
|
||||
synapses: Synapse[];
|
||||
} {
|
||||
const layerCounts =
|
||||
density === "sparse" ? [3, 4, 4, 3] : [4, 5, 6, 5, 3];
|
||||
const layers = layerCounts.length;
|
||||
const padX = density === "sparse" ? 110 : 80;
|
||||
const padY = 48;
|
||||
const nodes: Node[] = [];
|
||||
let id = 0;
|
||||
|
||||
for (let L = 0; L < layers; L++) {
|
||||
const count = layerCounts[L];
|
||||
const x =
|
||||
padX + (L / Math.max(1, layers - 1)) * (VIEW_W - padX * 2);
|
||||
for (let i = 0; i < count; i++) {
|
||||
const t = count === 1 ? 0.5 : i / (count - 1);
|
||||
const y = padY + t * (VIEW_H - padY * 2);
|
||||
const jitterX = (rand(id * 11 + 1) - 0.5) * 36;
|
||||
const jitterY = (rand(id * 11 + 2) - 0.5) * 28;
|
||||
const active = rand(id * 17) > 0.72;
|
||||
nodes.push({
|
||||
id,
|
||||
x: x + jitterX,
|
||||
y: y + jitterY,
|
||||
r: active ? 7.5 : 5.2 + rand(id * 3) * 2,
|
||||
layer: L,
|
||||
active,
|
||||
});
|
||||
id += 1;
|
||||
}
|
||||
}
|
||||
|
||||
const byLayer = layerCounts.map((_, L) =>
|
||||
nodes.filter((n) => n.layer === L),
|
||||
);
|
||||
const synapses: Synapse[] = [];
|
||||
let synSeed = 0;
|
||||
|
||||
for (let L = 0; L < layers - 1; L++) {
|
||||
const left = byLayer[L];
|
||||
const right = byLayer[L + 1];
|
||||
for (const a of left) {
|
||||
// Each neuron fans out to 2–3 targets in the next layer
|
||||
const fan = 2 + Math.floor(rand(a.id * 31) * 2);
|
||||
const ranked = [...right].sort(
|
||||
(p, q) =>
|
||||
Math.abs(p.y - a.y) + rand(a.id + p.id) * 20 -
|
||||
(Math.abs(q.y - a.y) + rand(a.id + q.id) * 20),
|
||||
);
|
||||
for (let k = 0; k < Math.min(fan, ranked.length); k++) {
|
||||
const b = ranked[k];
|
||||
const weight = 0.55 + rand(synSeed + 3) * 0.45;
|
||||
const active =
|
||||
(a.active || b.active) && rand(synSeed + 7) > 0.45;
|
||||
synapses.push({
|
||||
d: synapsePath(a, b, synSeed),
|
||||
from: a.id,
|
||||
to: b.id,
|
||||
active,
|
||||
weight,
|
||||
});
|
||||
synSeed += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A few skip connections (deeper net feel)
|
||||
if (layers >= 4) {
|
||||
const from = byLayer[0];
|
||||
const to = byLayer[layers - 1];
|
||||
for (let i = 0; i < Math.min(2, from.length, to.length); i++) {
|
||||
const a = from[i];
|
||||
const b = to[Math.min(to.length - 1, i + 1)];
|
||||
synapses.push({
|
||||
d: synapsePath(a, b, 900 + i),
|
||||
from: a.id,
|
||||
to: b.id,
|
||||
active: true,
|
||||
weight: 0.4,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return { nodes, synapses };
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorative neural-network field — layered nodes + curved synapses.
|
||||
* Evokes AI / learning systems without looking like a flowchart.
|
||||
* Desktop + motion only (SVG density is heavy on phones).
|
||||
*/
|
||||
export function MetamorphField({
|
||||
className,
|
||||
@@ -85,6 +160,10 @@ export function MetamorphField({
|
||||
density = "normal",
|
||||
}: MetamorphFieldProps) {
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const { nodes, synapses } = useMemo(
|
||||
() => buildNetwork(density),
|
||||
[density],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const mq = window.matchMedia(ENABLE_MQ);
|
||||
@@ -96,19 +175,27 @@ export function MetamorphField({
|
||||
|
||||
if (!enabled) return null;
|
||||
|
||||
const nodes = density === "sparse" ? NODES_SPARSE : NODES_NORMAL;
|
||||
const edges = density === "sparse" ? EDGES_SPARSE : EDGES_NORMAL;
|
||||
const stroke =
|
||||
tone === "dark" ? "color-mix(in oklab, white 55%, transparent)" : "var(--foreground)";
|
||||
const fill =
|
||||
tone === "dark" ? "color-mix(in oklab, white 70%, transparent)" : "var(--primary)";
|
||||
const edge =
|
||||
tone === "dark"
|
||||
? "color-mix(in oklab, white 42%, transparent)"
|
||||
: "color-mix(in oklab, var(--foreground) 36%, transparent)";
|
||||
const edgeActive =
|
||||
tone === "dark"
|
||||
? "color-mix(in oklab, var(--accent) 70%, white)"
|
||||
: "var(--primary)";
|
||||
const soma =
|
||||
tone === "dark"
|
||||
? "color-mix(in oklab, white 82%, transparent)"
|
||||
: "var(--foreground)";
|
||||
const accent = tone === "dark" ? "var(--accent)" : "var(--primary)";
|
||||
const core =
|
||||
tone === "dark" ? "var(--chart-3)" : "var(--background)";
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"pointer-events-none absolute inset-0 z-[1] overflow-hidden metamorph-field",
|
||||
tone === "light" ? "opacity-[0.14]" : "opacity-[0.42]",
|
||||
tone === "light" ? "opacity-[0.18]" : "opacity-[0.52]",
|
||||
className,
|
||||
)}
|
||||
aria-hidden
|
||||
@@ -120,35 +207,55 @@ export function MetamorphField({
|
||||
preserveAspectRatio="xMidYMid slice"
|
||||
focusable="false"
|
||||
>
|
||||
<g stroke={stroke} strokeWidth="0.9">
|
||||
{edges.map(([a, b], i) => {
|
||||
const n1 = nodes[a];
|
||||
const n2 = nodes[b];
|
||||
if (!n1 || !n2) return null;
|
||||
return (
|
||||
<line
|
||||
key={`e-${i}`}
|
||||
x1={n1.x}
|
||||
y1={n1.y}
|
||||
x2={n2.x}
|
||||
y2={n2.y}
|
||||
opacity="0.55"
|
||||
{synapses.map((s, i) => (
|
||||
<g key={`syn-${i}`}>
|
||||
<path
|
||||
d={s.d}
|
||||
stroke={s.active ? edgeActive : edge}
|
||||
strokeWidth={s.active ? 1.35 * s.weight : 1.05 * s.weight}
|
||||
strokeLinecap="round"
|
||||
opacity={s.active ? 0.55 : 0.28}
|
||||
/>
|
||||
{s.active ? (
|
||||
<path
|
||||
className="metamorph-pulse"
|
||||
d={s.d}
|
||||
stroke={accent}
|
||||
strokeWidth={2}
|
||||
strokeLinecap="round"
|
||||
strokeDasharray="6 120"
|
||||
opacity="0.85"
|
||||
style={{ animationDelay: `${(i % 7) * 0.35}s` }}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</g>
|
||||
<g>
|
||||
{nodes.map((n, i) => (
|
||||
) : null}
|
||||
</g>
|
||||
))}
|
||||
|
||||
{nodes.map((n) => (
|
||||
<g key={`n-${n.id}`}>
|
||||
<circle
|
||||
key={`n-${i}`}
|
||||
cx={n.x}
|
||||
cy={n.y}
|
||||
r={n.r ?? 2}
|
||||
fill={i % 5 === 0 ? accent : fill}
|
||||
opacity={i % 5 === 0 ? 0.85 : 0.7}
|
||||
r={n.r + 10}
|
||||
fill={n.active ? accent : soma}
|
||||
opacity={n.active ? 0.16 : 0.08}
|
||||
/>
|
||||
))}
|
||||
</g>
|
||||
<circle
|
||||
cx={n.x}
|
||||
cy={n.y}
|
||||
r={n.r}
|
||||
fill={n.active ? accent : soma}
|
||||
opacity={n.active ? 0.95 : 0.75}
|
||||
/>
|
||||
<circle
|
||||
cx={n.x}
|
||||
cy={n.y}
|
||||
r={n.r * 0.38}
|
||||
fill={core}
|
||||
opacity="0.5"
|
||||
/>
|
||||
</g>
|
||||
))}
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type SectionProps = React.ComponentProps<"section"> & {
|
||||
tone?: "default" | "muted" | "dark" | "accent";
|
||||
tone?: "default" | "subtle" | "muted" | "dark" | "accent";
|
||||
tight?: boolean;
|
||||
};
|
||||
|
||||
const tones = {
|
||||
default: "bg-background text-foreground",
|
||||
subtle: "bg-gradient-to-b from-background to-muted/40 text-foreground",
|
||||
muted: "bg-muted text-foreground",
|
||||
dark: "bg-chart-3 text-background",
|
||||
accent: "bg-primary text-primary-foreground",
|
||||
@@ -23,7 +24,7 @@ export function Section({
|
||||
data-tone={tone}
|
||||
className={cn(
|
||||
"motion-section relative min-w-0",
|
||||
tight ? "py-8 sm:py-10" : "py-16 sm:py-24",
|
||||
tight ? "py-10 sm:py-14" : "py-16 sm:py-24",
|
||||
tones[tone],
|
||||
className,
|
||||
)}
|
||||
|
||||
@@ -20,7 +20,7 @@ export function ProgramCard({
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<Card className={cn("group h-full gap-2 border-border/70 py-6 shadow-sm transition-[box-shadow,border-color] hover:border-primary/25 hover:shadow-lg", className)}>
|
||||
<Card className={cn("group h-full gap-2 py-6 hover:shadow-md hover:ring-primary/25", className)}>
|
||||
<CardHeader className="gap-1">
|
||||
{program.tagline ? (
|
||||
<p className="text-xs font-bold text-primary">{program.tagline}</p>
|
||||
@@ -219,38 +219,6 @@ export function EventCard({
|
||||
);
|
||||
}
|
||||
|
||||
export function StatItem({ value, label }: { value: string; label: string }) {
|
||||
return (
|
||||
<div className="text-center">
|
||||
<p className="text-4xl font-extrabold text-accent">{value}</p>
|
||||
<p className="mt-2 text-sm text-background/70">{label}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function QuoteBlock({
|
||||
quote,
|
||||
name,
|
||||
role,
|
||||
courseTitle,
|
||||
}: {
|
||||
quote: string;
|
||||
name: string;
|
||||
role: string;
|
||||
courseTitle: string;
|
||||
}) {
|
||||
return (
|
||||
<blockquote className="flex h-full flex-col rounded-xl bg-background/5 p-7 ring-1 ring-background/10">
|
||||
<p className="flex-1 text-sm leading-8 text-background/90">«{quote}»</p>
|
||||
<footer className="mt-7">
|
||||
<p className="font-bold text-background">{name}</p>
|
||||
<p className="mt-0.5 text-sm text-background/55">{role}</p>
|
||||
<p className="mt-2 text-xs font-semibold text-accent">{courseTitle}</p>
|
||||
</footer>
|
||||
</blockquote>
|
||||
);
|
||||
}
|
||||
|
||||
export function IntersectionCard({
|
||||
title,
|
||||
description,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { Check } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function CheckList({
|
||||
items,
|
||||
className,
|
||||
}: {
|
||||
items: string[];
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<ul className={cn("space-y-3", className)}>
|
||||
{items.map((item) => (
|
||||
<li key={item} className="flex items-start gap-3 text-base leading-8">
|
||||
<span className="mt-1.5 flex size-5 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary">
|
||||
<Check className="size-3" aria-hidden />
|
||||
</span>
|
||||
<span className="min-w-0 text-foreground/90">{item}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Mail, MapPin, Phone } from "lucide-react";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { siteAddress } from "@/lib/site-config";
|
||||
|
||||
const rowClass = "flex items-start gap-4";
|
||||
const iconClass =
|
||||
"flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary";
|
||||
|
||||
export function ContactDetails() {
|
||||
return (
|
||||
<div className="min-w-0 space-y-8">
|
||||
<Heading level={3} as="h2">
|
||||
اطلاعات تماس
|
||||
</Heading>
|
||||
<ul className="space-y-6 text-sm leading-7">
|
||||
<li className={rowClass}>
|
||||
<span className={iconClass}>
|
||||
<MapPin className="size-4" aria-hidden />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<p className="font-semibold text-foreground">آدرس</p>
|
||||
<p className="text-muted-foreground">{siteAddress.line}</p>
|
||||
<a
|
||||
href={siteAddress.mapUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="mt-1 inline-block font-medium text-primary underline-offset-4 hover:underline"
|
||||
>
|
||||
مشاهده روی نقشه
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<li className={rowClass}>
|
||||
<span className={iconClass}>
|
||||
<Phone className="size-4" aria-hidden />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<p className="font-semibold text-foreground">تلفن</p>
|
||||
<p className="text-muted-foreground">
|
||||
<span dir="ltr">{siteAddress.phone}</span>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li className={rowClass}>
|
||||
<span className={iconClass}>
|
||||
<Mail className="size-4" aria-hidden />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<p className="font-semibold text-foreground">ایمیل</p>
|
||||
<TextLink href={`mailto:${siteAddress.email}`} tone="accent">
|
||||
{siteAddress.email}
|
||||
</TextLink>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type DetailItem = {
|
||||
label: string;
|
||||
value: React.ReactNode;
|
||||
icon?: LucideIcon;
|
||||
emphasis?: boolean;
|
||||
};
|
||||
|
||||
/** Label/value rows for side panels and detail pages. */
|
||||
export function DetailList({
|
||||
items,
|
||||
className,
|
||||
}: {
|
||||
items: DetailItem[];
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<dl className={cn("divide-y divide-border text-sm", className)}>
|
||||
{items.map((item) => (
|
||||
<div
|
||||
key={item.label}
|
||||
className="flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0"
|
||||
>
|
||||
<dt className="flex items-center gap-2 text-muted-foreground">
|
||||
{item.icon ? (
|
||||
<item.icon className="size-4 shrink-0 text-primary" aria-hidden />
|
||||
) : null}
|
||||
{item.label}
|
||||
</dt>
|
||||
<dd
|
||||
className={cn(
|
||||
"text-end font-semibold",
|
||||
item.emphasis ? "text-primary" : "text-foreground",
|
||||
)}
|
||||
>
|
||||
{item.value}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** Public-site form wrapper (contact, register, legal pages). */
|
||||
export function FormCard({
|
||||
title,
|
||||
description,
|
||||
children,
|
||||
className,
|
||||
}: {
|
||||
title: string;
|
||||
description?: string;
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<Card className={cn("gap-0 py-0", className)}>
|
||||
<CardHeader className="gap-2 p-6 pb-0 sm:p-8 sm:pb-0">
|
||||
<CardTitle className="text-lg font-bold">{title}</CardTitle>
|
||||
{description ? (
|
||||
<CardDescription className="leading-7">{description}</CardDescription>
|
||||
) : null}
|
||||
</CardHeader>
|
||||
<CardContent className="p-6 sm:p-8">{children}</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import { ArrowLeft, GraduationCap } from "lucide-react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
@@ -17,41 +19,53 @@ export function HeroFeatured({
|
||||
}) {
|
||||
return (
|
||||
<header className="home-hero relative isolate overflow-hidden bg-chart-3 text-background">
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="sparse"
|
||||
className="end-0 start-auto w-[min(55vw,36rem)] opacity-20"
|
||||
/>
|
||||
<div className="pointer-events-none absolute inset-0 z-[1]" aria-hidden>
|
||||
<Image
|
||||
src="/brand/amirkabir-arches.png"
|
||||
alt=""
|
||||
fill
|
||||
priority
|
||||
className="scale-125 object-cover object-[62%_55%] opacity-[0.28] mix-blend-screen sm:scale-110 sm:object-[58%_50%] sm:opacity-[0.32]"
|
||||
sizes="100vw"
|
||||
/>
|
||||
{/* Unified navy wash — keeps text clear and softens the art */}
|
||||
<div className="absolute inset-0 bg-chart-3/45" />
|
||||
<div className="absolute inset-0 bg-gradient-to-l from-chart-3/90 via-chart-3/40 to-chart-3/25" />
|
||||
<div className="absolute inset-x-0 bottom-0 h-24 bg-gradient-to-t from-chart-3 to-transparent" />
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="sparse"
|
||||
className="opacity-[0.28]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Container className="relative z-[2] flex min-h-[34rem] min-w-0 items-center py-16 sm:min-h-[36rem] sm:py-20">
|
||||
<div className="home-hero__copy w-full min-w-0 max-w-4xl text-start">
|
||||
<div className="home-hero__copy w-full min-w-0 max-w-2xl text-start lg:max-w-3xl">
|
||||
<div className="inline-flex max-w-full items-start gap-2 text-sm font-medium text-background/60">
|
||||
<GraduationCap className="mt-0.5 size-4 shrink-0" />
|
||||
<span className="min-w-0 leading-7 text-pretty">
|
||||
مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه{"\u00A0"}صنعتی{"\u00A0"}امیرکبیر
|
||||
</span>
|
||||
</div>
|
||||
<h1 className="mt-6 max-w-4xl text-[1.65rem] font-black leading-[1.45] tracking-tight sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]">
|
||||
<Heading as="h1" level={1} className="mt-6 max-w-4xl">
|
||||
برای تصمیمهایی که{" "}
|
||||
<span className="whitespace-nowrap">صنعت را پیش میبرند</span>
|
||||
</h1>
|
||||
</Heading>
|
||||
<p className="mt-6 max-w-2xl border-t border-accent/60 pt-5 text-base leading-8 text-pretty text-background/65 sm:text-lg sm:leading-8">
|
||||
دانش امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی.
|
||||
دانش دانشگاه صنعتی امیرکبیر، پشتوانه رهبری نوآور در عصر داده و هوش{"\u00A0"}مصنوعی.
|
||||
</p>
|
||||
<div className="mt-9 flex flex-wrap gap-3">
|
||||
<Link
|
||||
href="/programs"
|
||||
className={cn(
|
||||
buttonVariants({ size: "lg" }),
|
||||
"bg-primary font-bold text-primary-foreground hover:bg-primary/85",
|
||||
)}
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "font-bold")}
|
||||
>
|
||||
مشاهده دورهها <ArrowLeft className="size-4" />
|
||||
</Link>
|
||||
<Link
|
||||
href="/about"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "outline", size: "lg" }),
|
||||
"border-background/25 bg-transparent font-bold text-background hover:bg-background hover:text-foreground",
|
||||
buttonVariants({ variant: "inverse", size: "lg" }),
|
||||
"font-bold",
|
||||
)}
|
||||
>
|
||||
درباره مرکز
|
||||
|
||||
@@ -2,50 +2,63 @@ import Image from "next/image";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function PageHero({
|
||||
title,
|
||||
intro,
|
||||
eyebrow,
|
||||
imageUrl,
|
||||
actions,
|
||||
size = "default",
|
||||
showField = true,
|
||||
}: {
|
||||
title: string;
|
||||
intro?: string;
|
||||
eyebrow?: string;
|
||||
imageUrl?: string;
|
||||
actions?: React.ReactNode;
|
||||
size?: "default" | "lg";
|
||||
/** Decorative line field; hide when a strong photo background is enough. */
|
||||
showField?: boolean;
|
||||
}) {
|
||||
const hasPhoto = Boolean(imageUrl);
|
||||
|
||||
return (
|
||||
<header className="page-hero relative isolate overflow-hidden bg-chart-3 py-16 text-background sm:py-24">
|
||||
{imageUrl ? (
|
||||
<>
|
||||
<Image
|
||||
src={imageUrl}
|
||||
alt=""
|
||||
fill
|
||||
priority
|
||||
className="object-cover opacity-25"
|
||||
sizes="100vw"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-l from-chart-3 via-chart-3/90 to-chart-3/60" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Image
|
||||
src="/brand/campus-collaboration-v1.png"
|
||||
alt=""
|
||||
fill
|
||||
priority
|
||||
className="object-cover opacity-15 grayscale"
|
||||
sizes="100vw"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-l from-chart-3 via-chart-3/95 to-chart-3/75" />
|
||||
</>
|
||||
<header
|
||||
className={cn(
|
||||
"page-hero relative isolate flex items-center overflow-hidden bg-chart-3 text-background",
|
||||
size === "lg"
|
||||
? "min-h-[34rem] py-16 sm:min-h-[38rem] sm:py-20"
|
||||
: "py-16 sm:py-24",
|
||||
)}
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="normal"
|
||||
className="end-0 start-auto w-[min(75vw,42rem)] opacity-45"
|
||||
>
|
||||
<Image
|
||||
src={imageUrl ?? "/brand/campus-collaboration-v1.png"}
|
||||
alt=""
|
||||
fill
|
||||
priority
|
||||
className={cn(
|
||||
"object-cover",
|
||||
hasPhoto ? "opacity-45" : "opacity-15 grayscale",
|
||||
)}
|
||||
sizes="100vw"
|
||||
/>
|
||||
<div
|
||||
className={cn(
|
||||
"absolute inset-0",
|
||||
hasPhoto
|
||||
? "bg-gradient-to-l from-chart-3 via-chart-3/85 to-chart-3/55"
|
||||
: "bg-gradient-to-l from-chart-3 via-chart-3/90 to-chart-3/65",
|
||||
)}
|
||||
/>
|
||||
{showField ? (
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="normal"
|
||||
className="end-0 start-auto w-[min(75vw,42rem)] opacity-40"
|
||||
/>
|
||||
) : null}
|
||||
<div className="absolute end-0 top-0 h-px w-1/3 bg-gradient-to-l from-accent to-transparent" />
|
||||
<Container className="relative z-[2] min-w-0">
|
||||
<div className="page-hero__content w-full min-w-0 max-w-4xl text-start">
|
||||
@@ -54,11 +67,7 @@ export function PageHero({
|
||||
{eyebrow}
|
||||
</p>
|
||||
) : null}
|
||||
<Heading
|
||||
as="h1"
|
||||
level={1}
|
||||
className="max-w-4xl text-[1.65rem] leading-[1.45] text-pretty text-background sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]"
|
||||
>
|
||||
<Heading as="h1" level={1} className="max-w-4xl text-background">
|
||||
{title}
|
||||
</Heading>
|
||||
{intro ? (
|
||||
@@ -66,6 +75,9 @@ export function PageHero({
|
||||
{intro}
|
||||
</p>
|
||||
) : null}
|
||||
{actions ? (
|
||||
<div className="mt-8 flex flex-wrap gap-3">{actions}</div>
|
||||
) : null}
|
||||
</div>
|
||||
</Container>
|
||||
</header>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/**
|
||||
* Eyebrow + title + description for every content section.
|
||||
* `inverse` is for `Section` tones `dark` / `accent`.
|
||||
*/
|
||||
export function SectionHeader({
|
||||
eyebrow,
|
||||
title,
|
||||
description,
|
||||
inverse = false,
|
||||
align = "start",
|
||||
as = "h2",
|
||||
className,
|
||||
}: {
|
||||
eyebrow?: string;
|
||||
title: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
inverse?: boolean;
|
||||
align?: "start" | "center";
|
||||
as?: "h1" | "h2";
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"mb-10 max-w-3xl min-w-0 sm:mb-12",
|
||||
align === "center" && "mx-auto text-center",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{eyebrow ? (
|
||||
<p
|
||||
className={cn(
|
||||
"text-sm font-bold sm:text-base",
|
||||
inverse ? "text-accent" : "text-primary",
|
||||
)}
|
||||
>
|
||||
{eyebrow}
|
||||
</p>
|
||||
) : null}
|
||||
<Heading
|
||||
as={as}
|
||||
level={2}
|
||||
className={cn(
|
||||
"break-words",
|
||||
eyebrow && "mt-3",
|
||||
inverse && "text-current",
|
||||
)}
|
||||
>
|
||||
{title}
|
||||
</Heading>
|
||||
{description ? (
|
||||
<p
|
||||
className={cn(
|
||||
"mt-4 text-base leading-8 sm:text-lg sm:leading-8",
|
||||
inverse ? "opacity-75" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{description}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { AnimatedMetric } from "@/components/atoms/AnimatedMetric";
|
||||
import type { SiteStat } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function StatGrid({
|
||||
stats,
|
||||
inverse = false,
|
||||
className,
|
||||
}: {
|
||||
stats: SiteStat[];
|
||||
inverse?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={cn("grid min-w-0 gap-8 sm:grid-cols-3", className)}>
|
||||
{stats.map((stat) => (
|
||||
<div key={stat.id} className="min-w-0 text-center">
|
||||
<p
|
||||
className={cn(
|
||||
"text-4xl font-extrabold tabular-nums sm:text-5xl",
|
||||
inverse ? "text-accent" : "text-primary",
|
||||
)}
|
||||
>
|
||||
<AnimatedMetric value={stat.value} />
|
||||
</p>
|
||||
<p
|
||||
className={cn(
|
||||
"mt-2 text-sm",
|
||||
inverse ? "text-background/70" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{stat.label}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -7,6 +7,8 @@ type SurfaceCardProps = {
|
||||
id?: string;
|
||||
padded?: boolean | "sm" | "md" | "lg";
|
||||
as?: "article" | "div";
|
||||
/** Hover feedback; only for cards that are (or contain) a primary link. */
|
||||
interactive?: boolean;
|
||||
};
|
||||
|
||||
const padClass = {
|
||||
@@ -23,13 +25,15 @@ export function SurfaceCard({
|
||||
children,
|
||||
id,
|
||||
as = "article",
|
||||
interactive = false,
|
||||
}: SurfaceCardProps) {
|
||||
return (
|
||||
<Card
|
||||
id={id}
|
||||
data-slot={as === "div" ? "surface-div" : "surface-article"}
|
||||
className={cn(
|
||||
"gap-0 border-border/70 bg-card py-0 shadow-sm transition-[box-shadow,border-color] hover:border-primary/20 hover:shadow-md",
|
||||
"gap-0 bg-card py-0",
|
||||
interactive && "hover:shadow-md hover:ring-primary/25",
|
||||
padded !== false &&
|
||||
padClass[padded === true ? "true" : (padded as "sm" | "md" | "lg")],
|
||||
className,
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useDeferredValue, useMemo, useState } from "react";
|
||||
import { useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||
import { Search, X } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -19,11 +20,23 @@ import type { Course, TaxonomyRef } from "@/lib/types";
|
||||
import {
|
||||
courseCatalogHref,
|
||||
courseCategoryHref,
|
||||
courseFilterHref,
|
||||
courseTagHref,
|
||||
} from "@/lib/course-nav";
|
||||
import { formatCoursePrice, formatLabel } from "@/lib/labels";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const categoryChipClass =
|
||||
"h-9 shrink-0 rounded-full px-4 text-sm font-semibold whitespace-nowrap";
|
||||
const categoryChipIdle =
|
||||
"text-background/70 hover:bg-background/10 hover:text-background";
|
||||
const tagChipClass =
|
||||
"h-7 shrink-0 rounded-full border px-3 text-xs whitespace-nowrap";
|
||||
const tagChipIdle =
|
||||
"border-background/15 bg-transparent text-background/65 hover:border-background/35 hover:bg-transparent hover:text-background";
|
||||
const tagChipActive =
|
||||
"border-primary bg-primary/20 text-background hover:bg-primary/30";
|
||||
|
||||
export function CategoryCourseExplorer({
|
||||
courses,
|
||||
findLabel,
|
||||
@@ -47,35 +60,50 @@ export function CategoryCourseExplorer({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const searchParams = useSearchParams();
|
||||
const onCatalogPage = pathname.startsWith("/professional");
|
||||
|
||||
// URL is source of truth on the catalog page; home keeps local filter state.
|
||||
const urlTag = searchParams.get("tag")?.trim() ?? "";
|
||||
const urlCategory = searchParams.get("category")?.trim() ?? "";
|
||||
|
||||
const [query, setQuery] = useState("");
|
||||
const [categorySlug, setCategorySlug] = useState(initialCategory);
|
||||
const [tagSlug, setTagSlug] = useState(initialTag);
|
||||
const [searchOpen, setSearchOpen] = useState(false);
|
||||
const [localCategory, setLocalCategory] = useState(initialCategory);
|
||||
const [localTag, setLocalTag] = useState(initialTag);
|
||||
const deferredQuery = useDeferredValue(query);
|
||||
const isStale = query !== deferredQuery;
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const syncUrl = (nextTag: string, nextCategory: string) => {
|
||||
if (pathname !== "/professional" && !pathname.startsWith("/professional")) {
|
||||
const categorySlug = onCatalogPage ? urlCategory : localCategory;
|
||||
const tagSlug = onCatalogPage ? urlTag : localTag;
|
||||
|
||||
useEffect(() => {
|
||||
if (searchOpen) {
|
||||
searchInputRef.current?.focus();
|
||||
}
|
||||
}, [searchOpen]);
|
||||
|
||||
/** Navigate (catalog) or update local state (home). */
|
||||
const applyFilters = (nextTag: string, nextCategory: string) => {
|
||||
if (onCatalogPage) {
|
||||
router.push(courseFilterHref({ tag: nextTag, category: nextCategory }), {
|
||||
scroll: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const params = new URLSearchParams();
|
||||
if (nextTag) params.set("tag", nextTag);
|
||||
if (nextCategory) params.set("category", nextCategory);
|
||||
const qs = params.toString();
|
||||
router.replace(qs ? `/professional?${qs}` : courseCatalogHref(), {
|
||||
scroll: false,
|
||||
});
|
||||
setLocalTag(nextTag);
|
||||
setLocalCategory(nextCategory);
|
||||
};
|
||||
|
||||
const selectTag = (slug: string) => {
|
||||
const next = tagSlug === slug ? "" : slug;
|
||||
setTagSlug(next);
|
||||
syncUrl(next, categorySlug);
|
||||
applyFilters(next, categorySlug);
|
||||
};
|
||||
|
||||
const selectCategory = (slug: string) => {
|
||||
const next = categorySlug === slug ? "" : slug;
|
||||
setCategorySlug(next);
|
||||
syncUrl(tagSlug, next);
|
||||
applyFilters(tagSlug, next);
|
||||
};
|
||||
|
||||
const filtered = useMemo(() => {
|
||||
@@ -93,188 +121,158 @@ export function CategoryCourseExplorer({
|
||||
});
|
||||
}, [courses, categorySlug, tagSlug, deferredQuery]);
|
||||
|
||||
const hasFilters = tagSlug !== "" || categorySlug !== "" || query !== "";
|
||||
|
||||
const resetFilters = () => {
|
||||
setCategorySlug("");
|
||||
setTagSlug("");
|
||||
setQuery("");
|
||||
syncUrl("", "");
|
||||
setSearchOpen(false);
|
||||
applyFilters("", "");
|
||||
};
|
||||
|
||||
const activeCategory = filterCategories.find((c) => c.slug === categorySlug);
|
||||
const activeTag = filterTags.find((t) => t.slug === tagSlug);
|
||||
const closeSearch = () => {
|
||||
setSearchOpen(false);
|
||||
setQuery("");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<form
|
||||
className="flex flex-col gap-3 sm:flex-row"
|
||||
onSubmit={(e) => e.preventDefault()}
|
||||
role="search"
|
||||
>
|
||||
<Label className="sr-only" htmlFor="course-search">
|
||||
{findLabel}
|
||||
</Label>
|
||||
<Input
|
||||
id="course-search"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder={findLabel}
|
||||
className="h-11 flex-1 border-border bg-background text-foreground placeholder:text-muted-foreground"
|
||||
/>
|
||||
<Button type="submit" className="h-11">
|
||||
جستجو
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
{filterCategories.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
<span className="text-sm font-semibold text-background/80">
|
||||
{categoriesLabel}
|
||||
</span>
|
||||
<div
|
||||
className="flex flex-wrap gap-2"
|
||||
role="tablist"
|
||||
aria-label={categoriesLabel}
|
||||
>
|
||||
<Button
|
||||
type="button"
|
||||
role="tab"
|
||||
size="sm"
|
||||
variant={categorySlug === "" ? "default" : "ghost"}
|
||||
aria-selected={categorySlug === ""}
|
||||
onClick={() => {
|
||||
setCategorySlug("");
|
||||
syncUrl(tagSlug, "");
|
||||
}}
|
||||
className={cn(
|
||||
categorySlug !== "" &&
|
||||
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||
)}
|
||||
<div className="rounded-2xl bg-background/5 p-2 ring-1 ring-background/10">
|
||||
<div className="flex h-11 items-center gap-2">
|
||||
{searchOpen ? (
|
||||
<form
|
||||
className="animate-in fade-in slide-in-from-left-4 flex h-full min-w-0 flex-1 items-center gap-2 duration-200"
|
||||
onSubmit={(e) => e.preventDefault()}
|
||||
role="search"
|
||||
>
|
||||
همه
|
||||
</Button>
|
||||
{filterCategories.map((item) => (
|
||||
<Label className="sr-only" htmlFor="course-search">
|
||||
{findLabel}
|
||||
</Label>
|
||||
<div className="relative h-full min-w-0 flex-1">
|
||||
<Search
|
||||
className="pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-background/50"
|
||||
aria-hidden
|
||||
/>
|
||||
<Input
|
||||
ref={searchInputRef}
|
||||
id="course-search"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape") closeSearch();
|
||||
}}
|
||||
placeholder={findLabel}
|
||||
className="h-full rounded-full border-0 bg-background/10 ps-10 pe-3 text-background placeholder:text-background/45 focus-visible:ring-1 focus-visible:ring-background/30"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
size="sm"
|
||||
variant={categorySlug === item.slug ? "default" : "ghost"}
|
||||
aria-selected={categorySlug === item.slug}
|
||||
onClick={() => selectCategory(item.slug)}
|
||||
className={cn(
|
||||
categorySlug !== item.slug &&
|
||||
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||
)}
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-10 shrink-0 rounded-full text-background/70 hover:bg-background/10 hover:text-background"
|
||||
aria-label="بستن جستجو"
|
||||
onClick={closeSearch}
|
||||
>
|
||||
{item.label}
|
||||
<X className="size-5" />
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{filterTags.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-sm font-semibold text-background/80">
|
||||
{tagsLabel}
|
||||
</span>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant={tagSlug === "" ? "default" : "ghost"}
|
||||
aria-selected={tagSlug === ""}
|
||||
onClick={() => {
|
||||
setTagSlug("");
|
||||
syncUrl("", categorySlug);
|
||||
}}
|
||||
className={cn(
|
||||
tagSlug !== "" &&
|
||||
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||
)}
|
||||
>
|
||||
همه
|
||||
</Button>
|
||||
{filterTags.map((item) => (
|
||||
</form>
|
||||
) : (
|
||||
<div className="animate-in fade-in flex h-full min-w-0 flex-1 items-center gap-2 duration-200">
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
size="sm"
|
||||
variant={tagSlug === item.slug ? "default" : "ghost"}
|
||||
aria-selected={tagSlug === item.slug}
|
||||
onClick={() => selectTag(item.slug)}
|
||||
className={cn(
|
||||
tagSlug !== item.slug &&
|
||||
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||
)}
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-10 shrink-0 rounded-full bg-background/10 text-background hover:bg-background/20 hover:text-background"
|
||||
aria-label={findLabel}
|
||||
onClick={() => setSearchOpen(true)}
|
||||
>
|
||||
{item.label}
|
||||
<Search className="size-[1.125rem]" />
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
{filterCategories.length > 0 ? (
|
||||
<>
|
||||
<span
|
||||
className="h-6 w-px shrink-0 bg-background/15"
|
||||
aria-hidden
|
||||
/>
|
||||
<div
|
||||
className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
role="tablist"
|
||||
aria-label={categoriesLabel}
|
||||
>
|
||||
<Button
|
||||
type="button"
|
||||
role="tab"
|
||||
variant={categorySlug === "" ? "default" : "ghost"}
|
||||
aria-selected={categorySlug === ""}
|
||||
onClick={() => applyFilters(tagSlug, "")}
|
||||
className={cn(
|
||||
categoryChipClass,
|
||||
categorySlug !== "" && categoryChipIdle,
|
||||
)}
|
||||
>
|
||||
همه دورهها
|
||||
</Button>
|
||||
{filterCategories.map((item) => (
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
variant={categorySlug === item.slug ? "default" : "ghost"}
|
||||
aria-selected={categorySlug === item.slug}
|
||||
onClick={() => selectCategory(item.slug)}
|
||||
className={cn(
|
||||
categoryChipClass,
|
||||
categorySlug !== item.slug && categoryChipIdle,
|
||||
)}
|
||||
>
|
||||
{item.label}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{(tagSlug !== "" || categorySlug !== "") && (
|
||||
<div className="flex flex-wrap items-center gap-2 text-xs text-background/60">
|
||||
<span>فیلترهای فعال:</span>
|
||||
{activeCategory ? (
|
||||
<Badge variant="secondary" className="gap-1 py-0.5 pe-1">
|
||||
{activeCategory.label}
|
||||
{filterTags.length > 0 || hasFilters ? (
|
||||
<div className="mt-2 flex flex-wrap items-center gap-1.5 border-t border-background/10 px-2 pt-2.5 pb-0.5">
|
||||
{filterTags.length > 0 ? (
|
||||
<>
|
||||
<span className="me-1 text-xs text-background/45">
|
||||
{tagsLabel}
|
||||
</span>
|
||||
{filterTags.map((item) => {
|
||||
const active = tagSlug === item.slug;
|
||||
return (
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
variant="outline"
|
||||
aria-pressed={active}
|
||||
onClick={() => selectTag(item.slug)}
|
||||
className={cn(
|
||||
tagChipClass,
|
||||
active ? tagChipActive : tagChipIdle,
|
||||
)}
|
||||
>
|
||||
{item.label}
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
) : null}
|
||||
{hasFilters ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setCategorySlug("");
|
||||
syncUrl(tagSlug, "");
|
||||
}}
|
||||
className="rounded-full p-0.5 hover:bg-foreground/10"
|
||||
aria-label="حذف فیلتر دسته"
|
||||
onClick={resetFilters}
|
||||
className="ms-auto text-xs text-background/55 underline-offset-4 transition-colors hover:text-background hover:underline"
|
||||
>
|
||||
×
|
||||
پاککردن فیلترها
|
||||
</button>
|
||||
</Badge>
|
||||
) : null}
|
||||
{activeTag ? (
|
||||
<Badge variant="secondary" className="gap-1 py-0.5 pe-1">
|
||||
{activeTag.label}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setTagSlug("");
|
||||
syncUrl("", categorySlug);
|
||||
}}
|
||||
className="rounded-full p-0.5 hover:bg-foreground/10"
|
||||
aria-label="حذف فیلتر تگ"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</Badge>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
onClick={resetFilters}
|
||||
className="underline underline-offset-4 hover:text-background"
|
||||
>
|
||||
پاککردن همه
|
||||
</button>
|
||||
{activeTag ? (
|
||||
<Link
|
||||
href={courseTagHref(activeTag.slug)}
|
||||
className="sr-only"
|
||||
>
|
||||
{activeTag.label}
|
||||
</Link>
|
||||
) : null}
|
||||
{activeCategory ? (
|
||||
<Link
|
||||
href={courseCategoryHref(activeCategory.slug)}
|
||||
className="sr-only"
|
||||
>
|
||||
{activeCategory.label}
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{filtered.length === 0 ? (
|
||||
<p className="py-10 text-center text-sm text-background/60">
|
||||
@@ -292,51 +290,90 @@ export function CategoryCourseExplorer({
|
||||
return (
|
||||
<Card
|
||||
key={course.id}
|
||||
className="gap-0 overflow-hidden bg-background/5 py-0 text-background ring-background/10"
|
||||
className="group relative gap-0 overflow-hidden bg-background/5 py-0 text-background ring-background/10 transition-colors hover:ring-background/30"
|
||||
>
|
||||
<div className="relative aspect-[16/10] overflow-hidden">
|
||||
{/* Full-card hit target sits under content; badges use pointer-events-auto */}
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="absolute inset-0 z-0"
|
||||
aria-label={course.title}
|
||||
/>
|
||||
<div className="pointer-events-none relative aspect-[16/10] overflow-hidden">
|
||||
<Image
|
||||
src={course.posterImageUrl}
|
||||
alt={course.title}
|
||||
alt=""
|
||||
fill
|
||||
className="object-cover"
|
||||
className="object-cover transition-transform duration-300 group-hover:scale-[1.03]"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="gap-1 px-4 pt-4">
|
||||
<CardHeader className="pointer-events-none relative z-[1] gap-1 px-4 pt-4">
|
||||
<CardTitle className="text-base text-background">
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="transition-opacity hover:opacity-90"
|
||||
>
|
||||
{course.title}
|
||||
</Link>
|
||||
{course.title}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3 px-4 pb-4">
|
||||
<CardContent className="pointer-events-none relative z-[1] space-y-3 px-4 pb-4">
|
||||
<CardDescription className="line-clamp-3 text-background/70">
|
||||
{course.summary}
|
||||
</CardDescription>
|
||||
{(course.categories.length > 0 || course.tags.length > 0) && (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
{course.categories.map((c) => (
|
||||
<Badge
|
||||
key={`cat:${c.id}`}
|
||||
variant="outline"
|
||||
className="border-background/25 text-[10px] text-background/80"
|
||||
>
|
||||
{c.label}
|
||||
</Badge>
|
||||
))}
|
||||
{course.tags.map((t) => (
|
||||
<Badge
|
||||
key={`tag:${t.id}`}
|
||||
variant="outline"
|
||||
className="border-background/25 text-[10px] text-background/80"
|
||||
>
|
||||
{t.label}
|
||||
</Badge>
|
||||
))}
|
||||
<div className="pointer-events-auto flex flex-wrap gap-1.5">
|
||||
{course.categories.map((c) => {
|
||||
const href = onCatalogPage
|
||||
? courseCategoryHref(
|
||||
categorySlug === c.slug ? "" : c.slug,
|
||||
tagSlug,
|
||||
)
|
||||
: courseCategoryHref(c.slug);
|
||||
const active = categorySlug === c.slug;
|
||||
return (
|
||||
<Link
|
||||
key={`cat:${c.id}`}
|
||||
href={href || courseCatalogHref()}
|
||||
className="relative z-[2]"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
aria-current={active ? "true" : undefined}
|
||||
>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={cn(
|
||||
"cursor-pointer border-background/25 text-[11px] font-semibold text-background/90 hover:bg-background/15",
|
||||
active && "border-accent bg-accent/20 text-background",
|
||||
)}
|
||||
>
|
||||
{c.label}
|
||||
</Badge>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
{course.tags.map((t) => {
|
||||
const href = onCatalogPage
|
||||
? courseTagHref(
|
||||
tagSlug === t.slug ? "" : t.slug,
|
||||
categorySlug,
|
||||
)
|
||||
: courseTagHref(t.slug);
|
||||
const active = tagSlug === t.slug;
|
||||
return (
|
||||
<Link
|
||||
key={`tag:${t.id}`}
|
||||
href={href || courseCatalogHref()}
|
||||
className="relative z-[2]"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
aria-current={active ? "true" : undefined}
|
||||
>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className={cn(
|
||||
"cursor-pointer border-background/25 text-[10px] text-background/75 hover:bg-background/15",
|
||||
active && "border-accent bg-accent/20 text-background",
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
</Badge>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-xs text-background/55">
|
||||
@@ -351,12 +388,9 @@ export function CategoryCourseExplorer({
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="inline-flex text-sm font-semibold text-background underline-offset-4 hover:underline"
|
||||
>
|
||||
<span className="inline-flex text-sm font-semibold text-background underline-offset-4 group-hover:underline">
|
||||
جزئیات و ثبتنام
|
||||
</Link>
|
||||
</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -54,7 +54,7 @@ export function ContactInterestForm({
|
||||
|
||||
if (sent) {
|
||||
return (
|
||||
<p className="rounded-lg border border-primary/25 bg-primary/5 p-4 text-sm text-chart-2">
|
||||
<p className="rounded-xl border border-primary/25 bg-primary/5 p-4 text-sm leading-7 text-foreground">
|
||||
{successLabel}
|
||||
</p>
|
||||
);
|
||||
@@ -63,7 +63,7 @@ export function ContactInterestForm({
|
||||
return (
|
||||
<form className="space-y-4" onSubmit={handleSubmit}>
|
||||
{error && (
|
||||
<p className="rounded-lg bg-destructive/10 p-3 text-sm text-red-600" role="alert">
|
||||
<p className="rounded-xl bg-destructive/10 p-3 text-sm text-destructive" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
@@ -129,7 +129,7 @@ export function ContactInterestForm({
|
||||
rows={4}
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" disabled={loading}>
|
||||
<Button type="submit" size="lg" className="w-full font-bold" disabled={loading}>
|
||||
{loading ? "در حال ارسال..." : submitLabel}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -34,45 +34,41 @@ export function CourseRegisterGate({
|
||||
}: CourseRegisterGateProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
if (!open) {
|
||||
return (
|
||||
<div className="space-y-4 rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-lg font-bold tracking-tight">{formTitle}</h2>
|
||||
<p className="text-sm leading-7 text-muted-foreground">{hint}</p>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
size="lg"
|
||||
className="w-full font-bold"
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
{ctaLabel}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card className="rounded-2xl border-border/70 shadow-lg" id="register-form">
|
||||
<CardHeader className="space-y-1">
|
||||
<CardTitle>{formTitle}</CardTitle>
|
||||
<CardDescription>{formDescription}</CardDescription>
|
||||
<Card id="register-form" className="gap-0 py-0">
|
||||
<CardHeader className="gap-2 p-6 pb-0">
|
||||
<CardTitle className="text-lg font-bold">{formTitle}</CardTitle>
|
||||
<CardDescription className="leading-7">
|
||||
{open ? formDescription : hint}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<ContactInterestForm
|
||||
courseSlug={courseSlug}
|
||||
submitLabel={submitLabel}
|
||||
successLabel={successLabel}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
className="w-full"
|
||||
onClick={() => setOpen(false)}
|
||||
>
|
||||
{cancelLabel}
|
||||
</Button>
|
||||
<CardContent className="space-y-3 p-6">
|
||||
{open ? (
|
||||
<>
|
||||
<ContactInterestForm
|
||||
courseSlug={courseSlug}
|
||||
submitLabel={submitLabel}
|
||||
successLabel={successLabel}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
className="w-full"
|
||||
onClick={() => setOpen(false)}
|
||||
>
|
||||
{cancelLabel}
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
type="button"
|
||||
size="lg"
|
||||
className="w-full font-bold"
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
{ctaLabel}
|
||||
</Button>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
|
||||
export function ErrorState({
|
||||
error,
|
||||
reset,
|
||||
homeHref = "/",
|
||||
}: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
homeHref?: string;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<main id="main-content" className="bg-background">
|
||||
<Container className="flex min-h-[60vh] flex-col items-start justify-center py-20">
|
||||
<p className="text-sm font-bold text-primary sm:text-base">خطا</p>
|
||||
<Heading as="h1" level={2} className="mt-3">
|
||||
بارگذاری صفحه ناموفق بود
|
||||
</Heading>
|
||||
<p className="mt-4 max-w-md text-base leading-8 text-muted-foreground">
|
||||
لطفاً دوباره تلاش کنید. اگر مشکل ادامه داشت، چند لحظه بعد بازگردید.
|
||||
</p>
|
||||
<div className="mt-8 flex flex-wrap gap-3">
|
||||
<Button type="button" size="lg" className="font-bold" onClick={reset}>
|
||||
تلاش مجدد
|
||||
</Button>
|
||||
<Link
|
||||
href={homeHref}
|
||||
className={buttonVariants({ variant: "outline", size: "lg" })}
|
||||
>
|
||||
بازگشت
|
||||
</Link>
|
||||
</div>
|
||||
</Container>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -56,17 +56,19 @@ export function SiteFooter({
|
||||
تماس
|
||||
</p>
|
||||
<div className="space-y-1.5 text-sm text-background/75">
|
||||
<p dir="ltr">
|
||||
<p>
|
||||
<a
|
||||
href={`tel:${siteAddress.phone}`}
|
||||
dir="ltr"
|
||||
className="transition-colors hover:text-background"
|
||||
>
|
||||
{siteAddress.phone}
|
||||
</a>
|
||||
</p>
|
||||
<p dir="ltr">
|
||||
<p>
|
||||
<a
|
||||
href={`mailto:${siteAddress.email}`}
|
||||
dir="ltr"
|
||||
className="transition-colors hover:text-background"
|
||||
>
|
||||
{siteAddress.email}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
import Link from "next/link";
|
||||
import { ChevronDown, Menu, X } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
@@ -18,14 +17,6 @@ import { SearchOverlay } from "@/components/organisms/SearchOverlay";
|
||||
import type { Course, NavItem, Program } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const AcademicsOverlay = dynamic(
|
||||
() =>
|
||||
import("@/components/organisms/AcademicsOverlay").then(
|
||||
(m) => m.AcademicsOverlay,
|
||||
),
|
||||
{ ssr: false },
|
||||
);
|
||||
|
||||
function NavLink({
|
||||
item,
|
||||
isDark,
|
||||
@@ -62,7 +53,7 @@ function NavDropdown({
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger
|
||||
className={cn(
|
||||
"inline-flex cursor-pointer items-center gap-1 rounded-lg px-2.5 py-2 text-sm font-semibold transition-colors outline-none",
|
||||
"inline-flex cursor-pointer items-center gap-1 rounded-lg px-3 py-2 text-sm font-semibold transition-colors outline-none",
|
||||
isDark
|
||||
? "text-background/80 hover:text-background"
|
||||
: "text-foreground/75 hover:bg-muted hover:text-primary",
|
||||
@@ -73,13 +64,12 @@ function NavDropdown({
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent className="z-[60] w-56 p-1" align="start">
|
||||
{children.map((child) => (
|
||||
<DropdownMenuItem key={`nav:${child.href}:${child.label}`} className="p-0">
|
||||
<Link
|
||||
href={child.href}
|
||||
className="w-full cursor-pointer px-1.5 py-1.5"
|
||||
>
|
||||
{child.label}
|
||||
</Link>
|
||||
<DropdownMenuItem
|
||||
key={`nav:${child.href}:${child.label}`}
|
||||
className="cursor-pointer"
|
||||
render={<Link href={child.href} />}
|
||||
>
|
||||
{child.label}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
@@ -90,35 +80,26 @@ function NavDropdown({
|
||||
export function SiteHeader({
|
||||
items,
|
||||
searchLabel,
|
||||
contactLabel,
|
||||
brandHref = "/",
|
||||
brandTitle,
|
||||
brandSubtitle,
|
||||
academicsLabel,
|
||||
programSelectorTitle,
|
||||
executiveLabel,
|
||||
exploreLabel,
|
||||
variant = "home",
|
||||
courses = [],
|
||||
programs = [],
|
||||
}: {
|
||||
items: NavItem[];
|
||||
searchLabel: string;
|
||||
contactLabel: string;
|
||||
brandHref?: string;
|
||||
brandTitle: string;
|
||||
brandSubtitle?: string;
|
||||
academicsLabel: string;
|
||||
programSelectorTitle: string;
|
||||
executiveLabel: string;
|
||||
exploreLabel: string;
|
||||
variant?: "home" | "professional";
|
||||
courses?: Course[];
|
||||
programs?: Program[];
|
||||
}) {
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
const [academicsOpen, setAcademicsOpen] = useState(false);
|
||||
const isDark = variant === "professional";
|
||||
const standardPrograms = programs.filter((p) => p.group === "standard");
|
||||
const executivePrograms = programs.filter((p) => p.group === "executive");
|
||||
|
||||
useEffect(() => {
|
||||
if (!mobileOpen) return;
|
||||
@@ -139,7 +120,7 @@ export function SiteHeader({
|
||||
: "border-b border-border bg-card/95 text-foreground",
|
||||
)}
|
||||
>
|
||||
<Container className="flex h-[4.5rem] min-w-0 items-center justify-start gap-2 sm:h-20 sm:gap-5" dir="rtl">
|
||||
<Container className="flex h-[4.5rem] min-w-0 items-center justify-start gap-3 sm:h-20 sm:gap-6" dir="rtl">
|
||||
<BrandLogo
|
||||
href={brandHref}
|
||||
title={brandTitle}
|
||||
@@ -149,7 +130,7 @@ export function SiteHeader({
|
||||
/>
|
||||
|
||||
<nav
|
||||
className="hidden min-w-0 flex-1 items-center justify-start gap-0.5 xl:flex"
|
||||
className="hidden min-w-0 flex-1 items-center justify-start gap-2 xl:flex"
|
||||
aria-label="منوی اصلی"
|
||||
>
|
||||
{items.map((item) => {
|
||||
@@ -163,25 +144,13 @@ export function SiteHeader({
|
||||
/>
|
||||
);
|
||||
}
|
||||
return item.prominent ? (
|
||||
return (
|
||||
<NavLink
|
||||
key={itemKey}
|
||||
item={item}
|
||||
isDark={isDark}
|
||||
className={cn(
|
||||
"ms-1 inline-flex items-center rounded-md border px-2.5 py-1 text-xs font-bold shadow-sm transition-all",
|
||||
isDark
|
||||
? "border-primary-foreground/30 bg-primary-foreground/10 text-primary-foreground hover:bg-primary-foreground hover:text-primary"
|
||||
: "border-primary/30 bg-primary/10 text-primary hover:bg-primary hover:text-primary-foreground",
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
<NavLink
|
||||
key={itemKey}
|
||||
item={item}
|
||||
isDark={isDark}
|
||||
className={cn(
|
||||
"rounded-lg px-2.5 py-2 text-sm font-semibold transition-colors",
|
||||
"rounded-lg px-3 py-2 text-sm font-semibold transition-colors",
|
||||
isDark
|
||||
? "text-background/80 hover:text-background"
|
||||
: "text-foreground/75 hover:bg-muted hover:text-primary",
|
||||
@@ -189,26 +158,25 @@ export function SiteHeader({
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className={cn(
|
||||
"ms-2 h-9 border-primary/20 font-bold text-primary hover:bg-primary hover:text-primary-foreground",
|
||||
isDark &&
|
||||
"border-background/50 bg-transparent text-background hover:bg-background hover:text-foreground",
|
||||
)}
|
||||
onClick={() => setAcademicsOpen(true)}
|
||||
>
|
||||
{academicsLabel}
|
||||
</Button>
|
||||
</nav>
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
"ms-auto flex shrink-0 items-center gap-0.5 xl:ms-0",
|
||||
"ms-auto flex shrink-0 items-center gap-2 xl:ms-0",
|
||||
isDark && "text-background",
|
||||
)}
|
||||
>
|
||||
<Link
|
||||
href="/contact"
|
||||
className={cn(
|
||||
"hidden rounded-lg px-3 py-2 text-sm font-semibold transition-colors sm:inline-flex",
|
||||
isDark
|
||||
? "text-background/80 hover:text-background"
|
||||
: "text-foreground/75 hover:bg-muted hover:text-primary",
|
||||
)}
|
||||
>
|
||||
{contactLabel}
|
||||
</Link>
|
||||
<SearchOverlay
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
@@ -284,42 +252,25 @@ export function SiteHeader({
|
||||
<NavLink
|
||||
item={item}
|
||||
isDark
|
||||
className={cn(
|
||||
"block py-3.5 text-lg font-bold transition-colors hover:text-background/70",
|
||||
item.prominent &&
|
||||
"inline-block text-primary underline underline-offset-4",
|
||||
)}
|
||||
className="block py-3.5 text-lg font-bold transition-colors hover:text-background/70"
|
||||
onClick={() => setMobileOpen(false)}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
<li>
|
||||
<Link
|
||||
href="/contact"
|
||||
className="block py-3.5 text-lg font-bold transition-colors hover:text-background/70"
|
||||
onClick={() => setMobileOpen(false)}
|
||||
>
|
||||
{contactLabel}
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<Button
|
||||
variant="outline"
|
||||
className="mt-8 w-full border-background/80 bg-transparent py-3.5 text-background hover:bg-background hover:text-foreground"
|
||||
onClick={() => {
|
||||
setMobileOpen(false);
|
||||
setAcademicsOpen(true);
|
||||
}}
|
||||
>
|
||||
{academicsLabel}
|
||||
</Button>
|
||||
</Container>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{academicsOpen ? (
|
||||
<AcademicsOverlay
|
||||
open={academicsOpen}
|
||||
onClose={() => setAcademicsOpen(false)}
|
||||
title={programSelectorTitle}
|
||||
executiveLabel={executiveLabel}
|
||||
exploreLabel={exploreLabel}
|
||||
standardPrograms={standardPrograms}
|
||||
executivePrograms={executivePrograms}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export function AdminShell({
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<span className="relative size-6 shrink-0 md:hidden">
|
||||
<Image
|
||||
src="/brand/amirkabir.png"
|
||||
src="/brand/mst-faculty.png"
|
||||
alt=""
|
||||
fill
|
||||
sizes="24px"
|
||||
|
||||
@@ -110,7 +110,7 @@ export function AdminSidebar({ userName }: { userName: string }) {
|
||||
>
|
||||
<span className="relative size-8 shrink-0">
|
||||
<Image
|
||||
src="/brand/amirkabir.png"
|
||||
src="/brand/mst-faculty.png"
|
||||
alt=""
|
||||
fill
|
||||
sizes="32px"
|
||||
@@ -121,7 +121,7 @@ export function AdminSidebar({ userName }: { userName: string }) {
|
||||
<div className="grid flex-1 text-start text-sm leading-tight">
|
||||
<span className="truncate font-semibold">پنل مدیریت</span>
|
||||
<span className="truncate text-xs text-muted-foreground">
|
||||
آموزش آزاد امیرکبیر
|
||||
آموزش آزاد دانشگاه صنعتی امیرکبیر
|
||||
</span>
|
||||
</div>
|
||||
</SidebarMenuButton>
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState, useTransition } from "react";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
type SyncPayload = {
|
||||
ok?: boolean;
|
||||
error?: string;
|
||||
data?: {
|
||||
total: number;
|
||||
inserted: number;
|
||||
updated: number;
|
||||
imagesSaved: number;
|
||||
};
|
||||
};
|
||||
|
||||
export function FacultySyncButton() {
|
||||
const router = useRouter();
|
||||
const [pending, startTransition] = useTransition();
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [message, setMessage] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
async function onSync() {
|
||||
setBusy(true);
|
||||
setMessage(null);
|
||||
setError(null);
|
||||
try {
|
||||
const res = await fetch("/api/admin/faculty/sync", { method: "POST" });
|
||||
const body = (await res.json()) as SyncPayload;
|
||||
if (!res.ok || !body.ok || !body.data) {
|
||||
setError(body.error ?? "همگامسازی ناموفق بود");
|
||||
return;
|
||||
}
|
||||
const { total, inserted, updated, imagesSaved } = body.data;
|
||||
setMessage(
|
||||
`${total} استاد خوانده شد — ${inserted} جدید، ${updated} بهروز` +
|
||||
(imagesSaved > 0 ? `، ${imagesSaved} تصویر` : ""),
|
||||
);
|
||||
startTransition(() => {
|
||||
router.refresh();
|
||||
});
|
||||
} catch {
|
||||
setError("ارتباط با سرور برقرار نشد");
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
const loading = busy || pending;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-stretch gap-1.5 sm:items-end">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={onSync}
|
||||
disabled={loading}
|
||||
className="gap-2"
|
||||
>
|
||||
<RefreshCw className={loading ? "size-4 animate-spin" : "size-4"} />
|
||||
{loading ? "در حال بروزرسانی…" : "بروزرسانی از شبکه اساتید"}
|
||||
</Button>
|
||||
{message ? (
|
||||
<p className="max-w-xs text-xs text-muted-foreground" role="status">
|
||||
{message}
|
||||
</p>
|
||||
) : null}
|
||||
{error ? (
|
||||
<p className="max-w-xs text-xs text-destructive" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export function LeadsList({ leads }: { leads: LeadForDashboard[] }) {
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{error && (
|
||||
<p className="text-sm text-red-600" role="alert">
|
||||
<p className="text-sm text-destructive" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -22,12 +22,15 @@ import type { AdminCourseCategory, AdminCourseTag } from "@/lib/data/admin/taxon
|
||||
import { AdminFormCard } from "@/components/organisms/admin/AdminPage";
|
||||
import { ImageUploadField } from "@/components/organisms/admin/ImageUploadField";
|
||||
|
||||
type FacultyOption = { id: string; name: string; title: string };
|
||||
|
||||
type Payload = {
|
||||
slug: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
categoryIds: string[];
|
||||
tagIds: string[];
|
||||
facultyIds: string[];
|
||||
durationHours: number | null;
|
||||
format: string;
|
||||
price: number | null;
|
||||
@@ -42,13 +45,19 @@ interface CourseFormProps {
|
||||
initial?: AdminCourse;
|
||||
categories: AdminCourseCategory[];
|
||||
tags: AdminCourseTag[];
|
||||
faculty: FacultyOption[];
|
||||
}
|
||||
|
||||
function toggleId(ids: string[], id: string): string[] {
|
||||
return ids.includes(id) ? ids.filter((x) => x !== id) : [...ids, id];
|
||||
}
|
||||
|
||||
export function CourseForm({ initial, categories, tags }: CourseFormProps) {
|
||||
export function CourseForm({
|
||||
initial,
|
||||
categories,
|
||||
tags,
|
||||
faculty,
|
||||
}: CourseFormProps) {
|
||||
const router = useRouter();
|
||||
const isEdit = Boolean(initial);
|
||||
const [form, setForm] = useState<Payload>({
|
||||
@@ -57,6 +66,7 @@ export function CourseForm({ initial, categories, tags }: CourseFormProps) {
|
||||
summary: initial?.summary ?? "",
|
||||
categoryIds: initial?.categoryIds ?? [],
|
||||
tagIds: initial?.tagIds ?? [],
|
||||
facultyIds: initial?.facultyIds ?? [],
|
||||
durationHours: initial?.durationHours ?? null,
|
||||
format: initial?.format ?? "in-person",
|
||||
price: initial?.price ?? null,
|
||||
@@ -345,6 +355,62 @@ export function CourseForm({ initial, categories, tags }: CourseFormProps) {
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>اساتید (رفرنس دانشکده)</Label>
|
||||
{faculty.length === 0 ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
هنوز استادی تعریف نشده. از «اساتید» در ادمین اضافه کنید و لینک
|
||||
صفحه دانشکده را وارد کنید.
|
||||
</p>
|
||||
) : (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{faculty.map((item) => {
|
||||
const active = form.facultyIds.includes(item.id);
|
||||
return (
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
size="sm"
|
||||
variant={active ? "default" : "outline"}
|
||||
aria-pressed={active}
|
||||
onClick={() =>
|
||||
set("facultyIds", toggleId(form.facultyIds, item.id))
|
||||
}
|
||||
className="h-8 px-3 text-xs"
|
||||
>
|
||||
{item.name}
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{form.facultyIds.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-1.5 pt-1">
|
||||
{form.facultyIds.map((id) => {
|
||||
const item = faculty.find((f) => f.id === id);
|
||||
return (
|
||||
<Badge key={id} variant="secondary" className="gap-1 py-1 pe-1">
|
||||
{item?.name ?? id}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() =>
|
||||
set(
|
||||
"facultyIds",
|
||||
form.facultyIds.filter((x) => x !== id),
|
||||
)
|
||||
}
|
||||
className="rounded-full p-0.5 hover:bg-foreground/10"
|
||||
aria-label="حذف استاد"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<Separator />
|
||||
|
||||
@@ -48,7 +48,7 @@ export function DeleteCourseDialog({ id, title }: { id: string; title: string })
|
||||
دوره «{title}» برای همیشه حذف میشود. این عمل قابل بازگشت نیست.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={() => setOpen(false)}>
|
||||
انصراف
|
||||
|
||||
@@ -40,7 +40,7 @@ export function PublishToggle({ id, published }: { id: string; published: boolea
|
||||
>
|
||||
{loading ? "..." : published ? "منتشرشده" : "پیشنویس"}
|
||||
</Button>
|
||||
{error && <p className="mt-1 max-w-40 text-xs text-red-600">{error}</p>}
|
||||
{error && <p className="mt-1 max-w-40 text-xs text-destructive">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export function GenericDeleteDialog({
|
||||
«{subject}» برای همیشه حذف میشود. این عمل قابل بازگشت نیست.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||
{error && <p className="text-sm text-destructive">{error}</p>}
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={() => setOpen(false)}>
|
||||
انصراف
|
||||
|
||||
@@ -48,7 +48,7 @@ export function PublishToggle({
|
||||
>
|
||||
{loading ? "..." : published ? "منتشرشده" : "پیشنویس"}
|
||||
</Button>
|
||||
{error && <p className="mt-1 max-w-40 text-xs text-red-600">{error}</p>}
|
||||
{error && <p className="mt-1 max-w-40 text-xs text-destructive">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
import Link from "next/link";
|
||||
import { ArrowUpLeft } from "lucide-react";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { aboutContent, facultyNetworkUrl } from "@/lib/site-config";
|
||||
import type { IntersectionTopic } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function ProseBlock({ paragraphs }: { paragraphs: string[] }) {
|
||||
return (
|
||||
<div className="max-w-3xl space-y-4">
|
||||
{paragraphs.map((paragraph, index) => (
|
||||
<p
|
||||
key={index}
|
||||
className="text-base leading-8 text-muted-foreground sm:text-lg sm:leading-8"
|
||||
>
|
||||
{paragraph}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function AboutTemplate({ topics }: { topics: IntersectionTopic[] }) {
|
||||
const { amirkabir, faculty, learning, topics: topicsCopy, audience } =
|
||||
aboutContent;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHero
|
||||
eyebrow={aboutContent.eyebrow}
|
||||
title={aboutContent.title}
|
||||
intro={aboutContent.intro}
|
||||
/>
|
||||
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<p className="max-w-3xl text-base leading-8 text-foreground sm:text-lg sm:leading-8">
|
||||
{aboutContent.introFollowUp}
|
||||
</p>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<Container>
|
||||
<SectionHeader title={amirkabir.title} />
|
||||
<ProseBlock paragraphs={amirkabir.paragraphs} />
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<SectionHeader title={faculty.title} />
|
||||
<ProseBlock paragraphs={faculty.paragraphs} />
|
||||
<div className="mt-8">
|
||||
<DotCta href={facultyNetworkUrl} external>
|
||||
{faculty.ctaLabel}
|
||||
</DotCta>
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<Container>
|
||||
<SectionHeader title={learning.title} />
|
||||
<ProseBlock paragraphs={learning.paragraphs} />
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<SectionHeader
|
||||
title={topicsCopy.title}
|
||||
description={topicsCopy.description}
|
||||
/>
|
||||
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{topics.map((topic) => (
|
||||
<Link
|
||||
key={topic.id}
|
||||
href={topic.href}
|
||||
className="group block h-full"
|
||||
>
|
||||
<SurfaceCard padded interactive className="h-full">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<Heading
|
||||
as="h3"
|
||||
level={4}
|
||||
className="transition-colors group-hover:text-primary"
|
||||
>
|
||||
{topic.title}
|
||||
</Heading>
|
||||
<ArrowUpLeft className="mt-1 size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-primary" />
|
||||
</div>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{topic.description}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<p className="mt-6 max-w-3xl text-sm leading-7 text-muted-foreground">
|
||||
{topicsCopy.note}
|
||||
</p>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(buttonVariants({ size: "lg" }), "mt-8 font-bold")}
|
||||
>
|
||||
مشاهده دورهها
|
||||
</Link>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<Container>
|
||||
<SectionHeader title={audience.title} />
|
||||
<ProseBlock paragraphs={audience.paragraphs} />
|
||||
</Container>
|
||||
</Section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
import Image from "next/image";
|
||||
import { Clock, Layers, Tag, Wallet } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { ArrowUpLeft, Clock, Layers, Wallet } from "lucide-react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { TextLink } from "@/components/atoms/TextLink";
|
||||
import { DetailList, type DetailItem } from "@/components/molecules/DetailList";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { CourseRegisterGate } from "@/components/organisms/CourseRegisterGate";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import type { Course } from "@/lib/types";
|
||||
import { courseCategoryHref, courseTagHref } from "@/lib/course-nav";
|
||||
import { formatCoursePrice, formatLabel } from "@/lib/labels";
|
||||
import { JsonLd, courseJsonLd } from "@/lib/seo/json-ld";
|
||||
|
||||
@@ -36,19 +41,9 @@ export function CourseDetailTemplate({
|
||||
labels: CourseDetailLabels;
|
||||
}) {
|
||||
const priceLabel = formatCoursePrice(course.price);
|
||||
const categoryText =
|
||||
course.categories.map((c) => c.label).join(" · ") || "—";
|
||||
const specs = [
|
||||
{
|
||||
icon: Tag,
|
||||
label: labels.category,
|
||||
value: categoryText,
|
||||
},
|
||||
{
|
||||
icon: Layers,
|
||||
label: labels.format,
|
||||
value: formatLabel(course.format),
|
||||
},
|
||||
const instructors = course.instructors ?? [];
|
||||
const details: DetailItem[] = [
|
||||
{ icon: Layers, label: labels.format, value: formatLabel(course.format) },
|
||||
...(course.durationHours
|
||||
? [
|
||||
{
|
||||
@@ -58,16 +53,14 @@ export function CourseDetailTemplate({
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(priceLabel
|
||||
? [
|
||||
{
|
||||
icon: Wallet,
|
||||
label: labels.price,
|
||||
value: priceLabel,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
icon: Wallet,
|
||||
label: labels.price,
|
||||
value: priceLabel ?? labels.priceUnset,
|
||||
emphasis: Boolean(priceLabel),
|
||||
},
|
||||
];
|
||||
const hasTaxonomy = course.categories.length > 0 || course.tags.length > 0;
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
@@ -75,99 +68,111 @@ export function CourseDetailTemplate({
|
||||
<PageHero
|
||||
title={course.title}
|
||||
intro={course.summary}
|
||||
eyebrow={
|
||||
course.categories[0]?.label ??
|
||||
course.tags[0]?.label ??
|
||||
undefined
|
||||
}
|
||||
eyebrow={course.categories[0]?.label ?? course.tags[0]?.label}
|
||||
imageUrl={course.posterImageUrl}
|
||||
/>
|
||||
|
||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="space-y-8">
|
||||
<div className="overflow-hidden rounded-2xl ring-1 ring-border">
|
||||
<div className="relative aspect-[16/9] bg-muted">
|
||||
<Image
|
||||
src={course.brochureImageUrl}
|
||||
alt={course.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:1024px) 100vw, 60vw"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
<Section tone="subtle">
|
||||
<Container className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,22rem)] lg:items-start lg:gap-12">
|
||||
<div className="min-w-0 space-y-10">
|
||||
<div className="relative aspect-[16/9] overflow-hidden rounded-2xl bg-muted ring-1 ring-foreground/10">
|
||||
<Image
|
||||
src={course.brochureImageUrl}
|
||||
alt={course.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:1024px) 100vw, 60vw"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-xl font-bold tracking-tight">
|
||||
<Heading level={3} as="h2">
|
||||
{labels.aboutTitle}
|
||||
</h2>
|
||||
</Heading>
|
||||
<p className="text-base leading-8 text-foreground/90">
|
||||
{course.summary}
|
||||
{course.seoDescription || course.summary}
|
||||
</p>
|
||||
{course.seoDescription &&
|
||||
course.seoDescription !== course.summary ? (
|
||||
<p className="text-base leading-8 text-muted-foreground">
|
||||
{course.seoDescription}
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
<section className="space-y-4">
|
||||
<h2 className="text-xl font-bold tracking-tight">
|
||||
{labels.detailsTitle}
|
||||
</h2>
|
||||
<dl className="grid overflow-hidden rounded-2xl bg-card ring-1 ring-border sm:grid-cols-2 sm:divide-x sm:divide-x-reverse sm:divide-border">
|
||||
{specs.map((item) => (
|
||||
<div
|
||||
key={item.label}
|
||||
className="flex gap-3 border-b border-border p-5 last:border-b-0 sm:[&:nth-last-child(-n+2)]:border-b-0"
|
||||
>
|
||||
<div className="flex size-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
|
||||
<item.icon className="size-4" />
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<dt className="text-xs font-medium text-muted-foreground">
|
||||
{item.label}
|
||||
</dt>
|
||||
<dd className="mt-1 text-sm font-semibold text-foreground">
|
||||
{item.value}
|
||||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</section>
|
||||
{instructors.length > 0 ? (
|
||||
<section className="space-y-4">
|
||||
<Heading level={3} as="h2">
|
||||
اساتید
|
||||
</Heading>
|
||||
<ul className="grid gap-3 sm:grid-cols-2">
|
||||
{instructors.map((person) => {
|
||||
const body = (
|
||||
<>
|
||||
<span className="block font-semibold text-foreground">
|
||||
{person.name}
|
||||
</span>
|
||||
{person.title ? (
|
||||
<span className="mt-1 block text-xs text-muted-foreground">
|
||||
{person.title}
|
||||
</span>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<li key={person.id}>
|
||||
{person.profileUrl ? (
|
||||
<a
|
||||
href={person.profileUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="group flex items-center justify-between gap-3 rounded-xl bg-card p-4 text-sm ring-1 ring-foreground/10 transition-shadow hover:shadow-md hover:ring-primary/25"
|
||||
>
|
||||
<span className="min-w-0">{body}</span>
|
||||
<ArrowUpLeft className="size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-primary" />
|
||||
</a>
|
||||
) : (
|
||||
<div className="rounded-xl bg-card p-4 text-sm ring-1 ring-foreground/10">
|
||||
{body}
|
||||
</div>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{hasTaxonomy ? (
|
||||
<section className="space-y-4">
|
||||
<Heading level={3} as="h2">
|
||||
{labels.category}
|
||||
</Heading>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{course.categories.map((c) => (
|
||||
<Link key={c.id} href={courseCategoryHref(c.slug)}>
|
||||
<Badge className="h-7 cursor-pointer px-3 text-sm font-semibold">
|
||||
{c.label}
|
||||
</Badge>
|
||||
</Link>
|
||||
))}
|
||||
{course.tags.map((t) => (
|
||||
<Link key={t.id} href={courseTagHref(t.slug)}>
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="h-7 cursor-pointer px-3 text-xs hover:bg-muted"
|
||||
>
|
||||
{t.label}
|
||||
</Badge>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<aside className="space-y-6 lg:sticky lg:top-28">
|
||||
<div className="rounded-2xl bg-card p-6 shadow-sm ring-1 ring-border">
|
||||
<p className="text-sm font-semibold text-foreground">{course.title}</p>
|
||||
<Separator className="my-4" />
|
||||
<ul className="space-y-3 text-sm text-muted-foreground">
|
||||
{course.durationHours ? (
|
||||
<li className="flex justify-between gap-3">
|
||||
<span>{labels.duration}</span>
|
||||
<span className="font-medium text-foreground">
|
||||
{course.durationHours} ساعت
|
||||
</span>
|
||||
</li>
|
||||
) : null}
|
||||
<li className="flex justify-between gap-3">
|
||||
<span>{labels.format}</span>
|
||||
<span className="font-medium text-foreground text-end">
|
||||
{formatLabel(course.format)}
|
||||
</span>
|
||||
</li>
|
||||
{priceLabel ? (
|
||||
<li className="flex justify-between gap-3">
|
||||
<span>{labels.price}</span>
|
||||
<span className="font-bold text-primary">{priceLabel}</span>
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
</div>
|
||||
<aside className="min-w-0 space-y-4 lg:sticky lg:top-28">
|
||||
<SurfaceCard padded as="div">
|
||||
<p className="mb-4 text-sm font-bold text-foreground">
|
||||
{labels.detailsTitle}
|
||||
</p>
|
||||
<DetailList items={details} />
|
||||
</SurfaceCard>
|
||||
|
||||
<CourseRegisterGate
|
||||
courseSlug={course.slug}
|
||||
@@ -180,7 +185,7 @@ export function CourseDetailTemplate({
|
||||
cancelLabel={labels.cancel}
|
||||
/>
|
||||
|
||||
<TextLink href="/professional" className="block text-sm">
|
||||
<TextLink href="/professional" className="block px-1 text-sm">
|
||||
{labels.backToCatalog}
|
||||
</TextLink>
|
||||
</aside>
|
||||
|
||||
@@ -6,20 +6,27 @@ import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { HeroFeatured } from "@/components/molecules/HeroFeatured";
|
||||
import {
|
||||
EventCard,
|
||||
IntersectionCard,
|
||||
} from "@/components/molecules/Cards";
|
||||
import { ProgramCarousel } from "@/components/organisms/ProgramCarousel";
|
||||
import type { Article, EventItem, IntersectionTopic, Program, SiteStat } from "@/lib/types";
|
||||
import { IntersectionCard } from "@/components/molecules/Cards";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { StatGrid } from "@/components/molecules/StatGrid";
|
||||
import type {
|
||||
Article,
|
||||
Course,
|
||||
IntersectionTopic,
|
||||
SiteStat,
|
||||
} from "@/lib/types";
|
||||
import { formatCoursePrice, formatLabel } from "@/lib/labels";
|
||||
import { siteMission } from "@/lib/site-config";
|
||||
import { AnimatedMetric } from "@/components/atoms/AnimatedMetric";
|
||||
|
||||
export type HomeLabels = {
|
||||
executiveLabel: string;
|
||||
@@ -39,8 +46,27 @@ export type HomeLabels = {
|
||||
findUsTitle: string;
|
||||
ideasEyebrow: string;
|
||||
linksTitle: string;
|
||||
exploreCourses?: string;
|
||||
};
|
||||
|
||||
const ideas = [
|
||||
{
|
||||
icon: Compass,
|
||||
title: "پشتوانه علمی دانشگاه صنعتی امیرکبیر",
|
||||
text: "آموزش مدیریت در بستر دانشگاه صنعتی امیرکبیر، با تکیه بر دانش تخصصی، استدلال علمی و نگاه نقادانه.",
|
||||
},
|
||||
{
|
||||
icon: Building2,
|
||||
title: "پیوند مدیریت و فناوری",
|
||||
text: "نگاهی میانرشتهای به داده و هوش مصنوعی؛ با توجه به تأثیر آنها بر تصمیمهای مدیریتی، مدلهای کسبوکار و آینده صنعت.",
|
||||
},
|
||||
{
|
||||
icon: Network,
|
||||
title: "تمرکز بر مسائل صنعت",
|
||||
text: "توسعه توانمندی مدیران با توجه به چالشهای اجرای نوآوری، تغییر فرایندها و بهبود عملکرد سازمان.",
|
||||
},
|
||||
];
|
||||
|
||||
export function HomeHero({
|
||||
featured,
|
||||
eyebrow,
|
||||
@@ -60,100 +86,162 @@ export function HomeHero({
|
||||
|
||||
export function HomeIdeas() {
|
||||
return (
|
||||
<>
|
||||
<Section className="relative py-20 sm:py-28">
|
||||
<Section>
|
||||
<Container>
|
||||
<div className="grid min-w-0 gap-10 lg:grid-cols-[minmax(0,.8fr)_minmax(0,1.2fr)] lg:items-start lg:gap-20">
|
||||
<div className="min-w-0 lg:sticky lg:top-28">
|
||||
<Badge variant="outline" className="border-primary/20 bg-primary/5 text-primary">چرا دانشگاه امیرکبیر؟</Badge>
|
||||
<Heading level={2} className="mt-5 text-3xl leading-tight break-words sm:text-4xl">
|
||||
مدیریت با پشتوانه دانش مهندسی
|
||||
</Heading>
|
||||
<p className="mt-5 text-base leading-8 text-muted-foreground sm:text-lg">
|
||||
هویت مهندسی و فناورانه دانشگاه صنعتی امیرکبیر به آموزش مدیریت در این دانشگاه جهت میدهد. در مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری، توسعه مدیران با شناخت فناوری و مسائل صنعت پیوند دارد.
|
||||
</p>
|
||||
<SectionHeader
|
||||
className="mb-0 sm:mb-0"
|
||||
eyebrow="چرا دانشگاه صنعتی امیرکبیر؟"
|
||||
title="مدیریت با پشتوانه دانش مهندسی"
|
||||
description="هویت مهندسی و فناورانه دانشگاه صنعتی امیرکبیر به آموزش مدیریت در این دانشگاه جهت میدهد. در مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری، توسعه مدیران با شناخت فناوری و مسائل صنعت پیوند دارد."
|
||||
/>
|
||||
</div>
|
||||
<div className="grid min-w-0 gap-4 md:grid-cols-3 lg:grid-cols-1">
|
||||
{[
|
||||
{ icon: Compass, title: "پشتوانه علمی امیرکبیر", text: "آموزش مدیریت در بستر دانشگاه صنعتی امیرکبیر، با تکیه بر دانش تخصصی، استدلال علمی و نگاه نقادانه." },
|
||||
{ icon: Building2, title: "پیوند مدیریت و فناوری", text: "نگاهی میانرشتهای به داده و هوش مصنوعی؛ با توجه به تأثیر آنها بر تصمیمهای مدیریتی، مدلهای کسبوکار و آینده صنعت." },
|
||||
{ icon: Network, title: "تمرکز بر مسائل صنعت", text: "توسعه توانمندی مدیران با توجه به چالشهای اجرای نوآوری، تغییر فرایندها و بهبود عملکرد سازمان." },
|
||||
].map((item, index) => (
|
||||
<Card key={item.title} className="min-w-0 border-border/70 py-0 shadow-none transition-colors hover:border-primary/25">
|
||||
<CardContent className="flex h-full min-w-0 flex-col gap-5 p-5 sm:p-6 lg:flex-row lg:items-center lg:gap-6 lg:p-7">
|
||||
<div className="flex size-12 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary"><item.icon className="size-6" /></div>
|
||||
<div className="min-w-0"><p className="text-xs font-bold text-primary">۰{index + 1}</p><h3 className="mt-1 text-lg font-bold">{item.title}</h3><p className="mt-2 text-sm leading-7 text-muted-foreground">{item.text}</p></div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className="grid min-w-0 gap-8 md:grid-cols-3 lg:grid-cols-1 lg:gap-10">
|
||||
{ideas.map((item) => (
|
||||
<div
|
||||
key={item.title}
|
||||
className="flex min-w-0 flex-col gap-4 lg:flex-row lg:items-start lg:gap-5"
|
||||
>
|
||||
<div className="flex size-12 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
|
||||
<item.icon className="size-6" />
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<Heading as="h3" level={3}>
|
||||
{item.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{item.text}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
<section className="overflow-hidden bg-chart-3 text-background">
|
||||
<div className="grid min-w-0 lg:grid-cols-2">
|
||||
<div className="relative z-[1] order-2 flex min-w-0 flex-col justify-center gap-4 px-5 py-8 sm:gap-5 sm:px-10 sm:py-10 lg:order-1 lg:min-h-[22rem] lg:px-14 lg:py-12">
|
||||
<p className="text-xs font-bold text-background/55">
|
||||
رویکرد آموزشی ما
|
||||
</p>
|
||||
<Heading
|
||||
level={2}
|
||||
className="text-2xl leading-snug break-words text-background sm:text-3xl lg:text-[2.125rem] lg:leading-snug"
|
||||
>
|
||||
دانش امیرکبیر، در خدمت تحول صنعت
|
||||
</Heading>
|
||||
<p className="max-w-xl text-sm leading-7 text-background/70 sm:text-base sm:leading-8">
|
||||
امیرکبیر، دانش تخصصی و چارچوبهای مدیریتی را برای مواجهه با چالشهای صنعت در اختیار مدیران قرار میدهد؛ از شناخت ظرفیتهای داده و هوش مصنوعی تا ارزیابی تصمیمها و راهبری نوآوری در سازمان.
|
||||
</p>
|
||||
<Link
|
||||
href="/about"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "outline" }),
|
||||
"mt-1 w-fit border-background/30 bg-transparent text-background hover:bg-background hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
آشنایی با رویکرد ما
|
||||
</Link>
|
||||
</div>
|
||||
<div className="relative order-1 aspect-[16/10] min-h-0 lg:order-2 lg:aspect-auto lg:min-h-full lg:self-stretch">
|
||||
<Image
|
||||
src="/brand/campus-collaboration-v1.png"
|
||||
alt="همکاری مدرسان و متخصصان در محیط دانشگاه"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:1024px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function HomeEvents({
|
||||
events,
|
||||
title,
|
||||
seeAllLabel,
|
||||
export function HomeCourseSearch({
|
||||
courses,
|
||||
exploreLabel = "مشاهده دورهها",
|
||||
}: {
|
||||
events: EventItem[];
|
||||
title: string;
|
||||
seeAllLabel: string;
|
||||
courses: Course[];
|
||||
exploreLabel?: string;
|
||||
}) {
|
||||
return (
|
||||
<Section className="py-20 sm:py-24">
|
||||
<Section tone="dark" className="overflow-hidden">
|
||||
<Container>
|
||||
<p className="text-center text-xs font-bold text-primary">در جریان یادگیری</p>
|
||||
<Heading level={2} className="mt-2 text-center text-3xl sm:text-4xl">
|
||||
{title}
|
||||
</Heading>
|
||||
<Separator className="mx-auto mt-5 max-w-16 bg-primary" />
|
||||
<div className="mt-10 grid min-w-0 gap-0 border-y border-border md:grid-cols-2 lg:grid-cols-4">
|
||||
{events.map((event) => (
|
||||
<EventCard key={event.id} {...event} variant="home" />
|
||||
))}
|
||||
</div>
|
||||
<SectionHeader
|
||||
inverse
|
||||
eyebrow="دورههای کوتاه"
|
||||
title="جدیدترین دورهها"
|
||||
/>
|
||||
{courses.length === 0 ? (
|
||||
<p className="py-10 text-center text-sm text-background/60">
|
||||
در حال حاضر دورهای برای نمایش نیست.
|
||||
</p>
|
||||
) : (
|
||||
<div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{courses.map((course) => {
|
||||
const priceLabel = formatCoursePrice(course.price);
|
||||
return (
|
||||
<Card
|
||||
key={course.id}
|
||||
className="group relative gap-0 overflow-hidden bg-background/5 py-0 text-background ring-background/10 transition-colors hover:ring-background/30"
|
||||
>
|
||||
<Link
|
||||
href={course.registrationUrl}
|
||||
className="absolute inset-0 z-0"
|
||||
aria-label={course.title}
|
||||
/>
|
||||
<div className="relative aspect-[16/10] overflow-hidden">
|
||||
<Image
|
||||
src={course.posterImageUrl}
|
||||
alt={course.title}
|
||||
fill
|
||||
className="object-cover transition-transform duration-300 group-hover:scale-[1.03]"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="relative z-[1] gap-1 px-4 pt-4">
|
||||
<CardTitle className="text-base text-background">
|
||||
{course.title}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="relative z-[1] space-y-3 px-4 pb-4">
|
||||
<CardDescription className="line-clamp-2 text-background/70">
|
||||
{course.summary}
|
||||
</CardDescription>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-xs text-background/55">
|
||||
<span>
|
||||
{course.durationHours
|
||||
? `${course.durationHours} ساعت · ${formatLabel(course.format)}`
|
||||
: formatLabel(course.format)}
|
||||
</span>
|
||||
{priceLabel ? (
|
||||
<span className="font-semibold text-background/90">
|
||||
{priceLabel}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-10 flex justify-center">
|
||||
<DotCta href="/events">{seeAllLabel}</DotCta>
|
||||
<Link
|
||||
href="/professional"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "inverse", size: "lg" }),
|
||||
"font-bold",
|
||||
)}
|
||||
>
|
||||
{exploreLabel}
|
||||
</Link>
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
export function HomeApproach() {
|
||||
return (
|
||||
<Section>
|
||||
<Container>
|
||||
<div className="overflow-hidden rounded-2xl bg-chart-3 text-background">
|
||||
<div className="grid min-w-0 lg:grid-cols-2">
|
||||
<div className="relative z-[1] order-2 flex min-w-0 flex-col justify-center px-6 py-10 sm:px-10 lg:order-1 lg:min-h-[22rem] lg:px-12 lg:py-14">
|
||||
<SectionHeader
|
||||
inverse
|
||||
className="mb-0 sm:mb-0"
|
||||
eyebrow="رویکرد آموزشی ما"
|
||||
title="دانش دانشگاه صنعتی امیرکبیر، در خدمت تحول صنعت"
|
||||
description="دانشگاه صنعتی امیرکبیر، دانش تخصصی و چارچوبهای مدیریتی را برای مواجهه با چالشهای صنعت در اختیار مدیران قرار میدهد؛ از شناخت ظرفیتهای داده و هوش مصنوعی تا ارزیابی تصمیمها و راهبری نوآوری در سازمان."
|
||||
/>
|
||||
<Link
|
||||
href="/about"
|
||||
className={cn(
|
||||
buttonVariants({ variant: "inverse", size: "lg" }),
|
||||
"mt-8 w-fit font-bold",
|
||||
)}
|
||||
>
|
||||
آشنایی با رویکرد ما
|
||||
</Link>
|
||||
</div>
|
||||
<div className="relative order-1 aspect-[16/10] min-h-0 lg:order-2 lg:aspect-auto lg:min-h-full lg:self-stretch">
|
||||
<Image
|
||||
src="/brand/campus-collaboration-v1.png"
|
||||
alt="همکاری مدرسان و متخصصان در محیط دانشگاه"
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:1024px) 100vw, 50vw"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
@@ -162,26 +250,22 @@ export function HomeEvents({
|
||||
|
||||
export function HomeRest({
|
||||
labels,
|
||||
carouselPrograms,
|
||||
intersections,
|
||||
stats,
|
||||
}: {
|
||||
labels: HomeLabels;
|
||||
carouselPrograms: Program[];
|
||||
intersections: IntersectionTopic[];
|
||||
stats: SiteStat[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Section tone="muted" className="py-20 sm:py-24">
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<div className="mb-10 max-w-3xl">
|
||||
<p className="text-xs font-bold text-primary">حوزههای آموزشی</p>
|
||||
<Heading level={2} className="mt-2 text-3xl sm:text-4xl">{labels.intersectionsTitle}</Heading>
|
||||
<p className="mt-3 text-lg font-semibold leading-relaxed text-primary sm:text-xl">
|
||||
{labels.intersectionsSubtitle}
|
||||
</p>
|
||||
</div>
|
||||
<SectionHeader
|
||||
eyebrow="حوزههای آموزشی"
|
||||
title={labels.intersectionsTitle}
|
||||
description={labels.intersectionsSubtitle}
|
||||
/>
|
||||
<div className="grid min-w-0 gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{intersections.map((topic) => (
|
||||
<IntersectionCard key={topic.id} {...topic} />
|
||||
@@ -190,38 +274,17 @@ export function HomeRest({
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section className="relative overflow-hidden py-20 sm:py-24">
|
||||
<MetamorphField tone="light" density="sparse" />
|
||||
<Container className="relative z-[1] min-w-0">
|
||||
<div className="mx-auto mb-10 max-w-2xl text-center">
|
||||
<Heading level={2} className="break-words">{labels.moreThanDegree}</Heading>
|
||||
<p className="mt-4 text-base leading-relaxed text-muted-foreground sm:text-lg">
|
||||
{labels.moreThanDegreeBody}
|
||||
</p>
|
||||
</div>
|
||||
<ProgramCarousel
|
||||
title=""
|
||||
programs={carouselPrograms}
|
||||
keepExploringLabel={labels.keepExploring}
|
||||
hideTitle
|
||||
<Section tone="dark" className="overflow-hidden">
|
||||
<MetamorphField tone="dark" density="sparse" className="opacity-40" />
|
||||
<Container className="relative z-[1] grid min-w-0 gap-8 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end lg:gap-12">
|
||||
<SectionHeader
|
||||
inverse
|
||||
className="mb-0 sm:mb-0"
|
||||
eyebrow="همکاری با سازمانها"
|
||||
title={labels.hireTitle}
|
||||
description={labels.hireBody}
|
||||
/>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section tone="dark" className="relative overflow-hidden py-20 sm:py-28">
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="sparse"
|
||||
className="opacity-[0.4]"
|
||||
/>
|
||||
<Container className="relative z-[1] grid min-w-0 gap-10 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-end lg:gap-12">
|
||||
<div className="min-w-0 max-w-3xl"><p className="text-xs font-bold text-background/60">همکاری با سازمانها</p><Heading level={2} className="mt-3 break-words text-background sm:text-5xl">
|
||||
{labels.hireTitle}
|
||||
</Heading>
|
||||
<p className="mt-5 max-w-2xl text-base leading-relaxed text-background/75 sm:text-lg">
|
||||
{labels.hireBody}
|
||||
</p>
|
||||
</div><div className="shrink-0">
|
||||
<div className="shrink-0">
|
||||
<DotCta href="/professional" onDark>
|
||||
{labels.registerCta}
|
||||
</DotCta>
|
||||
@@ -229,20 +292,17 @@ export function HomeRest({
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section className="py-20 sm:py-24">
|
||||
<Container className="max-w-4xl text-center">
|
||||
<Heading
|
||||
level={2}
|
||||
className="text-sm font-bold uppercase tracking-wider text-muted-foreground"
|
||||
>
|
||||
{labels.missionTitle}
|
||||
</Heading>
|
||||
<p className="mt-5 text-xl font-bold leading-relaxed break-words text-foreground sm:text-2xl md:text-3xl">
|
||||
{siteMission}
|
||||
</p>
|
||||
<div className="mt-12 grid min-w-0 gap-6 border-t border-border pt-10 sm:grid-cols-3">
|
||||
{stats.map((stat) => <div key={stat.id} className="min-w-0"><p className="text-3xl font-black text-primary sm:text-4xl"><AnimatedMetric value={stat.value} /></p><p className="mt-2 text-sm text-muted-foreground">{stat.label}</p></div>)}
|
||||
</div>
|
||||
<Section>
|
||||
<Container className="max-w-4xl">
|
||||
<SectionHeader
|
||||
align="center"
|
||||
eyebrow={labels.missionTitle}
|
||||
title={siteMission}
|
||||
/>
|
||||
<StatGrid
|
||||
stats={stats}
|
||||
className="border-t border-border pt-10"
|
||||
/>
|
||||
</Container>
|
||||
</Section>
|
||||
</>
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
import Image from "next/image";
|
||||
import { Suspense } from "react";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { DotCta } from "@/components/atoms/DotCta";
|
||||
import { Heading } from "@/components/atoms/Heading";
|
||||
import { MetamorphField } from "@/components/atoms/MetamorphField";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { QuoteBlock } from "@/components/molecules/Cards";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SectionHeader } from "@/components/molecules/SectionHeader";
|
||||
import { StatGrid } from "@/components/molecules/StatGrid";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { CategoryCourseExplorer } from "@/components/organisms/CategoryCourseExplorer";
|
||||
import type { Course, SiteStat, TaxonomyRef, Testimonial } from "@/lib/types";
|
||||
import { AnimatedMetric } from "@/components/atoms/AnimatedMetric";
|
||||
import type { Course, SiteStat, TaxonomyRef } from "@/lib/types";
|
||||
|
||||
const highlights = [
|
||||
{
|
||||
value: "#۱",
|
||||
title: "از برترین دانشگاههای فنی کشور",
|
||||
text: "دانشگاه صنعتی امیرکبیر",
|
||||
},
|
||||
{
|
||||
value: "۶۰+",
|
||||
title: "سال تجربه آموزش عالی",
|
||||
text: "میراث علمی و صنعتی",
|
||||
},
|
||||
];
|
||||
|
||||
export function ProfessionalLandingTemplate({
|
||||
labels,
|
||||
courses,
|
||||
stats,
|
||||
testimonials,
|
||||
filterCategories,
|
||||
filterTags,
|
||||
initialTag = "",
|
||||
@@ -31,11 +44,9 @@ export function ProfessionalLandingTemplate({
|
||||
dppBody: string;
|
||||
statsTitle: string;
|
||||
rankTitle: string;
|
||||
testimonialsTitle: string;
|
||||
};
|
||||
courses: Course[];
|
||||
stats: SiteStat[];
|
||||
testimonials: Testimonial[];
|
||||
filterCategories: TaxonomyRef[];
|
||||
filterTags: TaxonomyRef[];
|
||||
initialTag?: string;
|
||||
@@ -43,140 +54,82 @@ export function ProfessionalLandingTemplate({
|
||||
}) {
|
||||
return (
|
||||
<main id="main-content">
|
||||
<header className="relative isolate min-h-[42rem] overflow-hidden bg-chart-3 text-background">
|
||||
<div className="absolute inset-0">
|
||||
<Image
|
||||
src="https://images.unsplash.com/photo-1497366216548-37526070297c?w=1600&q=80"
|
||||
alt="نمایی از پردیس دانشگاه"
|
||||
fill
|
||||
priority
|
||||
className="object-cover opacity-35"
|
||||
sizes="100vw"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="absolute inset-0 bg-gradient-to-l from-chart-3 via-chart-3/85 to-chart-3/60"
|
||||
aria-hidden
|
||||
/>
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
className="inset-y-0 end-0 start-auto w-[min(72vw,36rem)] opacity-[0.5]"
|
||||
/>
|
||||
<div className="relative z-[2] flex min-h-[inherit] min-w-0 items-center py-12">
|
||||
<Container>
|
||||
<div className="w-full min-w-0 max-w-4xl text-start">
|
||||
<div className="min-w-0">
|
||||
<p className="text-sm font-semibold text-background/75">
|
||||
{labels.offeredBy}
|
||||
</p>
|
||||
<Heading
|
||||
as="h1"
|
||||
level={1}
|
||||
className="mt-4 max-w-4xl text-[1.65rem] leading-[1.45] text-pretty text-background sm:text-4xl lg:text-[2.75rem] lg:leading-[1.4]"
|
||||
>
|
||||
{labels.heroTitle}
|
||||
</Heading>
|
||||
<p className="mt-5 max-w-2xl border-t border-accent/60 pt-5 text-base leading-8 text-pretty text-background/70 sm:text-lg sm:leading-8">
|
||||
{labels.heroBody}
|
||||
</p>
|
||||
<div className="mt-6">
|
||||
<DotCta href="#programs" onDark>
|
||||
{labels.exploreCourses}
|
||||
</DotCta>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
</header>
|
||||
<PageHero
|
||||
size="lg"
|
||||
showField={false}
|
||||
eyebrow={labels.offeredBy}
|
||||
title={labels.heroTitle}
|
||||
intro={labels.heroBody}
|
||||
imageUrl="/brand/seminar-room.jpg"
|
||||
actions={
|
||||
<DotCta href="#programs" onDark>
|
||||
{labels.exploreCourses}
|
||||
</DotCta>
|
||||
}
|
||||
/>
|
||||
|
||||
<Section
|
||||
id="programs"
|
||||
tone="dark"
|
||||
className="relative scroll-mt-24 overflow-hidden py-20 sm:py-24"
|
||||
className="scroll-mt-24 overflow-hidden border-t border-background/10"
|
||||
>
|
||||
<MetamorphField
|
||||
tone="dark"
|
||||
density="sparse"
|
||||
className="opacity-[0.28]"
|
||||
/>
|
||||
<MetamorphField tone="dark" density="sparse" className="opacity-30" />
|
||||
<Container className="relative z-[1]">
|
||||
<div id="courses" className="scroll-mt-24" />
|
||||
<div id="certificates" className="scroll-mt-24" />
|
||||
<div id="corporate" className="scroll-mt-24" />
|
||||
<p className="mb-6 text-lg font-semibold text-background/80">
|
||||
{labels.pathways}
|
||||
</p>
|
||||
<CategoryCourseExplorer
|
||||
key={`${initialTag}|${initialCategory}`}
|
||||
courses={courses}
|
||||
findLabel={labels.findProgram}
|
||||
filterCategories={filterCategories}
|
||||
filterTags={filterTags}
|
||||
initialTag={initialTag}
|
||||
initialCategory={initialCategory}
|
||||
<SectionHeader
|
||||
inverse
|
||||
eyebrow="جستجوی دورهها"
|
||||
title={labels.pathways}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<CategoryCourseExplorer
|
||||
courses={courses}
|
||||
findLabel={labels.findProgram}
|
||||
filterCategories={filterCategories}
|
||||
filterTags={filterTags}
|
||||
initialTag={initialTag}
|
||||
initialCategory={initialCategory}
|
||||
/>
|
||||
</Suspense>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section id="digital" tone="accent" tight className="scroll-mt-24">
|
||||
<Container>
|
||||
<SectionHeader
|
||||
inverse
|
||||
className="mb-0 sm:mb-0"
|
||||
title={labels.dppTitle}
|
||||
description={labels.dppBody}
|
||||
/>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section id="digital" tone="accent" className="scroll-mt-24 py-16 sm:py-20">
|
||||
<Section tone="muted">
|
||||
<Container>
|
||||
<Heading level={2} className="text-primary-foreground">
|
||||
{labels.dppTitle}
|
||||
</Heading>
|
||||
<p className="mt-3 max-w-3xl text-primary-foreground/80">
|
||||
{labels.dppBody}
|
||||
</p>
|
||||
<SectionHeader align="center" title={labels.statsTitle} />
|
||||
<StatGrid stats={stats} />
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section tone="muted" className="py-20 sm:py-24">
|
||||
<Section>
|
||||
<Container>
|
||||
<Heading level={2} className="mb-8 text-center">
|
||||
{labels.statsTitle}
|
||||
</Heading>
|
||||
<div className="grid gap-6 sm:grid-cols-3 sm:gap-8">
|
||||
{stats.map((stat) => (
|
||||
<div key={stat.id} className="text-center">
|
||||
<p className="text-4xl font-extrabold text-primary"><AnimatedMetric value={stat.value} /></p>
|
||||
<p className="mt-2 text-sm text-muted-foreground">{stat.label}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section className="py-20 sm:py-24">
|
||||
<Container className="text-center">
|
||||
<Heading level={2}>{labels.rankTitle}</Heading>
|
||||
<div className="mt-6 grid gap-4 sm:grid-cols-2">
|
||||
<SurfaceCard padded="md" className="text-start">
|
||||
<p className="text-3xl font-extrabold text-primary">#۱</p>
|
||||
<p className="mt-2 font-bold">از برترین دانشگاههای فنی کشور</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
دانشگاه صنعتی امیرکبیر
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
<SurfaceCard padded="md" className="text-start">
|
||||
<p className="text-3xl font-extrabold text-primary">۶۰+</p>
|
||||
<p className="mt-2 font-bold">سال تجربه آموزش عالی</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
میراث علمی و صنعتی
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
|
||||
<Section tone="dark" className="relative overflow-hidden py-20 sm:py-24">
|
||||
<MetamorphField tone="dark" density="sparse" className="opacity-25" />
|
||||
<Container className="relative z-[1]">
|
||||
<Heading level={2} className="mb-6 text-background">
|
||||
{labels.testimonialsTitle}
|
||||
</Heading>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{testimonials.map((item) => (
|
||||
<QuoteBlock key={item.id} {...item} />
|
||||
<SectionHeader align="center" title={labels.rankTitle} />
|
||||
<div className="mx-auto grid max-w-4xl gap-4 sm:grid-cols-2">
|
||||
{highlights.map((item) => (
|
||||
<SurfaceCard key={item.title} padded>
|
||||
<p className="text-3xl font-extrabold text-primary">
|
||||
{item.value}
|
||||
</p>
|
||||
<Heading as="h3" level={4} className="mt-3">
|
||||
{item.title}
|
||||
</Heading>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
{item.text}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
@@ -17,6 +17,8 @@ const buttonVariants = cva(
|
||||
destructive:
|
||||
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
inverse:
|
||||
"border-background/30 bg-transparent text-background hover:border-background hover:bg-background hover:text-foreground",
|
||||
},
|
||||
size: {
|
||||
default:
|
||||
|
||||
@@ -11,7 +11,7 @@ function Card({
|
||||
data-slot="card"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-2xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-sm ring-1 ring-foreground/10 transition-[box-shadow,ring-color] duration-300 [--card-spacing:--spacing(4)] hover:shadow-lg hover:ring-primary/20 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-2xl *:[img:last-child]:rounded-b-2xl",
|
||||
"group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-2xl bg-card py-(--card-spacing) text-sm text-card-foreground shadow-sm ring-1 ring-foreground/10 transition-[box-shadow,ring-color] duration-300 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-2xl *:[img:last-child]:rounded-b-2xl",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -4,12 +4,14 @@ import { errorResponse } from "@/lib/api/response";
|
||||
* Admin entities temporarily hidden from the panel (nav, dashboard, pages, APIs).
|
||||
* Code and DB remain intact — remove a key from this set to re-enable.
|
||||
*
|
||||
* Matches public-site temporary hide: articles (insights), events, alumni.
|
||||
* Matches public-site temporary hide: articles (insights), events, alumni,
|
||||
* testimonials (نظر شرکتکنندگان).
|
||||
*/
|
||||
export const DISABLED_ADMIN_ENTITIES = new Set([
|
||||
"articles",
|
||||
"events",
|
||||
"alumni",
|
||||
"testimonials",
|
||||
]);
|
||||
|
||||
export function isAdminEntityEnabled(key: string): boolean {
|
||||
|
||||
@@ -297,6 +297,13 @@ export const ENTITIES: Record<string, AdminEntitySpec> = {
|
||||
},
|
||||
{ name: "linkedinUrl", label: "لینکدین", type: "text", placeholder: "https://www.linkedin.com/in/..." },
|
||||
{ name: "scholarUrl", label: "گوگل اسکولار", type: "text", placeholder: "https://scholar.google.com/..." },
|
||||
{
|
||||
name: "profileUrl",
|
||||
label: "صفحه استاد در دانشکده",
|
||||
type: "text",
|
||||
placeholder: "https://mst.aut.ac.ir/...",
|
||||
full: true,
|
||||
},
|
||||
{ name: "bio", label: "بیوگرافی", type: "textarea", required: true, full: true },
|
||||
publishedField,
|
||||
],
|
||||
|
||||
+20
-11
@@ -53,17 +53,26 @@ export async function verifySession(): Promise<AdminSession | null> {
|
||||
const [token, tokenHash] = cookie.split(".");
|
||||
if (!token || !tokenHash) return null;
|
||||
|
||||
const res = await query(
|
||||
`SELECT u.id, u.email, u.name, u.role
|
||||
FROM admin_users u
|
||||
JOIN admin_sessions s ON s.user_id = u.id
|
||||
WHERE s.token_hash = $1 AND s.expires_at > now()
|
||||
LIMIT 1`,
|
||||
[tokenHash],
|
||||
);
|
||||
if (res.rows.length === 0) return null;
|
||||
const u = res.rows[0];
|
||||
return { userId: u.id, email: u.email, name: u.name, role: u.role };
|
||||
try {
|
||||
const res = await query(
|
||||
`SELECT u.id, u.email, u.name, u.role
|
||||
FROM admin_users u
|
||||
JOIN admin_sessions s ON s.user_id = u.id
|
||||
WHERE s.token_hash = $1 AND s.expires_at > now()
|
||||
LIMIT 1`,
|
||||
[tokenHash],
|
||||
);
|
||||
if (res.rows.length === 0) return null;
|
||||
const u = res.rows[0];
|
||||
return { userId: u.id, email: u.email, name: u.name, role: u.role };
|
||||
} catch (err) {
|
||||
// Transient DB timeouts must not 500 the entire admin shell — treat as logged out.
|
||||
console.error(
|
||||
"[auth] verifySession failed:",
|
||||
err instanceof Error ? err.message : err,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function destroySession(): Promise<void> {
|
||||
|
||||
+26
-9
@@ -2,18 +2,34 @@ import type { NavItem, TaxonomyRef } from "@/lib/types";
|
||||
import { courseNavParentTag, homeNav } from "@/lib/site-config";
|
||||
|
||||
/** Link to the full course catalog (parent / «همه»). */
|
||||
export function courseCatalogHref(): string {
|
||||
return "/professional";
|
||||
export function courseCatalogHref(hash = "#courses"): string {
|
||||
return `/professional${hash}`;
|
||||
}
|
||||
|
||||
/** Deep-link filtered by tag slug. */
|
||||
export function courseTagHref(slug: string): string {
|
||||
return `/professional?tag=${encodeURIComponent(slug)}`;
|
||||
/** Build catalog URL with optional tag/category filters. */
|
||||
export function courseFilterHref(opts: {
|
||||
tag?: string;
|
||||
category?: string;
|
||||
hash?: string;
|
||||
}): string {
|
||||
const params = new URLSearchParams();
|
||||
const tag = opts.tag?.trim() ?? "";
|
||||
const category = opts.category?.trim() ?? "";
|
||||
if (tag) params.set("tag", tag);
|
||||
if (category) params.set("category", category);
|
||||
const qs = params.toString();
|
||||
const hash = opts.hash ?? "#courses";
|
||||
return qs ? `/professional?${qs}${hash}` : `/professional${hash}`;
|
||||
}
|
||||
|
||||
/** Deep-link filtered by category slug. */
|
||||
export function courseCategoryHref(slug: string): string {
|
||||
return `/professional?category=${encodeURIComponent(slug)}`;
|
||||
/** Deep-link filtered by tag slug (optionally keep a category). */
|
||||
export function courseTagHref(slug: string, category?: string): string {
|
||||
return courseFilterHref({ tag: slug, category });
|
||||
}
|
||||
|
||||
/** Deep-link filtered by category slug (optionally keep a tag). */
|
||||
export function courseCategoryHref(slug: string, tag?: string): string {
|
||||
return courseFilterHref({ category: slug, tag });
|
||||
}
|
||||
|
||||
/** Build dropdown children: parent (all) + one item per nav tag. */
|
||||
@@ -44,7 +60,8 @@ export function buildHomeNavWithCourseTags(
|
||||
children: buildCourseNavChildren(tags),
|
||||
};
|
||||
|
||||
const insertAt = homeNav.findIndex((item) => item.prominent);
|
||||
// Insert courses before «درباره ما» so order is: … → دورهها → درباره ما
|
||||
const insertAt = homeNav.findIndex((item) => item.href === "/about");
|
||||
if (insertAt === -1) {
|
||||
return [...homeNav, coursesItem];
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface AdminCourse extends Course {
|
||||
published: boolean;
|
||||
categoryIds: string[];
|
||||
tagIds: string[];
|
||||
facultyIds: string[];
|
||||
}
|
||||
|
||||
function toAdminCourse(row: CourseRow): AdminCourse {
|
||||
@@ -18,6 +19,7 @@ function toAdminCourse(row: CourseRow): AdminCourse {
|
||||
published: row.published,
|
||||
categoryIds: course.categories.map((c) => c.id),
|
||||
tagIds: course.tags.map((t) => t.id),
|
||||
facultyIds: (course.instructors ?? []).map((f) => f.id),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -106,3 +106,20 @@ export async function setCourseTags(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/** Replace faculty (instructor) links for a course. */
|
||||
export async function setCourseFaculty(
|
||||
courseId: string,
|
||||
facultyIds: string[],
|
||||
): Promise<void> {
|
||||
await query(`DELETE FROM course_faculty_links WHERE course_id = $1`, [
|
||||
courseId,
|
||||
]);
|
||||
for (const facultyId of facultyIds) {
|
||||
await query(
|
||||
`INSERT INTO course_faculty_links (course_id, faculty_id)
|
||||
VALUES ($1, $2) ON CONFLICT DO NOTHING`,
|
||||
[courseId, facultyId],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Shared SELECT fragment: course row + JSON arrays of categories/tags. */
|
||||
/** Shared SELECT fragment: course row + JSON arrays of categories/tags/instructors. */
|
||||
export const COURSE_WITH_TAXONOMY_SELECT = `
|
||||
SELECT c.*,
|
||||
COALESCE(
|
||||
@@ -24,6 +24,23 @@ export const COURSE_WITH_TAXONOMY_SELECT = `
|
||||
WHERE l.course_id = c.id
|
||||
),
|
||||
'[]'::json
|
||||
) AS tags
|
||||
) AS tags,
|
||||
COALESCE(
|
||||
(
|
||||
SELECT json_agg(
|
||||
json_build_object(
|
||||
'id', f.id,
|
||||
'name', f.name,
|
||||
'title', f.title,
|
||||
'profileUrl', f.profile_url
|
||||
)
|
||||
ORDER BY f.name ASC
|
||||
)
|
||||
FROM course_faculty_links l
|
||||
JOIN faculty_members f ON f.id = l.faculty_id
|
||||
WHERE l.course_id = c.id
|
||||
),
|
||||
'[]'::json
|
||||
) AS instructors
|
||||
FROM courses c
|
||||
`;
|
||||
@@ -12,6 +12,18 @@ export async function getCourses(): Promise<Course[]> {
|
||||
return res.rows.map(rowToCourse);
|
||||
}
|
||||
|
||||
/** Latest published courses for home preview (newest first). */
|
||||
export async function getLatestCourses(limit = 6): Promise<Course[]> {
|
||||
const res = await query<CourseRow>(
|
||||
`${COURSE_WITH_TAXONOMY_SELECT}
|
||||
WHERE c.published = true
|
||||
ORDER BY c.created_at DESC, c.title ASC
|
||||
LIMIT $1`,
|
||||
[limit],
|
||||
);
|
||||
return res.rows.map(rowToCourse);
|
||||
}
|
||||
|
||||
export async function getCourseById(id: string): Promise<Course | null> {
|
||||
const res = await query<CourseRow>(
|
||||
`${COURSE_WITH_TAXONOMY_SELECT}
|
||||
|
||||
+16
-2
@@ -4,6 +4,11 @@ const { Pool } = pg;
|
||||
|
||||
let poolInstance: pg.Pool | null = null;
|
||||
|
||||
/** Remote Postgres (e.g. 185.x) often needs >5s to establish TCP+auth. */
|
||||
const CONNECTION_TIMEOUT_MS = Number(
|
||||
process.env.DATABASE_CONNECTION_TIMEOUT_MS ?? 20_000,
|
||||
);
|
||||
|
||||
function getPool(): pg.Pool {
|
||||
const url = process.env.DATABASE_URL?.trim();
|
||||
if (!url) {
|
||||
@@ -15,8 +20,11 @@ function getPool(): pg.Pool {
|
||||
poolInstance = new Pool({
|
||||
connectionString: url,
|
||||
max: 5,
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 5000,
|
||||
idleTimeoutMillis: 30_000,
|
||||
connectionTimeoutMillis: CONNECTION_TIMEOUT_MS,
|
||||
// Keepalive helps long-lived pools through NATs/firewalls to remote hosts.
|
||||
keepAlive: true,
|
||||
keepAliveInitialDelayMillis: 10_000,
|
||||
});
|
||||
poolInstance.on("error", (err) => {
|
||||
console.error("[db] idle client error:", err.message);
|
||||
@@ -48,6 +56,12 @@ export async function query<T extends pg.QueryResultRow = pg.QueryResultRow>(
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
console.error("[db] query failed:", message, { text: text.slice(0, 120) });
|
||||
// Drop a poisoned pool after connect timeouts so the next request retries cleanly.
|
||||
if (/timeout|ECONNREFUSED|ECONNRESET|Connection terminated/i.test(message)) {
|
||||
const dead = poolInstance;
|
||||
poolInstance = null;
|
||||
void dead?.end().catch(() => {});
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
Course,
|
||||
EventItem,
|
||||
FacultyMember,
|
||||
FacultyRef,
|
||||
IntersectionTopic,
|
||||
LegalPage,
|
||||
Program,
|
||||
@@ -54,6 +55,7 @@ export interface CourseRow {
|
||||
/** Present when SELECT aggregates taxonomy as JSON. */
|
||||
categories?: unknown;
|
||||
tags?: unknown;
|
||||
instructors?: unknown;
|
||||
}
|
||||
|
||||
/** Seed/upsert row for courses table (no taxonomy columns). */
|
||||
@@ -75,6 +77,25 @@ export function courseToRow(course: Course): CourseRow {
|
||||
};
|
||||
}
|
||||
|
||||
function asFacultyRefs(value: unknown): FacultyRef[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
const out: FacultyRef[] = [];
|
||||
for (const item of value) {
|
||||
if (!item || typeof item !== "object") continue;
|
||||
const o = item as Record<string, unknown>;
|
||||
const id = typeof o.id === "string" ? o.id : "";
|
||||
const name = typeof o.name === "string" ? o.name : "";
|
||||
const title = typeof o.title === "string" ? o.title : "";
|
||||
if (!id || !name) continue;
|
||||
const ref: FacultyRef = { id, name, title };
|
||||
if (typeof o.profileUrl === "string" && o.profileUrl) {
|
||||
ref.profileUrl = o.profileUrl;
|
||||
}
|
||||
out.push(ref);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function asTaxonomyRefs(value: unknown): TaxonomyRef[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value
|
||||
@@ -217,6 +238,7 @@ export interface FacultyMemberRow {
|
||||
department: string | null;
|
||||
linkedin_url: string | null;
|
||||
scholar_url: string | null;
|
||||
profile_url: string | null;
|
||||
published: boolean;
|
||||
}
|
||||
|
||||
@@ -234,6 +256,7 @@ export function facultyMemberToRow(faculty: FacultyMember): FacultyMemberRow {
|
||||
department: faculty.department ?? null,
|
||||
linkedin_url: faculty.linkedinUrl ?? null,
|
||||
scholar_url: faculty.scholarUrl ?? null,
|
||||
profile_url: faculty.profileUrl ?? null,
|
||||
published: true,
|
||||
};
|
||||
}
|
||||
@@ -349,6 +372,7 @@ export function rowToCourse(row: CourseRow): Course {
|
||||
summary: row.summary,
|
||||
categories: asTaxonomyRefs(row.categories),
|
||||
tags: asTaxonomyRefs(row.tags),
|
||||
instructors: asFacultyRefs(row.instructors),
|
||||
durationHours: row.duration_hours,
|
||||
format: row.format as Course["format"],
|
||||
price: Number.isFinite(price) ? price : null,
|
||||
@@ -430,6 +454,7 @@ export function rowToFacultyMember(row: FacultyMemberRow): FacultyMember {
|
||||
department: row.department ?? undefined,
|
||||
linkedinUrl: row.linkedin_url ?? undefined,
|
||||
scholarUrl: row.scholar_url ?? undefined,
|
||||
profileUrl: row.profile_url ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* Parse the MST «شبکه اساتید» page HTML (live or saved) into faculty records.
|
||||
* Markup uses `mstf-*` classes embedded in the CMS page body.
|
||||
*/
|
||||
|
||||
export type ParsedMstFaculty = {
|
||||
name: string;
|
||||
/** Pill on the card, e.g. عضو هیئت علمی / استاد مدعو */
|
||||
title: string;
|
||||
department: string;
|
||||
focus: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
linkedinUrl: string;
|
||||
scholarUrl: string;
|
||||
/** Absolute or relative image URL as found in HTML */
|
||||
imageSrc: string;
|
||||
visiting: boolean;
|
||||
};
|
||||
|
||||
function decodeEntities(s: string): string {
|
||||
return s
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/ /g, " ")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function stripTags(s: string): string {
|
||||
return decodeEntities(s.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim());
|
||||
}
|
||||
|
||||
function pickHref(block: string, classToken: string): string {
|
||||
const re = new RegExp(
|
||||
`class="[^"]*${classToken}[^"]*"[^>]*href="([^"]+)"|href="([^"]+)"[^>]*class="[^"]*${classToken}[^"]*"`,
|
||||
"i",
|
||||
);
|
||||
const m = block.match(re);
|
||||
const href = m?.[1] || m?.[2] || "";
|
||||
if (!href || href === "https://orcid.org/" || href.endsWith("orcid.org/")) {
|
||||
return "";
|
||||
}
|
||||
return decodeEntities(href);
|
||||
}
|
||||
|
||||
function formatPhone(tel: string): string {
|
||||
const digits = tel.replace(/\D/g, "");
|
||||
// +98 21 6454xxxx → ۰۲۱-۶۴۵۴xxxx
|
||||
let local = digits;
|
||||
if (local.startsWith("98")) local = "0" + local.slice(2);
|
||||
if (local.length === 11 && local.startsWith("021")) {
|
||||
return `${local.slice(0, 3)}-${local.slice(3)}`;
|
||||
}
|
||||
return local || tel;
|
||||
}
|
||||
|
||||
/** Stable id from email local-part, else a short hash of the name. */
|
||||
export function facultyIdFromParsed(p: ParsedMstFaculty): string {
|
||||
if (p.email) {
|
||||
const local = p.email
|
||||
.split("@")[0]
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
if (local) return `fac-${local}`;
|
||||
}
|
||||
let h = 0;
|
||||
for (let i = 0; i < p.name.length; i++) {
|
||||
h = (h * 31 + p.name.charCodeAt(i)) >>> 0;
|
||||
}
|
||||
return `fac-${h.toString(36)}`;
|
||||
}
|
||||
|
||||
export function parseMstFacultyNetworkHtml(html: string): ParsedMstFaculty[] {
|
||||
const cardRe = /<div class="mstf-card([^"]*)"([\s\S]*?)<\/div>\s*<\/div>/g;
|
||||
const out: ParsedMstFaculty[] = [];
|
||||
let m: RegExpExecArray | null;
|
||||
while ((m = cardRe.exec(html))) {
|
||||
const classExtra = m[1] ?? "";
|
||||
const body = m[0];
|
||||
const name = stripTags(body.match(/mstf-name">([^<]+)/)?.[1] ?? "");
|
||||
if (!name) continue;
|
||||
|
||||
const pill = stripTags(body.match(/mstf-pill">([^<]+)/)?.[1] ?? "") || "عضو هیئت علمی";
|
||||
const deptRaw = body.match(/mstf-dept">([\s\S]*?)<\/div>/)?.[1] ?? "";
|
||||
const department = stripTags(deptRaw);
|
||||
const focus = stripTags(
|
||||
body.match(/mstf-int"><b>[^<]*<\/b>\s*([^<]+)/)?.[1] ?? "",
|
||||
);
|
||||
const email = decodeEntities(
|
||||
body.match(/mailto:([^"'>\s]+)/)?.[1] ?? "",
|
||||
);
|
||||
const telRaw = body.match(/tel:(\+?[\d]+)/)?.[1] ?? "";
|
||||
const phone = telRaw ? formatPhone(telRaw) : "";
|
||||
const linkedinUrl = pickHref(body, "mstf-i-linkedin");
|
||||
const scholarUrl = pickHref(body, "mstf-i-scholar");
|
||||
const imageSrc = decodeEntities(
|
||||
body.match(/mstf-avatar"><img[^>]+src="([^"]+)"/)?.[1] ?? "",
|
||||
);
|
||||
const visiting =
|
||||
classExtra.includes("mstf-visiting") || pill.includes("مدعو");
|
||||
|
||||
out.push({
|
||||
name,
|
||||
title: pill,
|
||||
department,
|
||||
focus: focus || (visiting ? "استاد مدعو" : "—"),
|
||||
email,
|
||||
phone,
|
||||
linkedinUrl,
|
||||
scholarUrl,
|
||||
imageSrc,
|
||||
visiting,
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve image src from MST HTML.
|
||||
* Live pages use `./files/mst/...` which is rooted at the site origin
|
||||
* (https://mst.aut.ac.ir/), not the content page path.
|
||||
* Offline Chrome saves rewrite to `./…_files/foo.png` — those stay local-only.
|
||||
*/
|
||||
export function resolveMstImageUrl(
|
||||
imageSrc: string,
|
||||
pageUrl: string,
|
||||
): string {
|
||||
if (!imageSrc) return "";
|
||||
if (/^https?:\/\//i.test(imageSrc)) return imageSrc;
|
||||
// Browser-saved offline assets — not fetchable from MST
|
||||
if (imageSrc.includes("_files/")) {
|
||||
return imageSrc.split(/[/\\]/).pop() ?? "";
|
||||
}
|
||||
try {
|
||||
const origin = new URL(pageUrl).origin;
|
||||
// `/files/...` or `./files/...` → site root
|
||||
if (
|
||||
imageSrc.startsWith("/files/") ||
|
||||
imageSrc.startsWith("./files/") ||
|
||||
imageSrc.startsWith("files/")
|
||||
) {
|
||||
const normalized = imageSrc.replace(/^\.\//, "");
|
||||
return new URL(
|
||||
normalized.startsWith("/") ? normalized : `/${normalized}`,
|
||||
origin,
|
||||
).href;
|
||||
}
|
||||
if (imageSrc.startsWith("/")) {
|
||||
return new URL(imageSrc, origin).href;
|
||||
}
|
||||
return new URL(imageSrc, pageUrl).href;
|
||||
} catch {
|
||||
return imageSrc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
import { createWriteStream } from "node:fs";
|
||||
import { mkdir, copyFile, access } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { Readable } from "node:stream";
|
||||
import { query } from "@/lib/db";
|
||||
import type { FacultyMemberRow } from "@/lib/db/mappers";
|
||||
import { facultyNetworkUrl } from "@/lib/site-config";
|
||||
import {
|
||||
facultyIdFromParsed,
|
||||
parseMstFacultyNetworkHtml,
|
||||
resolveMstImageUrl,
|
||||
type ParsedMstFaculty,
|
||||
} from "@/lib/faculty/parse-mst-network";
|
||||
|
||||
const PLACEHOLDER_IMAGE = "/images/faculty/placeholder.png";
|
||||
const FETCH_TIMEOUT_MS = 25_000;
|
||||
|
||||
export type FacultySyncResult = {
|
||||
total: number;
|
||||
inserted: number;
|
||||
updated: number;
|
||||
imagesSaved: number;
|
||||
source: "remote" | "html";
|
||||
};
|
||||
|
||||
export type FacultySyncOptions = {
|
||||
/** When set, parse this HTML instead of fetching the live page. */
|
||||
html?: string;
|
||||
/** Absolute path to a folder of saved avatar files (offline import). */
|
||||
localImageDir?: string;
|
||||
/** Public site origin used only for logging; images stored under /public. */
|
||||
publicDir?: string;
|
||||
};
|
||||
|
||||
function normalizeName(name: string): string {
|
||||
return name.replace(/\s+/g, " ").trim().toLowerCase();
|
||||
}
|
||||
|
||||
function isPlaceholderSrc(src: string): boolean {
|
||||
const base = src.split(/[/\\]/).pop()?.toLowerCase() ?? "";
|
||||
return !base || base === "johndoe.png" || base.includes("placeholder");
|
||||
}
|
||||
|
||||
function imageFileName(id: string, src: string): string {
|
||||
const ext =
|
||||
path.extname(src.split("?")[0]).toLowerCase() || ".png";
|
||||
const safeExt = [".png", ".jpg", ".jpeg", ".webp", ".gif"].includes(ext)
|
||||
? ext
|
||||
: ".png";
|
||||
return `${id}${safeExt}`;
|
||||
}
|
||||
|
||||
async function fileExists(p: string): Promise<boolean> {
|
||||
try {
|
||||
await access(p);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function downloadImage(
|
||||
url: string,
|
||||
destPath: string,
|
||||
): Promise<boolean> {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
signal: controller.signal,
|
||||
headers: {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (compatible; AUT-OpenEdu-FacultySync/1.0)",
|
||||
Accept: "image/*,*/*;q=0.8",
|
||||
},
|
||||
redirect: "follow",
|
||||
});
|
||||
if (!res.ok || !res.body) return false;
|
||||
await mkdir(path.dirname(destPath), { recursive: true });
|
||||
const nodeStream = Readable.fromWeb(
|
||||
res.body as import("node:stream/web").ReadableStream,
|
||||
);
|
||||
await pipeline(nodeStream, createWriteStream(destPath));
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveImageUrl(
|
||||
parsed: ParsedMstFaculty,
|
||||
id: string,
|
||||
existing: FacultyMemberRow | undefined,
|
||||
opts: FacultySyncOptions,
|
||||
): Promise<{ imageUrl: string; saved: boolean }> {
|
||||
const publicDir =
|
||||
opts.publicDir ?? path.join(process.cwd(), "public");
|
||||
const facultyDir = path.join(publicDir, "images", "faculty");
|
||||
await mkdir(facultyDir, { recursive: true });
|
||||
|
||||
const src = parsed.imageSrc || "";
|
||||
const fileBase = src.split(/[/\\]/).pop() ?? "";
|
||||
|
||||
// Prefer keeping a curated local photo over the generic johndoe avatar.
|
||||
if (
|
||||
existing?.image_url &&
|
||||
!existing.image_url.includes("placeholder") &&
|
||||
isPlaceholderSrc(src)
|
||||
) {
|
||||
return { imageUrl: existing.image_url, saved: false };
|
||||
}
|
||||
|
||||
// Offline import: copy from the browser-saved `_files` folder.
|
||||
if (opts.localImageDir && fileBase && !isPlaceholderSrc(src)) {
|
||||
const from = path.join(opts.localImageDir, fileBase);
|
||||
if (await fileExists(from)) {
|
||||
const destName = imageFileName(id, fileBase);
|
||||
const dest = path.join(facultyDir, destName);
|
||||
await copyFile(from, dest);
|
||||
return { imageUrl: `/images/faculty/${destName}`, saved: true };
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.localImageDir && isPlaceholderSrc(src)) {
|
||||
const from = path.join(opts.localImageDir, "johndoe.png");
|
||||
const dest = path.join(facultyDir, "placeholder.png");
|
||||
if (!(await fileExists(dest)) && (await fileExists(from))) {
|
||||
await copyFile(from, dest);
|
||||
}
|
||||
if (existing?.image_url) {
|
||||
return { imageUrl: existing.image_url, saved: false };
|
||||
}
|
||||
return { imageUrl: PLACEHOLDER_IMAGE, saved: false };
|
||||
}
|
||||
|
||||
// Live / relative MST asset → download into public/
|
||||
if (src && !src.includes("_files/") && !isPlaceholderSrc(src)) {
|
||||
const abs = /^https?:\/\//i.test(src)
|
||||
? src
|
||||
: resolveMstImageUrl(src, facultyNetworkUrl);
|
||||
if (/^https?:\/\//i.test(abs)) {
|
||||
const destName = imageFileName(id, abs);
|
||||
const dest = path.join(facultyDir, destName);
|
||||
const ok = await downloadImage(abs, dest);
|
||||
if (ok) return { imageUrl: `/images/faculty/${destName}`, saved: true };
|
||||
}
|
||||
}
|
||||
|
||||
if (existing?.image_url) {
|
||||
return { imageUrl: existing.image_url, saved: false };
|
||||
}
|
||||
return { imageUrl: PLACEHOLDER_IMAGE, saved: false };
|
||||
}
|
||||
|
||||
function findMatch(
|
||||
parsed: ParsedMstFaculty,
|
||||
byEmail: Map<string, FacultyMemberRow>,
|
||||
byName: Map<string, FacultyMemberRow>,
|
||||
): FacultyMemberRow | undefined {
|
||||
if (parsed.email) {
|
||||
const hit = byEmail.get(parsed.email.toLowerCase());
|
||||
if (hit) return hit;
|
||||
}
|
||||
return byName.get(normalizeName(parsed.name));
|
||||
}
|
||||
|
||||
function bioFor(parsed: ParsedMstFaculty): string {
|
||||
const bits = [parsed.title];
|
||||
if (parsed.department) bits.push(parsed.department);
|
||||
return bits.join(" — ");
|
||||
}
|
||||
|
||||
export async function fetchMstFacultyNetworkHtml(): Promise<string> {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
||||
try {
|
||||
const res = await fetch(facultyNetworkUrl, {
|
||||
signal: controller.signal,
|
||||
headers: {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (compatible; AUT-OpenEdu-FacultySync/1.0)",
|
||||
Accept: "text/html,application/xhtml+xml",
|
||||
"Accept-Language": "fa,en;q=0.8",
|
||||
},
|
||||
redirect: "follow",
|
||||
cache: "no-store",
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`دریافت صفحه شبکه اساتید ناموفق بود (${res.status})`);
|
||||
}
|
||||
return await res.text();
|
||||
} catch (err) {
|
||||
if (err instanceof Error && err.name === "AbortError") {
|
||||
throw new Error(
|
||||
"مهلت اتصال به سایت دانشکده به پایان رسید. اتصال شبکه را بررسی کنید.",
|
||||
);
|
||||
}
|
||||
throw err instanceof Error
|
||||
? err
|
||||
: new Error("خطا در دریافت صفحه شبکه اساتید");
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upsert faculty members parsed from MST «شبکه اساتید» HTML.
|
||||
* Matches existing rows by email (preferred) or name.
|
||||
*/
|
||||
export async function syncFacultyFromMstHtml(
|
||||
html: string,
|
||||
opts: FacultySyncOptions = {},
|
||||
): Promise<FacultySyncResult> {
|
||||
const parsedList = parseMstFacultyNetworkHtml(html);
|
||||
if (parsedList.length === 0) {
|
||||
throw new Error("در صفحهٔ دریافتی هیچ کارت استادی پیدا نشد.");
|
||||
}
|
||||
|
||||
const existing = await query<FacultyMemberRow>(
|
||||
`SELECT * FROM faculty_members`,
|
||||
);
|
||||
const byEmail = new Map<string, FacultyMemberRow>();
|
||||
const byName = new Map<string, FacultyMemberRow>();
|
||||
for (const row of existing.rows) {
|
||||
if (row.email) byEmail.set(row.email.toLowerCase(), row);
|
||||
byName.set(normalizeName(row.name), row);
|
||||
}
|
||||
|
||||
let inserted = 0;
|
||||
let updated = 0;
|
||||
let imagesSaved = 0;
|
||||
|
||||
for (const parsed of parsedList) {
|
||||
const match = findMatch(parsed, byEmail, byName);
|
||||
const id = match?.id ?? facultyIdFromParsed(parsed);
|
||||
const { imageUrl, saved } = await resolveImageUrl(
|
||||
parsed,
|
||||
id,
|
||||
match,
|
||||
opts,
|
||||
);
|
||||
if (saved) imagesSaved += 1;
|
||||
|
||||
const focus = parsed.focus || (parsed.visiting ? "استاد مدعو" : "—");
|
||||
const pill = parsed.title || "عضو هیئت علمی";
|
||||
// Keep a more specific academic rank already in DB (e.g. استادیار).
|
||||
const title =
|
||||
match?.title &&
|
||||
!/هیئت علمی|مدعو/.test(match.title)
|
||||
? match.title
|
||||
: pill;
|
||||
const bio = match?.bio?.trim() ? match.bio : bioFor(parsed);
|
||||
|
||||
if (match) {
|
||||
await query(
|
||||
`UPDATE faculty_members SET
|
||||
name = $2,
|
||||
title = $3,
|
||||
focus = $4,
|
||||
bio = $5,
|
||||
image_url = $6,
|
||||
email = $7,
|
||||
phone = $8,
|
||||
department = $9,
|
||||
linkedin_url = $10,
|
||||
scholar_url = $11,
|
||||
updated_at = now()
|
||||
WHERE id = $1`,
|
||||
[
|
||||
id,
|
||||
parsed.name,
|
||||
title,
|
||||
focus,
|
||||
bio,
|
||||
imageUrl,
|
||||
parsed.email || null,
|
||||
parsed.phone || null,
|
||||
parsed.department || null,
|
||||
parsed.linkedinUrl || null,
|
||||
parsed.scholarUrl || null,
|
||||
],
|
||||
);
|
||||
updated += 1;
|
||||
// Refresh maps so later duplicates in the same page hit this row
|
||||
if (parsed.email) byEmail.set(parsed.email.toLowerCase(), { ...match, id });
|
||||
byName.set(normalizeName(parsed.name), { ...match, id });
|
||||
} else {
|
||||
await query(
|
||||
`INSERT INTO faculty_members (
|
||||
id, name, title, focus, bio, image_url,
|
||||
email, office, phone, department,
|
||||
linkedin_url, scholar_url, profile_url, published
|
||||
) VALUES (
|
||||
$1,$2,$3,$4,$5,$6,
|
||||
$7,NULL,$8,$9,
|
||||
$10,$11,NULL,true
|
||||
)`,
|
||||
[
|
||||
id,
|
||||
parsed.name,
|
||||
title,
|
||||
focus,
|
||||
bio,
|
||||
imageUrl,
|
||||
parsed.email || null,
|
||||
parsed.phone || null,
|
||||
parsed.department || null,
|
||||
parsed.linkedinUrl || null,
|
||||
parsed.scholarUrl || null,
|
||||
],
|
||||
);
|
||||
inserted += 1;
|
||||
const row = {
|
||||
id,
|
||||
name: parsed.name,
|
||||
title,
|
||||
focus,
|
||||
bio,
|
||||
image_url: imageUrl,
|
||||
email: parsed.email || null,
|
||||
office: null,
|
||||
phone: parsed.phone || null,
|
||||
department: parsed.department || null,
|
||||
linkedin_url: parsed.linkedinUrl || null,
|
||||
scholar_url: parsed.scholarUrl || null,
|
||||
profile_url: null,
|
||||
published: true,
|
||||
} satisfies FacultyMemberRow;
|
||||
if (parsed.email) byEmail.set(parsed.email.toLowerCase(), row);
|
||||
byName.set(normalizeName(parsed.name), row);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
total: parsedList.length,
|
||||
inserted,
|
||||
updated,
|
||||
imagesSaved,
|
||||
source: "html",
|
||||
};
|
||||
}
|
||||
|
||||
/** Fetch the live MST network page and upsert faculty. */
|
||||
export async function syncFacultyFromMstNetwork(
|
||||
opts: Omit<FacultySyncOptions, "html"> = {},
|
||||
): Promise<FacultySyncResult> {
|
||||
const html = await fetchMstFacultyNetworkHtml();
|
||||
const result = await syncFacultyFromMstHtml(html, opts);
|
||||
return { ...result, source: "remote" };
|
||||
}
|
||||
+2
-46
@@ -354,52 +354,8 @@ export const legalPages: LegalPage[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const aboutFocusAreas = [
|
||||
{
|
||||
title: "هوش مصنوعی و تحول سازمان",
|
||||
description:
|
||||
"دوره تخصصی دوروزه و کارگاه عملی AI Fluency؛ از آمادگی سازمان تا محصول، داده و تجربه عملی.",
|
||||
},
|
||||
{
|
||||
title: "برندینگ",
|
||||
description:
|
||||
"انسجام هویت، وعده و تجربه برند برای اعتماد مخاطب و تصمیمهای جایگاه کسبوکار.",
|
||||
},
|
||||
{
|
||||
title: "برند و بازاریابی",
|
||||
description:
|
||||
"از شناخت مشتری و استراتژی بازار تا کمپین، سنجش اثربخشی و هماهنگی برند با فعالیتهای بازار.",
|
||||
},
|
||||
{
|
||||
title: "هماندیشی مدیریتی",
|
||||
description:
|
||||
"گفتوگوی یکبهیک درباره مسئله واقعی سازمان برای روشنترشدن فرضها و گزینههای تصمیم.",
|
||||
},
|
||||
];
|
||||
|
||||
export const valuesContent = {
|
||||
title: "ارزشهای ما",
|
||||
intro:
|
||||
"در دانشکده مدیریت علم و فناوری باور داریم یادگیری جدی باید همراه احترام، گشودگی و کاربرد واقعی باشد.",
|
||||
items: [
|
||||
{
|
||||
title: "کیفیت علمی",
|
||||
text: "استاندارد دانشگاهی و محتوای بهروز.",
|
||||
},
|
||||
{
|
||||
title: "احترام و گفتگو",
|
||||
text: "تنوع دیدگاهها و فضای امن برای پرسش.",
|
||||
},
|
||||
{
|
||||
title: "شبکه حرفهای",
|
||||
text: "ارتباطی که بعد از پایان دوره هم ادامه دارد.",
|
||||
},
|
||||
{
|
||||
title: "کاربرد عملی",
|
||||
text: "یادگیری برای حل مسئله واقعی سازمان.",
|
||||
},
|
||||
],
|
||||
};
|
||||
/** @deprecated Prefer `@/lib/site-config` — kept only for seed/reference parity. */
|
||||
export { aboutContent, valuesContent } from "@/lib/site-config";
|
||||
|
||||
export const stats: SiteStat[] = [
|
||||
{ id: "st-1", value: "+۱۲٬۰۰۰", label: "شرکتکننده در دورهها" },
|
||||
|
||||
+105
-38
@@ -11,7 +11,7 @@ export const siteShortName = "مرکز آموزشهای آزاد";
|
||||
export const siteFaculty = "دانشکده مدیریت، علم و فناوری";
|
||||
export const siteUniversity = "دانشگاه صنعتی امیرکبیر";
|
||||
export const siteMission =
|
||||
"آموزش مدیران برای تحول در صنعت؛ با تمرکز بر تصمیمگیری دادهمحور، کاربرد هوش مصنوعی و مدیریت تغییر برای بهبود عملکرد سازمان.";
|
||||
"پیوند دانش مدیریت، فناوری و تجربه؛ توسعه دانش و توانمندیهای حرفهای در مواجهه با مسائل کسبوکار و تحولات فناوری.";
|
||||
|
||||
export const siteAddress = {
|
||||
line: "تهران، خیابان حافظ، دانشگاه صنعتی امیرکبیر — دانشکده مدیریت، علم و فناوری",
|
||||
@@ -27,12 +27,19 @@ export const siteAddress = {
|
||||
*/
|
||||
export const courseNavParentTag = "دورهها";
|
||||
|
||||
/** Main nav (static items). Courses dropdown is injected at runtime from tags. */
|
||||
/** Faculty site (quick links / external). Not a page on this site. */
|
||||
export const facultySiteUrl = "https://mst.aut.ac.ir/";
|
||||
export const facultyNetworkUrl =
|
||||
"https://mst.aut.ac.ir/content/31094/شبکه-اساتید";
|
||||
|
||||
/**
|
||||
* Main nav (static items). Courses dropdown is injected before «درباره ما».
|
||||
* Order after inject: ارزشها → اساتید → دورهها → درباره ما.
|
||||
*/
|
||||
export const homeNav: NavItem[] = [
|
||||
{ label: "ارزشها", href: "/values" },
|
||||
{ label: "اساتید", href: "https://mst.aut.ac.ir/content/31094/شبکه-اساتید" },
|
||||
{ label: "اساتید", href: facultyNetworkUrl },
|
||||
{ label: "درباره ما", href: "/about" },
|
||||
{ label: "دانشگاه امیرکبیر", href: "https://mst.aut.ac.ir/", prominent: true },
|
||||
];
|
||||
|
||||
/** Professional layout nav; courses children filled at runtime from DB tags. */
|
||||
@@ -47,49 +54,109 @@ export const professionalNav: NavItem[] = [
|
||||
{ label: "تماس با ما", href: "/contact" },
|
||||
];
|
||||
|
||||
export const aboutFocusAreas = [
|
||||
{
|
||||
title: "هوش مصنوعی و تحول سازمان",
|
||||
description:
|
||||
"دوره تخصصی دوروزه و کارگاه عملی AI Fluency؛ از آمادگی سازمان تا محصول، داده و تجربه عملی.",
|
||||
},
|
||||
{
|
||||
title: "برندینگ",
|
||||
description:
|
||||
"انسجام هویت، وعده و تجربه برند برای اعتماد مخاطب و تصمیمهای جایگاه کسبوکار.",
|
||||
},
|
||||
{
|
||||
title: "برند و بازاریابی",
|
||||
description:
|
||||
"از شناخت مشتری و استراتژی بازار تا کمپین، سنجش اثربخشی و هماهنگی برند با فعالیتهای بازار.",
|
||||
},
|
||||
{
|
||||
title: "هماندیشی مدیریتی",
|
||||
description:
|
||||
"گفتوگوی یکبهیک درباره مسئله واقعی سازمان برای روشنترشدن فرضها و گزینههای تصمیم.",
|
||||
},
|
||||
];
|
||||
|
||||
export const valuesContent = {
|
||||
title: "یادگیری با مسئلههای واقعی",
|
||||
/**
|
||||
* Editorial copy for /about — positions the center at the intersection of
|
||||
* management knowledge, technology, and real business problems (not AI-only).
|
||||
*/
|
||||
export const aboutContent = {
|
||||
eyebrow: "درباره ما",
|
||||
title: "پیوند دانش مدیریت، فناوری و تجربه",
|
||||
intro:
|
||||
"در مرکز آموزشهای آزاد دانشگاه صنعتی امیرکبیر، کاربرد آموزش در تصمیمهای مدیریتی و عملکرد سازمان معیار مهمی برای کیفیت یادگیری است. بررسی مسائل صنعت و تبادل تجربه میان مدیران، مبنای رویکرد آموزشی ما هستند.",
|
||||
"مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر، بستری برای توسعه دانش و توانمندیهای حرفهای در مواجهه با مسائل کسبوکار و تحولات فناوری است. جهتگیری آموزشی ما، کمک به شناخت دقیقتر مسائل، ارزیابی آگاهانه گزینهها و بهکارگیری آموختهها در محیط کار است.",
|
||||
introFollowUp:
|
||||
"در این مسیر، دانش دانشگاهی و تجربه حرفهای در کنار یکدیگر قرار میگیرند تا یادگیری به فهمی روشنتر و توانایی بیشتری برای تصمیمگیری و عمل منجر شود.",
|
||||
amirkabir: {
|
||||
title: "ریشه در امیرکبیر، رو به مسائل امروز",
|
||||
paragraphs: [
|
||||
"قرارگرفتن در دانشگاه صنعتی امیرکبیر به رویکرد آموزشی ما زمینهای متمایز میدهد؛ زمینهای که در آن، تحلیل مسئله، شناخت فناوری و توجه به امکان اجرا اهمیت دارند.",
|
||||
"دانشکده مدیریت، علم و فناوری این نگاه را با شناخت انسان، سازمان، اقتصاد و بازار پیوند میدهد. از این منظر، بررسی یک مسئله مدیریتی مستلزم توجه به ارتباط میان افراد، فرایندها، منابع و محیط کسبوکار است. آموزشهای مرکز با الهام از این نگاه، به نیازهای حرفهای و شرایط واقعی سازمانها توجه دارند.",
|
||||
],
|
||||
},
|
||||
faculty: {
|
||||
title: "پشتوانه علمی، با نگاه میانرشتهای",
|
||||
paragraphs: [
|
||||
"شبکه اساتید دانشکده، حوزههای متنوعی از مدیریت و منابع انسانی تا اقتصاد و مالی، توسعه محصول، بازاریابی، فناوری و مطالعات علم را دربر میگیرد. این تنوع، زمینهای برای بررسی مسائل از زاویههای مکمل فراهم میکند.",
|
||||
"در معرفی هر دوره، مدرسان و حوزه مشارکت آنان مشخص میشوند تا مخاطبان بتوانند تناسب برنامه با نیاز و مسیر حرفهای خود را بهتر ارزیابی کنند.",
|
||||
],
|
||||
ctaLabel: "آشنایی با شبکه اساتید",
|
||||
},
|
||||
learning: {
|
||||
title: "یادگیری در ارتباط با عمل",
|
||||
paragraphs: [
|
||||
"رویکرد آموزشی مرکز بر پیوند مفاهیم با موقعیتهای کاربردی استوار است. بسته به موضوع و ساختار دوره، مطالعه موردی، تمرین، کارگاه عملی و گفتوگوی تخصصی به درک و بهکارگیری آموختهها کمک میکنند.",
|
||||
"در دورههای هوش مصنوعی، شناخت کاربرد مناسب با ساخت، آزمون و ارزیابی همراه میشود. در برند و بازاریابی، ارتباط میان شناخت مخاطب، انتخاب استراتژی و تجربه مشتری بررسی میشود. در هماندیشی مدیریتی، مسئلهای مشخص مبنای گفتوگو درباره فرضها و گزینههای تصمیم قرار میگیرد.",
|
||||
],
|
||||
},
|
||||
topics: {
|
||||
title: "حوزههای آموزشی ما",
|
||||
description:
|
||||
"برنامههای مرکز موضوعاتی مانند مدیریت و رهبری، تحلیل کسبوکار و تصمیمهای مالی، برند و بازاریابی و تحول سازمانی با فناوری و هوش مصنوعی را پوشش میدهند. دورههای تخصصی و کارگاههای کاربردی، فرصت تمرکز بر مهارتها و مسائل مشخص را فراهم میکنند.",
|
||||
note: "محتوا، مخاطبان، پیشنیازها و شیوه برگزاری هر برنامه در صفحه اختصاصی آن معرفی میشود.",
|
||||
},
|
||||
audience: {
|
||||
title: "همراه مسیر حرفهای شما",
|
||||
paragraphs: [
|
||||
"مخاطبان مرکز، متناسب با هر برنامه، شامل دانشجویان و دانشآموختگان، کارشناسان، متخصصان و مدیرانی هستند که برای گام بعدی مسیر حرفهای خود به دانش و توانمندی تازه نیاز دارند.",
|
||||
"هدف ما فراهمکردن فرصتهایی برای یادگیری مستمر است؛ فرصتهایی برای بازنگری در دانستهها، آشنایی با دیدگاههای تازه و آمادگی بیشتر برای تصمیمها و مسئولیتهای پیش رو.",
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Editorial values for the open-education center (not formal university doctrine).
|
||||
* Axis: پرورش توانایی فهم مسئله و تصمیمگیری مسئولانه، با پیوند دانش علمی و تجربه عملی.
|
||||
*/
|
||||
export const valuesContent = {
|
||||
eyebrow: "ارزشهای ما",
|
||||
title: "دانش دقیق، تصمیم آگاهانه، اثر ماندگار",
|
||||
intro:
|
||||
"در مرکز آموزشهای آزاد دانشکده مدیریت، علم و فناوری دانشگاه صنعتی امیرکبیر، یادگیری را فرصتی برای بهتر فهمیدن مسائل، سنجیدن انتخابها و توسعه توانایی عمل میدانیم. رویکرد ما از پیوند دانش دانشگاهی، تجربه حرفهای و شناخت تحولات فناوری شکل میگیرد. این اصول، مبنای نگاه ما به آموزش و ارتباط با یادگیرندگان و سازمانهاست.",
|
||||
items: [
|
||||
{
|
||||
title: "دقت علمی",
|
||||
text: "استدلالها باید به منابع معتبر و شواهد قابل بررسی متکی باشند. در تحلیل داده و استفاده از هوش مصنوعی، بررسی درستی خروجی بخشی از کار است.",
|
||||
title: "دقت علمی و تفکر نقادانه",
|
||||
text: "برای شواهد معتبر، استدلال روشن و پرسش دقیق ارزش قائلیم. یادگیری با بررسی فرضها، مقایسه دیدگاهها و شناخت محدودیتهای هر روش عمیقتر میشود. هدف ما تقویت توانایی قضاوت آگاهانه درباره اطلاعات، تحلیلها و راهحلهاست.",
|
||||
},
|
||||
{
|
||||
title: "تمرین و کاربرد",
|
||||
text: "آموختهها باید در تصمیمهای مدیریتی کاربرد داشته باشند؛ مانند ارزیابی سرمایهگذاری در فناوری، بازطراحی یک فرایند یا برنامهریزی برای اجرای تغییر.",
|
||||
title: "مسئلهمحوری و شناخت زمینه",
|
||||
text: "شناخت درست مسئله، نقطه آغاز انتخاب راهحل است. مسائل کسبوکار را با توجه به شرایط اقتصادی، فرهنگی و اجرایی سازمانها در ایران بررسی میکنیم. در کاربرد دانش و تجربههای جهانی، به تفاوت نیازها، منابع و محدودیتهای هر سازمان توجه داریم.",
|
||||
},
|
||||
{
|
||||
title: "پرسش و گفتوگو",
|
||||
text: "پرسیدن، نقد ایدهها و شنیدن تجربه دیگران به یادگیری کمک میکند. ایدههای خلاقانه با گفتوگو و آزمودن دقیقتر میشوند.",
|
||||
title: "پیوند مدیریت، فناوری و انسان",
|
||||
text: "تصمیمهای سازمانی در تعامل میان انسانها، فناوری، فرایندها و بازار شکل میگیرند. نگاه میانرشتهای به ما کمک میکند این ارتباطها را بهتر بشناسیم و پیامدهای تصمیمها را گستردهتر ببینیم. مواجهه آگاهانه با فناوریهای نو، بخشی از این نگاه است.",
|
||||
},
|
||||
{
|
||||
title: "ارزیابی نتیجه",
|
||||
text: "یک راهحل را با نتیجه آن میسنجیم: آیا کیفیت بهتر شده، زمان انجام کار کاهش یافته یا تصمیم دقیقتری گرفته شده است؟",
|
||||
title: "یادگیری از تجربه و ارزیابی",
|
||||
text: "فهم مفاهیم با تمرین، مطالعه موردی و بازنگری در نتیجهها کاملتر میشود. برای توانایی بهکارگیری آموختهها، دریافت بازخورد و اصلاح مسیر ارزش قائلیم. هر تجربه یادگیری باید به روشنترشدن مسئله، سنجش بهتر گزینهها یا توسعه یک توانمندی مشخص کمک کند.",
|
||||
},
|
||||
{
|
||||
title: "مسئولیتپذیری و اعتماد",
|
||||
text: "کیفیت تصمیم را در کنار پیامدهای آن برای افراد، سازمان و جامعه میسنجیم. صداقت در بیان تواناییها و محدودیتها، احترام به محرمانگی اطلاعات و توجه به حقوق افراد برای ما اهمیت دارد. در استفاده از داده و هوش مصنوعی، بر قضاوت و مسئولیت انسانی تأکید داریم.",
|
||||
},
|
||||
{
|
||||
title: "گفتوگو و یادگیری مستمر",
|
||||
text: "تجربههای متفاوت، فرصت دیدن ابعاد تازه مسائل را فراهم میکنند. برای شنیدن، نقد محترمانه و تبادل دانش میان دانشگاه و محیط حرفهای ارزش قائلیم. توانایی یادگرفتن و بازنگری در دانستهها را بخشی از آمادگی برای آینده میدانیم.",
|
||||
},
|
||||
],
|
||||
inPractice: {
|
||||
title: "این ارزشها در آموزش چگونه دیده میشوند؟",
|
||||
description:
|
||||
"سه نمونه مشخص از دورهها که همان اصول را در عمل نشان میدهند.",
|
||||
examples: [
|
||||
{
|
||||
title: "تمرین و ارزیابی در AI Fluency",
|
||||
text: "ساخت مرحلهای، نظارت انسان و سنجش خروجی — یادگیری عملی همراه با مسئولیتپذیری.",
|
||||
href: "/register/ai-fluency",
|
||||
},
|
||||
{
|
||||
title: "مطالعه موردی در برندینگ",
|
||||
text: "شناخت مخاطب، تجربه و استراتژی — توجه همزمان به انسان، شواهد و نتیجه تصمیم.",
|
||||
href: "/register/branding",
|
||||
},
|
||||
{
|
||||
title: "بررسی مسئله در هماندیشی مدیریتی",
|
||||
text: "بازنگری فرضها روی مسئله واقعی — پرسشگری، گفتوگو و احترام به تجربه.",
|
||||
href: "/register/managerial-dialogue",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -7,6 +7,14 @@ export interface TaxonomyRef {
|
||||
label: string;
|
||||
}
|
||||
|
||||
/** Lightweight faculty reference for course detail links (MST profile). */
|
||||
export interface FacultyRef {
|
||||
id: string;
|
||||
name: string;
|
||||
title: string;
|
||||
profileUrl?: string;
|
||||
}
|
||||
|
||||
export interface Course {
|
||||
id: string;
|
||||
slug: string;
|
||||
@@ -16,6 +24,8 @@ export interface Course {
|
||||
categories: TaxonomyRef[];
|
||||
/** Type tags for nav/filters (many-to-many; admin-managed). */
|
||||
tags: TaxonomyRef[];
|
||||
/** Instructors linked for external faculty-page references. */
|
||||
instructors?: FacultyRef[];
|
||||
/** Hours; null/omit when not confirmed in source materials */
|
||||
durationHours?: number | null;
|
||||
format: CourseFormat;
|
||||
@@ -114,6 +124,8 @@ export interface FacultyMember {
|
||||
department?: string;
|
||||
linkedinUrl?: string;
|
||||
scholarUrl?: string;
|
||||
/** External MST faculty profile page (reference only). */
|
||||
profileUrl?: string;
|
||||
}
|
||||
|
||||
export interface AlumniStory {
|
||||
|
||||
@@ -28,6 +28,7 @@ const courseFields = {
|
||||
summary: z.string().min(1, "summary الزامی است"),
|
||||
categoryIds: z.array(z.string().min(1)).default([]),
|
||||
tagIds: z.array(z.string().min(1)).default([]),
|
||||
facultyIds: z.array(z.string().min(1)).default([]),
|
||||
durationHours: z
|
||||
.union([z.number().int().positive("durationHours باید عدد مثبت باشد"), z.null()])
|
||||
.optional(),
|
||||
@@ -211,6 +212,7 @@ const facultyFields = {
|
||||
department: z.string().optional(),
|
||||
linkedinUrl: optionalUrl,
|
||||
scholarUrl: optionalUrl,
|
||||
profileUrl: optionalUrl,
|
||||
published: z.boolean(),
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user