Remove login page
It is not needed because it is useless in the public repository (thx Nadezhda Fedorova)
This commit is contained in:
parent
09ab4474e9
commit
c645db4377
28
src/App.js
28
src/App.js
@ -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,25 +12,17 @@ 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 />} />
|
||||
<Route path="/image/:name" element={<RepoPage />} />
|
||||
<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>
|
||||
<Route path="/" element={<Navigate to="/home" />} />
|
||||
<Route path="/home" element={<HomePage />} />
|
||||
<Route path="/explore" element={<ExplorePage />} />
|
||||
<Route path="/image/:name" element={<RepoPage />} />
|
||||
<Route path="/image/:reponame/tag/:tag" element={<TagPage />} />
|
||||
{isApiKeyEnabled() && <Route path="/user/apikey" element={<UserManagementPage />} />}
|
||||
<Route path="*" element={<Navigate to="/home" />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</div>
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user