Skip to content

Commit

Permalink
chore: adapt dates to S25 semester
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemSBulgakov committed Jan 22, 2025
1 parent a8d34e0 commit bf83ff1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/components/calendar/CalendarViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ function renderDayHeader({ date }: DayHeaderContentArg) {

function calculateWeek(date: Date) {
// Calculate academic week number
const semesterStart = new Date("2024-08-26").getTime(); // Monday, first day of first week
const semesterEnd = new Date("2024-12-30").getTime(); // Monday, the day after the last week
const semesterStart = new Date("2025-01-20").getTime(); // Monday, first day of first week
const semesterEnd = new Date("2025-06-30").getTime(); // Monday, the day after the last week

const time = date.getTime();
if (time < semesterStart || time >= semesterEnd) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useNowMS } from "@/lib/utils/use-now.ts";

export function NewYearWidget() {
export function CountdownWidget() {
const nowMs = useNowMS(true, 1000);

const nextYear = new Date().getFullYear() + 1;
const currentYear = new Date().getFullYear();
const deadlineMs =
new Date(`${nextYear}-01-01`).getTime() - 3 * 60 * 60 * 1000;
new Date(`${currentYear}-06-01`).getTime() - 3 * 60 * 60 * 1000;
const daysLeft = Math.max(
0,
Math.floor((deadlineMs - nowMs) / (1000 * 60 * 60 * 24)),
Expand All @@ -19,12 +19,11 @@ export function NewYearWidget() {
return (
<div className="group flex flex-row gap-4 rounded-2xl bg-primary px-4 py-6">
<div className="w-12">
<span className="icon-[twemoji--christmas-tree] text-5xl text-brand-violet" />
<span className="icon-[twemoji--sun] text-5xl text-brand-violet" />
</div>
<div className="flex flex-col">
<div className="text-2xl font-semibold text-contrast">
New Year Countdown:{" "}
<span className="font-normal">{daysLeft} days</span>
Summer Countdown: <span className="font-normal">{daysLeft} days</span>
<p className="mt-2 text-lg text-contrast/75">
{hoursLeft} hours, {minutesLeft} minutes, {secondsLeft} seconds
</p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { URLType } from "@/components/calendar/CalendarViewer.tsx";
import { AuthWall } from "@/components/common/AuthWall.tsx";
import { AcademicCalendarWidget } from "@/components/dashboard/AcademicCalendarWidget.tsx";
import { AccountWidget } from "@/components/dashboard/AccountWidget.tsx";
import { NewYearWidget } from "@/components/dashboard/NewYearWidget.tsx";
import { CountdownWidget } from "@/components/dashboard/CountdownWidget.tsx";
import { SportsWidget } from "@/components/dashboard/SportsWidget.tsx";
import { GroupCardById } from "@/components/schedule/group-card/GroupCardById.tsx";
import LinkIconButton from "@/components/schedule/group-card/LinkIconButton.tsx";
Expand Down Expand Up @@ -39,7 +39,7 @@ export function DashboardPage() {
<div className="grid gap-4 @4xl/content:grid-cols-2">
<AcademicCalendarWidget />
<SportsWidget />
<NewYearWidget />
<CountdownWidget />
</div>
<div className="flex flex-col justify-between gap-4 @container/sections @6xl/content:flex-row @6xl/content:gap-8">
<details className="flex w-full flex-col @container/schedule @6xl/content:w-1/2">
Expand Down
9 changes: 1 addition & 8 deletions src/components/dashboard/SportsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function SportsWidget() {
const debtHours = sportInfo.ongoing_semester.debt;

// TODO: Fetch the end date of current semester from sports
const deadline = new Date("2024-12-08");
const deadline = new Date("2025-05-04");
const daysLeft = Math.max(
0,
Math.ceil((deadline.getTime() - nowMs) / (1000 * 60 * 60 * 24)),
Expand Down Expand Up @@ -43,13 +43,6 @@ export function SportsWidget() {
})}{" "}
({daysLeft} days left)
</p>
<a
href="https://t.me/sportinIU/566"
className="w-fit text-lg text-contrast/75 hover:underline"
>
Register for <span className="text-brand-violet">Fitness test</span>
<span className="icon-[material-symbols--open-in-new-rounded] ml-1 text-xs" />
</a>
<a
href="https://t.me/IUSportBot"
className="w-fit text-lg text-contrast/75 hover:underline"
Expand Down
35 changes: 18 additions & 17 deletions src/lib/events/academic-calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,45 @@ export type AcademicCalendar = {
// prettier-ignore
export const academicCalendar: AcademicCalendar[] = [{
groupPrefix: "B21",
Title: () => <p>[B21] Semester F24: <span className="font-normal">Aug 26 - Dec 21</span></p>,
Title: () => <p>[B21] Semester S25</p>,
Details: () => <>
<p><span className="font-semibold">Winter break:</span> Dec 22 - Jan 12</p>
<p><span className="font-semibold">Spring break:</span> May 25 - May 31</p>
<p><span className="font-semibold">Thesis defense:</span> June 1 - July 13</p>
</>,
}, {
groupPrefix: "B22",
Title: () => <p>[B22] Semester F24: <span className="font-normal">Aug 26 - Dec 20</span></p>,
Title: () => <p>[B22] Semester S25: <span className="font-normal">Jan 20 - May 16</span></p>,
Details: () => <>
<p><span className="font-semibold">Exams:</span> Dec 10 - Dec 20</p>
<p><span className="font-semibold">Winter break:</span> Dec 21 - Jan 19</p>
<p><span className="font-semibold">Exams:</span> May 8 - May 16</p>
<p><span className="font-semibold">Spring break:</span> May 17 - May 25</p>
</>,
}, {
groupPrefix: "B23",
Title: () => <p>[B23] Semester F24: <span className="font-normal">Aug 26 - Dec 23</span></p>,
Title: () => <p>[B23] Semester S25: <span className="font-normal">Jan 20 - May 22</span></p>,
Details: () => <>
<p><span className="font-semibold">Exams:</span> Dec 10 - Dec 23</p>
<p><span className="font-semibold">Winter break:</span> Dec 24 - Jan 19</p>
<p><span className="font-semibold">Exams:</span> May 8 - May 22</p>
<p><span className="font-semibold">Spring break:</span> May 23 - June 1</p>
</>,
}, {
groupPrefix: "B24-AI360",
Title: () => <p>[B24-AI360] Semester F24: <span className="font-normal">Aug 26 - Dec 28</span></p>,
Title: () => <p>[B24-AI360] Semester S25: <span className="font-normal">Jan 20 - June 29</span></p>,
Details: () => <>
<p><span className="font-semibold">Exams:</span> Dec 10 - Dec 28</p>
<p><span className="font-semibold">Winter break:</span> Dec 29 - Jan 19</p>
<p><span className="font-semibold">Exams:</span> May 30 - June 29</p>
<p><span className="font-semibold">Summer break:</span> June 30 - Aug 24</p>
</>,
}, {
groupPrefix: "B24",
Title: () => <p>[B24] Semester F24: <span className="font-normal">Aug 26 - Dec 22</span></p>,
Title: () => <p>[B24] Semester S25: <span className="font-normal">Jan 20 - May 22</span></p>,
Details: () => <>
<p><span className="font-semibold">Exams:</span> Dec 10 - Dec 22</p>
<p><span className="font-semibold">Winter break:</span> Dec 23 - Jan 19</p>
<p><span className="font-semibold">Exams:</span> May 8 - May 22</p>
<p><span className="font-semibold">Spring break:</span> May 23 - June 1</p>
</>,
}, {
groupPrefix: "M24",
Title: () => <p>[M24] Semester F24: <span className="font-normal">Aug 26 - Dec 22</span></p>,
Title: () => <p>[M24] Semester S25: <span className="font-normal">Jan 20 - May 22</span></p>,
Details: () => <>
<p><span className="font-semibold">Exams:</span> Dec 10 - Dec 22</p>
<p><span className="font-semibold">Winter break:</span> Dec 23 - Jan 19</p>
<p><span className="font-semibold">Exams:</span> May 8 - May 22</p>
<p><span className="font-semibold">Spring break:</span> May 23 - June 1</p>
</>,
}];

Expand Down

0 comments on commit bf83ff1

Please sign in to comment.