-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: app router - /bookings status page (#18183)
* chore: app router - /bookings page * remove env vars * fix * Update middleware.ts * revert unneeded change * refactor for the better * fix
- Loading branch information
Showing
10 changed files
with
35 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { PageProps } from "app/_types"; | ||
import { _generateMetadata } from "app/_utils"; | ||
import { WithLayout } from "app/layoutHOC"; | ||
import { redirect } from "next/navigation"; | ||
import { z } from "zod"; | ||
|
||
import { validStatuses } from "~/bookings/lib/validStatuses"; | ||
import BookingsList from "~/bookings/views/bookings-listing-view"; | ||
|
||
const querySchema = z.object({ | ||
status: z.enum(validStatuses), | ||
}); | ||
|
||
export const generateMetadata = async () => | ||
await _generateMetadata( | ||
(t) => t("bookings"), | ||
(t) => t("bookings_description") | ||
); | ||
|
||
export const generateStaticParams = async () => { | ||
return validStatuses.map((status) => ({ status })); | ||
}; | ||
|
||
const Page = async ({ params, searchParams }: PageProps) => { | ||
const parsed = querySchema.safeParse({ ...params, ...searchParams }); | ||
if (!parsed.success) { | ||
redirect("/bookings/upcoming"); | ||
} | ||
|
||
return <BookingsList status={parsed.data.status} />; | ||
}; | ||
|
||
export default WithLayout({ ServerPage: Page })<"P">; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
apps/web/modules/bookings/views/bookings-listing-view.getStaticProps.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters