Add access-denied pages and improve admin states

Add dedicated 403 pages for the app and admin area, enable Next.js forbidden handling, and improve admin loading, navigation, and error-boundary experiences.
This commit is contained in:
Ichsan Kurniawan
2026-11-07 20:27:39 +07:00
parent 7f8e6637e4
commit 8478b1f28f
11 changed files with 456 additions and 75 deletions
+1
View File
@@ -16,6 +16,7 @@ const SEGMENT_LABELS: Record<string, string> = {
'user': 'User',
'division': 'Division',
'area': 'Area',
'forbidden': 'Access Restricted',
};
export default function AdminBreadcrumb() {
+3 -2
View File
@@ -3,7 +3,7 @@
import dynamic from 'next/dynamic';
import { FC, FormEvent, useEffect, useRef, useState } from 'react';
import { ArrowBigLeft } from 'lucide-react'
import SIDEBAR_MENU from '@/lib/data-sidebar';
// import SIDEBAR_MENU from '@/lib/data-sidebar';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
import { ISideMenu } from './SidebarItem';
@@ -12,10 +12,11 @@ import Notification from './Notification';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { UserNav } from '@/app/(dashboard)/components/UserNav';
import { Skeleton } from '@/components/ui/skeleton';
const SidebarItem = dynamic(() => import("./SidebarItem"), {
loading: () => <p className='text-zinc-200 dark:text-zinc-800 mb-3 animate-pulse'>loading...</p>,
loading: () => <Skeleton className='w-full h-7 2xl:h-8 mx-6 mb-5' />,
ssr: false
})
+1 -3
View File
@@ -43,9 +43,7 @@ const SidebarItem: FC<Props> = ({ menu, expand, onChangeExpand }) => {
const getActiveBackgroundMenu = () => {
const currentPath = pathanme || '';
const fullPath = '/admin' + (menu.path || '');
const isActive = menu.path === ''
? currentPath === '/admin' || currentPath === '/admin/'
: currentPath === fullPath || (menu.path && currentPath.startsWith(fullPath + '/'));
const isActive = menu.path === '' ? currentPath === '/admin' || currentPath === '/admin/' : currentPath === fullPath || (menu.path && currentPath.startsWith(fullPath + '/'));
if (isActive) {
return {
+2
View File
@@ -0,0 +1,2 @@
export { default, metadata } from './forbidden/page';
+100
View File
@@ -0,0 +1,100 @@
import { Metadata } from 'next';
import Link from 'next/link';
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { LayoutDashboard, Home, ShieldAlert, KeyRound, ArrowLeft } from 'lucide-react';
export const metadata: Metadata = {
title: 'Access Restricted | Admin',
description: 'You do not have permission to access this administrative page.',
};
export default function AdminForbiddenPage() {
return (
<div className="flex flex-col w-full max-w-4xl mx-auto py-2 sm:py-6">
<Card className="border-zinc-200/90 dark:border-zinc-800/90 shadow-sm overflow-hidden">
<CardHeader className="flex flex-col sm:flex-row items-start sm:items-center gap-4 pb-4 border-b border-zinc-100 dark:border-zinc-800/80">
{/* Security Icon Badge */}
<div className="w-12 h-12 rounded-xl bg-rose-500/10 text-rose-600 border border-rose-500/20 dark:bg-rose-500/20 dark:text-rose-400 flex items-center justify-center shrink-0">
<i className="ti ti-shield-lock text-2xl" />
</div>
<div className="space-y-1 flex-1">
<div className="flex items-center gap-2 flex-wrap">
<CardTitle className="text-xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50">
Access Restricted
</CardTitle>
<span className="inline-flex items-center px-2 py-0.5 rounded text-[11px] font-mono font-medium bg-rose-500/10 text-rose-600 border border-rose-500/20 dark:bg-rose-500/20 dark:text-rose-400">
HTTP 403
</span>
</div>
<CardDescription className="text-zinc-600 dark:text-zinc-400 text-sm">
Your account does not have sufficient role permissions to view or manage this administrative resource.
</CardDescription>
</div>
</CardHeader>
<CardContent className="space-y-6 pt-6">
{/* Explanation Box */}
<div className="p-4 rounded-lg bg-zinc-50 dark:bg-zinc-900/60 border border-zinc-200/80 dark:border-zinc-800 space-y-3">
<div className="flex items-center gap-2 text-zinc-800 dark:text-zinc-200 text-sm font-semibold">
<ShieldAlert size={16} className="text-rose-500 shrink-0" />
<span>Why am I seeing this page?</span>
</div>
<p className="text-xs sm:text-sm text-zinc-600 dark:text-zinc-400 leading-relaxed">
Access to this section is protected by Role-Based Access Control (RBAC). Your assigned user role has not been granted the necessary permissions for this menu action or route.
</p>
<div className="pt-2 flex flex-wrap gap-2 text-xs">
<div className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-white dark:bg-zinc-950 border border-zinc-200 dark:border-zinc-800 text-zinc-700 dark:text-zinc-300 font-mono text-[11px]">
<KeyRound size={12} className="text-his" />
<span>Policy: Role Permission Required</span>
</div>
<div className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-white dark:bg-zinc-950 border border-zinc-200 dark:border-zinc-800 text-zinc-700 dark:text-zinc-300 font-mono text-[11px]">
<span>Area: Admin Panel</span>
</div>
</div>
</div>
{/* How to Resolve */}
<div className="space-y-2 text-xs text-muted-foreground leading-relaxed">
<p className="font-medium text-zinc-700 dark:text-zinc-300">
Need access to this resource?
</p>
<p>
Please contact HATs system administrator, Manager or Team Leader to request the relevant permission assignment for your account role.
</p>
</div>
{/* Action Buttons */}
<div className="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3 pt-2">
<div className="flex items-center gap-2.5 flex-wrap">
<Link href="/admin">
<Button className="bg-his hover:bg-his/90 text-white font-medium inline-flex items-center gap-2 shadow-sm">
<LayoutDashboard size={15} />
Back to Admin Dashboard
</Button>
</Link>
<Link href="/">
<Button variant="outline" className="inline-flex items-center gap-2 font-medium">
<Home size={15} />
Homepage
</Button>
</Link>
</div>
<Link href="/auth" className="self-center sm:self-auto">
<Button variant="ghost" size="sm" className="text-xs text-muted-foreground inline-flex items-center gap-1.5">
<ArrowLeft size={13} />
Switch Account
</Button>
</Link>
</div>
</CardContent>
</Card>
</div>
);
}
+4 -2
View File
@@ -67,18 +67,20 @@ export default async function AdminLayout({ children }: { children: React.ReactN
children.sort(sortByOrder)
return {
title: parent.menu?.name!,
Icon: <i className={`${parent.menu?.icon} text-base`}></i>,
Icon: parent.menu?.icon ? <i className={`${parent.menu.icon} text-base`}></i> : undefined,
path: cleanPath(parent.menu?.path_url!),
submenuId: parent.menu?.id,
submenuItems: children.map((child) => ({
title: child.menu?.name,
path: cleanPath(child.menu?.path_url!),
Icon: child.menu?.icon ? <i className={`${child.menu.icon} text-base`}></i> : undefined,
})),
}
}
return {
title: parent.menu?.name!,
Icon: <i className={`${parent.menu?.icon} text-base`}></i>,
Icon: parent.menu?.icon ? <i className={`${parent.menu.icon} text-base`}></i> : undefined,
path: cleanPath(parent.menu?.path_url!),
}
})
+88 -14
View File
@@ -1,19 +1,93 @@
import SkeletonTable from "@/components/skeleton/SkeletonTable"
import { Skeleton } from "@/components/ui/skeleton"
import { FC } from 'react';
import { Card, CardContent, CardHeader } from '@/components/ui/card';
export default function Loading() {
export default function AdminLoading() {
return (
<div className="flex flex-col w-full">
<div className="bg-white dark:bg-zinc-950 p-6 rounded-2xl shadow">
<div className="flex justify-between items-center w-full">
<div className="flex flex-col space-y-4 w-full">
<Card className="border-zinc-200/90 dark:border-zinc-800/90">
{/* Header Skeleton */}
<CardHeader className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 pb-4">
<div className="space-y-2">
<Skeleton className="h-8 w-40" />
<Skeleton className="h-6 w-96" />
{/* Title skeleton */}
<div className="h-7 w-44 rounded-md bg-zinc-200 dark:bg-zinc-800 animate-pulse" />
{/* Description skeleton */}
<div className="h-4 w-72 max-w-full rounded-md bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
</div>
<Skeleton className="h-10 w-36 rounded-2xl" />
</div>
<SkeletonTable />
</div>
{/* Action button skeleton */}
<div className="h-9 w-32 rounded-lg bg-zinc-200/80 dark:bg-zinc-800 animate-pulse shrink-0" />
</CardHeader>
<CardContent className="space-y-4">
{/* Search & Filter Toolbar Skeleton */}
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3">
<div className="h-8 w-full sm:w-64 rounded-md bg-zinc-100 dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 animate-pulse" />
<div className="flex items-center gap-2 self-end sm:self-auto">
<div className="h-8 w-24 rounded-md bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
</div>
</div>
{/* Table Skeleton */}
<div className="w-full rounded-lg border border-zinc-200/80 dark:border-zinc-800/80 overflow-hidden">
{/* Table Header Row */}
<div className="h-10 bg-zinc-50 dark:bg-zinc-900/90 border-b border-zinc-200 dark:border-zinc-800 flex items-center px-4 gap-4">
<div className="h-3.5 w-8 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse" />
<div className="h-3.5 w-32 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse" />
<div className="h-3.5 w-24 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse hidden md:block" />
<div className="h-3.5 w-48 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse flex-1" />
<div className="h-3.5 w-16 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse ml-auto" />
</div>
{/* Table Body Rows */}
<div className="divide-y divide-zinc-200/70 dark:divide-zinc-800/70 bg-white dark:bg-zinc-950">
{[1, 2, 3, 4, 5, 6].map((i) => (
<div
key={i}
className="h-14 flex items-center px-4 gap-4 transition-colors"
>
{/* Num / Index */}
<div className="h-3 w-6 rounded bg-zinc-200/70 dark:bg-zinc-800/70 animate-pulse" />
{/* Primary title + subtitle */}
<div className="space-y-1.5 flex-1 sm:flex-initial sm:w-48">
<div
className="h-3.5 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse"
style={{ width: `${65 + (i * 7) % 30}%` }}
/>
<div className="h-2.5 w-24 rounded bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
</div>
{/* Badge / Type */}
<div className="hidden md:block w-24">
<div className="h-5 w-20 rounded-full bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
</div>
{/* Secondary detail / Description */}
<div className="hidden lg:block flex-1">
<div
className="h-3 rounded bg-zinc-100 dark:bg-zinc-850 animate-pulse"
style={{ width: `${50 + (i * 11) % 40}%` }}
/>
</div>
{/* Action button */}
<div className="h-8 w-8 rounded-md bg-zinc-100 dark:bg-zinc-850 animate-pulse ml-auto" />
</div>
))}
</div>
</div>
{/* Pagination Footer Skeleton */}
<div className="flex items-center justify-between pt-2">
<div className="h-4 w-40 rounded bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
<div className="flex items-center gap-1.5">
<div className="h-7 w-7 rounded bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
<div className="h-7 w-7 rounded bg-zinc-200 dark:bg-zinc-800 animate-pulse" />
<div className="h-7 w-7 rounded bg-zinc-100 dark:bg-zinc-850 animate-pulse" />
</div>
</div>
</CardContent>
</Card>
</div>
)
}
);
}
+153 -30
View File
@@ -1,37 +1,160 @@
'use client'
'use client';
import { useEffect } from "react"
import Image from "next/image"
import Link from "next/link"
import { Button } from "@/components/ui/button"
import { clientLogger } from "@/lib/logger-client"
import { useEffect, useState } from 'react';
import Link from 'next/link';
import { motion } from 'framer-motion';
import { Button } from '@/components/ui/button';
import { clientLogger } from '@/lib/logger-client';
import { RotateCcw, Home, LayoutDashboard, Copy, Check, ChevronDown, ChevronUp, ArrowLeft, AlertTriangle } from 'lucide-react';
export default function Error({
error,
reset,
}: {
error: Error
reset: () => void
}) {
interface ErrorProps {
error: Error & { digest?: string };
reset: () => void;
}
export default function RootError({ error, reset }: ErrorProps) {
const [showStack, setShowStack] = useState(false);
const [copied, setCopied] = useState(false);
useEffect(() => {
console.log({ name: error.name, cause: error.cause, message: error.message, stack: error.stack })
clientLogger.error(error.stack!)
}, [error])
console.error('Root Application Error Boundary caught:', error);
if (error.stack) {
clientLogger.error(error.stack);
}
}, [error]);
const handleCopyDigest = async () => {
if (!error.digest) return;
try {
await navigator.clipboard.writeText(error.digest);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch {
// ignore clipboard errors
}
};
return (
<>
<div className="h-[90vh] flex flex-col justify-center items-center overflow-x-hidden overflow-y-auto py-5">
<Image alt='ilustrations' height={0} width={0} quality={70} src='/assets/illustrations/maintenance.svg' className='w-80 md:w-md 2xl:w-160 shadow-sm rounded-full object-cover' />
<h2 className="text-xl sm:text-2xl font-semibold tracking-tight text-center">Oopps.. something went wrong!</h2>
<span className="text-center mt-1 mb-6 text-zinc-600 dark:text-zinc-400 md:w-9/12 break-all px-2 sm:px-0">{error.message || 'Sorry, system error has occurred'}</span>
<div className="flex items-center space-x-2">
<Button onClick={() => window.location.reload()} variant='secondary' className="w-28">Try Again</Button>
<Link href='/auth'>
<Button variant='outline' className="w-28">Login</Button>
</Link>
<div className="min-h-screen flex flex-col items-center justify-center p-4 sm:p-6 bg-soft dark:bg-zinc-950">
<motion.div
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.35, ease: 'easeOut' }}
className="w-full max-w-xl"
>
{/* Elevated Error Card */}
<div className="bg-white dark:bg-zinc-900 border border-zinc-200/90 dark:border-zinc-800 rounded-2xl p-6 sm:p-8 shadow-sm">
{/* Header with Crafted Warning Beacon */}
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-4 mb-6">
<div className="relative shrink-0">
<motion.div
animate={{ scale: [1, 1.06, 1] }}
transition={{ duration: 3, repeat: Infinity, ease: 'easeInOut' }}
className="w-14 h-14 rounded-2xl bg-his/10 text-his border border-his/20 dark:bg-his/20 dark:border-his/30 flex items-center justify-center shadow-xs"
>
<AlertTriangle className="w-7 h-7" />
</motion.div>
<span className="absolute -bottom-1.5 -right-1.5 px-1.5 py-0.5 rounded-full text-[10px] font-mono font-bold bg-rose-500 text-white shadow-xs">
500
</span>
</div>
<div className="space-y-1">
<div className="flex items-center gap-2 flex-wrap">
<h1 className="text-xl sm:text-2xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50">
Unexpected Application Error
</h1>
</div>
<p className="text-sm text-zinc-600 dark:text-zinc-400 leading-relaxed">
We encountered an issue while processing your request. The system has automatically recorded the incident.
</p>
</div>
</div>
{/* Error Summary Box */}
<div className="p-4 rounded-xl bg-zinc-50 dark:bg-zinc-950/70 border border-zinc-200/80 dark:border-zinc-800 space-y-3 mb-6">
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 text-xs">
<span className="font-semibold text-zinc-700 dark:text-zinc-300 uppercase tracking-wider">
Error Summary
</span>
{error.digest && (
<button
type="button"
onClick={handleCopyDigest}
className="inline-flex items-center gap-1.5 font-mono text-muted-foreground hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors cursor-pointer"
title="Copy Error ID"
>
<span>Error ID: {error.digest}</span>
{copied ? <Check size={12} className="text-emerald-500" /> : <Copy size={12} />}
</button>
)}
</div>
<p className="text-xs sm:text-sm font-mono text-zinc-800 dark:text-zinc-200 break-all leading-relaxed">
{error.message || 'An unexpected runtime error occurred.'}
</p>
</div>
{/* Developer Stack Trace Accordion */}
{error.stack && (
<div className="border border-zinc-200/80 dark:border-zinc-800 rounded-xl overflow-hidden mb-6">
<button
type="button"
onClick={() => setShowStack(!showStack)}
className="w-full px-4 py-2.5 flex items-center justify-between bg-zinc-50/70 dark:bg-zinc-950/40 hover:bg-zinc-100/70 dark:hover:bg-zinc-950/80 text-xs font-medium text-muted-foreground transition-colors cursor-pointer"
>
<span>Diagnostics & Stack Trace</span>
{showStack ? <ChevronUp size={14} /> : <ChevronDown size={14} />}
</button>
{showStack && (
<div className="p-4 bg-zinc-950 text-zinc-300 overflow-x-auto max-h-60 text-xs font-mono border-t border-zinc-200 dark:border-zinc-800">
<pre className="whitespace-pre-wrap leading-relaxed">{error.stack}</pre>
</div>
)}
</div>
)}
{/* Primary & Secondary Action Controls */}
<div className="flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-3 pt-2">
<div className="flex items-center gap-2.5 flex-wrap">
<Button
onClick={() => reset()}
className="bg-his hover:bg-his/90 text-white font-medium inline-flex items-center justify-center gap-2 shadow-sm"
>
<RotateCcw size={15} />
Try Again
</Button>
<Link href="/">
<Button variant="outline" className="inline-flex items-center justify-center gap-2 font-medium">
<Home size={15} />
Homepage
</Button>
</Link>
<Button
variant="ghost"
onClick={() => window.location.reload()}
className="text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100"
>
Reload
</Button>
</div>
<Link href="/auth" className="self-center sm:self-auto">
<Button variant="ghost" size="sm" className="text-xs text-muted-foreground inline-flex items-center gap-1.5">
<ArrowLeft size={13} />
Login Page
</Button>
</Link>
</div>
</div>
</div>
</>
)
}
{/* Footer Brand Note */}
<p className="text-center text-xs text-zinc-400 dark:text-zinc-500 mt-6 font-medium">
H.A.T.s • HIS Attendance Task System
</p>
</motion.div>
</div>
);
}
+2
View File
@@ -0,0 +1,2 @@
export { default, metadata } from './forbidden/page';
+75
View File
@@ -0,0 +1,75 @@
import { Metadata } from 'next';
import Link from 'next/link';
import { Button } from '@/components/ui/button';
import { Home, LayoutDashboard, ArrowLeft, ShieldX, Lock } from 'lucide-react';
export const metadata: Metadata = {
title: '403 Forbidden | H.A.T.s',
description: 'You do not have permission to access this page.',
};
export default function ForbiddenPage() {
return (
<div className="min-h-screen flex flex-col items-center justify-center px-4 py-12">
<div className="w-full max-w-md text-center">
{/* Security Emblem */}
<div className="relative inline-flex items-center justify-center mb-6">
<div className="w-16 h-16 rounded-2xl bg-his/10 text-his border border-his/20 dark:bg-his/20 dark:border-his/30 flex items-center justify-center shadow-xs">
<i className="ti ti-shield-lock text-3xl" />
</div>
<span className="absolute -bottom-2 px-2 py-0.5 rounded-full text-[10px] font-mono font-bold bg-rose-500 text-white shadow-xs">
403
</span>
</div>
{/* Status & Title */}
<h1 className="text-2xl sm:text-3xl font-bold tracking-tight text-zinc-900 dark:text-zinc-50 mb-2">
Access Restricted
</h1>
<p className="text-sm text-zinc-600 dark:text-zinc-400 mb-6 leading-relaxed">
You do not have permission to view or manage this resource. This may be due to role restrictions or an unassigned permission set.
</p>
{/* Info Card */}
<div className="p-4 rounded-xl bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 text-left space-y-2 mb-8 shadow-xs">
<div className="flex items-center gap-2 text-xs font-semibold text-zinc-800 dark:text-zinc-200 uppercase tracking-wider">
<Lock size={13} className="text-his shrink-0" />
<span>Permission Required</span>
</div>
<p className="text-xs text-muted-foreground leading-relaxed">
If you need access to this feature, please contact HATs system administrator, Manager or Team Leader to request role privileges.
</p>
</div>
{/* Actions */}
<div className="flex flex-col sm:flex-row items-center justify-center gap-3">
<Link href="/" className="w-full sm:w-auto">
<Button className="w-full sm:w-auto bg-his hover:bg-his/90 text-white font-medium inline-flex items-center justify-center gap-2 shadow-sm">
<Home size={15} />
Return to Homepage
</Button>
</Link>
<Link href="/admin" className="w-full sm:w-auto">
<Button variant="outline" className="w-full sm:w-auto inline-flex items-center justify-center gap-2 font-medium">
<LayoutDashboard size={15} />
Admin Panel
</Button>
</Link>
</div>
{/* Switch Account Option */}
<div className="mt-6 pt-4 border-t border-zinc-200/60 dark:border-zinc-800/60">
<Link
href="/auth"
className="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors font-medium"
>
<ArrowLeft size={13} />
Sign in with a different account
</Link>
</div>
</div>
</div>
);
}
+27 -24
View File
@@ -1,30 +1,33 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
basePath: process.env.BASE_PATH ?? '',
env: {
'BASE_PATH': process.env.BASE_PATH ?? '',
'BASE_URL_API': process.env.BASE_URL_API,
'BASE_URL_IMG': process.env.BASE_URL_IMG,
'FIREBASE_API_KEY': process.env.FIREBASE_API_KEY,
'FIREBASE_APP_ID': process.env.FIREBASE_APP_ID,
'DEVICE_CODE': process.env.DEVICE_CODE,
},
images: {
// unoptimized: true, // <--- ADD THIS LINE
remotePatterns: [
new URL('https://36.66.3.44/**'),
new URL('https://his.nutech-integrasi.com/**'),
new URL('https://hats.hisnutech.my.id/**'),
new URL('https://api-hats.hisnutech.my.id/**'),
{ protocol: 'https', hostname: 'avatars.githubusercontent.com', pathname: '/u/**/*' },
{ protocol: 'https', hostname: 'lh3.googleusercontent.com', pathname: '/a/**/*' }
],
qualities: [50, 65, 70, 75, 80, 85, 90, 100],
},
reactCompiler: true,
reactStrictMode: false
/* config options here */
basePath: process.env.BASE_PATH ?? '',
env: {
'BASE_PATH': process.env.BASE_PATH ?? '',
'BASE_URL_API': process.env.BASE_URL_API,
'BASE_URL_IMG': process.env.BASE_URL_IMG,
'FIREBASE_API_KEY': process.env.FIREBASE_API_KEY,
'FIREBASE_APP_ID': process.env.FIREBASE_APP_ID,
'DEVICE_CODE': process.env.DEVICE_CODE,
},
images: {
// unoptimized: true, // <--- ADD THIS LINE
remotePatterns: [
new URL('https://36.66.3.44/**'),
new URL('https://his.nutech-integrasi.com/**'),
new URL('https://hats.hisnutech.my.id/**'),
new URL('https://api-hats.hisnutech.my.id/**'),
{ protocol: 'https', hostname: 'avatars.githubusercontent.com', pathname: '/u/**/*' },
{ protocol: 'https', hostname: 'lh3.googleusercontent.com', pathname: '/a/**/*' }
],
qualities: [50, 65, 70, 75, 80, 85, 90, 100],
},
reactCompiler: true,
reactStrictMode: false,
experimental: {
authInterrupts: true, // for forbidden page
},
};
export default nextConfig;