Remove login page

It is not needed because it is useless in the public repository
(thx Nadezhda Fedorova)
This commit is contained in:
Alexander Burmatov 2024-05-23 01:16:48 +03:00 committed by Nadezhda Fedorova
parent 09ab4474e9
commit c645db4377
2 changed files with 9 additions and 70 deletions

View File

@ -1,11 +1,9 @@
import React, { useState } from 'react';
import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { isAuthenticated, isApiKeyEnabled } from 'utilities/authUtilities';
import { AuthWrapper } from 'utilities/AuthWrapper';
import { isApiKeyEnabled } from 'utilities/authUtilities';
import HomePage from './pages/HomePage';
import LoginPage from './pages/LoginPage';
import RepoPage from 'pages/RepoPage';
import TagPage from 'pages/TagPage';
import ExplorePage from 'pages/ExplorePage';
@ -14,13 +12,10 @@ import UserManagementPage from 'pages/UserManagementPage';
import './App.css';
function App() {
const [isLoggedIn, setIsLoggedIn] = useState(isAuthenticated());
return (
<div className="App" data-testid="app-container">
<Router>
<Routes>
<Route element={<AuthWrapper isLoggedIn={isLoggedIn} hasHeader redirect="/login" />}>
<Route path="/" element={<Navigate to="/home" />} />
<Route path="/home" element={<HomePage />} />
<Route path="/explore" element={<ExplorePage />} />
@ -28,11 +23,6 @@ function App() {
<Route path="/image/:reponame/tag/:tag" element={<TagPage />} />
{isApiKeyEnabled() && <Route path="/user/apikey" element={<UserManagementPage />} />}
<Route path="*" element={<Navigate to="/home" />} />
</Route>
<Route element={<AuthWrapper isLoggedIn={!isLoggedIn} redirect="/" />}>
<Route path="/login" element={<LoginPage isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} />} />
<Route path="*" element={<Navigate to="/login" />} />
</Route>
</Routes>
</Router>
</div>

View File

@ -1,51 +0,0 @@
// react global
import React from 'react';
// components
import SignIn from '../components/Login/SignIn';
import makeStyles from '@mui/styles/makeStyles';
import { Grid } from '@mui/material';
import SigninPresentation from 'components/Login/SignInPresentation';
import { useState } from 'react';
import Loading from 'components/Shared/Loading';
const useStyles = makeStyles(() => ({
container: {
minHeight: '100vh',
backgroundColor: '#F6F7F9'
},
signinContainer: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
},
loadingHidden: {
display: 'none'
}
}));
function LoginPage({ isLoggedIn, setIsLoggedIn }) {
const [isLoading, setIsLoading] = useState(true);
const classes = useStyles();
return (
<Grid container spacing={0} className={classes.container} data-testid="login-container">
{isLoading && <Loading />}
<Grid item xs={1} md={6} className={`${isLoading ? classes.loadingHidden : ''} hide-on-small`}>
<SigninPresentation />
</Grid>
<Grid
item
xs={12}
sm={12}
md={6}
className={`${classes.signinContainer} ${isLoading ? classes.loadingHidden : ''}`}
>
<SignIn isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} wrapperSetLoading={setIsLoading} />
</Grid>
</Grid>
);
}
export default LoginPage;