Skip to content

Commit

Permalink
light mode period name contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
33tm committed Aug 30, 2024
1 parent 57e3b36 commit f9704a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/components/schedule/Period.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function Period(props: PeriodProps) {
<>
<h2 className="text-xl break-words min-w-0">
{id ? (
<a href={`https://pausd.schoology.com/course/${id}`} className="text-white" target="__blank">
<a href={`https://pausd.schoology.com/course/${id}`} className="text-black dark:text-white" target="__blank">
{name}
</a>
) : name}
Expand Down
13 changes: 2 additions & 11 deletions shared/util/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import schedule, {SCHOOL_START, SCHOOL_END, SCHOOL_END_EXCLUSIVE, PeriodObj} fro
// To account for duplicated weekday letters, Thursday is R and Saturday is A.
export const numToWeekday = (num: number) => ['S', 'M', 'T', 'W', 'R', 'F', 'A'][num];

// Account for how the weekly SELF/SH rotation aren't necessarily alternates
export function isAlternate(normal: PeriodObj[], alternate: PeriodObj[] | null) {
if (!alternate) return true
const selfShFilter = ({ n }: { n: PeriodObj["n"] }) => !['S', 'H'].includes(n);
return JSON.stringify(normal.filter(selfShFilter)) !== JSON.stringify(alternate.filter(selfShFilter));
}

// Gets the Gunn schedule for a given `DateTime`, as an object {periods, alternate} representing the day's schedule
// as a `PeriodObj[]` or null if there's no school and whether the schedule is an alternate.
export function getSchedule(date: DateTime, alternates: Alternates['alternates']) {
Expand All @@ -27,16 +20,14 @@ export function getSchedule(date: DateTime, alternates: Alternates['alternates']
let periods: PeriodObj[] | null;
let alternate = false;

const normal = schedule[numToWeekday(localizedDate.weekday % 7)];

// Check for alternate schedules
if (altFormat in alternates) {
// If viewDate exists in alt schedules, load that schedule
periods = alternates[altFormat];
alternate = isAlternate(normal, periods);
alternate = true;
} else {
// Otherwise, use default schedule
periods = normal;
periods = schedule[numToWeekday(localizedDate.weekday % 7)];
}

return {periods, alternate};
Expand Down

0 comments on commit f9704a6

Please sign in to comment.