"use client";

import { useEffect } from "react";
import { useRouter } from "next/navigation";

// The marketing landing page (Hero + sections) is no longer used — opening the
// app should land directly on the dashboard. We keep the same auth check as the
// root page: send unauthenticated visitors to login, everyone else to the dashboard.
export default function page() {
  const router = useRouter();

  useEffect(() => {
    const hasToken = document.cookie.includes("accessToken");
    if (!hasToken) {
      window.location.href = "/login.html";
    } else {
      router.replace("/main/overview/dashboard");
    }
  }, [router]);

  return null;
}
