import React from 'react';
import { ConfigProvider, theme } from 'antd';
import { useStore } from './store';
import { LoginPage } from './pages/LoginPage';
import { MainLayout } from './components/Layout/MainLayout';

const App: React.FC = () => {
  const token = useStore((s) => s.token);

  return (
    <ConfigProvider
      theme={{
        algorithm: theme.defaultAlgorithm,
        token: {
          colorPrimary: '#1677ff',
          borderRadius: 6,
        },
      }}
    >
      {token ? <MainLayout /> : <LoginPage />}
    </ConfigProvider>
  );
};

export default App;
