Enhance course management by adding 'featured' and 'sort_order' fields to the database schema and related components. Update course filtering and display logic to prioritize featured courses in the catalog. Modify admin interfaces for course creation and editing to include new fields, ensuring proper handling in both the frontend and backend. Update documentation to reflect these changes.
This commit is contained in:
1 parent
1641edfd01
commit
4b84409ed7
43 files changed
+703
-155
No files matched your search
@@ -47,6 +47,8 @@ const COURSE_COLUMNS: Record<string, string> = {
|
||||
bodyHtml: "body_html",
|
||||
seoDescription: "seo_description",
|
||||
published: "published",
|
||||
featured: "featured",
|
||||
sortOrder: "sort_order",
|
||||
};
|
||||
|
||||
// PATCH /api/admin/courses/[id] — update course (admin only)
|
||||
|
||||
@@ -65,8 +65,8 @@ export async function POST(request: NextRequest) {
|
||||
`INSERT INTO courses
|
||||
(id, slug, title, summary, duration_hours, format, price,
|
||||
registration_url, poster_image_url, brochure_image_url, image_url,
|
||||
lead_html, body_html, seo_description, published)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15)`,
|
||||
lead_html, body_html, seo_description, published, featured, sort_order)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17)`,
|
||||
[
|
||||
id,
|
||||
d.slug,
|
||||
@@ -83,6 +83,8 @@ export async function POST(request: NextRequest) {
|
||||
d.bodyHtml,
|
||||
d.seoDescription,
|
||||
d.published,
|
||||
d.featured,
|
||||
d.sortOrder,
|
||||
],
|
||||
);
|
||||
await setCourseCategories(id, d.categoryIds ?? []);
|
||||
|
||||
@@ -2,6 +2,8 @@ import type { Metadata, Viewport } from "next";
|
||||
import { Vazirmatn } from "next/font/google";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
import { getLocale, getMessages, getTranslations } from "next-intl/server";
|
||||
import { Suspense } from "react";
|
||||
import { GlobalActionLoadingOverlay } from "@/components/molecules/GlobalActionLoadingOverlay";
|
||||
import { getSiteOrigin } from "@/lib/seo/metadata";
|
||||
import { JsonLd, organizationJsonLd } from "@/lib/seo/json-ld";
|
||||
import "./globals.css";
|
||||
@@ -78,6 +80,9 @@ export default async function RootLayout({
|
||||
className={`${vazirmatn.className} flex min-h-full min-w-0 flex-col font-sans`}
|
||||
>
|
||||
<NextIntlClientProvider messages={messages}>
|
||||
<Suspense fallback={null}>
|
||||
<GlobalActionLoadingOverlay />
|
||||
</Suspense>
|
||||
<a
|
||||
href="#main-content"
|
||||
className="sr-only focus:not-sr-only focus:absolute focus:start-4 focus:top-4 focus:z-[100] focus:bg-card focus:px-3 focus:py-2"
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import { useState, FormEvent, Suspense } from "react";
|
||||
import Image from "next/image";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { useAppRouter } from "@/hooks/use-app-router";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
@@ -17,7 +18,7 @@ import {
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
function LoginForm() {
|
||||
const router = useRouter();
|
||||
const router = useAppRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const redirect = searchParams.get("redirect") || "/mstcontroller";
|
||||
|
||||
|
||||
Reference in new issue
Block a user