'use client';

import { useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { useAuth } from '@/components/id/auth-provider';
import { getAdminLandingPath } from '@/lib/admin-access';

export default function AdminIndexPage() {
  const router = useRouter();
  const { user, isLoading } = useAuth();

  useEffect(() => {
    if (isLoading || !user) return;
    router.replace(getAdminLandingPath(user));
  }, [isLoading, router, user]);

  return (
    <div className="flex min-h-[40vh] items-center justify-center text-[#667085]">
      Перенаправление в админ-панель...
    </div>
  );
}
