import Link from "next/link"; import { 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 { CourseMediaFigure } from "@/components/molecules/CourseMediaFigure"; import { DetailList, type DetailItem } from "@/components/molecules/DetailList"; import { PageHero } from "@/components/molecules/PageHero"; import { RichHtmlContent } from "@/components/molecules/RichHtmlContent"; import { SurfaceCard } from "@/components/molecules/SurfaceCard"; import { CourseRegisterGate } from "@/components/organisms/CourseRegisterGate"; 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"; /** Portrait brochure delivery assets (~A4). */ const BROCHURE_HINT = { width: 1200, height: 1697 } as const; export type CourseDetailLabels = { submit: string; success: string; cta: string; formTitle: string; formDescription: string; hint: string; cancel: string; backToCatalog: string; detailsTitle: string; aboutTitle: string; duration: string; format: string; category: string; price: string; priceUnset: string; }; export function CourseDetailTemplate({ course, labels, }: { course: Course; labels: CourseDetailLabels; }) { const priceLabel = formatCoursePrice(course.price); const details: DetailItem[] = [ { icon: Layers, label: labels.format, value: formatLabel(course.format) }, ...(course.durationHours ? [ { icon: Clock, label: labels.duration, value: `${course.durationHours} ساعت`, }, ] : []), { icon: Wallet, label: labels.price, value: priceLabel ?? labels.priceUnset, emphasis: Boolean(priceLabel), }, ]; const hasTaxonomy = course.categories.length > 0 || course.tags.length > 0; const brochureUrl = course.brochureImageUrl?.trim() || undefined; const leadHtml = course.leadHtml?.trim() ?? ""; const bodyHtml = course.bodyHtml?.trim() ?? ""; const heroIntro = leadHtml ? ( ) : ( course.summary ); return (
{brochureUrl ? ( ) : null} {bodyHtml || course.seoDescription ? (
{labels.aboutTitle} {bodyHtml ? ( ) : (

{course.seoDescription}

)}
) : null} {hasTaxonomy ? (
{labels.category}
{course.categories.map((c) => ( {c.label} ))} {course.tags.map((t) => ( {t.label} ))}
) : null}
); }