Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
/yarn.lock
.eslintcache

# testing
/coverage
Expand Down
6,395 changes: 5,155 additions & 1,240 deletions client/package-lock.json

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
"dependencies": {
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"@reduxjs/toolkit": "^1.6.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"formik": "^2.2.6",
"notistack": "^1.0.6",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-redux": "^7.2.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4",
"formik": "^2.2.6",
"notistack": "^1.0.6"
"web-vitals": "^0.2.4"
},
"devDependencies": {
"@types/material-ui": "^0.21.8",
Expand Down Expand Up @@ -63,4 +65,4 @@
"last 1 safari version"
]
}
}
}
98 changes: 0 additions & 98 deletions client/src/App.js

This file was deleted.

97 changes: 97 additions & 0 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import React, { useState, useEffect, Suspense, lazy } from 'react';
import './App.css';
import axios from 'axios';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
// import Authentication from './components/authentication';
// import MainAppBar from './components/mainAppBar';
import { useAppSelector } from './redux/store';
import {
Box, LinearProgress,
createStyles, makeStyles,
Theme
} from '@material-ui/core';

const QuestionBox = lazy(() => import('./components/QuestionBox'));
const QuesstionList = lazy(() => import('./components/QuestionList'));

const SignUp = lazy(() => import('./screens/SignUp'));
const SignIn = lazy(() => import('./screens/SignIn'));
// const AnswerScreen = lazy(() => import('./screens/AnswerScreen'));
// const Find = lazy(() => import('./screens/find'));

const useStyles = makeStyles((theme) =>
createStyles({
toolbar: theme.mixins.toolbar,
BackgroundDark: {
// background: '#121212'
background: '#0b0f13'
},
BackgroundLight: {
background: '#fafafa'
}
})
);

const App = () => {
const classes = useStyles();

// prop drilling
const [authStatus, setAuthStatus] = useState(false);
const [profileImage, setProfileImage] = useState(null);
const [username, setUsername] = useState(null);
const darkTheme = useAppSelector(state => state.ui.darkTheme);

// whenever anything happens in the "App", useEffect is triggered.

useEffect(() => {
axios
.get('/isLoggedIn')
.then((response) => {
setAuthStatus(response.data.authStatus);
setProfileImage(response.data.profileImage);
setUsername(response.data.username);
})
.catch((error) => {
console.log(error);
});
});

return (
<Router>
{/* <Route path='/' component={Authentication} /> */}
<Box display="flex" flexGrow={1} className={darkTheme ? classes.BackgroundDark : classes.BackgroundLight}>
<Box className={classes.toolbar} display="flex" flexDirection="column" flexGrow={1}>
{/* <Route path='/' component={MainAppBar} /> */}
{/* <Route path='/' component={Background} /> */}
<Suspense fallback={<LinearProgress />}>
<Switch>
<Route path="/signin">
<SignIn />
</Route>

<Route path="/signup">
<SignUp />
</Route>
{/* App Routes */}
{/* <Route path="/questions/:id" render={(children) => (
<AnswerScreen authStatus={authStatus} profileImage={profileImage} username={username}
{...children} />
)} exact /> */}

{/* <Route path="/find">
<Find />
</Route> */}

<Route path="/">
<QuestionBox authStatus={authStatus} profileImage={profileImage} username={username} />
<QuesstionList />
</Route>
</Switch>
</Suspense>
</Box>
</Box>
</Router>
);
};

export default App;
76 changes: 0 additions & 76 deletions client/src/StyleSheet/Header.css

This file was deleted.

Loading