+
+ {/* Tombol Prev */}
- {Array.from({ length: categoryTotalPages }, (_, i) => (
-
- ))}
+ {(() => {
+ const maxVisible = 4;
+ let startPage = Math.max(
+ 1,
+ Math.min(
+ categoryPage - Math.floor(maxVisible / 2),
+ categoryTotalPages - maxVisible + 1
+ )
+ );
+ const endPage = Math.min(
+ categoryTotalPages,
+ startPage + maxVisible - 1
+ );
+ const visiblePages = [];
+ for (let i = startPage; i <= endPage; i++) {
+ visiblePages.push(i);
+ }
+
+ return visiblePages.map((pageNum) => (
+
+ ));
+ })()}
+
+ {/* Tombol Next */}
)
)}
diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx
index 28998ddd..741f68ab 100644
--- a/components/landing-page/navbar.tsx
+++ b/components/landing-page/navbar.tsx
@@ -99,7 +99,7 @@ const Navbar = () => {
? `/polda/${poldaName}`
: satkerName
? `/satker/${satkerName}`
- : "/";
+ : "";
let menu = "";
diff --git a/lib/menus.ts b/lib/menus.ts
index 47edd011..870ff19c 100644
--- a/lib/menus.ts
+++ b/lib/menus.ts
@@ -100,6 +100,13 @@ export function getMenuList(pathname: string, t: any): Group[] {
},
...(!hideForRole14
? [
+ // {
+ // href: "/contributor/content/satker",
+ // label: "satker",
+ // active: pathname.includes("/content/satker"),
+ // icon: "heroicons:credit-card",
+ // children: [],
+ // },
{
href: "/contributor/content/spit",
label: "spit",
@@ -4321,13 +4328,13 @@ export function getMenuList(pathname: string, t: any): Group[] {
icon: "heroicons:arrow-trending-up",
children: [],
},
- {
- href: "/admin/settings/banner",
- label: "Banner",
- active: pathname === "/admin/settings/banner",
- icon: "heroicons:arrow-trending-up",
- children: [],
- },
+ // {
+ // href: "/admin/settings/banner",
+ // label: "Banner",
+ // active: pathname === "/admin/settings/banner",
+ // icon: "heroicons:arrow-trending-up",
+ // children: [],
+ // },
// {
// href: "/admin/settings/feedback",
// label: "Feedback",
diff --git a/middleware.ts b/middleware.ts
index f8a2d2b1..d186fa40 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -1,29 +1,73 @@
import createMiddleware from "next-intl/middleware";
import { NextRequest, NextResponse } from "next/server";
-import { locales } from "@/config";
import { routing } from "./i18n/routing";
-// export default async function middleware(request: NextRequest) {
-// // Step 1: Use the incoming request (example)
-// const defaultLocale = "in";
-// // const defaultLocale = request.headers.get("dashcode-locale") || "in";
+const intlMiddleware = createMiddleware(routing);
-// // Step 2: Create and call the next-intl middleware (example)
-// const handleI18nRouting = createMiddleware({
-// locales: ["in", "en"],
-// defaultLocale: "in",
-// });
-// const response = handleI18nRouting(request);
+export default function middleware(request: NextRequest) {
+ const { pathname } = request.nextUrl;
-// // Step 3: Alter the response (example)
-// response.headers.set("dashcode-locale", defaultLocale);
+ // --- IGNORE STATIC ASSET ---
+ const isStaticAsset =
+ pathname.startsWith("/api") ||
+ pathname.startsWith("/_next") ||
+ pathname.startsWith("/favicon") ||
+ pathname.startsWith("/assets") ||
+ pathname.startsWith("/static") ||
+ pathname.match(/\.(png|jpg|jpeg|gif|webp|svg|ico|css|js)$/);
-// return response;
-// }
+ if (isStaticAsset) return NextResponse.next();
-export default createMiddleware(routing);
+ // --- LOCALES YANG VALID ---
+ const locales = ["in", "en"];
+ // Ambil locale utama dari URL
+ const firstSegment = pathname.split("/")[1];
+
+ const isLocaleURL = locales.includes(firstSegment);
+
+ // Jika URL sudah mengandung locale → JALANKAN next-intl
+ if (isLocaleURL) {
+ return intlMiddleware(request);
+ }
+
+ // Jika URL TIDAK ada locale → redirect ke /in/
+ const url = request.nextUrl.clone();
+ url.pathname = `/in${pathname}`;
+ return NextResponse.redirect(url);
+}
+
+// Matcher untuk semua route kecuali static files
export const config = {
- // Match only internationalized pathnames
- matcher: ["/", "/(in|en)/:path*"],
+ matcher: ["/((?!_next|api|favicon.ico|assets|static).*)"],
};
+
+// import createMiddleware from "next-intl/middleware";
+// import { NextRequest, NextResponse } from "next/server";
+// import { locales } from "@/config";
+// import { routing } from "./i18n/routing";
+
+// // export default async function middleware(request: NextRequest) {
+// // // Step 1: Use the incoming request (example)
+// // const defaultLocale = "in";
+// // // const defaultLocale = request.headers.get("dashcode-locale") || "in";
+
+// // // Step 2: Create and call the next-intl middleware (example)
+// // const handleI18nRouting = createMiddleware({
+// // locales: ["in", "en"],
+// // defaultLocale: "in",
+// // });
+// // const response = handleI18nRouting(request);
+
+// // // Step 3: Alter the response (example)
+// // response.headers.set("dashcode-locale", defaultLocale);
+
+// // return response;
+// // }
+
+// export default createMiddleware(routing);
+
+// export const config = {
+// // Match only internationalized pathnames
+// matcher: ["/", "/(in|en)/:path*"],
+// };
diff --git a/service/content/content.ts b/service/content/content.ts
index 144748b5..67b33052 100644
--- a/service/content/content.ts
+++ b/service/content/content.ts
@@ -46,6 +46,39 @@ export async function listDataAll(
);
}
+export async function listDataSatker(
+ isForSelf: any,
+ isApproval: any,
+ page: any,
+ limit: any,
+ search: any,
+ typeId: any,
+ statusFilter: any,
+ needApprovalFromLevel: any,
+ creator: any,
+ source: any,
+ startDate: any,
+ endDate: any,
+ title: string = ""
+) {
+ return await httpGetInterceptor(
+ `media/list?enablePage=1&sortBy=createdAt&sort=desc&isAllSatker=true` +
+ `&size=${limit}` +
+ `&page=${page}` +
+ `&isForSelf=${isForSelf}` +
+ `&isApproval=${isApproval}` +
+ `&typeId=${typeId || ""}` +
+ `&statusId=${statusFilter || ""}` +
+ `&needApprovalFromLevel=${needApprovalFromLevel || ""}` +
+ `&creator=${encodeURIComponent(creator || "")}` +
+ `&source=${encodeURIComponent(source || "")}` +
+ `&startDate=${startDate || ""}` +
+ `&endDate=${endDate || ""}` +
+ `&title=${encodeURIComponent(title || search || "")}`
+ );
+}
+
+
export async function listDataImage(
size: any = "",
page: any = "",