Skip to content

Commit 038ca05

Browse files
committed
Changed Sub Requirement Properties, fixes DAP-54 as well
1 parent 216d23d commit 038ca05

1 file changed

Lines changed: 24 additions & 27 deletions

File tree

entrypoints/degree-audit/components/requirement-breakdown.tsx

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,22 @@ const statusIcons = {
6363
icon: (
6464
<CheckIcon className="-ml-1 text-white w-5 h-5 bg-green-500 rounded-full p-1" />
6565
),
66-
color: "bg-[var(--color-course-applied)]",
66+
color: "bg-lime-100 border-lime-200",
6767
},
6868
Planned: {
6969
icon: (
7070
<CalendarBlankIcon className="-ml-1 text-white w-5 h-5 bg-blue-500 rounded-full p-1" />
7171
),
72-
color: "bg-[var(--color-course-applied)]",
72+
color: "bg-[var(--color-course-applied)] border-gray-200",
7373
},
7474
"In Progress": {
7575
icon: null,
76-
color: "bg-[var(--color-course-in-progress)]",
76+
color: "bg-[var(--color-course-in-progress)] border-gray-200",
7777
},
7878
// TODO: make sure this is valid
7979
"Not Started": {
8080
icon: null,
81-
color: "bg-[var(--color-course-unknown)]",
81+
color: "bg-[var(--color-course-unknown)] border-gray-200",
8282
},
8383
} as const satisfies Record<
8484
PlannableStatus,
@@ -93,15 +93,15 @@ const CoursePill = ({ course }: { course: Course }) => {
9393
return (
9494
<div
9595
className={cn(
96-
"flex items-center gap-6 px-4 py-3 rounded-lg text-sm w-[80%] border border-gray-200",
96+
"flex items-center justify-between px-4 py-3 rounded-lg text-sm w-full border",
9797
statusIcons[course.status].color,
9898
)}
9999
>
100-
<span className="font-semibold min-w-[80px]">{course.code}</span>
101-
<span className="flex-1">
100+
<span className="font-semibold flex-1 text-left">{course.code}</span>
101+
<span className="flex-1 text-center font-medium">
102102
{course.name}
103103
</span>
104-
<span className="text-gray-700">
104+
<span className="flex-1 text-right text-gray-800">
105105
{isValidSemester ? course.semester : ''}
106106
{isApplied && course.grade ? ` - Grade: ${course.grade}` : ''}
107107
</span>
@@ -126,6 +126,8 @@ const parseRequirementCode = (
126126
// Individual requirement row with expandable courses
127127
const RequirementRow = ({ requirement }: { requirement: RequirementRule }) => {
128128
const { getCourseById } = useAuditContext();
129+
const { openModal } = useCourseModalContext();
130+
129131
const courses = requirement.courses.map((courseId) =>
130132
getCourseById(courseId),
131133
);
@@ -163,13 +165,22 @@ const RequirementRow = ({ requirement }: { requirement: RequirementRule }) => {
163165
</HStack>
164166
</button>
165167

166-
{/* Expanded courses */}
167-
{isExpanded && requirement.courses.length > 0 && (
168-
<VStack gap={2} className="pl-11 pr-4 pb-3 bg-white">
168+
{/* Expanded courses and add button */}
169+
{isExpanded && requirement.courses.length > 0 &&(
170+
<div className="flex flex-col items-center gap-3 px-4 pb-4 bg-white">
169171
{courses.map((course, idx) => (
170172
<CoursePill key={`${course.code}-${idx}`} course={course} />
171173
))}
172-
</VStack>
174+
175+
<Button
176+
fill="solid"
177+
className="bg-[var(--color-dap-orange)] hover:opacity-90 text-white border-none w-max px-6 py-2 rounded-md font-semibold flex items-center justify-center gap-2 mt-2"
178+
onClick={openModal}
179+
>
180+
<PlusCircleIcon className="w-5 h-5" />
181+
Add Planned Course
182+
</Button>
183+
</div>
173184
)}
174185
</div>
175186
);
@@ -230,7 +241,6 @@ type RequirementBreakdownProps = {
230241
colorIndex?: number;
231242
};
232243
const RequirementBreakdown = (props: RequirementBreakdownProps) => {
233-
const { openModal } = useCourseModalContext();
234244
const { title, hours, requirements, colorIndex = 0 } = props;
235245
const [isOpen, setIsOpen] = useState(false);
236246
const borderColor = CATEGORY_COLORS[colorIndex % CATEGORY_COLORS.length];
@@ -242,7 +252,7 @@ const RequirementBreakdown = (props: RequirementBreakdownProps) => {
242252
>
243253
{/* Main header */}
244254
<button
245-
className="w-full p-4 flex items-center justify-between hover:bg-gray-50 transition-colors bg-white"
255+
className="w-full p-4 flex items-center justify-between hover:bg-gray-50 transition-colors bg-white"
246256
onClick={() => setIsOpen(!isOpen)}
247257
>
248258
<VStack gap={1}>
@@ -277,19 +287,6 @@ const RequirementBreakdown = (props: RequirementBreakdownProps) => {
277287
/>
278288
))}
279289
</div>
280-
281-
{/* Add course button */}
282-
<div className="px-4 pb-4">
283-
<Button
284-
color="black"
285-
fill="solid"
286-
className="w-full text-base font-semibold py-3 px-6"
287-
onClick={openModal}
288-
>
289-
<PlusCircleIcon className="w-5 h-5" />
290-
Add Hypothetical Course
291-
</Button>
292-
</div>
293290
</div>
294291
)}
295292
</div>

0 commit comments

Comments
 (0)