mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
default expand past courses
This commit is contained in:
@@ -17,6 +17,8 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
|||||||
"week calculation start date"
|
"week calculation start date"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isPastSemester = Date.now() > new Date(settings.endDate).getTime();
|
||||||
|
|
||||||
const pastWeekNumber = getWeekNumber(
|
const pastWeekNumber = getWeekNumber(
|
||||||
startDate,
|
startDate,
|
||||||
new Date(Date.now() - four_days_in_milliseconds)
|
new Date(Date.now() - four_days_in_milliseconds)
|
||||||
@@ -27,7 +29,7 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
|||||||
new Date(month.year, month.month, 1)
|
new Date(month.year, month.month, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
const isInPast = pastWeekNumber >= startOfMonthWeekNumber;
|
const shouldCollapse = (pastWeekNumber >= startOfMonthWeekNumber) && !isPastSemester;
|
||||||
|
|
||||||
const monthName = new Date(month.year, month.month - 1, 1).toLocaleString(
|
const monthName = new Date(month.year, month.month - 1, 1).toLocaleString(
|
||||||
"default",
|
"default",
|
||||||
@@ -37,7 +39,7 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Expandable
|
<Expandable
|
||||||
defaultExpanded={!isInPast}
|
defaultExpanded={!shouldCollapse}
|
||||||
ExpandableElement={({ setIsExpanded, isExpanded }) => (
|
ExpandableElement={({ setIsExpanded, isExpanded }) => (
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
<h3
|
<h3
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default function LecturePreviewPage({
|
|||||||
href={getLectureUrl(courseName, lectureDay)}
|
href={getLectureUrl(courseName, lectureDay)}
|
||||||
shallow={true}
|
shallow={true}
|
||||||
>
|
>
|
||||||
Edit Page
|
Edit Lecture
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="">
|
||||||
|
|||||||
Reference in New Issue
Block a user