Skip to content

Commit 0d61015

Browse files
Add back button to PDP onboarding
Allow exiting the degree plan onboarding flow back to the most recent plan when degree plans already exist. Made-with: Cursor
1 parent 3f9de54 commit 0d61015

4 files changed

Lines changed: 58 additions & 8 deletions

File tree

frontend/degree-plan/components/FourYearPlanPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ const FourYearPlanPage = ({ updateUser, user }: FourYearPlanPageProps) => {
220220
<OnboardingPage
221221
setShowOnboardingModal={setShowOnboardingModal}
222222
setActiveDegreeplan={setActiveDegreeplan}
223+
canExit={!!degreeplans?.length}
223224
/>
224225
) : (
225226
<Row>

frontend/degree-plan/components/OnboardingPanels/CreateWithTranscriptPanel.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ type WelcomeLayoutProps = {
5151
inputtedSchools: SchoolOption[];
5252
inputtedMajors: MajorOption[];
5353
setShowOnboardingModal: (arg0: boolean) => void;
54+
canExit?: boolean;
55+
onExit?: () => void;
5456
};
5557

5658
export default function CreateWithTranscriptPanel({
@@ -62,6 +64,8 @@ export default function CreateWithTranscriptPanel({
6264
inputtedSchools,
6365
inputtedMajors,
6466
setShowOnboardingModal,
67+
canExit = false,
68+
onExit,
6569
}: WelcomeLayoutProps) {
6670
const [startingYear, setStartingYear] = useState<{
6771
label: any;
@@ -211,15 +215,31 @@ export default function CreateWithTranscriptPanel({
211215
return (
212216
<CenteredFlexContainer>
213217
<PanelContainer $maxWidth="90%" $minWidth="90%">
214-
<TextButton
215-
onClick={() => {
216-
setCurrentPage(0);
218+
<div
219+
style={{
220+
display: "flex",
221+
justifyContent: "space-between",
222+
alignItems: "center",
223+
marginLeft: "5%",
224+
marginRight: "5%",
225+
marginTop: "3%",
217226
}}
218-
style={{ marginLeft: "5%", marginTop: "3%" }}
219227
>
220-
<ArrowLeftIcon />
221-
<p>Back</p>
222-
</TextButton>
228+
<TextButton
229+
onClick={() => {
230+
setCurrentPage(0);
231+
}}
232+
>
233+
<ArrowLeftIcon />
234+
<p>Back</p>
235+
</TextButton>
236+
237+
{canExit && onExit && (
238+
<TextButton onClick={onExit}>
239+
<p>Back to plan</p>
240+
</TextButton>
241+
)}
242+
</div>
223243
<ColumnsContainer>
224244
<Column>
225245
<h1 style={{ paddingTop: "1.25%" }}>Enter your degree(s):</h1>

frontend/degree-plan/components/OnboardingPanels/WelcomePanel.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArrowRightIcon, UploadIcon } from "@radix-ui/react-icons";
1+
import { ArrowLeftIcon, ArrowRightIcon, UploadIcon } from "@radix-ui/react-icons";
22
import { Dispatch, MutableRefObject, SetStateAction } from "react";
33
import { Document, Page } from "react-pdf";
44
import {
@@ -21,6 +21,8 @@ type WelcomeLayoutProps = {
2121
transcriptDetected: MutableRefObject<boolean | null>;
2222
startingYear: { label: any; value: number } | null;
2323
setCurrentPage: Dispatch<SetStateAction<number>>;
24+
canExit?: boolean;
25+
onExit?: () => void;
2426
};
2527

2628
export default function WelcomeLayout({
@@ -33,10 +35,25 @@ export default function WelcomeLayout({
3335
transcriptDetected,
3436
startingYear,
3537
setCurrentPage,
38+
canExit = false,
39+
onExit,
3640
}: WelcomeLayoutProps) {
3741
return (
3842
<CenteredFlexContainer>
3943
<ChooseContainer $maxWidth="90%" $minWidth="90%">
44+
{canExit && onExit && (
45+
<TextButton
46+
onClick={onExit}
47+
style={{
48+
position: "absolute",
49+
left: "5%",
50+
top: "3%",
51+
}}
52+
>
53+
<ArrowLeftIcon />
54+
<p>Back</p>
55+
</TextButton>
56+
)}
4057
<div style={{ display: "none" }}>
4158
<Document
4259
file={PDF}

frontend/degree-plan/pages/OnboardingPage.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/l
2020
const OnboardingPage = ({
2121
setShowOnboardingModal,
2222
setActiveDegreeplan,
23+
canExit = false,
2324
}: {
2425
setShowOnboardingModal: (arg0: boolean) => void;
2526
setActiveDegreeplan: (arg0: DegreePlan) => void;
27+
canExit?: boolean;
2628
}) => {
2729
const [startingYear, setStartingYear] = useState<{
2830
label: any;
@@ -100,6 +102,12 @@ const OnboardingPage = ({
100102
setGraduationYear(null);
101103
};
102104

105+
const exitOnboarding = () => {
106+
resetParser();
107+
setCurrentPage(0);
108+
setShowOnboardingModal(false);
109+
};
110+
103111
if (currentPage === 0)
104112
return (
105113
<WelcomeLayout
@@ -112,6 +120,8 @@ const OnboardingPage = ({
112120
transcriptDetected={transcriptDetected}
113121
startingYear={startingYear}
114122
setCurrentPage={setCurrentPage}
123+
canExit={canExit}
124+
onExit={exitOnboarding}
115125
/>
116126
);
117127

@@ -125,6 +135,8 @@ const OnboardingPage = ({
125135
inputtedSchools={schools}
126136
inputtedMajors={majors}
127137
setShowOnboardingModal={setShowOnboardingModal}
138+
canExit={canExit}
139+
onExit={exitOnboarding}
128140
/>
129141
);
130142
};

0 commit comments

Comments
 (0)