Skip to content

Commit c601878

Browse files
committed
Add landing page and modify navbar
1 parent 5dff1cc commit c601878

File tree

10 files changed

+76
-20
lines changed

10 files changed

+76
-20
lines changed
30.2 KB
Loading
10.6 KB
Loading

frontend/public/match_found.png

12 KB
Loading

frontend/public/questions_list.png

17.8 KB
Loading

frontend/src/components/Navbar/index.tsx

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,27 @@ import {
1414
} from "@mui/material";
1515
import { grey } from "@mui/material/colors";
1616
import AppMargin from "../AppMargin";
17-
import { useNavigate } from "react-router-dom";
17+
import { useNavigate, useLocation } from "react-router-dom";
1818
import { useAuth } from "../../contexts/AuthContext";
1919
import { useState } from "react";
2020
import { USE_AUTH_ERROR_MESSAGE } from "../../utils/constants";
2121

22-
type NavbarItem = { label: string; link: string };
22+
type NavbarItem = { label: string; link: string; needsLogin: boolean };
2323

2424
type NavbarProps = { navbarItems?: Array<NavbarItem> };
2525

2626
const Navbar: React.FC<NavbarProps> = (props) => {
27-
const { navbarItems = [{ label: "Questions", link: "/questions" }] } = props;
27+
const {
28+
navbarItems = [
29+
{ label: "Find Match", link: "/home", needsLogin: true },
30+
{ label: "Questions", link: "/questions", needsLogin: false },
31+
],
32+
} = props;
33+
2834
const navigate = useNavigate();
35+
const location = useLocation();
36+
const path = location.pathname;
37+
2938
const auth = useAuth();
3039
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
3140

@@ -63,16 +72,18 @@ const Navbar: React.FC<NavbarProps> = (props) => {
6372
PeerPrep
6473
</Typography>
6574
<Stack direction={"row"} alignItems={"center"} spacing={2}>
66-
{navbarItems.map((item) => (
67-
<Link
68-
key={item.label}
69-
href={item.link}
70-
underline="none"
71-
sx={{ color: "common.black" }}
72-
>
73-
{item.label}
74-
</Link>
75-
))}
75+
{navbarItems
76+
.filter((item) => !item.needsLogin || (item.needsLogin && user))
77+
.map((item) => (
78+
<Link
79+
key={item.label}
80+
href={item.link}
81+
underline="none"
82+
sx={{ color: "common.black" }}
83+
>
84+
{path == item.link ? <b>{item.label}</b> : item.label}
85+
</Link>
86+
))}
7687
{user ? (
7788
<>
7889
<Tooltip title={"Account settings"}>

frontend/src/pages/Home/index.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111

1212
.margins {
13-
margin-top: 25px;
14-
margin-bottom: 25px;
13+
margin-top: 50px;
14+
margin-bottom: 50px;
1515
}

frontend/src/pages/Home/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const Home: React.FC = () => {
5050
marginBottom: theme.spacing(4),
5151
})}
5252
>
53-
Level up in your technical interviews!
53+
Start an interactive practice session today!
5454
</Typography>
5555

5656
<Typography
@@ -62,8 +62,7 @@ const Home: React.FC = () => {
6262
maxWidth: "80%",
6363
})}
6464
>
65-
Your ultimate technical interview preparation platform to practice
66-
whiteboard style interview questions with a peer.
65+
Specify your question preferences and sit back as we find you the best match.
6766
</Typography>
6867
{/* <Box
6968
component="img"

frontend/src/pages/Landing/index.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
}
1111

1212
.margins {
13-
margin-top: 25px;
14-
margin-bottom: 25px;
13+
margin-top: 50px;
14+
margin-bottom: 50px;
1515
}

frontend/src/pages/Landing/index.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
import { Typography } from "@mui/material";
2+
import Carousel from "react-material-ui-carousel";
3+
import { Paper } from "@mui/material";
24

35
import classes from "./index.module.css";
46
import AppMargin from "../../components/AppMargin";
7+
import {
8+
COLLABORATIVE_EDITOR_PATH,
9+
FIND_MATCH_FORM_PATH,
10+
MATCH_FOUND_PATH,
11+
QUESTIONS_LIST_PATH,
12+
} from "../../utils/constants";
513

614
const Landing: React.FC = () => {
15+
const images = [
16+
{
17+
name: "Questions list",
18+
path: QUESTIONS_LIST_PATH,
19+
},
20+
{
21+
name: "Find match form",
22+
path: FIND_MATCH_FORM_PATH,
23+
},
24+
{
25+
name: "Match found",
26+
path: MATCH_FOUND_PATH,
27+
},
28+
{
29+
name: "Collaborative editor",
30+
path: COLLABORATIVE_EDITOR_PATH,
31+
},
32+
];
33+
734
return (
835
<AppMargin
936
classname={`${classes.fullheight} ${classes.center} ${classes.margins}`}
@@ -33,6 +60,19 @@ const Landing: React.FC = () => {
3360
Your ultimate technical interview preparation platform to practice
3461
whiteboard style interview questions with a peer.
3562
</Typography>
63+
64+
<Carousel
65+
sx={{ width: "600px" }}
66+
height={400}
67+
navButtonsAlwaysInvisible
68+
stopAutoPlayOnHover={false}
69+
>
70+
{images.map((image, i) => (
71+
<Paper key={i} elevation={2}>
72+
<img src={image.path} alt={image.name} />
73+
</Paper>
74+
))}
75+
</Carousel>
3676
</AppMargin>
3777
);
3878
};

frontend/src/utils/constants.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,9 @@ export const SUCCESS_PW_UPDATE_MESSAGE = "Password updated successfully";
7171
export const FAILED_PW_UPDATE_MESSAGE = "Failed to update password";
7272
export const SUCCESS_PROFILE_UPDATE_MESSAGE = "Profile updated successfully";
7373
export const FAILED_PROFILE_UPDATE_MESSAGE = "Failed to update profile";
74+
75+
// Image paths
76+
export const FIND_MATCH_FORM_PATH = "/find_match_form.png";
77+
export const MATCH_FOUND_PATH = "/match_found.png";
78+
export const QUESTIONS_LIST_PATH = "/questions_list.png";
79+
export const COLLABORATIVE_EDITOR_PATH = "/collaborative_editor.png";

0 commit comments

Comments
 (0)