Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Persist data from Personal Info in Available Sessions Page #292

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import React, {
useRef,
useEffect,
useMemo,
SetStateAction,
Dispatch,
} from "react";
import { CampResponse, CampSession } from "../../../../types/CampsTypes";
import {
Expand Down Expand Up @@ -43,6 +45,8 @@ import { EDLP_PLACEHOLDER_TIMESLOT } from "../../../../constants/RegistrationCon

type RegistrationStepsProps = {
camp: CampResponse;
campers: RegistrantExperienceCamper[];
setCampers: Dispatch<SetStateAction<RegistrantExperienceCamper[]>>;
orderedSelectedSessions: CampSession[];
waiver: WaiverType;
waitlistedCamper?: WaitlistedCamper;
Expand All @@ -52,6 +56,8 @@ type RegistrationStepsProps = {

const RegistrationSteps = ({
camp,
campers,
setCampers,
orderedSelectedSessions: selectedSessions,
waiver,
onClickBack,
Expand All @@ -71,30 +77,6 @@ const RegistrationSteps = ({

const [isEditing, setIsEditing] = useState(0);

const [campers, setCampers] = useState<RegistrantExperienceCamper[]>([
{
firstName: "",
lastName: "",
age: NaN,
contacts: [
{
firstName: "",
lastName: "",
email: "",
phoneNumber: "",
relationshipToCamper: "",
},
{
firstName: "",
lastName: "",
email: "",
phoneNumber: "",
relationshipToCamper: "",
},
],
optionalClauses: [],
},
]);

const [
requireEarlyDropOffLatePickup,
Expand Down
30 changes: 29 additions & 1 deletion frontend/src/components/pages/RegistrantExperience/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import RegistrationResultPage from "./RegistrationResult";
import RegistrationSteps from "./RegistrationSteps";
import SessionSelection from "./SessionSelection";
import AdminAPIClient from "../../../APIClients/AdminAPIClient";
import { WaitlistedCamper } from "../../../types/CamperTypes";
import { RegistrantExperienceCamper, WaitlistedCamper } from "../../../types/CamperTypes";
import { Waiver as WaiverType } from "../../../types/AdminTypes";
import { sortSessions } from "../../../utils/CampUtils";
import WaitlistExperiencePage from "../WaitlistExperience";
Expand Down Expand Up @@ -59,6 +59,32 @@ const RegistrantExperiencePage = (): React.ReactElement => {
CheckoutData | undefined
>(undefined);

const [campers, setCampers] = useState<RegistrantExperienceCamper[]>([
{
firstName: "",
lastName: "",
age: NaN,
contacts: [
{
firstName: "",
lastName: "",
email: "",
phoneNumber: "",
relationshipToCamper: "",
},
{
firstName: "",
lastName: "",
email: "",
phoneNumber: "",
relationshipToCamper: "",
},
],
optionalClauses: [],
},
]);


const getCurrentStep = () => {
switch (currentStep) {
case "loading":
Expand All @@ -82,6 +108,8 @@ const RegistrantExperiencePage = (): React.ReactElement => {
return (
<RegistrationSteps
camp={camp as CampResponse}
campers={campers}
setCampers={setCampers}
orderedSelectedSessions={sortSessions(
(camp as CampResponse).campSessions.filter((session) =>
selectedSessions.has(session.id),
Expand Down