Skip to content

Commit

Permalink
Merge pull request #137 from makeopensource/task-52-Build-the-fronten…
Browse files Browse the repository at this point in the history
…d-of-the-homepage-with-accordance-to-the-figma

Task 52 build the frontend of the homepage with accordance to the figma
  • Loading branch information
jessehartloff authored Oct 14, 2024
2 parents 6d954e7 + 0dd5c4f commit 4e5c1cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions devU-client/src/components/listItems/userCourseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const UserCourseListItem = ({course, assignments, past = false, instructor = fal
return(
<ListItemWrapper to={null} tag={course.number} containerStyle={styles.container}>

<div className={styles.name}>{instructor ? (course.name + " (Instructor)") : course.name.toUpperCase() + " " + course.number + " " + "(" + course.semester + ")" }</div>
<div className={styles.name}>{instructor ? (course.name + " " + course.number + " (" + course.semester + ")" + " Instructor") : course.name.toUpperCase() + " " + course.number + " " + "(" + course.semester + ")" }</div>
<div className={styles.subText}>
{assignments && assignments.length > 0 ? (assignments.map((assignment) => (
<SimpleAssignmentListItem assignment={assignment} key={assignment.id}/>
))) : ((past || instructor) ? <div></div> : <div className={styles.No_assignments}>No Assignments Due Yet</div>)}
))) : ((past) ? <div></div> : <div className={styles.No_assignments}>No Assignments Due Yet</div>)}
<div className={styles.Buttons}>
<button className={styles.gradebook_button} onClick={(e) => {
e.stopPropagation();
Expand Down
13 changes: 10 additions & 3 deletions devU-client/src/components/pages/homePage/homePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const HomePage = () => {
instructorCourses: Course[];
activeCourses: Course[];
pastCourses: Course[];
upcomingCourses: Course[];//TODO: Add upcoming courses feature
upcomingCourses: Course[];
}>(`/api/courses/user/${userId}`);
const enrolledCourses: Course[] = allCourses.activeCourses;
const upcomingCourses: Course[] = allCourses.upcomingCourses;
Expand All @@ -46,6 +46,13 @@ const HomePage = () => {
})
const assignmentResults = await Promise.all(assignmentPromises)
assignmentResults.forEach(([course, assignments]) => assignmentMap.set(course, assignments))

const assignmentPromises_instructor = instructorCourses.map((course) => {
const assignments = RequestService.get<Assignment[]>(`/api/course/${course.id}/assignments/released`)
return Promise.all([course, assignments])
})
const assignmentResults_instructor = await Promise.all(assignmentPromises_instructor)
assignmentResults_instructor.forEach(([course, assignments]) => assignmentMap.set(course, assignments))

setAssignments(assignmentMap)
setPastCourses(pastCourses)
Expand Down Expand Up @@ -81,10 +88,10 @@ const HomePage = () => {
<div className={styles.largeLine}></div>
</div>
<div className={styles.coursesContainer}>
{instructorCourses && instructorCourses.map((course) => (
{instructorCourses.map((course) => (
<div className={styles.courseCard} key={course.id}>
<UserCourseListItem course={course} assignments={assignments.get(course)} key={course.id}
instructor={true}/>
instructor = {true}/>
</div>
))}
</div>
Expand Down

0 comments on commit 4e5c1cd

Please sign in to comment.