Skip to content

Commit

Permalink
confirmation page text changes for walkins
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Sep 30, 2024
1 parent 1d6226c commit 50a360b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
5 changes: 4 additions & 1 deletion booking-app/app/book/confirmation/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// app/book/confirmation/page.tsx
import BookingFormConfirmationPage from "@/components/src/client/routes/booking/formPages/BookingFormConfirmationPage";
import { FormContextLevel } from "@/components/src/types";
import React from "react";

const Role: React.FC = () => <BookingFormConfirmationPage />;
const Role: React.FC = () => (
<BookingFormConfirmationPage formContext={FormContextLevel.FULL_FORM} />
);

export default Role;
10 changes: 10 additions & 0 deletions booking-app/app/walk-in/confirmation/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// app/walk-in/confirmation/page.tsx
import BookingFormConfirmationPage from "@/components/src/client/routes/booking/formPages/BookingFormConfirmationPage";
import { FormContextLevel } from "@/components/src/types";
import React from "react";

const Role: React.FC = () => (
<BookingFormConfirmationPage formContext={FormContextLevel.WALK_IN} />
);

export default Role;
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ export default function FormInput({ calendarEventId, formContext }: Props) {

// setFormData(data);
registerEvent(data, isAutoApproval, calendarEventId);
// // TODO confirmation page for walk-in
router.push("/book/confirmation");
router.push(isWalkIn ? "/walk-in/confirmation" : "/book/confirmation");
};

const fullFormFields = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Error, Event } from "@mui/icons-material";
import React, { useContext } from "react";

import { BookingContext } from "../bookingProvider";
import { FormContextLevel } from "@/components/src/types";
import Loading from "../../components/Loading";
import { styled } from "@mui/system";
import { useRouter } from "next/navigation";
Expand All @@ -18,11 +19,17 @@ const Centered = styled(Box)`
height: 55vh;
`;

export default function BookingFormConfirmationPage() {
interface Props {
formContext: FormContextLevel;
}

export default function BookingFormConfirmationPage({ formContext }: Props) {
const { submitting } = useContext(BookingContext);
const router = useRouter();
const theme = useTheme();

const isWalkIn = formContext === FormContextLevel.WALK_IN;

// don't submit form via useEffect here b/c it submits twice in development strict mode

if (submitting === "submitting") {
Expand All @@ -38,7 +45,9 @@ export default function BookingFormConfirmationPage() {
>
<Loading />
</Box>
<Typography variant="h6">Submitting your booking request...</Typography>
<Typography variant="h6">
Submitting {isWalkIn ? "walk-in" : "your booking"} request...
</Typography>
</Centered>
);
}
Expand All @@ -59,7 +68,9 @@ export default function BookingFormConfirmationPage() {
</Typography>
</Box>
<Typography variant="h6" sx={{ padding: 3 }}>
Yay! We've received your booking request
{isWalkIn
? "Walk-in submitted"
: "Yay! We've received your booking request"}
</Typography>
<Box
sx={{
Expand All @@ -70,15 +81,15 @@ export default function BookingFormConfirmationPage() {
}}
>
<Button
onClick={() => router.push("/")}
onClick={() => router.push(isWalkIn ? "/pa" : "/")}
variant="text"
sx={{
background: theme.palette.primary[50],
color: theme.palette.primary.main,
}}
>
<Event />
View My Bookings
View Bookings
</Button>
</Box>
</Centered>
Expand All @@ -99,7 +110,7 @@ export default function BookingFormConfirmationPage() {
<Error />
</Box>
<Typography variant="h6">
Sorry, an error occured while submitting your booking
Sorry, an error occured while submitting this request
</Typography>
</Centered>
);
Expand Down

0 comments on commit 50a360b

Please sign in to comment.