Skip to content

Commit

Permalink
feat: Location, Time, Details, CCN, Tooltip; sections, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathhulk committed Apr 13, 2024
1 parent b15fda9 commit 7c2f065
Show file tree
Hide file tree
Showing 21 changed files with 1,089 additions and 211 deletions.
46 changes: 4 additions & 42 deletions frontend/src/app/Catalog/Class/Class.module.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.root {
flex-grow: 1;
overflow: auto;
display: flex;
flex-direction: column;

.view {
flex-grow: 1;
overflow: auto;
}

.header {
Expand All @@ -15,51 +15,13 @@
display: flex;
align-items: center;
gap: 12px;
padding: 16px 24px 0;
padding: 16px 24px 12px;
font-size: 14px;
line-height: 1;

.units {
font-size: 14px;
color: var(--slate-500);
user-select: none;
line-height: 1;
}
}

.row {
display: flex;
padding: 24px 24px 12px;

.detail {
flex: 1;
font-size: 14px;

.title {
color: var(--slate-500);
line-height: 1;
margin-bottom: 8px;
}

.description {
color: var(--slate-600);
line-height: 1.5;
font-weight: 500;
}

&:not(:last-child) {
border-right: 1px solid var(--slate-200);
}

&:first-child {
padding-right: 16px;
}

&:nth-child(2) {
padding: 0 16px;
}

&:last-child {
padding-left: 16px;
}
}
}

Expand Down
18 changes: 18 additions & 0 deletions frontend/src/app/Catalog/Class/Overview/Overview.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.root {
padding: 24px;
background-color: var(--slate-50);
min-height: 100%;
font-size: 14px;

.label {
margin-top: 24px;
color: var(--slate-400);
line-height: 1;
}

.description {
color: var(--slate-500);
margin-top: 8px;
line-height: 1.5;
}
}
29 changes: 27 additions & 2 deletions frontend/src/app/Catalog/Class/Overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
export default function Overview() {
return <div>Overview</div>;
import Details from "@/components/Details";
import { IClass } from "@/lib/api";

import styles from "./Overview.module.scss";

interface OverviewProps {
currentClass?: IClass;
}

export default function Overview({ currentClass }: OverviewProps) {
if (!currentClass) return null;

return (
<div className={styles.root}>
<Details {...currentClass.primarySection} />
<p className={styles.label}>Description</p>
<p className={styles.description}>
{currentClass.description ?? currentClass.course.description}
</p>
{currentClass.course.prereqs && (
<>
<p className={styles.label}>Prerequisites</p>
<p className={styles.description}>{currentClass.course.prereqs}</p>
</>
)}
</div>
);
}
96 changes: 83 additions & 13 deletions frontend/src/app/Catalog/Class/Sections/Sections.module.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,89 @@
.root {
background-color: var(--slate-50);
height: 100%;
padding: 24px;

.section {
padding: 24px;
background-color: white;
border-radius: 8px;
box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
margin-bottom: 24px;
border: 1px solid var(--slate-200);

.header {
min-height: 100%;
padding: 24px 24px 24px 12px;
display: flex;
align-items: flex-start;
gap: 24px;

.view {
flex-grow: 1;
height: 200vh;

.section {
padding: 24px;
background-color: white;
border-radius: 8px;
box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
margin-bottom: 24px;
border: 1px solid var(--slate-200);

.header {
display: flex;
margin-bottom: 24px;
gap: 12px;

.lock {
height: 32px;
width: 32px;
border-radius: 16px;
display: grid;
place-items: center;
background-color: var(--red-50);
color: var(--red-500);
}

.text {
flex-grow: 1;

.title {
color: var(--slate-900);
font-size: 14px;
margin-bottom: 8px;
line-height: 1;
font-weight: 500;
}
}
}
}
}

.menu {
position: sticky;
top: 24px;
width: 128px;
display: flex;
flex-direction: column;
gap: 8px;

.item {
height: 32px;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 12px;
font-size: 14px;
font-weight: 500;
color: var(--slate-500);
width: fit-content;

&:hover {
background-color: var(--slate-100);
}

&:first-child {
color: var(--slate-900);
position: relative;

&::after {
content: '';
width: 2px;
height: 100%;
background-color: var(--blue-500);
position: absolute;
left: -12px;
}
}
}
}
}
59 changes: 44 additions & 15 deletions frontend/src/app/Catalog/Class/Sections/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,54 @@
import { Lock } from "iconoir-react";

import CCN from "@/components/CCN";
import Details from "@/components/Details";
import { IClass } from "@/lib/api";

import Capacity from "../../../../components/Capacity";
import styles from "./Sections.module.scss";

export default function Sections() {
interface SectionsProps {
currentClass?: IClass;
}

export default function Sections({ currentClass }: SectionsProps) {
return (
<div className={styles.root}>
<div className={styles.section}>
<div className={styles.header}>
<div className={styles.text}>
<div className={styles.title}>Section 1</div>
<div className={styles.description}>Instructor: John Doe</div>
<div className={styles.menu}>
<div className={styles.item}>Discussions</div>
<div className={styles.item}>Labs</div>
</div>
<div className={styles.view}>
{currentClass?.sections.map((section) => (
<div className={styles.section}>
<div className={styles.header}>
<div className={styles.text}>
<p className={styles.title}>
{section.kind === "Laboratory" ? "Lab" : section.kind}{" "}
{section.number}
</p>
<CCN ccn={section.ccn} />
</div>
<div className={styles.lock}>
<Lock />
</div>
<Capacity
count={section.enrollCount}
capacity={section.enrollMax}
waitlistCount={section.waitlistCount}
waitlistCapacity={section.waitlistMax}
/>
</div>
<Details
days={section.days ?? []}
timeStart={section.timeStart}
timeEnd={section.timeEnd}
location={section.location}
instructors={section.instructors ?? []}
/>
</div>
<Capacity
count={10}
capacity={20}
waitlistCount={5}
waitlistCapacity={10}
/>
</div>
))}
</div>
<div className={styles.section}></div>
<div className={styles.section}></div>
</div>
);
}
48 changes: 21 additions & 27 deletions frontend/src/app/Catalog/Class/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useMemo, useState } from "react";

import { useQuery } from "@apollo/client";
import { Bookmark, Plus, Xmark } from "iconoir-react";
import { Bookmark, CalendarPlus, Xmark } from "iconoir-react";
import { Link, useSearchParams } from "react-router-dom";

import AverageGrade from "@/components/AverageGrade";
import CCN from "@/components/CCN";
import Capacity from "@/components/Capacity";
import IconButton from "@/components/IconButton";
import MenuItem from "@/components/MenuItem";
Expand All @@ -29,6 +30,18 @@ const views = [
text: "Sections",
Component: Sections,
},
{
text: "Grades",
Component: () => null,
},
{
text: "Enrollment",
Component: () => null,
},
{
text: "Discussion",
Component: () => null,
},
];

interface ClassProps {
Expand All @@ -51,6 +64,8 @@ export default function Class({
const [searchParams] = useSearchParams();
const [view, setView] = useState(0);

// TODO: Query for enrollment and grades data in the background

const { data } = useQuery<{ class: IClass }>(GET_CLASS, {
variables: {
term: {
Expand Down Expand Up @@ -84,6 +99,8 @@ export default function Class({

const Component = useMemo(() => views[view].Component, [view]);

console.log(currentClass?.primarySection);

return (
<div className={styles.root}>
<div className={styles.header}>
Expand All @@ -98,7 +115,7 @@ export default function Class({
</div>
<div className={styles.group}>
<IconButton>
<Plus />
<CalendarPlus />
</IconButton>
<IconButton>
<Bookmark />
Expand All @@ -116,10 +133,6 @@ export default function Class({
</div>
</div>
<div className={styles.information}>
{/*<Button secondary>
<ArrowSeparateVertical />
{currentSemester} {currentYear}
</Button>*/}
<AverageGrade
averageGrade={
currentClass?.course?.gradeAverage ?? currentCourse.gradeAverage
Expand All @@ -136,26 +149,7 @@ export default function Class({
}
/>
<div className={styles.units}>{units}</div>
</div>
<div className={styles.row}>
<div className={styles.detail}>
<div className={styles.title}>Time</div>
<div className={styles.description}>TuTh 6:30 PM - 7:59 PM</div>
</div>
<div className={styles.detail}>
<div className={styles.title}>Location</div>
<div className={styles.description}>
Anthro/Art Practice Bldg 160
</div>
</div>
<div className={styles.detail}>
<div className={styles.title}>Instructor</div>
{/*currentClass?.primarySection.instructors.map((instructor) => (
<div key={instructor.familyName} className={styles.description}>
{instructor.givenName} {instructor.familyName}
</div>
))*/}
</div>
{currentClass && <CCN ccn={currentClass.primarySection.ccn} />}
</div>
<div className={styles.menu}>
{views.map(({ text }, index) => (
Expand All @@ -170,7 +164,7 @@ export default function Class({
</div>
</div>
<div className={styles.view}>
<Component />
<Component currentClass={currentClass} />
</div>
</div>
);
Expand Down
Loading

0 comments on commit 7c2f065

Please sign in to comment.