import { useEffect } from "react";
import { redirect, useNavigate } from "@modern-js/runtime/router";

const DEFAULT_LANG = "ru";

/**
 * Root `/` route — redirects to `/{defaultLang}/onlineboard` to match
 * the Angular app's default routing behavior.
 */
export const loader = () => redirect(`/${DEFAULT_LANG}/onlineboard`);

export default function Home() {
  const navigate = useNavigate();

  // Client-side fallback redirect in case the loader redirect doesn't fire
  useEffect(() => {
    void navigate(`/${DEFAULT_LANG}/onlineboard`, { replace: true });
  }, [navigate]);

  return null;
}
