Update course banners, brochures, and archive offerings.
Deploy edu.mstaut.ir / deploy (push) Has been cancelled
Deploy edu.mstaut.ir / deploy (push) Has been cancelled
Ship delivery webp assets for AI Fluency and organizational AI transformation, keep brochure-only courses without fake card banners, and seed nine past open-education courses for production. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6e2c9f1ad7
commit
3eea1c35a6
14 files changed
+545
-365
No files matched your search
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { usePathname, useSearchParams } from "next/navigation";
|
||||
import { Search, X } from "lucide-react";
|
||||
@@ -16,6 +15,7 @@ import {
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { CourseCardBanner } from "@/components/molecules/CourseCardBanner";
|
||||
import type { Course, TaxonomyRef } from "@/lib/types";
|
||||
import {
|
||||
courseCatalogHref,
|
||||
@@ -28,19 +28,19 @@ 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";
|
||||
"text-primary-foreground/70 hover:bg-primary-foreground/10 hover:text-primary-foreground";
|
||||
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";
|
||||
"border-primary-foreground/15 bg-transparent text-primary-foreground/65 hover:border-primary-foreground/35 hover:bg-transparent hover:text-primary-foreground";
|
||||
const tagChipActive =
|
||||
"border-primary bg-primary/20 text-background hover:bg-primary/30";
|
||||
"border-secondary bg-secondary/20 text-secondary hover:bg-secondary/30";
|
||||
|
||||
export function CategoryCourseExplorer({
|
||||
courses,
|
||||
findLabel,
|
||||
categoriesLabel = "دستهبندیها",
|
||||
tagsLabel = "تگها",
|
||||
categoriesLabel = "دسته بندی ها",
|
||||
tagsLabel = "تگ ها",
|
||||
filterCategories,
|
||||
filterTags,
|
||||
initialTag = "",
|
||||
@@ -137,7 +137,7 @@ export function CategoryCourseExplorer({
|
||||
|
||||
return (
|
||||
<div className="space-y-8">
|
||||
<div className="rounded-2xl bg-background/5 p-2 ring-1 ring-background/10">
|
||||
<div className="rounded-2xl bg-primary-foreground/5 p-2 ring-1 ring-primary-foreground/10">
|
||||
<div className="flex h-11 items-center gap-2">
|
||||
{searchOpen ? (
|
||||
<form
|
||||
@@ -150,7 +150,7 @@ export function CategoryCourseExplorer({
|
||||
</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"
|
||||
className="pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2 text-primary-foreground/50"
|
||||
aria-hidden
|
||||
/>
|
||||
<Input
|
||||
@@ -162,14 +162,14 @@ export function CategoryCourseExplorer({
|
||||
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"
|
||||
className="h-full rounded-full border-0 bg-primary-foreground/10 ps-10 pe-3 text-primary-foreground placeholder:text-primary-foreground/45 focus-visible:ring-1 focus-visible:ring-primary-foreground/30"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-10 shrink-0 rounded-full text-background/70 hover:bg-background/10 hover:text-background"
|
||||
className="size-10 shrink-0 rounded-full text-primary-foreground/70 hover:bg-primary-foreground/10 hover:text-primary-foreground"
|
||||
aria-label="بستن جستجو"
|
||||
onClick={closeSearch}
|
||||
>
|
||||
@@ -182,7 +182,7 @@ export function CategoryCourseExplorer({
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="size-10 shrink-0 rounded-full bg-background/10 text-background hover:bg-background/20 hover:text-background"
|
||||
className="size-10 shrink-0 rounded-full bg-primary-foreground/10 text-primary-foreground hover:bg-primary-foreground/20 hover:text-primary-foreground"
|
||||
aria-label={findLabel}
|
||||
onClick={() => setSearchOpen(true)}
|
||||
>
|
||||
@@ -191,7 +191,7 @@ export function CategoryCourseExplorer({
|
||||
{filterCategories.length > 0 ? (
|
||||
<>
|
||||
<span
|
||||
className="h-6 w-px shrink-0 bg-background/15"
|
||||
className="h-6 w-px shrink-0 bg-primary-foreground/15"
|
||||
aria-hidden
|
||||
/>
|
||||
<div
|
||||
@@ -208,17 +208,17 @@ export function CategoryCourseExplorer({
|
||||
categoryChipClass,
|
||||
"inline-flex items-center justify-center",
|
||||
categorySlug === ""
|
||||
? "bg-primary text-primary-foreground"
|
||||
? "bg-secondary text-secondary-foreground"
|
||||
: categoryChipIdle,
|
||||
)}
|
||||
>
|
||||
همه دورهها
|
||||
همه دوره ها
|
||||
</Link>
|
||||
) : (
|
||||
<Button
|
||||
type="button"
|
||||
role="tab"
|
||||
variant={categorySlug === "" ? "default" : "ghost"}
|
||||
variant={categorySlug === "" ? "secondary" : "ghost"}
|
||||
aria-selected={categorySlug === ""}
|
||||
onClick={() => selectCategory("")}
|
||||
className={cn(
|
||||
@@ -226,7 +226,7 @@ export function CategoryCourseExplorer({
|
||||
categorySlug !== "" && categoryChipIdle,
|
||||
)}
|
||||
>
|
||||
همه دورهها
|
||||
همه دوره ها
|
||||
</Button>
|
||||
)}
|
||||
{filterCategories.map((item) => {
|
||||
@@ -235,7 +235,7 @@ export function CategoryCourseExplorer({
|
||||
categoryChipClass,
|
||||
"inline-flex items-center justify-center",
|
||||
!active && categoryChipIdle,
|
||||
active && "bg-primary text-primary-foreground",
|
||||
active && "bg-secondary text-secondary-foreground",
|
||||
);
|
||||
return onCatalogPage ? (
|
||||
<Link
|
||||
@@ -252,7 +252,7 @@ export function CategoryCourseExplorer({
|
||||
key={item.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
variant={active ? "default" : "ghost"}
|
||||
variant={active ? "secondary" : "ghost"}
|
||||
aria-selected={active}
|
||||
onClick={() => selectCategory(item.slug)}
|
||||
className={className}
|
||||
@@ -269,10 +269,10 @@ export function CategoryCourseExplorer({
|
||||
</div>
|
||||
|
||||
{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">
|
||||
<div className="mt-2 flex flex-wrap items-center gap-1.5 border-t border-primary-foreground/10 px-2 pt-2.5 pb-0.5">
|
||||
{filterTags.length > 0 ? (
|
||||
<>
|
||||
<span className="me-1 text-xs text-background/45">
|
||||
<span className="me-1 text-xs text-primary-foreground/45">
|
||||
{tagsLabel}
|
||||
</span>
|
||||
{filterTags.map((item) => {
|
||||
@@ -314,17 +314,17 @@ export function CategoryCourseExplorer({
|
||||
setQuery("");
|
||||
setSearchOpen(false);
|
||||
}}
|
||||
className="ms-auto text-xs text-background/55 underline-offset-4 transition-colors hover:text-background hover:underline"
|
||||
className="ms-auto text-xs text-primary-foreground/55 underline-offset-4 transition-colors hover:text-primary-foreground hover:underline"
|
||||
>
|
||||
پاککردن فیلترها
|
||||
پاک کردن فیلتر ها
|
||||
</Link>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={resetFilters}
|
||||
className="ms-auto text-xs text-background/55 underline-offset-4 transition-colors hover:text-background hover:underline"
|
||||
className="ms-auto text-xs text-primary-foreground/55 underline-offset-4 transition-colors hover:text-primary-foreground hover:underline"
|
||||
>
|
||||
پاککردن فیلترها
|
||||
پاک کردن فیلتر ها
|
||||
</button>
|
||||
)
|
||||
) : null}
|
||||
@@ -333,8 +333,8 @@ export function CategoryCourseExplorer({
|
||||
</div>
|
||||
|
||||
{filtered.length === 0 ? (
|
||||
<p className="py-10 text-center text-sm text-background/60">
|
||||
دورهای با این فیلترها یافت نشد.
|
||||
<p className="py-10 text-center text-sm text-primary-foreground/60">
|
||||
دوره ای با این فیلتر ها یافت نشد.
|
||||
</p>
|
||||
) : (
|
||||
<div
|
||||
@@ -348,7 +348,7 @@ export function CategoryCourseExplorer({
|
||||
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"
|
||||
className="group relative gap-0 overflow-hidden bg-primary-foreground/5 py-0 text-primary-foreground ring-primary-foreground/10 transition-colors hover:ring-primary-foreground/30"
|
||||
>
|
||||
{/* Full-card hit target sits under content; badges use pointer-events-auto */}
|
||||
<Link
|
||||
@@ -357,22 +357,17 @@ export function CategoryCourseExplorer({
|
||||
aria-label={course.title}
|
||||
tabIndex={-1}
|
||||
/>
|
||||
<div className="pointer-events-none relative aspect-[16/10] overflow-hidden">
|
||||
<Image
|
||||
src={course.posterImageUrl}
|
||||
alt=""
|
||||
fill
|
||||
className="object-cover transition-transform duration-300 group-hover:scale-[1.03]"
|
||||
sizes="(max-width:768px) 100vw, 33vw"
|
||||
/>
|
||||
</div>
|
||||
<CourseCardBanner
|
||||
title={course.title}
|
||||
bannerUrl={course.posterImageUrl}
|
||||
/>
|
||||
<CardHeader className="pointer-events-none relative z-[1] gap-1 px-4 pt-4">
|
||||
<CardTitle className="text-base text-background">
|
||||
<CardTitle className="text-base text-primary-foreground">
|
||||
{course.title}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pointer-events-none relative z-[1] space-y-3 px-4 pb-4">
|
||||
<CardDescription className="line-clamp-3 text-background/70">
|
||||
<CardDescription className="line-clamp-3 text-primary-foreground/70">
|
||||
{course.summary}
|
||||
</CardDescription>
|
||||
{(course.categories.length > 0 || course.tags.length > 0) && (
|
||||
@@ -390,8 +385,8 @@ export function CategoryCourseExplorer({
|
||||
<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",
|
||||
"cursor-pointer border-primary-foreground/25 text-[11px] font-semibold text-primary-foreground/90 hover:bg-primary-foreground/15",
|
||||
active && "border-secondary bg-secondary/25 text-secondary",
|
||||
)}
|
||||
>
|
||||
{c.label}
|
||||
@@ -412,8 +407,8 @@ export function CategoryCourseExplorer({
|
||||
<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",
|
||||
"cursor-pointer border-primary-foreground/25 text-[10px] text-primary-foreground/75 hover:bg-primary-foreground/15",
|
||||
active && "border-secondary bg-secondary/25 text-secondary",
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
@@ -423,20 +418,20 @@ export function CategoryCourseExplorer({
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-xs text-background/55">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-xs text-primary-foreground/55">
|
||||
<span>
|
||||
{course.durationHours
|
||||
? `${course.durationHours} ساعت · ${formatLabel(course.format)}`
|
||||
: formatLabel(course.format)}
|
||||
</span>
|
||||
{priceLabel ? (
|
||||
<span className="font-semibold text-background/90">
|
||||
<span className="font-semibold text-primary-foreground/90">
|
||||
{priceLabel}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<span className="inline-flex text-sm font-semibold text-background underline-offset-4 group-hover:underline">
|
||||
جزئیات و ثبتنام
|
||||
<span className="inline-flex text-sm font-semibold text-primary-foreground underline-offset-4 group-hover:underline">
|
||||
جزئیات و ثبت نام
|
||||
</span>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -115,7 +115,7 @@ export function CourseForm({
|
||||
setError(data.error || "خطا در ذخیره دوره");
|
||||
return;
|
||||
}
|
||||
router.push("/admin/courses");
|
||||
router.push("/mstcontroller/courses");
|
||||
router.refresh();
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -126,14 +126,14 @@ export function CourseForm({
|
||||
<form onSubmit={handleSubmit}>
|
||||
<AdminFormCard
|
||||
title={isEdit ? "ویرایش دوره" : "ثبت دوره جدید"}
|
||||
description="فیلدهای ستارهدار الزامیاند. دسته و تگ از فهرست ادمین انتخاب میشوند."
|
||||
description="فیلدهای ستاره دار الزامی اند. دسته و تگ از فهرست ادمین انتخاب می شوند."
|
||||
footer={
|
||||
<>
|
||||
<Button type="submit" disabled={loading}>
|
||||
{loading ? "در حال ذخیره..." : isEdit ? "ذخیره تغییرات" : "ایجاد دوره"}
|
||||
</Button>
|
||||
<Link
|
||||
href="/admin/courses"
|
||||
href="/mstcontroller/courses"
|
||||
className={cn(buttonVariants({ variant: "outline" }))}
|
||||
>
|
||||
انصراف
|
||||
@@ -152,7 +152,7 @@ export function CourseForm({
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-foreground">شناسه و معرفی</h2>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">
|
||||
شناسه، عنوان و خلاصهٔ نمایشی دوره
|
||||
شناسه، عنوان و خلاصه نمایشی دوره
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
@@ -194,7 +194,7 @@ export function CourseForm({
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-foreground">برگزاری و قیمت</h2>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">
|
||||
قالب، مدت و هزینهٔ اختیاری
|
||||
قالب، مدت و هزینه اختیاری
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid gap-4 sm:grid-cols-3">
|
||||
@@ -244,17 +244,17 @@ export function CourseForm({
|
||||
|
||||
<section className="space-y-4">
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-foreground">دستهبندی و تگ</h2>
|
||||
<h2 className="text-sm font-semibold text-foreground">دسته بندی و تگ</h2>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">
|
||||
دستهها موضوع محتوا هستند؛ تگها نوع برنامه (منو و فیلتر). تعریف جدید از منوی ادمین.
|
||||
دسته ها موضوع محتوا هستند؛ تگ ها نوع برنامه (منو و فیلتر). تعریف جدید از منوی ادمین.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>دستهبندیها</Label>
|
||||
<Label>دسته بندی ها</Label>
|
||||
{categories.length === 0 ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
هنوز دستهای تعریف نشده. از «دستهبندی دورهها» اضافه کنید.
|
||||
هنوز دسته ای تعریف نشده. از «دسته بندی دوره ها» اضافه کنید.
|
||||
</p>
|
||||
) : (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
@@ -304,10 +304,10 @@ export function CourseForm({
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label>تگها</Label>
|
||||
<Label>تگ ها</Label>
|
||||
{tags.length === 0 ? (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
هنوز تگی تعریف نشده. از «تگهای دوره» اضافه کنید.
|
||||
هنوز تگی تعریف نشده. از «تگ های دوره» اضافه کنید.
|
||||
</p>
|
||||
) : (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
@@ -419,12 +419,12 @@ export function CourseForm({
|
||||
<div>
|
||||
<h2 className="text-sm font-semibold text-foreground">رسانه و انتشار</h2>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">
|
||||
لینک ثبتنام، بارگذاری تصویر، SEO و وضعیت انتشار
|
||||
لینک ثبت نام، بارگذاری تصویر، SEO و وضعیت انتشار
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<div className="space-y-1.5 sm:col-span-2">
|
||||
<Label htmlFor="registrationUrl">لینک ثبتنام</Label>
|
||||
<Label htmlFor="registrationUrl">لینک ثبت نام</Label>
|
||||
<Input
|
||||
id="registrationUrl"
|
||||
value={form.registrationUrl}
|
||||
@@ -433,7 +433,7 @@ export function CourseForm({
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5 sm:col-span-2">
|
||||
<Label>پوستر</Label>
|
||||
<Label>بنر (کارت)</Label>
|
||||
<ImageUploadField
|
||||
id="posterImageUrl"
|
||||
value={form.posterImageUrl}
|
||||
@@ -442,7 +442,7 @@ export function CourseForm({
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5 sm:col-span-2">
|
||||
<Label>بروشور</Label>
|
||||
<Label>بروشور (جزئیات)</Label>
|
||||
<ImageUploadField
|
||||
id="brochureImageUrl"
|
||||
value={form.brochureImageUrl}
|
||||
@@ -469,8 +469,8 @@ export function CourseForm({
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="true">منتشرشده</SelectItem>
|
||||
<SelectItem value="false">پیشنویس</SelectItem>
|
||||
<SelectItem value="true">منتشر شده</SelectItem>
|
||||
<SelectItem value="false">پیش نویس</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user