Introduced NotificationProviderWrapper to dynamically load the notification context only on dashboard pages, reducing initial bundle size. KeepOnline component is now also lazy-loaded. Updated app layout to use the new wrapper.
22 lines
563 B
TypeScript
22 lines
563 B
TypeScript
"use client";
|
|
|
|
import { usePathname } from "next/navigation";
|
|
import dynamic from "next/dynamic";
|
|
|
|
// Lazy load KeepOnline component - only needed on dashboard pages
|
|
const KeepOnline = dynamic(() => import("@/components/KeepOnline"), {
|
|
ssr: false,
|
|
});
|
|
|
|
const KeepOnlineWrapper = () => {
|
|
const pathname = usePathname();
|
|
|
|
// Don't show KeepOnline on admin pages or non-dashboard pages
|
|
if (!pathname?.includes("/dashboard") || pathname?.includes("/dashboard/admin")) {
|
|
return null;
|
|
}
|
|
|
|
return <KeepOnline />;
|
|
};
|
|
|
|
export default KeepOnlineWrapper;
|