Skip to content

Commit f342b1d

Browse files
committed
Add sticky navbar and side panels, update GPA cards styling
- Make navbar sticky at top with z-index and white background - Add sticky positioning to side panels in audit and planner pages - Use completion percentage from context instead of calculating - Add shadow to GPA and Credit Hour cards
1 parent beeb49a commit f342b1d

5 files changed

Lines changed: 19 additions & 16 deletions

File tree

entrypoints/degree-audit/components/degree-audit-page.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const SidePanel = () => {
1010
const { sections } = useAuditContext();
1111

1212
// Find GPA Totals section
13-
const gpaSection = sections.find(
14-
(section) => section.title.toLowerCase().includes("gpa"),
13+
const gpaSection = sections.find((section) =>
14+
section.title.toLowerCase().includes("gpa"),
1515
);
1616

1717
// Extract GPA values from first rule (if exists)
@@ -20,7 +20,12 @@ const SidePanel = () => {
2020
const currentGPA = gpaRule?.appliedHours ?? 0.0;
2121

2222
return (
23-
<VStack fill className="h-full" y="stretch" x="center">
23+
<VStack
24+
fill
25+
className="h-full sticky top-[75px] z-20 bg-white"
26+
y="stretch"
27+
x="center"
28+
>
2429
<SimpleDegreeCompletionDonut size={300} />
2530
<VStack gap={4} className="w-sm mt-10">
2631
<GPATotalsCard
@@ -61,7 +66,9 @@ const MainContent = () => {
6166
<Title text="Degree Progress Overview" />
6267
{nonGPASections.map((section) => {
6368
// Find the correct progress index from original sections array
64-
const originalIdx = sections.findIndex((s) => s.title === section.title);
69+
const originalIdx = sections.findIndex(
70+
(s) => s.title === section.title,
71+
);
6572
const sectionProgress = progresses.sections[originalIdx];
6673

6774
return (

entrypoints/degree-audit/components/degree-completion-donut.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useAuditContext } from "./audit-provider";
77
import { CATEGORY_COLORS } from "./requirement-breakdown";
88

99
const DegreeCompletionDonut = (styleProps: GraphStyleProps) => {
10-
const { progresses } = useAuditContext();
10+
const { progresses, completion } = useAuditContext();
1111
const bars = progresses.sections
1212
.filter((section) => section.progress.total > 0)
1313
.sort((a, b) => b.progress.total - a.progress.total)
@@ -17,9 +17,7 @@ const DegreeCompletionDonut = (styleProps: GraphStyleProps) => {
1717
percentage: section.progress,
1818
})) satisfies Bar[];
1919

20-
const overallPercentage = Math.round(
21-
(progresses.total.current / progresses.total.total) * 100,
22-
);
20+
const overallPercentage = completion;
2321

2422
return (
2523
<MultiDonutGraph
@@ -61,7 +59,7 @@ const DegreeCompletionDonut = (styleProps: GraphStyleProps) => {
6159
};
6260

6361
export const SimpleDegreeCompletionDonut = (styleProps: GraphStyleProps) => {
64-
const { progresses } = useAuditContext();
62+
const { progresses, completion } = useAuditContext();
6563
const bars = progresses.sections
6664
.filter((section) => section.progress.total > 0)
6765
.sort((a, b) => b.progress.total - a.progress.total)
@@ -71,9 +69,7 @@ export const SimpleDegreeCompletionDonut = (styleProps: GraphStyleProps) => {
7169
percentage: section.progress,
7270
})) satisfies Bar[];
7371

74-
const overallPercentage = Math.round(
75-
(progresses.total.current / progresses.total.total) * 100,
76-
);
72+
const overallPercentage = completion;
7773

7874
return (
7975
<MultiDonutGraph {...styleProps} bars={bars}>

entrypoints/degree-audit/components/degree-planner-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SemesterCard from "./semester-card";
1515

1616
const SidePanel = () => {
1717
return (
18-
<VStack fill className="h-full" y="stretch" x="center">
18+
<VStack fill className="h-full sticky top-[75px] z-20 bg-white" y="stretch" x="center">
1919
<SimpleDegreeCompletionDonut size={300} />
2020
<div className="w-sm mt-10 p-3 rounded-lg border border-gray-200 bg-[#FAFAF9]">
2121
<CourseSearchContent />

entrypoints/degree-audit/components/gpa-credit-cards.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const GPATotalsCard = ({
1414
points = 320,
1515
}: GPATotalsProps) => {
1616
return (
17-
<div className="p-5 rounded-lg border border-gray-200 bg-white">
17+
<div className="p-5 rounded-lg border border-gray-200 bg-white shadow-md">
1818
<HStack x="between" y="top" fill>
1919
<h3 className="text-xl font-bold text-gray-900">GPA Totals</h3>
2020
<img src="/Info.svg" alt="Info" className="w-6 h-6 cursor-pointer" />
@@ -70,7 +70,7 @@ export const CreditHourTotalsCard = ({
7070
],
7171
}: CreditHourTotalsProps) => {
7272
return (
73-
<div className="p-5 rounded-lg border border-gray-200 bg-white">
73+
<div className="p-5 rounded-lg border border-gray-200 bg-white shadow-md">
7474
<h3 className="text-xl font-bold text-gray-900">Credit Hour Totals</h3>
7575

7676
<VStack gap={3} className="mt-4">

entrypoints/degree-audit/components/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const Navbar = () => {
3030
fill
3131
x="between"
3232
y="middle"
33-
className="border-b-2 border-gray-100 px-10 py-2"
33+
className="border-b-2 border-gray-100 px-10 py-2 sticky top-0 z-10 bg-white"
3434
style={{
3535
height: "75px",
3636
}}

0 commit comments

Comments
 (0)