-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
784 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
frontend/src/app/Schedule/Calendar/Week/Day/Day.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.root { | ||
aspect-ratio: 1; | ||
padding: 8px; | ||
display: flex; | ||
flex-direction: column; | ||
font-size: 12px; | ||
line-height: 1; | ||
gap: 4px; | ||
overflow: hidden; | ||
|
||
&:not(:last-child) { | ||
border-right: 1px solid var(--border-color); | ||
} | ||
|
||
.event { | ||
display: flex; | ||
align-items: center; | ||
padding: 0 8px; | ||
border-radius: 4px; | ||
gap: 8px; | ||
height: 24px; | ||
white-space: nowrap; | ||
|
||
&.active { | ||
opacity: 0.5; | ||
} | ||
|
||
.time { | ||
color: rgb(255 255 255 / 75%); | ||
font-size: 8px; | ||
} | ||
|
||
.course { | ||
color: white; | ||
font-weight: 500; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
} | ||
} | ||
|
||
.date { | ||
display: flex; | ||
|
||
.month { | ||
color: var(--heading-color); | ||
font-weight: 500; | ||
} | ||
|
||
.number { | ||
margin-left: auto; | ||
color: var(--label-color); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import classNames from "classnames"; | ||
|
||
import { getColor } from "@/lib/section"; | ||
|
||
import { IDay } from "../../semester"; | ||
import styles from "./Day.module.scss"; | ||
|
||
const parseTime = (time: string) => { | ||
const [hours, minutes] = time.split(":").map(Number); | ||
|
||
let _time = `${hours % 12 || 12}`; | ||
if (minutes > 0) _time += `:${minutes.toString().padStart(2, "0")}`; | ||
_time += hours < 12 ? " AM" : " PM"; | ||
|
||
return _time; | ||
}; | ||
|
||
interface DayProps extends IDay { | ||
active: boolean; | ||
} | ||
|
||
export default function Day({ date, events, active }: DayProps) { | ||
return ( | ||
<div key={date.format("YYYY-MM-DD")} className={styles.root}> | ||
{active && ( | ||
<div className={styles.date}> | ||
{date.format("D") === "1" && ( | ||
<p className={styles.month}>{date.format("MMMM")}</p> | ||
)} | ||
<p className={styles.number}>{date.format("D")}</p> | ||
</div> | ||
)} | ||
{events.map((event) => ( | ||
<div | ||
className={classNames(styles.event, { | ||
[styles.active]: event.active, | ||
})} | ||
style={{ | ||
backgroundColor: getColor( | ||
event.course.subject, | ||
event.course.number | ||
), | ||
}} | ||
> | ||
<div className={styles.time}> | ||
{parseTime(event.meetings[0].startTime)} | ||
</div> | ||
<div className={styles.course}> | ||
{event.course.subject} {event.course.number} | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.root { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&:not(:first-child) { | ||
border-top: 1px solid var(--border-color); | ||
} | ||
|
||
&.dead { | ||
background-color: var(--slate-100); | ||
} | ||
|
||
&.finals { | ||
background-color: white; | ||
} | ||
|
||
.header { | ||
font-size: 12px; | ||
line-height: 1; | ||
height: 32px; | ||
color: var(--paragraph-color); | ||
padding: 0 12px; | ||
display: flex; | ||
gap: 12px; | ||
align-items: center; | ||
border-bottom: 1px solid var(--border-color); | ||
} | ||
|
||
.body { | ||
flex-grow: 1; | ||
display: grid; | ||
grid-template-columns: repeat(7, 1fr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import classNames from "classnames"; | ||
import { ArrowDown } from "iconoir-react"; | ||
import moment from "moment"; | ||
|
||
import { IDay } from "../semester"; | ||
import Day from "./Day"; | ||
import styles from "./Week.module.scss"; | ||
|
||
interface WeekProps { | ||
days: IDay[]; | ||
finals: boolean; | ||
dead: boolean; | ||
first: moment.Moment; | ||
last: moment.Moment; | ||
} | ||
|
||
export default function Week({ days, finals, dead, first, last }: WeekProps) { | ||
return ( | ||
<div | ||
className={classNames(styles.root, { | ||
[styles.finals]: finals, | ||
[styles.dead]: dead, | ||
})} | ||
> | ||
{(dead || finals) && ( | ||
<div className={styles.header}> | ||
<ArrowDown width={12} height={12} /> | ||
{dead ? "Reading, Review, and Recitation (RRR)" : "Finals"} week | ||
</div> | ||
)} | ||
<div className={styles.body}> | ||
{days.map(({ date, events }) => ( | ||
<Day | ||
key={date.format("YYYY-MM-DD")} | ||
date={date} | ||
events={events} | ||
active={date.isBetween(first, last, "day", "[]")} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.