"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; 