Skip to content

Commit 1230a30

Browse files
thomasyzy7Austin-Xminhhaitran08kevin-lannMasahisaSekita
authored
Release/1.4 - develop (#127)
Co-authored-by: Austin-X <[email protected]> Co-authored-by: minhhaitran08 <[email protected]> Co-authored-by: kevin-lann <[email protected]> Co-authored-by: Masahisa Sekita <[email protected]> Co-authored-by: Dmitriy Prokopchuk <[email protected]> Co-authored-by: Austin-X <[email protected]> Co-authored-by: dawangk <[email protected]> Co-authored-by: kevin-lann <[email protected]> Co-authored-by: MasahisaSekita <[email protected]>
1 parent 265aba0 commit 1230a30

File tree

6 files changed

+492
-35
lines changed

6 files changed

+492
-35
lines changed

.github/workflows/workflow.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Format the code
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
format:
8+
runs-on: ubuntu-latest
9+
name: Format Files
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: "20"
15+
- name: Prettier
16+
run: npx prettier --write **/*.{js,ts,tsx,json,md}
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
- uses: stefanzweifel/git-auto-commit-action@v4
20+
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
21+
with:
22+
commit_message: "Auto-formatted the code using Prettier"

course-matrix/frontend/src/models/timetable-form.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { z, ZodType } from "zod";
2-
32
import { OfferingModel } from "./models";
43

54
const timeRegex = /^([01]\d|2[0-3]):([0-5]\d)$/;

course-matrix/frontend/src/pages/Home/Home.tsx

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,9 @@ const Home = () => {
7676
const sharedWithMeTimetables = [...(sharedWithMeData ?? [])]
7777
.flatMap((share) => share.timetables)
7878
.sort(sortingFunction);
79-
const allTimetables = [...myOwningTimetables, ...sharedWithMeTimetables]
80-
.map((timetable, index) => ({
81-
...timetable,
82-
isShared: index >= myOwningTimetables.length,
83-
}))
84-
.sort(sortingFunction);
8579

8680
const [errorMessage, setErrorMessage] = useState<string | null>(null);
87-
const [activeTab, setActiveTab] = useState("All");
81+
const [activeTab, setActiveTab] = useState("Mine");
8882

8983
const [selectedSharedTimetable, setSelectedSharedTimetable] =
9084
useState<Timetable | null>(null);
@@ -136,13 +130,6 @@ const Home = () => {
136130
/>
137131
<div className="mb-4 flex flex-row justify-between items-center">
138132
<div className="flex gap-4">
139-
<Button
140-
size="xs"
141-
className={`py-3 px-5 hover:bg-blue-300 text-black ${activeTab === "All" ? "bg-blue-300" : "bg-blue-100"}`}
142-
onClick={() => setActiveTab("All")}
143-
>
144-
All
145-
</Button>
146133
<Button
147134
size="xs"
148135
className={`py-3 px-5 hover:bg-blue-300 text-black ${activeTab === "Mine" ? "bg-blue-300" : "bg-blue-100"}`}
@@ -167,22 +154,6 @@ const Home = () => {
167154
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 justify-between mt-4">
168155
{isLoading ? (
169156
<p className="text-sm text-muted-foreground">Loading...</p>
170-
) : activeTab === "All" ? (
171-
allTimetables.map((timetable) => (
172-
<TimetableCard
173-
refetchMyTimetables={refetchMyTimetables}
174-
refetchSharedTimetables={refetchSharedTimetables}
175-
setErrorMessage={setErrorMessage}
176-
key={`${timetable.id}-${timetable.user_id}`}
177-
ownerId={timetable.user_id}
178-
title={timetable.timetable_title}
179-
lastEditedDate={new Date(timetable.updated_at)}
180-
isShared={timetable.isShared}
181-
timetable={timetable}
182-
setSelectedSharedTimetable={setSelectedSharedTimetable}
183-
favorite={timetable.favorite}
184-
/>
185-
))
186157
) : activeTab === "Mine" ? (
187158
myOwningTimetables.map((timetable) => (
188159
<TimetableCard

course-matrix/frontend/src/pages/Home/TimetableCardKebabMenu.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const TimetableCardKebabMenu = ({
5757
<EllipsisVertical />
5858
</Button>
5959
</DropdownMenuTrigger>
60-
6160
<DropdownMenuContent>
6261
<DropdownMenuItem>
6362
<Link to={`/dashboard/timetable?edit=${timetableId}`}>

course-matrix/frontend/src/pages/TimetableBuilder/SharedCalendar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ const SharedCalendar = React.memo<SharedCalendarProps>(
6464

6565
const courses = [
6666
...new Set(
67-
courseEvents.map((event) => event.event_name.split(" - ")[0].trim()),
67+
courseEvents.map((event) => event.event_name.split("-")[0].trim()),
6868
),
6969
];
7070
const courseToMeetingSectionMap = new Map<string, string[]>();
7171
courseEvents.forEach((event) => {
72-
const course = event.event_name.split(" - ")[0].trim();
73-
const meetingSection = event.event_name.split(" - ")[1].trim();
72+
const course = event.event_name.split("-")[0].trim();
73+
const meetingSection = event.event_name.split("-")[1].trim();
7474
if (courseToMeetingSectionMap.has(course)) {
7575
const meetingSections = courseToMeetingSectionMap.get(course);
7676
if (meetingSections) {

0 commit comments

Comments
 (0)