26 lines
1.1 KiB
JavaScript
Executable File
26 lines
1.1 KiB
JavaScript
Executable File
import React, { useState } from "react";
|
|
import Dashboard from "./Components/Layout/Dashboard";
|
|
import LoginModal from "./Components/UI/LoginModal"; // Импортируем компонент авторизации
|
|
import "./Style/LoginModal.css"; // Импортируем стили
|
|
|
|
function App() {
|
|
const [isAuthenticated, setIsAuthenticated] = useState(false); // Состояние авторизации
|
|
const [showLoginModal, setShowLoginModal] = useState(true); // Показывать ли модальное окно
|
|
|
|
const handleLogin = () => {
|
|
setIsAuthenticated(true); // Устанавливаем авторизацию
|
|
setShowLoginModal(false); // Скрываем модальное окно
|
|
};
|
|
|
|
return (
|
|
<div style={{ display: "flex", height: "100vh", overflow: "hidden" }}>
|
|
{!isAuthenticated && showLoginModal && (
|
|
<LoginModal onLogin={handleLogin} onClose={() => setShowLoginModal(false)} />
|
|
)}
|
|
|
|
{isAuthenticated && <Dashboard />}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default App; |