Skip to content

Commit 31265cb

Browse files
added empty state to semester card. Abandoned splitting planned and real hour percentages in split since insufficient data on course credits
1 parent fcf6bc0 commit 31265cb

1 file changed

Lines changed: 41 additions & 31 deletions

File tree

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,55 @@
11
import Dropdown, {
2-
DropdownContent,
3-
DropdownHeader,
2+
DropdownContent,
3+
DropdownHeader,
44
} from "@/entrypoints/components/common/dropdown";
55
import { HStack, VStack } from "@/entrypoints/components/common/helperdivs";
66
import CourseCard from "@/entrypoints/components/course-card";
77
import { Course } from "@/lib/general-types";
88

99
export interface SemesterCardProps {
10-
semester: string;
11-
courses: Course[];
10+
semester: string;
11+
courses: Course[];
1212
}
1313

1414
const SemesterCard = ({ semester, courses }: SemesterCardProps) => {
15-
const totalHours = courses.reduce((acc, course) => acc + course.hours, 0);
15+
const totalHours = courses.reduce((acc, course) => acc + course.hours, 0);
1616

17-
return (
18-
<Dropdown
19-
className="w-sm p-6 rounded-lg border border-gray-200 bg-[#FAFAF9]"
20-
gap={6}
21-
>
22-
<DropdownHeader>
23-
<HStack y="middle" x="between" fill>
24-
<h2 className="text-lg text-dap-orange font-bold">{semester}</h2>
25-
<h2 className="text-sm">{`${totalHours} hours`}</h2>
26-
</HStack>
27-
</DropdownHeader>
28-
<DropdownContent className="w-full pb-6 max-h-86 overflow-y-auto">
29-
<VStack fill className="w-full" gap={4}>
30-
{courses.map((course) => (
31-
<CourseCard
32-
className="w-full"
33-
key={course.code}
34-
fullName={course.name}
35-
courseName={course.code}
36-
color="orange"
37-
/>
38-
))}
39-
</VStack>
40-
</DropdownContent>
41-
</Dropdown>
42-
);
17+
return (
18+
<Dropdown
19+
className="w-sm p-6 rounded-lg border border-gray-200 bg-[#FAFAF9]"
20+
gap={6}
21+
>
22+
<DropdownHeader>
23+
<HStack y="middle" x="between" fill>
24+
<h2 className="text-lg text-dap-orange font-bold">{semester}</h2>
25+
<h2 className="text-sm">{`${totalHours} hours`}</h2>
26+
</HStack>
27+
</DropdownHeader>
28+
<DropdownContent className="w-full max-h-86 overflow-y-auto">
29+
<VStack fill className="w-full" gap={4}>
30+
{courses.length > 0 ? (
31+
courses.map((course) => (
32+
<CourseCard
33+
className="w-full"
34+
key={course.code}
35+
fullName={course.name}
36+
courseName={course.code}
37+
color="orange"
38+
/>
39+
))
40+
) : (
41+
<VStack
42+
centered
43+
className="max-h-[16.5rem] text-ut-charcoal/50 h-[16.5rem] text-lg font-bold border-dashed border border-black rounded-md py-4 px-6 bg-white"
44+
fillWidth
45+
>
46+
Drag and drop courses here
47+
</VStack>
48+
)}
49+
</VStack>
50+
</DropdownContent>
51+
</Dropdown>
52+
);
4353
};
4454

4555
export default SemesterCard;

0 commit comments

Comments
 (0)