Implement faculty page redirect and enhance course management features. Added a redirect for the faculty page to an external URL. Updated course data structure to include new fields for poster and brochure images, and introduced tagging functionality for courses. Enhanced admin course filters to support tag-based filtering and improved course form for tag management. Updated navigation links to reflect changes in course and faculty structure.
This commit is contained in:
1 parent
0e2fcaacdd
commit
ab7fcd41d8
22 files changed
+474
-97
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
-- Add poster and brochure image URLs to courses table.
|
||||||
|
ALTER TABLE courses
|
||||||
|
ADD COLUMN IF NOT EXISTS poster_image_url TEXT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS brochure_image_url TEXT NULL;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- Add tags column to courses table
|
||||||
|
ALTER TABLE courses ADD COLUMN IF NOT EXISTS tags TEXT[] NOT NULL DEFAULT '{}';
|
||||||
+1
-1
@@ -83,7 +83,7 @@ async function main() {
|
|||||||
|
|
||||||
await upsert("courses", courses.map(courseToRow), [
|
await upsert("courses", courses.map(courseToRow), [
|
||||||
"id", "slug", "title", "summary", "category", "duration_hours", "format", "price",
|
"id", "slug", "title", "summary", "category", "duration_hours", "format", "price",
|
||||||
"registration_url", "image_url", "seo_description", "published",
|
"registration_url", "poster_image_url", "brochure_image_url", "image_url", "seo_description", "published",
|
||||||
]);
|
]);
|
||||||
const courseIds = courses.map((c) => c.id);
|
const courseIds = courses.map((c) => c.id);
|
||||||
await client.query(
|
await client.query(
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ const nextConfig: NextConfig = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
async redirects() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/faculty",
|
||||||
|
destination: "https://mst.aut.ac.ir/content/31094/شبکه-اساتید",
|
||||||
|
permanent: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withNextIntl(nextConfig);
|
export default withNextIntl(nextConfig);
|
||||||
@@ -1,41 +1,5 @@
|
|||||||
import type { Metadata } from "next";
|
import { redirect } from "next/navigation";
|
||||||
import { getTranslations } from "next-intl/server";
|
|
||||||
import { Container } from "@/components/atoms/Container";
|
|
||||||
import { Section } from "@/components/atoms/Section";
|
|
||||||
import { FacultyMemberCard } from "@/components/molecules/FacultyMemberCard";
|
|
||||||
import { PageHero } from "@/components/molecules/PageHero";
|
|
||||||
import { getFaculty } from "@/lib/data/site";
|
|
||||||
|
|
||||||
export async function generateMetadata(): Promise<Metadata> {
|
export default function FacultyPage() {
|
||||||
const t = await getTranslations("pages");
|
redirect("https://mst.aut.ac.ir/content/31094/شبکه-اساتید");
|
||||||
return { title: t("facultyTitle"), description: t("facultyIntro") };
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function FacultyPage() {
|
|
||||||
const t = await getTranslations("pages");
|
|
||||||
let members: Awaited<ReturnType<typeof getFaculty>> = [];
|
|
||||||
try {
|
|
||||||
members = await getFaculty();
|
|
||||||
} catch (err) {
|
|
||||||
console.error("[faculty] getFaculty failed:", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<main id="main-content">
|
|
||||||
<PageHero title={t("facultyTitle")} intro={t("facultyIntro")} />
|
|
||||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
|
||||||
<Container>
|
|
||||||
{members.length === 0 ? (
|
|
||||||
<p className="text-muted-foreground">در حال حاضر مدرسی برای نمایش نیست.</p>
|
|
||||||
) : (
|
|
||||||
<div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
||||||
{members.map((member) => (
|
|
||||||
<FacultyMemberCard key={member.id} member={member} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Container>
|
|
||||||
</Section>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { listAdminCourses } from "@/lib/data/admin/courses";
|
import { listAdminCourses, listCourseTags } from "@/lib/data/admin/courses";
|
||||||
import { CourseTable } from "@/components/organisms/admin/courses/CourseTable";
|
import { CourseTable } from "@/components/organisms/admin/courses/CourseTable";
|
||||||
import { CourseFilters } from "@/components/organisms/admin/courses/CourseFilters";
|
import { CourseFilters } from "@/components/organisms/admin/courses/CourseFilters";
|
||||||
import {
|
import {
|
||||||
@@ -16,13 +16,14 @@ export const dynamic = "force-dynamic";
|
|||||||
export default async function AdminCoursesPage({
|
export default async function AdminCoursesPage({
|
||||||
searchParams,
|
searchParams,
|
||||||
}: {
|
}: {
|
||||||
searchParams: Promise<{ search?: string; published?: string }>;
|
searchParams: Promise<{ search?: string; published?: string; tag?: string }>;
|
||||||
}) {
|
}) {
|
||||||
const { search = "", published: publishedRaw } = await searchParams;
|
const { search = "", published: publishedRaw, tag } = await searchParams;
|
||||||
const published =
|
const published =
|
||||||
publishedRaw === "true" ? true : publishedRaw === "false" ? false : undefined;
|
publishedRaw === "true" ? true : publishedRaw === "false" ? false : undefined;
|
||||||
|
|
||||||
const courses = await listAdminCourses({ search, published });
|
const courses = await listAdminCourses({ search, published, tag });
|
||||||
|
const availableTags = await listCourseTags();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AdminPage>
|
<AdminPage>
|
||||||
@@ -36,10 +37,12 @@ export default async function AdminCoursesPage({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AdminToolbarCard description="جستجو بر اساس عنوان یا اسلاگ و فیلتر وضعیت انتشار">
|
<AdminToolbarCard description="جستجو بر اساس عنوان یا اسلاگ، فیلتر وضعیت انتشار و تگها">
|
||||||
<CourseFilters
|
<CourseFilters
|
||||||
initialSearch={search}
|
initialSearch={search}
|
||||||
initialPublished={publishedRaw ?? "all"}
|
initialPublished={publishedRaw ?? "all"}
|
||||||
|
initialTag={tag ?? ""}
|
||||||
|
availableTags={availableTags}
|
||||||
/>
|
/>
|
||||||
</AdminToolbarCard>
|
</AdminToolbarCard>
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,10 @@ const COURSE_COLUMNS: Record<string, string> = {
|
|||||||
format: "format",
|
format: "format",
|
||||||
price: "price",
|
price: "price",
|
||||||
registrationUrl: "registration_url",
|
registrationUrl: "registration_url",
|
||||||
imageUrl: "image_url",
|
posterImageUrl: "poster_image_url",
|
||||||
|
brochureImageUrl: "brochure_image_url",
|
||||||
seoDescription: "seo_description",
|
seoDescription: "seo_description",
|
||||||
|
tags: "tags",
|
||||||
published: "published",
|
published: "published",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ export async function POST(request: NextRequest) {
|
|||||||
await query(
|
await query(
|
||||||
`INSERT INTO courses
|
`INSERT INTO courses
|
||||||
(id, slug, title, summary, category, duration_hours, format, price,
|
(id, slug, title, summary, category, duration_hours, format, price,
|
||||||
registration_url, image_url, seo_description, published)
|
registration_url, poster_image_url, brochure_image_url, image_url, seo_description, tags, published)
|
||||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)`,
|
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15)`,
|
||||||
[
|
[
|
||||||
id, d.slug, d.title, d.summary, d.category, d.durationHours ?? null, d.format,
|
id, d.slug, d.title, d.summary, d.category, d.durationHours ?? null, d.format,
|
||||||
d.price ?? null, d.registrationUrl, d.imageUrl, d.seoDescription, d.published,
|
d.price ?? null, d.registrationUrl, d.posterImageUrl, d.brochureImageUrl, d.posterImageUrl, d.seoDescription, d.tags ?? [], d.published,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
const res = await query<CourseRow>(`SELECT * FROM courses WHERE id = $1`, [id]);
|
const res = await query<CourseRow>(`SELECT * FROM courses WHERE id = $1`, [id]);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import Link from "next/link";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
CardContent,
|
CardContent,
|
||||||
@@ -21,28 +22,49 @@ import { cn } from "@/lib/utils";
|
|||||||
export function CategoryCourseExplorer({
|
export function CategoryCourseExplorer({
|
||||||
courses,
|
courses,
|
||||||
findLabel,
|
findLabel,
|
||||||
|
tagsLabel = "دستهبندیها",
|
||||||
}: {
|
}: {
|
||||||
courses: Course[];
|
courses: Course[];
|
||||||
findLabel: string;
|
findLabel: string;
|
||||||
|
tagsLabel?: string;
|
||||||
}) {
|
}) {
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
const [category, setCategory] = useState("all");
|
const [category, setCategory] = useState("all");
|
||||||
|
const [tag, setTag] = useState("");
|
||||||
const deferredQuery = useDeferredValue(query);
|
const deferredQuery = useDeferredValue(query);
|
||||||
const isStale = query !== deferredQuery;
|
const isStale = query !== deferredQuery;
|
||||||
|
|
||||||
|
// Distinct tags across all courses (stable order: most used first).
|
||||||
|
const tags = useMemo(() => {
|
||||||
|
const counts = new Map<string, number>();
|
||||||
|
for (const course of courses) {
|
||||||
|
for (const t of course.tags ?? []) {
|
||||||
|
counts.set(t, (counts.get(t) ?? 0) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...counts.entries()].sort((a, b) => b[1] - a[1]).map(([t]) => t);
|
||||||
|
}, [courses]);
|
||||||
|
|
||||||
const filtered = useMemo(() => {
|
const filtered = useMemo(() => {
|
||||||
return courses.filter((course) => {
|
return courses.filter((course) => {
|
||||||
const matchesCategory =
|
const matchesCategory =
|
||||||
category === "all" ||
|
category === "all" ||
|
||||||
category === "best" ||
|
category === "best" ||
|
||||||
course.category === category;
|
course.category === category;
|
||||||
|
const matchesTag = !tag || (course.tags ?? []).includes(tag);
|
||||||
const matchesQuery =
|
const matchesQuery =
|
||||||
!deferredQuery ||
|
!deferredQuery ||
|
||||||
course.title.includes(deferredQuery) ||
|
course.title.includes(deferredQuery) ||
|
||||||
course.summary.includes(deferredQuery);
|
course.summary.includes(deferredQuery);
|
||||||
return matchesCategory && matchesQuery;
|
return matchesCategory && matchesTag && matchesQuery;
|
||||||
});
|
});
|
||||||
}, [courses, category, deferredQuery]);
|
}, [courses, category, tag, deferredQuery]);
|
||||||
|
|
||||||
|
const resetFilters = () => {
|
||||||
|
setCategory("all");
|
||||||
|
setTag("");
|
||||||
|
setQuery("");
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-8">
|
<div className="space-y-8">
|
||||||
@@ -90,6 +112,89 @@ export function CategoryCourseExplorer({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{tags.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={tag === "" ? "default" : "ghost"}
|
||||||
|
aria-selected={tag === ""}
|
||||||
|
onClick={() => setTag("")}
|
||||||
|
className={cn(
|
||||||
|
tag !== "" &&
|
||||||
|
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
همه
|
||||||
|
</Button>
|
||||||
|
{tags.map((item) => (
|
||||||
|
<Button
|
||||||
|
key={item}
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
variant={tag === item ? "default" : "ghost"}
|
||||||
|
aria-selected={tag === item}
|
||||||
|
onClick={() => setTag(tag === item ? "" : item)}
|
||||||
|
className={cn(
|
||||||
|
tag !== item &&
|
||||||
|
"bg-background/10 text-background/85 hover:bg-background/20 hover:text-background",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{item}
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{(tag !== "" || category !== "all") && (
|
||||||
|
<div className="flex flex-wrap items-center gap-2 text-xs text-background/60">
|
||||||
|
<span>فیلترهای فعال:</span>
|
||||||
|
{category !== "all" && (
|
||||||
|
<Badge variant="secondary" className="gap-1 py-0.5 pe-1">
|
||||||
|
{courseCategories.find((c) => c.id === category)?.label ?? category}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setCategory("all")}
|
||||||
|
className="rounded-full p-0.5 hover:bg-foreground/10"
|
||||||
|
aria-label="حذف فیلتر دستهبندی"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
{tag !== "" && (
|
||||||
|
<Badge variant="secondary" className="gap-1 py-0.5 pe-1">
|
||||||
|
{tag}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setTag("")}
|
||||||
|
className="rounded-full p-0.5 hover:bg-foreground/10"
|
||||||
|
aria-label="حذف فیلتر تگ"
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={resetFilters}
|
||||||
|
className="underline underline-offset-4 hover:text-background"
|
||||||
|
>
|
||||||
|
پاککردن همه
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{filtered.length === 0 ? (
|
||||||
|
<p className="py-10 text-center text-sm text-background/60">
|
||||||
|
دورهای با این فیلترها یافت نشد.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"grid gap-5 transition-opacity sm:grid-cols-2 lg:grid-cols-3",
|
"grid gap-5 transition-opacity sm:grid-cols-2 lg:grid-cols-3",
|
||||||
@@ -105,7 +210,7 @@ export function CategoryCourseExplorer({
|
|||||||
>
|
>
|
||||||
<div className="relative aspect-[16/10] overflow-hidden">
|
<div className="relative aspect-[16/10] overflow-hidden">
|
||||||
<Image
|
<Image
|
||||||
src={course.imageUrl}
|
src={course.posterImageUrl}
|
||||||
alt={course.title}
|
alt={course.title}
|
||||||
fill
|
fill
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
@@ -126,6 +231,19 @@ export function CategoryCourseExplorer({
|
|||||||
<CardDescription className="line-clamp-3 text-background/70">
|
<CardDescription className="line-clamp-3 text-background/70">
|
||||||
{course.summary}
|
{course.summary}
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
|
{course.tags && course.tags.length > 0 ? (
|
||||||
|
<div className="flex flex-wrap gap-1.5">
|
||||||
|
{course.tags.map((t) => (
|
||||||
|
<Badge
|
||||||
|
key={t}
|
||||||
|
variant="outline"
|
||||||
|
className="border-background/25 text-[10px] text-background/80"
|
||||||
|
>
|
||||||
|
{t}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
<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-background/55">
|
||||||
<span>
|
<span>
|
||||||
{course.durationHours
|
{course.durationHours
|
||||||
@@ -149,6 +267,7 @@ export function CategoryCourseExplorer({
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,12 @@ import { BrandLogo } from "@/components/atoms/BrandLogo";
|
|||||||
import { Container } from "@/components/atoms/Container";
|
import { Container } from "@/components/atoms/Container";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
|
import {
|
||||||
|
DropdownMenu,
|
||||||
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
|
DropdownMenuTrigger,
|
||||||
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { SearchOverlay } from "@/components/organisms/SearchOverlay";
|
import { SearchOverlay } from "@/components/organisms/SearchOverlay";
|
||||||
import type { Course, NavItem, Program } from "@/lib/types";
|
import type { Course, NavItem, Program } from "@/lib/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
@@ -85,7 +91,65 @@ export function SiteHeader({
|
|||||||
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-0.5 xl:flex"
|
||||||
aria-label="منوی اصلی"
|
aria-label="منوی اصلی"
|
||||||
>
|
>
|
||||||
{items.map((item) => (
|
{items.map((item) => {
|
||||||
|
if (item.label.includes("دورهها") || item.label.includes("فهرست")) {
|
||||||
|
return (
|
||||||
|
<DropdownMenu key={item.href + item.label}>
|
||||||
|
<DropdownMenuTrigger
|
||||||
|
className={cn(
|
||||||
|
"rounded-lg px-2.5 py-2 text-sm font-semibold transition-colors outline-none cursor-pointer inline-flex items-center gap-1",
|
||||||
|
isDark
|
||||||
|
? "text-background/80 hover:text-background"
|
||||||
|
: "text-foreground/75 hover:bg-muted hover:text-primary",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{item.label}
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent className="z-[60] w-56 p-1">
|
||||||
|
<DropdownMenuItem>
|
||||||
|
<Link href="/professional" className="w-full cursor-pointer">
|
||||||
|
همه دورهها
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>
|
||||||
|
<Link href="/professional#programs" className="w-full cursor-pointer">
|
||||||
|
کارگاهها
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>
|
||||||
|
<Link href="/professional#programs" className="w-full cursor-pointer">
|
||||||
|
دورههای سازمانی
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem>
|
||||||
|
<Link href="/professional#programs" className="w-full cursor-pointer">
|
||||||
|
گزیده دورههای برگزار شده
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return item.prominent ? (
|
||||||
|
<Link
|
||||||
|
key={item.href + item.label}
|
||||||
|
href={item.href}
|
||||||
|
target={item.href.startsWith("http") ? "_blank" : undefined}
|
||||||
|
rel={
|
||||||
|
item.href.startsWith("http")
|
||||||
|
? "noopener noreferrer"
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
className={cn(
|
||||||
|
"ms-1 inline-flex items-center rounded-md border px-2.5 py-1 text-xs font-bold transition-all shadow-sm",
|
||||||
|
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",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{item.label}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
<Link
|
<Link
|
||||||
key={item.href + item.label}
|
key={item.href + item.label}
|
||||||
href={item.href}
|
href={item.href}
|
||||||
@@ -98,7 +162,8 @@ export function SiteHeader({
|
|||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
);
|
||||||
|
})}
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -174,7 +239,19 @@ export function SiteHeader({
|
|||||||
<li key={item.href + item.label}>
|
<li key={item.href + item.label}>
|
||||||
<Link
|
<Link
|
||||||
href={item.href}
|
href={item.href}
|
||||||
className="block py-3.5 text-lg font-bold transition-colors hover:text-background/70"
|
target={
|
||||||
|
item.href.startsWith("http") ? "_blank" : undefined
|
||||||
|
}
|
||||||
|
rel={
|
||||||
|
item.href.startsWith("http")
|
||||||
|
? "noopener noreferrer"
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
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"
|
||||||
|
)}
|
||||||
onClick={() => setMobileOpen(false)}
|
onClick={() => setMobileOpen(false)}
|
||||||
>
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
|
|
||||||
function buildUrl(search: string, published: string) {
|
function buildUrl(search: string, published: string, tag: string) {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
if (search.trim()) params.set("search", search.trim());
|
if (search.trim()) params.set("search", search.trim());
|
||||||
if (published && published !== "all") params.set("published", published);
|
if (published && published !== "all") params.set("published", published);
|
||||||
|
if (tag && tag.trim()) params.set("tag", tag.trim());
|
||||||
const qs = params.toString();
|
const qs = params.toString();
|
||||||
return qs ? `/admin/courses?${qs}` : "/admin/courses";
|
return qs ? `/admin/courses?${qs}` : "/admin/courses";
|
||||||
}
|
}
|
||||||
@@ -23,46 +24,48 @@ function buildUrl(search: string, published: string) {
|
|||||||
export function CourseFilters({
|
export function CourseFilters({
|
||||||
initialSearch,
|
initialSearch,
|
||||||
initialPublished,
|
initialPublished,
|
||||||
|
initialTag,
|
||||||
|
availableTags,
|
||||||
}: {
|
}: {
|
||||||
initialSearch: string;
|
initialSearch: string;
|
||||||
initialPublished: string;
|
initialPublished: string;
|
||||||
|
initialTag: string;
|
||||||
|
availableTags: string[];
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [search, setSearch] = useState(initialSearch);
|
const [search, setSearch] = useState(initialSearch);
|
||||||
const [published, setPublished] = useState(initialPublished);
|
const [published, setPublished] = useState(initialPublished);
|
||||||
const hasFilters = Boolean(initialSearch.trim()) || initialPublished !== "all";
|
const [tag, setTag] = useState(initialTag);
|
||||||
|
const hasFilters = Boolean(search.trim()) || published !== "all" || Boolean(tag.trim());
|
||||||
|
|
||||||
function apply(e: React.FormEvent) {
|
function apply(e: React.FormEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
router.push(buildUrl(search, published));
|
router.push(buildUrl(search, published, tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
setSearch("");
|
setSearch("");
|
||||||
setPublished("all");
|
setPublished("all");
|
||||||
|
setTag("");
|
||||||
router.push("/admin/courses");
|
router.push("/admin/courses");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form onSubmit={apply} className="flex flex-wrap items-end gap-3">
|
||||||
onSubmit={apply}
|
{/* ... search input ... */}
|
||||||
className="flex flex-wrap items-end gap-3"
|
|
||||||
>
|
|
||||||
<div className="w-full max-w-xs space-y-1.5">
|
<div className="w-full max-w-xs space-y-1.5">
|
||||||
<label htmlFor="course-search" className="text-sm font-medium">
|
<label htmlFor="course-search" className="text-sm font-medium">جستجو</label>
|
||||||
جستجو
|
|
||||||
</label>
|
|
||||||
<Input
|
<Input
|
||||||
id="course-search"
|
id="course-search"
|
||||||
placeholder="عنوان یا اسلاگ دوره..."
|
placeholder="عنوان یا اسلاگ..."
|
||||||
value={search}
|
value={search}
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ... published select ... */}
|
||||||
<div className="w-full max-w-[12rem] space-y-1.5">
|
<div className="w-full max-w-[12rem] space-y-1.5">
|
||||||
<label htmlFor="course-published" className="text-sm font-medium">
|
<label htmlFor="course-published" className="text-sm font-medium">وضعیت انتشار</label>
|
||||||
وضعیت انتشار
|
|
||||||
</label>
|
|
||||||
<Select value={published} onValueChange={(v) => setPublished(v ?? "all")}>
|
<Select value={published} onValueChange={(v) => setPublished(v ?? "all")}>
|
||||||
<SelectTrigger id="course-published" className="w-full">
|
<SelectTrigger id="course-published" className="w-full">
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
@@ -74,11 +77,26 @@ export function CourseFilters({
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ... tag select ... */}
|
||||||
|
<div className="w-full max-w-[12rem] space-y-1.5">
|
||||||
|
<label htmlFor="course-tag" className="text-sm font-medium">تگ</label>
|
||||||
|
<Select value={tag} onValueChange={(v) => setTag(v ?? "")}>
|
||||||
|
<SelectTrigger id="course-tag" className="w-full">
|
||||||
|
<SelectValue placeholder="همه" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="">همه</SelectItem>
|
||||||
|
{availableTags.map((t) => (
|
||||||
|
<SelectItem key={t} value={t}>{t}</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Button type="submit">اعمال فیلتر</Button>
|
<Button type="submit">اعمال فیلتر</Button>
|
||||||
{hasFilters && (
|
{hasFilters && (
|
||||||
<Button type="button" variant="ghost" onClick={clear}>
|
<Button type="button" variant="ghost" onClick={clear}>پاککردن فیلترها</Button>
|
||||||
پاککردن فیلترها
|
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,9 +16,17 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
|
import { Plus, X } from "lucide-react";
|
||||||
import type { AdminCourse } from "@/lib/data/admin/courses";
|
import type { AdminCourse } from "@/lib/data/admin/courses";
|
||||||
import { AdminFormCard } from "@/components/organisms/admin/AdminPage";
|
import { AdminFormCard } from "@/components/organisms/admin/AdminPage";
|
||||||
|
|
||||||
|
const SUGGESTED_TAGS = [
|
||||||
|
"کارگاهها",
|
||||||
|
"دورههای سازمانی",
|
||||||
|
"گزیده دورههای برگزار شده",
|
||||||
|
];
|
||||||
|
|
||||||
type Payload = {
|
type Payload = {
|
||||||
slug: string;
|
slug: string;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -28,8 +36,10 @@ type Payload = {
|
|||||||
format: string;
|
format: string;
|
||||||
price: number | null;
|
price: number | null;
|
||||||
registrationUrl: string;
|
registrationUrl: string;
|
||||||
imageUrl: string;
|
posterImageUrl: string;
|
||||||
|
brochureImageUrl: string;
|
||||||
seoDescription: string;
|
seoDescription: string;
|
||||||
|
tags: string[];
|
||||||
published: boolean;
|
published: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,13 +59,16 @@ export function CourseForm({ initial }: CourseFormProps) {
|
|||||||
format: initial?.format ?? "in-person",
|
format: initial?.format ?? "in-person",
|
||||||
price: initial?.price ?? null,
|
price: initial?.price ?? null,
|
||||||
registrationUrl: initial?.registrationUrl ?? "/register/",
|
registrationUrl: initial?.registrationUrl ?? "/register/",
|
||||||
imageUrl: initial?.imageUrl ?? "",
|
posterImageUrl: initial?.posterImageUrl ?? "",
|
||||||
|
brochureImageUrl: initial?.brochureImageUrl ?? "",
|
||||||
seoDescription: initial?.seoDescription ?? "",
|
seoDescription: initial?.seoDescription ?? "",
|
||||||
|
tags: initial?.tags ?? [],
|
||||||
published: initial?.published ?? true,
|
published: initial?.published ?? true,
|
||||||
});
|
});
|
||||||
const [priceInput, setPriceInput] = useState(
|
const [priceInput, setPriceInput] = useState(
|
||||||
initial?.price != null ? String(initial.price) : "",
|
initial?.price != null ? String(initial.price) : "",
|
||||||
);
|
);
|
||||||
|
const [customTagInput, setCustomTagInput] = useState("");
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState("");
|
const [error, setError] = useState("");
|
||||||
|
|
||||||
@@ -63,6 +76,29 @@ export function CourseForm({ initial }: CourseFormProps) {
|
|||||||
setForm((f) => ({ ...f, [key]: value }));
|
setForm((f) => ({ ...f, [key]: value }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleTag(tag: string) {
|
||||||
|
setForm((f) => {
|
||||||
|
const exists = f.tags.includes(tag);
|
||||||
|
return {
|
||||||
|
...f,
|
||||||
|
tags: exists ? f.tags.filter((t) => t !== tag) : [...f.tags, tag],
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function addCustomTag() {
|
||||||
|
const trimmed = customTagInput.trim();
|
||||||
|
if (!trimmed) return;
|
||||||
|
if (!form.tags.includes(trimmed)) {
|
||||||
|
set("tags", [...form.tags, trimmed]);
|
||||||
|
}
|
||||||
|
setCustomTagInput("");
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeTag(tagToRemove: string) {
|
||||||
|
set("tags", form.tags.filter((t) => t !== tagToRemove));
|
||||||
|
}
|
||||||
|
|
||||||
function onPriceChange(raw: string) {
|
function onPriceChange(raw: string) {
|
||||||
setPriceInput(raw);
|
setPriceInput(raw);
|
||||||
const trimmed = raw.trim();
|
const trimmed = raw.trim();
|
||||||
@@ -243,6 +279,94 @@ export function CourseForm({ initial }: CourseFormProps) {
|
|||||||
|
|
||||||
<Separator />
|
<Separator />
|
||||||
|
|
||||||
|
<section className="space-y-4">
|
||||||
|
<div>
|
||||||
|
<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-3">
|
||||||
|
<div>
|
||||||
|
<Label className="text-xs text-muted-foreground">تگهای پیشنهادی</Label>
|
||||||
|
<div className="mt-2 flex flex-wrap gap-2">
|
||||||
|
{SUGGESTED_TAGS.map((tag) => {
|
||||||
|
const active = form.tags.includes(tag);
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
key={tag}
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
variant={active ? "default" : "outline"}
|
||||||
|
aria-pressed={active}
|
||||||
|
onClick={() => toggleTag(tag)}
|
||||||
|
className="h-8 px-3 text-xs"
|
||||||
|
>
|
||||||
|
{tag}
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-end gap-2">
|
||||||
|
<div className="flex-1 space-y-1.5">
|
||||||
|
<Label htmlFor="newTag">افزودن تگ دلخواه</Label>
|
||||||
|
<Input
|
||||||
|
id="newTag"
|
||||||
|
value={customTagInput}
|
||||||
|
onChange={(e) => setCustomTagInput(e.target.value)}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
e.preventDefault();
|
||||||
|
addCustomTag();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
placeholder="مثلاً دورههای ویژه مدیران"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="outline"
|
||||||
|
onClick={addCustomTag}
|
||||||
|
className="shrink-0"
|
||||||
|
>
|
||||||
|
<Plus className="size-4" />
|
||||||
|
افزودن
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label className="text-xs text-muted-foreground">
|
||||||
|
تگهای این دوره ({form.tags.length})
|
||||||
|
</Label>
|
||||||
|
{form.tags.length > 0 ? (
|
||||||
|
<div className="flex flex-wrap gap-1.5">
|
||||||
|
{form.tags.map((tag) => (
|
||||||
|
<Badge key={tag} variant="secondary" className="gap-1 py-1 pe-1">
|
||||||
|
{tag}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => removeTag(tag)}
|
||||||
|
className="rounded-full p-0.5 transition-colors hover:bg-foreground/10"
|
||||||
|
aria-label={`حذف تگ ${tag}`}
|
||||||
|
>
|
||||||
|
<X className="size-3" />
|
||||||
|
</button>
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<p className="text-xs text-muted-foreground">
|
||||||
|
هنوز تگی برای این دوره انتخاب نشده است.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
<section className="space-y-4">
|
<section className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="text-sm font-semibold text-foreground">رسانه و انتشار</h2>
|
<h2 className="text-sm font-semibold text-foreground">رسانه و انتشار</h2>
|
||||||
@@ -261,11 +385,20 @@ export function CourseForm({ initial }: CourseFormProps) {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1.5 sm:col-span-2">
|
<div className="space-y-1.5 sm:col-span-2">
|
||||||
<Label htmlFor="imageUrl">آدرس تصویر</Label>
|
<Label htmlFor="posterImageUrl">آدرس پوستر (نمایش در لیست دورهها)</Label>
|
||||||
<Input
|
<Input
|
||||||
id="imageUrl"
|
id="posterImageUrl"
|
||||||
value={form.imageUrl}
|
value={form.posterImageUrl}
|
||||||
onChange={(e) => set("imageUrl", e.target.value)}
|
onChange={(e) => set("posterImageUrl", e.target.value)}
|
||||||
|
placeholder="/images/courses/..."
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="space-y-1.5 sm:col-span-2">
|
||||||
|
<Label htmlFor="brochureImageUrl">آدرس بروشور (نمایش در صفحه جزئیات)</Label>
|
||||||
|
<Input
|
||||||
|
id="brochureImageUrl"
|
||||||
|
value={form.brochureImageUrl}
|
||||||
|
onChange={(e) => set("brochureImageUrl", e.target.value)}
|
||||||
placeholder="/images/courses/..."
|
placeholder="/images/courses/..."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -42,7 +42,18 @@ export function CourseTable({ courses }: { courses: AdminCourse[] }) {
|
|||||||
<TableBody>
|
<TableBody>
|
||||||
{courses.map((course) => (
|
{courses.map((course) => (
|
||||||
<TableRow key={course.id}>
|
<TableRow key={course.id}>
|
||||||
<TableCell className="font-medium">{course.title}</TableCell>
|
<TableCell className="font-medium">
|
||||||
|
<div>{course.title}</div>
|
||||||
|
{course.tags && course.tags.length > 0 ? (
|
||||||
|
<div className="mt-1 flex flex-wrap gap-1">
|
||||||
|
{course.tags.map((tag) => (
|
||||||
|
<Badge key={tag} variant="outline" className="text-[10px] px-1.5 py-0">
|
||||||
|
{tag}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Badge variant="secondary">{categoryLabel(course.category)}</Badge>
|
<Badge variant="secondary">{categoryLabel(course.category)}</Badge>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export function CourseDetailTemplate({
|
|||||||
title={course.title}
|
title={course.title}
|
||||||
intro={course.summary}
|
intro={course.summary}
|
||||||
eyebrow={categoryLabel(course.category)}
|
eyebrow={categoryLabel(course.category)}
|
||||||
imageUrl={course.imageUrl}
|
imageUrl={course.posterImageUrl}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Section className="bg-gradient-to-b from-background to-muted/40">
|
<Section className="bg-gradient-to-b from-background to-muted/40">
|
||||||
@@ -87,7 +87,7 @@ export function CourseDetailTemplate({
|
|||||||
<div className="overflow-hidden rounded-2xl ring-1 ring-border">
|
<div className="overflow-hidden rounded-2xl ring-1 ring-border">
|
||||||
<div className="relative aspect-[16/9] bg-muted">
|
<div className="relative aspect-[16/9] bg-muted">
|
||||||
<Image
|
<Image
|
||||||
src={course.imageUrl}
|
src={course.brochureImageUrl}
|
||||||
alt={course.title}
|
alt={course.title}
|
||||||
fill
|
fill
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
|
|||||||
@@ -14,15 +14,18 @@ function toAdminCourse(row: CourseRow): AdminCourse {
|
|||||||
export async function listAdminCourses(opts?: {
|
export async function listAdminCourses(opts?: {
|
||||||
search?: string;
|
search?: string;
|
||||||
published?: boolean;
|
published?: boolean;
|
||||||
|
tag?: string;
|
||||||
}): Promise<AdminCourse[]> {
|
}): Promise<AdminCourse[]> {
|
||||||
const search = opts?.search?.trim() ?? "";
|
const search = opts?.search?.trim() ?? "";
|
||||||
const published = opts?.published ?? null;
|
const published = opts?.published ?? null;
|
||||||
|
const tag = opts?.tag?.trim() ?? "";
|
||||||
const res = await query<CourseRow>(
|
const res = await query<CourseRow>(
|
||||||
`SELECT * FROM courses
|
`SELECT * FROM courses
|
||||||
WHERE ($1 = '' OR title ILIKE '%' || $1 || '%' OR slug ILIKE '%' || $1 || '%')
|
WHERE ($1 = '' OR title ILIKE '%' || $1 || '%' OR slug ILIKE '%' || $1 || '%')
|
||||||
AND ($2::boolean IS NULL OR published = $2)
|
AND ($2::boolean IS NULL OR published = $2)
|
||||||
|
AND ($3 = '' OR $3 = ANY(tags))
|
||||||
ORDER BY updated_at DESC`,
|
ORDER BY updated_at DESC`,
|
||||||
[search, published],
|
[search, published, tag],
|
||||||
);
|
);
|
||||||
return res.rows.map(toAdminCourse);
|
return res.rows.map(toAdminCourse);
|
||||||
}
|
}
|
||||||
@@ -31,3 +34,14 @@ export async function getAdminCourseById(id: string): Promise<AdminCourse | null
|
|||||||
const res = await query<CourseRow>("SELECT * FROM courses WHERE id = $1 LIMIT 1", [id]);
|
const res = await query<CourseRow>("SELECT * FROM courses WHERE id = $1 LIMIT 1", [id]);
|
||||||
return res.rows[0] ? toAdminCourse(res.rows[0]) : null;
|
return res.rows[0] ? toAdminCourse(res.rows[0]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Distinct tags across all courses (admin view — includes unpublished), sorted by usage. */
|
||||||
|
export async function listCourseTags(): Promise<string[]> {
|
||||||
|
const res = await query<{ tag: string; count: string }>(
|
||||||
|
`SELECT tag, COUNT(*)::text AS count
|
||||||
|
FROM courses, UNNEST(tags) AS tag
|
||||||
|
GROUP BY tag
|
||||||
|
ORDER BY COUNT(*) DESC, tag ASC`,
|
||||||
|
);
|
||||||
|
return res.rows.map((r) => r.tag);
|
||||||
|
}
|
||||||
@@ -46,8 +46,10 @@ export interface CourseRow {
|
|||||||
format: string;
|
format: string;
|
||||||
price: string | number | null;
|
price: string | number | null;
|
||||||
registration_url: string;
|
registration_url: string;
|
||||||
image_url: string;
|
poster_image_url: string;
|
||||||
|
brochure_image_url: string;
|
||||||
seo_description: string;
|
seo_description: string;
|
||||||
|
tags: string[];
|
||||||
published: boolean;
|
published: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +64,10 @@ export function courseToRow(course: Course): CourseRow {
|
|||||||
format: course.format,
|
format: course.format,
|
||||||
price: course.price ?? null,
|
price: course.price ?? null,
|
||||||
registration_url: course.registrationUrl,
|
registration_url: course.registrationUrl,
|
||||||
image_url: course.imageUrl,
|
poster_image_url: course.posterImageUrl,
|
||||||
|
brochure_image_url: course.brochureImageUrl,
|
||||||
seo_description: course.seoDescription,
|
seo_description: course.seoDescription,
|
||||||
|
tags: course.tags ?? [],
|
||||||
published: true,
|
published: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -330,8 +334,10 @@ export function rowToCourse(row: CourseRow): Course {
|
|||||||
format: row.format as Course["format"],
|
format: row.format as Course["format"],
|
||||||
price: Number.isFinite(price) ? price : null,
|
price: Number.isFinite(price) ? price : null,
|
||||||
registrationUrl: row.registration_url,
|
registrationUrl: row.registration_url,
|
||||||
imageUrl: row.image_url,
|
posterImageUrl: row.poster_image_url ?? (row as unknown as { image_url?: string }).image_url ?? "",
|
||||||
|
brochureImageUrl: row.brochure_image_url ?? (row as unknown as { image_url?: string }).image_url ?? "",
|
||||||
seoDescription: row.seo_description,
|
seoDescription: row.seo_description,
|
||||||
|
tags: asStringArray(row.tags),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-7
@@ -12,7 +12,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/ai-organizational-transformation",
|
registrationUrl: "/register/ai-organizational-transformation",
|
||||||
imageUrl: "/images/courses/ai-organizational-transformation.png",
|
posterImageUrl: "/images/courses/ai-organizational-transformation-poster.png",
|
||||||
|
brochureImageUrl: "/images/courses/ai-organizational-transformation-brochure.png",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"دوره تخصصی دوروزه تحول سازمانی با هوش مصنوعی. مسیر یادگیری از مسئله سازمانی تا نقش انسان و AI، انتخاب مسیر، مدیریت محصول AI، داده و حاکمیت، ساخت و آزمون (Prompt، chatbot، AI Agent) و تشخیص کاربرد مناسب. محورها: ۱) آمادگی و مدیریت تغییر — دکتر آغاز؛ ۲) تحول با هوش مصنوعی — دکتر هراتینیک؛ ۳) چرخه عمر محصول AI — دکتر سلیمینمین؛ ۴) حاکمیت داده — دکتر روشنی؛ ۵) تجربه عملی AI Fluency و دستیاران صنعتی آموزشی — مهندس متین صفار و مهندس محمدحسین کشفی. شعار دوره: A SMARTER TOMORROW BY BETTER DECISIONS.",
|
"دوره تخصصی دوروزه تحول سازمانی با هوش مصنوعی. مسیر یادگیری از مسئله سازمانی تا نقش انسان و AI، انتخاب مسیر، مدیریت محصول AI، داده و حاکمیت، ساخت و آزمون (Prompt، chatbot، AI Agent) و تشخیص کاربرد مناسب. محورها: ۱) آمادگی و مدیریت تغییر — دکتر آغاز؛ ۲) تحول با هوش مصنوعی — دکتر هراتینیک؛ ۳) چرخه عمر محصول AI — دکتر سلیمینمین؛ ۴) حاکمیت داده — دکتر روشنی؛ ۵) تجربه عملی AI Fluency و دستیاران صنعتی آموزشی — مهندس متین صفار و مهندس محمدحسین کشفی. شعار دوره: A SMARTER TOMORROW BY BETTER DECISIONS.",
|
||||||
},
|
},
|
||||||
@@ -26,7 +27,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/ai-fluency",
|
registrationUrl: "/register/ai-fluency",
|
||||||
imageUrl: "/images/courses/ai-fluency.jpg",
|
posterImageUrl: "/images/courses/ai-fluency-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/ai-fluency-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"کارگاه عملی کاربرد هوش مصنوعی با شعار «از پرامپت دقیق تا ایجنت قابل اعتماد». پنج گام مسیر یادگیری: ۱) مهندسی پرامپت — درخواست شفاف، پاسخ هدفمند؛ مشخصکردن هدف، زمینه و قالب خروجی؛ ۲) طراحی دستورالعمل (Prompt Card / Skill) — دستور شفاف، اجرای منسجم؛ تعریف گامها و قوانین انجام کار؛ ۳) چتبات اختصاصی — دانش شما، دستیار شما؛ تعیین نقش، منابع و مرزهای پاسخ؛ ۴) ایجنت — از پاسخدادن تا انجام کار؛ اتصال ابزارها با نظارت انسان؛ ۵) ارزیابی و کنترل — بسنجید، اصلاح کنید، اعتماد کنید؛ آزمون پاسخها و کنترل خطا. در پایان کارگاه، از ایده به یک دستیار کاربردی میرسید: پرامپت دقیق، مهارت قابل تکرار، چتبات اختصاصی و ایجنت قابل ارزیابی.",
|
"کارگاه عملی کاربرد هوش مصنوعی با شعار «از پرامپت دقیق تا ایجنت قابل اعتماد». پنج گام مسیر یادگیری: ۱) مهندسی پرامپت — درخواست شفاف، پاسخ هدفمند؛ مشخصکردن هدف، زمینه و قالب خروجی؛ ۲) طراحی دستورالعمل (Prompt Card / Skill) — دستور شفاف، اجرای منسجم؛ تعریف گامها و قوانین انجام کار؛ ۳) چتبات اختصاصی — دانش شما، دستیار شما؛ تعیین نقش، منابع و مرزهای پاسخ؛ ۴) ایجنت — از پاسخدادن تا انجام کار؛ اتصال ابزارها با نظارت انسان؛ ۵) ارزیابی و کنترل — بسنجید، اصلاح کنید، اعتماد کنید؛ آزمون پاسخها و کنترل خطا. در پایان کارگاه، از ایده به یک دستیار کاربردی میرسید: پرامپت دقیق، مهارت قابل تکرار، چتبات اختصاصی و ایجنت قابل ارزیابی.",
|
||||||
},
|
},
|
||||||
@@ -40,7 +42,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/hr-prompt-engineering",
|
registrationUrl: "/register/hr-prompt-engineering",
|
||||||
imageUrl: "/images/courses/hr-prompt-engineering.jpg",
|
posterImageUrl: "/images/courses/hr-prompt-engineering-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/hr-prompt-engineering-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"استفاده حرفهای از هوش مصنوعی در منابع انسانی به شناخت مسئله و کیفیت تعامل با مدل وابسته است. این کارگاه به طراحی پرامپت برای تحلیل اطلاعات تخصصی HR میپردازد و کاربردهای آن را در جذب، توسعه و مدیریت عملکرد بررسی میکند. مدرس: دکتر عسل آغاز.",
|
"استفاده حرفهای از هوش مصنوعی در منابع انسانی به شناخت مسئله و کیفیت تعامل با مدل وابسته است. این کارگاه به طراحی پرامپت برای تحلیل اطلاعات تخصصی HR میپردازد و کاربردهای آن را در جذب، توسعه و مدیریت عملکرد بررسی میکند. مدرس: دکتر عسل آغاز.",
|
||||||
},
|
},
|
||||||
@@ -54,7 +57,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/branding",
|
registrationUrl: "/register/branding",
|
||||||
imageUrl: "/images/courses/branding.jpg",
|
posterImageUrl: "/images/courses/branding-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/branding-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"برند در ارتباط میان هویت کسبوکار و تجربه مخاطب شکل میگیرد. این کارگاه به تصمیمهای مؤثر بر این ارتباط میپردازد؛ از شناخت مخاطب و ارزش پیشنهادی تا روایت، تجربه و ارزیابی برند. مدرس: دکتر علیرضا شیخ. شعار منبع: از معنا و هویت تا تجربه و وفاداری.",
|
"برند در ارتباط میان هویت کسبوکار و تجربه مخاطب شکل میگیرد. این کارگاه به تصمیمهای مؤثر بر این ارتباط میپردازد؛ از شناخت مخاطب و ارزش پیشنهادی تا روایت، تجربه و ارزیابی برند. مدرس: دکتر علیرضا شیخ. شعار منبع: از معنا و هویت تا تجربه و وفاداری.",
|
||||||
},
|
},
|
||||||
@@ -68,7 +72,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/marketing",
|
registrationUrl: "/register/marketing",
|
||||||
imageUrl: "/images/courses/marketing.jpg",
|
posterImageUrl: "/images/courses/marketing-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/marketing-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"تصمیمهای بازاریابی به شناخت بازار، رفتار مشتری و ارزیابی نتیجه وابستهاند. این کارگاه ارتباط میان تحقیقات بازار، انتخاب استراتژی، طراحی کمپین و شاخصهای عملکرد را بررسی میکند. مدرس: دکتر علیرضا شیخ. شعار منبع: از شناخت مشتری تا طراحی استراتژی و اجرای کمپین.",
|
"تصمیمهای بازاریابی به شناخت بازار، رفتار مشتری و ارزیابی نتیجه وابستهاند. این کارگاه ارتباط میان تحقیقات بازار، انتخاب استراتژی، طراحی کمپین و شاخصهای عملکرد را بررسی میکند. مدرس: دکتر علیرضا شیخ. شعار منبع: از شناخت مشتری تا طراحی استراتژی و اجرای کمپین.",
|
||||||
},
|
},
|
||||||
@@ -82,7 +87,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/branding-marketing-in-practice",
|
registrationUrl: "/register/branding-marketing-in-practice",
|
||||||
imageUrl: "/images/courses/branding-marketing-practice.jpg",
|
posterImageUrl: "/images/courses/branding-marketing-practice-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/branding-marketing-practice-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"هویت برند، ارزش پیشنهادی و فعالیتهای بازاریابی بر یکدیگر اثر میگذارند. این کارگاه ارتباط میان آنها را در تصمیمهای کسبوکار بررسی میکند: از شناخت بازار و طراحی استراتژی برند تا انتخاب کانال، طراحی کمپین و تحلیل شاخصهای عملکرد. مدرس: دکتر علیرضا شیخ. شعار منبع: از هویت برند تا رشد پایدار کسبوکار.",
|
"هویت برند، ارزش پیشنهادی و فعالیتهای بازاریابی بر یکدیگر اثر میگذارند. این کارگاه ارتباط میان آنها را در تصمیمهای کسبوکار بررسی میکند: از شناخت بازار و طراحی استراتژی برند تا انتخاب کانال، طراحی کمپین و تحلیل شاخصهای عملکرد. مدرس: دکتر علیرضا شیخ. شعار منبع: از هویت برند تا رشد پایدار کسبوکار.",
|
||||||
},
|
},
|
||||||
@@ -96,7 +102,8 @@ export const courses: Course[] = [
|
|||||||
durationHours: null,
|
durationHours: null,
|
||||||
format: "in-person",
|
format: "in-person",
|
||||||
registrationUrl: "/register/managerial-dialogue",
|
registrationUrl: "/register/managerial-dialogue",
|
||||||
imageUrl: "/images/courses/managerial-dialogue.jpg",
|
posterImageUrl: "/images/courses/managerial-dialogue-poster.jpg",
|
||||||
|
brochureImageUrl: "/images/courses/managerial-dialogue-brochure.jpg",
|
||||||
seoDescription:
|
seoDescription:
|
||||||
"هماندیشی مدیریتی از مسئلهای آغاز میشود که مدیر با خود به جلسه میآورد. موضوع و انتظار او پیش از جلسه مشخص میشود و متخصص مرتبط با آن پیشنهاد میشود. گفتوگو به بررسی ابعاد مسئله، فرضیات و گزینههای تصمیم اختصاص دارد. زیرعنوان منبع: گفتوگویی تخصصی برای مواجهه با مسائل واقعی مدیریت.",
|
"هماندیشی مدیریتی از مسئلهای آغاز میشود که مدیر با خود به جلسه میآورد. موضوع و انتظار او پیش از جلسه مشخص میشود و متخصص مرتبط با آن پیشنهاد میشود. گفتوگو به بررسی ابعاد مسئله، فرضیات و گزینههای تصمیم اختصاص دارد. زیرعنوان منبع: گفتوگویی تخصصی برای مواجهه با مسائل واقعی مدیریت.",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -31,10 +31,11 @@ export const siteAddress = {
|
|||||||
/** Main nav labels for Persian users */
|
/** Main nav labels for Persian users */
|
||||||
export const homeNav: NavItem[] = [
|
export const homeNav: NavItem[] = [
|
||||||
{ label: "ارزشها", href: "/values" },
|
{ label: "ارزشها", href: "/values" },
|
||||||
{ label: "اساتید", href: "/faculty" },
|
{ label: "اساتید", href: "https://mst.aut.ac.ir/content/31094/شبکه-اساتید" },
|
||||||
{ label: "درباره ما", href: "/about" },
|
{ label: "درباره ما", href: "/about" },
|
||||||
{ label: "دورههای کوتاه", href: "/professional" },
|
{ label: "دورههای کوتاه", href: "/professional" },
|
||||||
{ label: "دورههای صنعتی", href: "/professional" },
|
{ label: "دورههای صنعتی", href: "/professional" },
|
||||||
|
{ label: "دانشگاه امیرکبیر", href: "https://mst.aut.ac.ir/", prominent: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const professionalNav: NavItem[] = [
|
export const professionalNav: NavItem[] = [
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function courseJsonLd(course: Course) {
|
|||||||
name: siteName,
|
name: siteName,
|
||||||
},
|
},
|
||||||
url: course.registrationUrl,
|
url: course.registrationUrl,
|
||||||
image: course.imageUrl,
|
image: course.posterImageUrl,
|
||||||
educationalCredentialAwarded: "گواهی دانشکده مدیریت علم و فناوری",
|
educationalCredentialAwarded: "گواهی دانشکده مدیریت علم و فناوری",
|
||||||
};
|
};
|
||||||
if (course.price != null && Number.isFinite(course.price) && course.price >= 0) {
|
if (course.price != null && Number.isFinite(course.price) && course.price >= 0) {
|
||||||
|
|||||||
@@ -23,10 +23,11 @@ export const siteAddress = {
|
|||||||
/** Main nav labels for Persian users */
|
/** Main nav labels for Persian users */
|
||||||
export const homeNav: NavItem[] = [
|
export const homeNav: NavItem[] = [
|
||||||
{ label: "ارزشها", href: "/values" },
|
{ label: "ارزشها", href: "/values" },
|
||||||
{ label: "اساتید", href: "/faculty" },
|
{ label: "اساتید", href: "https://mst.aut.ac.ir/content/31094/شبکه-اساتید" },
|
||||||
{ label: "درباره ما", href: "/about" },
|
{ label: "درباره ما", href: "/about" },
|
||||||
{ label: "دورههای کوتاه", href: "/professional" },
|
{ label: "دورههای کوتاه", href: "/professional" },
|
||||||
{ label: "دورههای صنعتی", href: "/professional" },
|
{ label: "دورههای صنعتی", href: "/professional" },
|
||||||
|
{ label: "دانشگاه امیرکبیر", href: "https://mst.aut.ac.ir/", prominent: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const professionalNav: NavItem[] = [
|
export const professionalNav: NavItem[] = [
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ export interface Course {
|
|||||||
/** Optional price in toman; omit/null = do not show price in UI */
|
/** Optional price in toman; omit/null = do not show price in UI */
|
||||||
price?: number | null;
|
price?: number | null;
|
||||||
registrationUrl: string;
|
registrationUrl: string;
|
||||||
imageUrl: string;
|
posterImageUrl: string;
|
||||||
|
brochureImageUrl: string;
|
||||||
seoDescription: string;
|
seoDescription: string;
|
||||||
|
/** Tags for filtering (e.g., "کارگاه", "دوره سازمانی", "گزیده") */
|
||||||
|
tags?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ProgramGroup = "standard" | "executive";
|
export type ProgramGroup = "standard" | "executive";
|
||||||
@@ -93,6 +96,7 @@ export interface NavItem {
|
|||||||
label: string;
|
label: string;
|
||||||
href: string;
|
href: string;
|
||||||
children?: NavItem[];
|
children?: NavItem[];
|
||||||
|
prominent?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FacultyMember {
|
export interface FacultyMember {
|
||||||
|
|||||||
@@ -36,7 +36,9 @@ const courseFields = {
|
|||||||
.union([z.number().int().nonnegative("قیمت نمیتواند منفی باشد"), z.null()])
|
.union([z.number().int().nonnegative("قیمت نمیتواند منفی باشد"), z.null()])
|
||||||
.optional(),
|
.optional(),
|
||||||
registrationUrl: urlOrPath,
|
registrationUrl: urlOrPath,
|
||||||
imageUrl: urlOrPath,
|
posterImageUrl: urlOrPath,
|
||||||
|
brochureImageUrl: urlOrPath,
|
||||||
|
tags: z.array(z.string()).default([]),
|
||||||
seoDescription: z.string(),
|
seoDescription: z.string(),
|
||||||
published: z.boolean(),
|
published: z.boolean(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user