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
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user