Remove unused redirects from the Next.js configuration and update package dependencies to include new Tiptap extensions for enhanced text editing capabilities. Clean up the database seeding script by removing commented-out code and ensuring proper deletion of obsolete entries. Update various pages to handle not found scenarios gracefully, improving user experience across the application.
This commit is contained in:
1 parent
4b84409ed7
commit
2858b9c746
106 files changed
+2516
-1004
No files matched your search
@@ -43,7 +43,7 @@ export default async function LegalSlugPage({ params }: Props) {
|
||||
<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="text-base leading-8 text-foreground/90">
|
||||
<p key={paragraph} className="text-justify text-base leading-8 text-foreground/90">
|
||||
{paragraph}
|
||||
</p>
|
||||
))}
|
||||
|
||||
@@ -1,69 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { CmsImage } from "@/components/atoms/CmsImage";
|
||||
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 { PageHero } from "@/components/molecules/PageHero";
|
||||
import { SurfaceCard } from "@/components/molecules/SurfaceCard";
|
||||
import { getAlumniStories } from "@/lib/data/site";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return pageMetadata({
|
||||
title: t("alumniTitle"),
|
||||
description: t("alumniIntro"),
|
||||
path: "/alumni",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function AlumniPage() {
|
||||
const t = await getTranslations("pages");
|
||||
const stories = await getAlumniStories();
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
title={t("alumniTitle")}
|
||||
intro={t("alumniIntro")}
|
||||
imageUrl="/brand/graduation-cap-neural.webp"
|
||||
/>
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-5 md:grid-cols-3">
|
||||
{stories.map((story) => (
|
||||
<SurfaceCard
|
||||
key={story.id}
|
||||
id={story.id}
|
||||
padded={false}
|
||||
className="scroll-mt-24"
|
||||
>
|
||||
<div className="relative aspect-[16/10] bg-muted">
|
||||
<CmsImage
|
||||
src={story.imageUrl}
|
||||
alt={story.name}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<div className="p-6">
|
||||
<BadgeLabel>{story.program}</BadgeLabel>
|
||||
<Heading as="h2" level={4} className="mt-3">
|
||||
{story.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
{story.excerpt}
|
||||
</p>
|
||||
<p className="mt-4 text-sm font-semibold">{story.name}</p>
|
||||
</div>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
export default function AlumniPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -1,90 +1,5 @@
|
||||
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";
|
||||
import { JsonLd } from "@/lib/seo/json-ld";
|
||||
import {
|
||||
absoluteUrl,
|
||||
pageMetadata,
|
||||
truncateMetaDescription,
|
||||
} from "@/lib/seo/metadata";
|
||||
|
||||
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);
|
||||
if (!event) return { title: "رویداد یافت نشد" };
|
||||
return pageMetadata({
|
||||
title: event.title,
|
||||
description: truncateMetaDescription(event.summary),
|
||||
path: `/events/${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function EventDetailPage({ params }: Props) {
|
||||
const { id } = await params;
|
||||
const event = await getEventById(id);
|
||||
if (!event) notFound();
|
||||
|
||||
const start = new Date(event.startDate).toLocaleDateString("fa-IR", dateFormat);
|
||||
const end = event.endDate
|
||||
? new Date(event.endDate).toLocaleDateString("fa-IR", dateFormat)
|
||||
: null;
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<JsonLd
|
||||
data={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Event",
|
||||
name: event.title,
|
||||
description: event.summary,
|
||||
startDate: event.startDate,
|
||||
...(event.endDate ? { endDate: event.endDate } : {}),
|
||||
location: { "@type": "Place", name: event.location },
|
||||
url: absoluteUrl(`/events/${id}`),
|
||||
}}
|
||||
/>
|
||||
<PageHero title={event.title} intro={event.summary} />
|
||||
<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>
|
||||
);
|
||||
export default function EventDetailPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -1,37 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { EventCard } from "@/components/molecules/Cards";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { getEvents } from "@/lib/data/events";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return pageMetadata({
|
||||
title: t("eventsTitle"),
|
||||
description: t("eventsIntro"),
|
||||
path: "/events",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function EventsPage() {
|
||||
const t = await getTranslations("pages");
|
||||
const events = await getEvents();
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero title={t("eventsTitle")} intro={t("eventsIntro")} />
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{events.map((event) => (
|
||||
<EventCard key={event.id} {...event} variant="list" />
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
export default function EventsPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
/** Faculty are not introduced on this site; send visitors home. */
|
||||
export default function FacultyPage() {
|
||||
redirect("/");
|
||||
notFound();
|
||||
}
|
||||
@@ -1,78 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { CmsImage } from "@/components/atoms/CmsImage";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
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";
|
||||
import {
|
||||
absoluteUrl,
|
||||
pageMetadata,
|
||||
truncateMetaDescription,
|
||||
} from "@/lib/seo/metadata";
|
||||
|
||||
type Props = { params: Promise<{ id: string }> };
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const article = await getArticleById(id);
|
||||
if (!article) return { title: "مقاله یافت نشد" };
|
||||
return pageMetadata({
|
||||
title: article.title,
|
||||
description: truncateMetaDescription(article.excerpt),
|
||||
path: `/insights/${id}`,
|
||||
image: article.imageUrl,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function InsightDetailPage({ params }: Props) {
|
||||
const { id } = await params;
|
||||
const article = await getArticleById(id);
|
||||
if (!article) notFound();
|
||||
|
||||
const date = new Date(article.publishedAt).toLocaleDateString("fa-IR");
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<JsonLd
|
||||
data={{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Article",
|
||||
headline: article.title,
|
||||
description: article.excerpt,
|
||||
datePublished: article.publishedAt,
|
||||
author: { "@type": "Person", name: article.author },
|
||||
image: article.imageUrl,
|
||||
url: absoluteUrl(`/insights/${id}`),
|
||||
}}
|
||||
/>
|
||||
<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 ring-1 ring-foreground/10">
|
||||
<CmsImage
|
||||
src={article.imageUrl}
|
||||
alt={article.title}
|
||||
fill
|
||||
className="object-cover"
|
||||
sizes="(max-width:768px) 100vw, 800px"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
<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>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
export default function InsightArticlePage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -1,49 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { Container } from "@/components/atoms/Container";
|
||||
import { Section } from "@/components/atoms/Section";
|
||||
import { ArticleCard } from "@/components/molecules/Cards";
|
||||
import { PageHero } from "@/components/molecules/PageHero";
|
||||
import { getArticles } from "@/lib/data/articles";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return pageMetadata({
|
||||
title: t("insightsTitle"),
|
||||
description: t("insightsIntro"),
|
||||
path: "/insights",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function InsightsPage() {
|
||||
const t = await getTranslations("pages");
|
||||
const articles = await getArticles();
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
title={t("insightsTitle")}
|
||||
intro={t("insightsIntro")}
|
||||
imageUrl="/brand/neural-open-book.webp"
|
||||
/>
|
||||
<Section tone="subtle">
|
||||
<Container>
|
||||
<div className="mx-auto max-w-5xl">
|
||||
{articles.map((article) => (
|
||||
<ArticleCard
|
||||
key={article.id}
|
||||
title={article.title}
|
||||
category={article.category}
|
||||
excerpt={article.excerpt}
|
||||
imageUrl={article.imageUrl}
|
||||
href={article.href}
|
||||
variant="list"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
export default function InsightsPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -5,9 +5,12 @@ import { SiteHeader } from "@/components/organisms/SiteHeader";
|
||||
import { buildHomeNavWithCourseTags } from "@/lib/course-nav";
|
||||
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 { facultySiteUrl, 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.
|
||||
@@ -21,13 +24,11 @@ export default async function MainLayout({
|
||||
const t = await getTranslations();
|
||||
const year = new Date().getFullYear();
|
||||
let courses: Awaited<ReturnType<typeof getCourses>> = [];
|
||||
let programs: Awaited<ReturnType<typeof getPrograms>> = [];
|
||||
let banners: Awaited<ReturnType<typeof getCampaignBanners>> = [];
|
||||
let navTags: Awaited<ReturnType<typeof listPublishedCourseTags>> = [];
|
||||
try {
|
||||
[courses, programs, banners, navTags] = await Promise.all([
|
||||
[courses, banners, navTags] = await Promise.all([
|
||||
getCourses(),
|
||||
getPrograms(),
|
||||
getCampaignBanners(),
|
||||
listPublishedCourseTags({ navOnly: true }),
|
||||
]);
|
||||
@@ -47,7 +48,6 @@ export default async function MainLayout({
|
||||
brandSubtitle={t("nav.brandSubtitle")}
|
||||
variant="home"
|
||||
courses={courses}
|
||||
programs={programs}
|
||||
/>
|
||||
<CampaignBanners banners={banners} />
|
||||
<div className="min-w-0 flex-1 overflow-x-clip">{children}</div>
|
||||
@@ -56,6 +56,7 @@ export default async function MainLayout({
|
||||
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,43 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { NewsDetailTemplate } from "@/components/templates/NewsDetailTemplate";
|
||||
import { getNewsById, newsExcerpt } from "@/lib/data/news";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const item = await getNewsById(id);
|
||||
if (!item) {
|
||||
return pageMetadata({
|
||||
title: "خبر",
|
||||
description: "خبر مرکز آموزش های آزاد",
|
||||
path: `/news/${id}`,
|
||||
});
|
||||
}
|
||||
return pageMetadata({
|
||||
title: item.title,
|
||||
description: newsExcerpt(item.body),
|
||||
path: `/news/${item.id}`,
|
||||
image: item.bannerImageUrl,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function NewsDetailPage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
const { id } = await params;
|
||||
const item = await getNewsById(id);
|
||||
if (!item) notFound();
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<NewsDetailTemplate item={item} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { NewsListTemplate } from "@/components/templates/NewsListTemplate";
|
||||
import { getNews } from "@/lib/data/news";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return pageMetadata({
|
||||
title: t("newsTitle"),
|
||||
description: t("newsIntro"),
|
||||
path: "/news",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function NewsPage() {
|
||||
const [t, items] = await Promise.all([getTranslations("pages"), getNews()]);
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<NewsListTemplate
|
||||
items={items}
|
||||
title={t("newsTitle")}
|
||||
intro={t("newsIntro")}
|
||||
emptyLabel={t("newsEmpty")}
|
||||
/>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -5,13 +5,11 @@ import {
|
||||
HomeApproach,
|
||||
HomeClosing,
|
||||
HomeCourseSearch,
|
||||
HomeEventsTeaser,
|
||||
HomeHero,
|
||||
HomeIdeas,
|
||||
HomeTeams,
|
||||
type HomeLabels,
|
||||
} from "@/components/templates/HomeTemplate";
|
||||
import { getFeaturedArticle } from "@/lib/data/articles";
|
||||
import { getLatestCourses } from "@/lib/data/courses";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
@@ -46,11 +44,8 @@ async function orFallback<T>(
|
||||
}
|
||||
|
||||
async function HeroSection() {
|
||||
const [featured, labels] = await Promise.all([
|
||||
orFallback("featured article", getFeaturedArticle, null),
|
||||
getLabels(),
|
||||
]);
|
||||
return <HomeHero featured={featured} eyebrow={labels.ideasEyebrow} />;
|
||||
const labels = await getLabels();
|
||||
return <HomeHero featured={null} eyebrow={labels.ideasEyebrow} />;
|
||||
}
|
||||
|
||||
async function CourseSearchSection() {
|
||||
@@ -76,7 +71,6 @@ export default function HomePage() {
|
||||
<HomeIdeas />
|
||||
<CourseSearchSection />
|
||||
<HomeApproach />
|
||||
<HomeEventsTeaser />
|
||||
<HomeTeams />
|
||||
<HomeClosing />
|
||||
</main>
|
||||
|
||||
@@ -1,115 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
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 { 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";
|
||||
import { getCourses } from "@/lib/data/courses";
|
||||
import { getProgramBySlug } from "@/lib/data/programs";
|
||||
import { pageMetadata, truncateMetaDescription } from "@/lib/seo/metadata";
|
||||
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const program = await getProgramBySlug(slug);
|
||||
if (!program) return { title: "برنامه یافت نشد" };
|
||||
return pageMetadata({
|
||||
title: program.title,
|
||||
description: truncateMetaDescription(program.blurb),
|
||||
path: `/programs/${slug}`,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function ProgramDetailPage({ params }: Props) {
|
||||
const { slug } = await params;
|
||||
const [program, courses, t] = await Promise.all([
|
||||
getProgramBySlug(slug),
|
||||
getCourses(),
|
||||
getTranslations("pages"),
|
||||
]);
|
||||
if (!program) notFound();
|
||||
|
||||
const related = courses.slice(0, 3);
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
title={program.title}
|
||||
intro={program.blurb}
|
||||
eyebrow={program.tagline}
|
||||
/>
|
||||
<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>
|
||||
{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="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>
|
||||
{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-accent"
|
||||
>
|
||||
{course.title}
|
||||
</Heading>
|
||||
<p className="mt-2 line-clamp-3 text-sm leading-7 text-muted-foreground">
|
||||
{course.summary}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Container>
|
||||
</Section>
|
||||
) : null}
|
||||
</main>
|
||||
);
|
||||
export default function ProgramDetailPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -1,93 +1,5 @@
|
||||
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 { 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";
|
||||
import { getPrograms } from "@/lib/data/programs";
|
||||
import { pageMetadata } from "@/lib/seo/metadata";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const t = await getTranslations("pages");
|
||||
return pageMetadata({
|
||||
title: t("programsTitle"),
|
||||
description: t("programsIntro"),
|
||||
path: "/programs",
|
||||
});
|
||||
}
|
||||
|
||||
export default async function ProgramsPage() {
|
||||
const t = await getTranslations("pages");
|
||||
const programs = await getPrograms();
|
||||
const standard = programs.filter((p) => p.group === "standard");
|
||||
const executive = programs.filter((p) => p.group === "executive");
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
title={t("programsTitle")}
|
||||
intro={t("programsIntro")}
|
||||
imageUrl="/brand/neural-tree-knowledge.webp"
|
||||
/>
|
||||
<Section tone="subtle">
|
||||
<Container className="space-y-16">
|
||||
<ProgramGroup title={t("standardGroup")} items={standard} />
|
||||
<ProgramGroup title={t("executiveGroup")} items={executive} />
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
function ProgramGroup({
|
||||
title,
|
||||
items,
|
||||
}: {
|
||||
title: string;
|
||||
items: Awaited<ReturnType<typeof getPrograms>>;
|
||||
}) {
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<div>
|
||||
<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} 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="transition-colors hover:text-accent">
|
||||
{program.title}
|
||||
</Link>
|
||||
</Heading>
|
||||
<p className="mt-2 flex-1 text-sm leading-7 text-muted-foreground">
|
||||
{program.blurb}
|
||||
</p>
|
||||
<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-6 w-fit")}
|
||||
>
|
||||
جزئیات برنامه
|
||||
</Link>
|
||||
</SurfaceCard>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
export default function ProgramsPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { notFound } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { CourseDetailTemplate } from "@/components/templates/CourseDetailTemplate";
|
||||
import { getCourseById } from "@/lib/data/courses";
|
||||
import { htmlToPlain } from "@/lib/html-text";
|
||||
import { pageMetadata, truncateMetaDescription } from "@/lib/seo/metadata";
|
||||
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
@@ -15,7 +16,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
return pageMetadata({
|
||||
title: course.title,
|
||||
description: truncateMetaDescription(
|
||||
course.seoDescription || course.summary,
|
||||
course.seoDescription || htmlToPlain(course.summary),
|
||||
),
|
||||
path: `/register/${pathSlug}`,
|
||||
...(course.posterImageUrl ? { image: course.posterImageUrl } : {}),
|
||||
@@ -45,6 +46,7 @@ export default async function CourseRegisterPage({ params }: Props) {
|
||||
detailsTitle: t("courseDetailsTitle"),
|
||||
aboutTitle: t("courseAboutTitle"),
|
||||
duration: t("courseDuration"),
|
||||
date: t("courseDate"),
|
||||
format: t("courseFormat"),
|
||||
category: t("courseCategory"),
|
||||
price: t("coursePrice"),
|
||||
|
||||
@@ -1,69 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
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 { cn } from "@/lib/utils";
|
||||
import { getTopicBySlug } from "@/lib/data/site";
|
||||
import { pageMetadata, truncateMetaDescription } from "@/lib/seo/metadata";
|
||||
|
||||
type Props = { params: Promise<{ slug: string }> };
|
||||
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const topic = await getTopicBySlug(slug);
|
||||
if (!topic) return { title: "موضوع یافت نشد" };
|
||||
return pageMetadata({
|
||||
title: topic.title,
|
||||
description: truncateMetaDescription(topic.description),
|
||||
path: `/topics/${slug}`,
|
||||
image: topic.imageUrl,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function TopicPage({ params }: Props) {
|
||||
const { slug } = await params;
|
||||
const topic = await getTopicBySlug(slug);
|
||||
if (!topic) notFound();
|
||||
|
||||
return (
|
||||
<main id="main-content">
|
||||
<PageHero
|
||||
title={topic.title}
|
||||
intro={topic.description}
|
||||
imageUrl={topic.imageUrl}
|
||||
/>
|
||||
<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="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>
|
||||
</Container>
|
||||
</Section>
|
||||
</main>
|
||||
);
|
||||
export default function TopicPage() {
|
||||
notFound();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export default async function ValuesPage() {
|
||||
<Heading as="h2" level={4} className="mt-2">
|
||||
{item.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
<p className="mt-2 text-justify text-sm leading-7 text-muted-foreground">
|
||||
{item.text}
|
||||
</p>
|
||||
</SurfaceCard>
|
||||
@@ -69,7 +69,7 @@ export default async function ValuesPage() {
|
||||
<Heading as="h3" level={4} className="group-hover:text-accent">
|
||||
{example.title}
|
||||
</Heading>
|
||||
<p className="mt-2 text-sm leading-7 text-muted-foreground">
|
||||
<p className="mt-2 text-justify text-sm leading-7 text-muted-foreground">
|
||||
{example.text}
|
||||
</p>
|
||||
<span className="mt-4 inline-flex items-center gap-1.5 text-sm font-semibold text-accent">
|
||||
|
||||
Reference in new issue
Block a user