minor changes

This commit is contained in:
Sahni-Arjun 2022-03-06 21:13:11 -05:00
parent 528cb80c1f
commit 532b5d3876
3 changed files with 59 additions and 54 deletions

View File

@ -4,6 +4,7 @@ import SignIn from './SignIn';
import SignUp from './SignUp'; import SignUp from './SignUp';
import Admin from './Admin'; import Admin from './Admin';
import Home from './Home'; import Home from './Home';
import ChatWindow from './ChatWindow';
function App() { function App() {
return ( return (
<div className="App"> <div className="App">
@ -12,6 +13,7 @@ function App() {
<Route path="sign-in" element={<SignIn />} /> <Route path="sign-in" element={<SignIn />} />
<Route path="sign-up" element={<SignUp />} /> <Route path="sign-up" element={<SignUp />} />
<Route path="admin" element={<Admin />} /> <Route path="admin" element={<Admin />} />
<Route path="chat-window" element={<ChatWindow />} />
</Routes> </Routes>
</div> </div>
); );

View File

@ -108,7 +108,7 @@ export default function Navbar() {
<Box sx={{ flexGrow: 0, marginRight: '1%' }}> <Box sx={{ flexGrow: 0, marginRight: '1%' }}>
<Tooltip title="Chats"> <Tooltip title="Chats">
<IconButton sx={{ p: 0 }}> <IconButton onClick={() => { navigate('/chat-window') }} sx={{ p: 0 }}>
<ForumIcon sx={{ color: 'white' }}></ForumIcon> <ForumIcon sx={{ color: 'white' }}></ForumIcon>
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@ -16,60 +16,63 @@ export default function SignIn() {
event.preventDefault(); event.preventDefault();
const data = new FormData(event.currentTarget); const data = new FormData(event.currentTarget);
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
if(data.get('username') == "admin" && data.get('password') == "admin"){ if (data.get('username') === "admin" && data.get('password') === "admin") {
navigate('/'); navigate('/admin');
} else if (data.get('username') === "user" && data.get('password') === "user") {
navigate('/chat-window')
} }
}; };
return ( return (
<Container component="main" maxWidth="xs"> <Container component="main" maxWidth="xs">
<CssBaseline /> <CssBaseline />
<Box <Box
sx={{ sx={{
marginTop: 8, marginTop: 8,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
}} }}
> >
<Avatar sx={{ m: 1, bgcolor: 'primary.main' }}> <Avatar sx={{ m: 1, bgcolor: 'primary.main' }}>
<AccountCircleIcon /> <AccountCircleIcon />
</Avatar> </Avatar>
<Typography component="h1" variant="h5"> <Typography component="h1" variant="h5">
Sign in Sign in
</Typography> </Typography>
<Box component="form" noValidate sx={{ mt: 1 }} onSubmit={handleSubmit}> <Box component="form" noValidate sx={{ mt: 1 }} onSubmit={handleSubmit}>
<TextField <TextField
margin="normal" margin="normal"
required required
fullWidth fullWidth
id="username" id="username"
label="Username" label="Username"
name="username" name="username"
autoComplete="username" autoComplete="username"
autoFocus autoFocus
/> />
<TextField <TextField
margin="normal" margin="normal"
required required
fullWidth fullWidth
name="password" name="password"
label="Password" label="Password"
type="password" type="password"
id="password" id="password"
autoComplete="current-password" autoComplete="current-password"
/> />
<Button <Button
type="submit" type="submit"
fullWidth fullWidth
variant="contained" variant="contained"
sx={{ mt: 3, mb: 2 }} sx={{ mt: 3, mb: 2 }}
> >
Sign In Sign In
</Button> </Button>
<Link href="/sign-up" underline="always"> <Link href="/sign-up" underline="always">
{"Don't have an account?"} {"Don't have an account?"}
</Link> </Link>
</Box> </Box>
</Box> </Box>
</Container> </Container>
)} )
}