default expand past courses

This commit is contained in:
2025-07-15 14:00:32 -06:00
parent 2b11106f02
commit c93c0b0e22
2 changed files with 5 additions and 3 deletions

View File

@@ -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

View File

@@ -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="">