'use client';
import { useEffect, useState } from 'react';
import { Dashboard } from '@/widgets/cabinet/ui/dashboard';
import { MOCK_USER } from '@/widgets/cabinet/lib/mock';

export default function Page() {
  const [userName, setUserName] = useState(MOCK_USER.first_name);

  useEffect(() => {
    const data = localStorage.getItem('user');
    if (data) {
      try {
        const user = JSON.parse(data);
        setUserName(user.name || MOCK_USER.first_name);
      } catch {
        // ignore
      }
    }
  }, []);

  return (
    <div className="max-w-6xl mx-auto w-full pt-20 px-4 pb-10">
      <Dashboard userName={userName} />
    </div>
  );
}
