/**
 * Root locale route — redirects `/ru` → `/ru/onlineboard`.
 *
 * Matches Angular's app-routing.module.ts where any top-level request
 * resolves to the online-board start page. Using <Navigate> keeps the
 * redirect working under both SSR and CSR since react-router's
 * Navigate component renders during hydration too.
 */

import { Navigate, useParams } from "@modern-js/runtime/router";
import { normalizeLocaleParam, DEFAULT_LOCALE_CODE } from "@/i18n/resolver";

export default function LangRoot(): JSX.Element {
  const { lang } = useParams<{ lang: string }>();
  const locale = normalizeLocaleParam(lang) ?? DEFAULT_LOCALE_CODE;
  return <Navigate to={`/${locale}/onlineboard`} replace />;
}
