Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forgot password backend logic + frontend design #73

Merged
merged 11 commits into from
Nov 11, 2024
Prev Previous commit
Next Next commit
minor fixes
98ZhaoJeffrey committed Oct 31, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e93a5a96cd049a7a5d5fc3d2d4b0b21926ad8c09
1 change: 0 additions & 1 deletion frontend/src/APIClients/CourseAPIClient.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ const getUnits = async (): Promise<CourseUnit[]> => {
const { data } = await baseAPIClient.get("/course/", {
headers: { Authorization: bearerToken },
});
console.log(data)
return data;
} catch (error) {
return [];
27 changes: 19 additions & 8 deletions frontend/src/components/courses/UnitSidebar.tsx
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@ import React, { useState } from "react";
import {
Box,
Button,
Divider,
Drawer,
List,
ListItem,
ListItemButton,
ListItemText,
useTheme,
} from "@mui/material";
import ArrowBackIosIcon from "@mui/icons-material/ArrowBackIos";
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
import { CourseUnit } from "../../types/CourseTypes";
import { neutral } from "../../theme/palette";

@@ -52,6 +52,7 @@ export default function UnitSidebar(props: UnitSideBarProps) {
height="59px"
display="flex"
p="12px"
paddingLeft="20px"
alignItems="center"
justifyContent="space-between"
fontWeight="700"
@@ -63,8 +64,10 @@ export default function UnitSidebar(props: UnitSideBarProps) {
sx={{
p: "8px",
fontSize: "12px",
color: theme.palette.neutral.main,
lineHeight: "1.5",
}}
endIcon={<ArrowBackIosIcon />}
endIcon={<MenuOpenIcon />}
onClick={handleClose}
>
Close
@@ -73,8 +76,19 @@ export default function UnitSidebar(props: UnitSideBarProps) {
<List sx={{ width: "100%" }}>
{courseUnits.map((course, index) => {
return (
<React.Fragment key={course.id}>
<ListItem
key={course.id}
disablePadding
sx={{
borderBottom: 1,
borderColor:
index !== courseUnits.length - 1
? "#DBE4E7"
: "transparent",
}}
>
<ListItemButton
key={course.id}
sx={{
py: "15px",
px: "32px",
@@ -93,10 +107,7 @@ export default function UnitSidebar(props: UnitSideBarProps) {
}
/>
</ListItemButton>
{index !== courseUnits.length - 1 && (
<Divider component="li" sx={{ color: "#FCF8F8" }} />
)}
</React.Fragment>
</ListItem>
);
})}
</List>
32 changes: 28 additions & 4 deletions frontend/src/components/pages/courses/CourseUnitsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React, { useEffect, useState } from "react";
import { Box, Typography } from "@mui/material";
import { Box, Button, Typography, useTheme } from "@mui/material";
import MenuOpenIcon from "@mui/icons-material/MenuOpen";
import UnitSidebar from "../../courses/UnitSidebar";
import { CourseUnit } from "../../../types/CourseTypes";
import CourseAPIClient from "../../../APIClients/CourseAPIClient";

export default function CourseUnitsPage() {
const theme = useTheme();
const [courseUnits, setCourseUnits] = useState<CourseUnit[]>([]);

const [open, setOpen] = useState(true);

// const handleDrawerOpen = () => {
// setOpen(true);
// };
const handleDrawerOpen = () => {
setOpen(true);
};

const handleDrawerClose = () => {
setOpen(false);
@@ -32,6 +34,28 @@ export default function CourseUnitsPage() {
handleClose={handleDrawerClose}
open={open}
/>
{!open && (
<Button
type="button"
sx={{
color: theme.palette.neutral.dark,
backgroundColor: theme.palette.neutral.light,
borderRadius: "4px",
width: "34px",
minWidth: "34px",
height: "34px",
padding: 0,
}}
onClick={handleDrawerOpen}
>
<MenuOpenIcon
sx={{
fontSize: "18px",
}}
/>
</Button>
)}

<Box sx={{ flexGrow: 1 }}>
<Typography paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
2 changes: 1 addition & 1 deletion frontend/src/constants/Routes.ts
Original file line number Diff line number Diff line change
@@ -18,4 +18,4 @@ export const MAKE_HELP_REQUEST_PAGE = "/ask-for-help";

export const VIEW_HELP_REQUESTS_PAGE = "/help-requests";

export const COURSES_PAGE = "/courses";
export const COURSES_PAGE = "/course";