Skip to content

Commit

Permalink
Feature new pages aug (#140)
Browse files Browse the repository at this point in the history
* add booking pages for nm1 and oona dj

* add password to and change url of bookings page

* put nm1 page under dev for now

* update page title for studio bookings page

* add redirect from /bookings to /studio-bookings
  • Loading branch information
antiantivirus authored Sep 17, 2024
1 parent fb7ebc0 commit 2bcd757
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 3 deletions.
47 changes: 47 additions & 0 deletions lib/contentful/pages/nm1booking.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { graphql } from "..";
import { AboutPageData } from "../../../types/shared";
import { extractPage } from "../../../util";

export async function getNM1BookingPage(preview: boolean) {
const AboutPageQuery = /* GraphQL */ `
query AboutPageQuery($preview: Boolean) {
pageAbout(id: "7nZvcNfNVRrZGs6x42RV3l", preview: $preview) {
coverImage {
sys {
id
}
title
description
url
width
height
}
content {
json
links {
assets {
block {
sys {
id
}
contentType
title
description
url
width
height
}
}
}
}
}
}
`;

const data = await graphql(AboutPageQuery, {
variables: { preview },
preview,
});

return extractPage<AboutPageData>(data, "pageAbout");
}
9 changes: 9 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ module.exports = {
scrollRestoration: true,
},
transpilePackages: ["@radix-ui"],
async redirects() {
return [
{
source: '/bookings',
destination: '/studio-bookings',
permanent: false,
},
];
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
]
},
"dependencies": {
"@calcom/embed-react": "^1.5.0",
"@contentful/rich-text-from-markdown": "^15.16.2",
"@contentful/rich-text-plain-text-renderer": "^16.0.2",
"@contentful/rich-text-react-renderer": "^15.16.2",
Expand Down
41 changes: 41 additions & 0 deletions pages/nm1/bookings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { InferGetStaticPropsType } from "next";
import Layout from "../../components/layout";
import Prose from "../../components/Prose";
import PageMeta from "../../components/seo/page";
import { getNM1BookingPage } from "../../lib/contentful/pages/nm1booking";
import { RenderRichTextWithImages } from "../../lib/rich-text";
import SinglePage from "../../views/singlePage";
import Head from "next/head";

export async function getStaticProps({ preview = false }) {
return {
props: {
preview,
...(await getNM1BookingPage(preview)),
},
revalidate: 60 * 60 * 24,
};
}

export default function AboutPage({
preview,
coverImage,
content,
}: InferGetStaticPropsType<typeof getStaticProps>) {
return (
<Layout preview={preview} pageId="7nZvcNfNVRrZGs6x42RV3l">
<Head>
<meta name="robots" content="noindex,nofollow" />
</Head>
<PageMeta title="NM1 Bookings | Refuge Worldwide" path="/nm1/bookings/" />
<SinglePage coverImage={coverImage}>
<section>
<div className="container-md p-4 sm:p-8 bg-white">
{/* <Prose>{RenderRichTextWithImages(content)}</Prose> */}
<p>Page under development</p>
</div>
</section>
</SinglePage>
</Layout>
);
}
29 changes: 26 additions & 3 deletions pages/bookings.tsx → pages/studio-bookings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import BookingPasswordForm from "../components/bookingForm";
import CalendlyEmbed from "../components/calendly";
import Layout from "../components/layout";
import PageMeta from "../components/seo/page";
import Cal, { getCalApi } from "@calcom/embed-react";
import { useEffect } from "react";
import Head from "next/head";

export default function BookingsPage() {
const [passwordCorrect, passwordCorrectSet] = useState(false);
Expand All @@ -11,13 +14,33 @@ export default function BookingsPage() {
passwordCorrectSet(true);
}, []);

useEffect(() => {
(async function () {
const Cal = await getCalApi();
Cal("ui", {
theme: "light",
hideEventTypeDetails: false,
});
})();
}, []);

return (
<Layout>
<PageMeta title="Bookings | Refuge Worldwide" path="bookings/" />

<Head>
<meta name="robots" content="noindex,nofollow" />
</Head>
<PageMeta
title="Studio Bookings | Refuge Worldwide"
path="studio-bookings/"
/>
{passwordCorrect ? (
<section>
<CalendlyEmbed shouldInit={passwordCorrect} />
<section className="">
<Cal
className="pt-24 pb-4 min-h-[75vh]"
calLink="refugeworldwide"
></Cal>
</section>
</section>
) : (
<section className="py-48 md:py-72">
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@
"@babel/helper-validator-identifier" "^7.22.5"
to-fast-properties "^2.0.0"

"@calcom/[email protected]":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@calcom/embed-core/-/embed-core-1.5.0.tgz#e9f4f23569aa0e0d132b2abc013fc799d84b2578"
integrity sha512-2R+u9tpsKl87AfNkZa2q+bZy4qM4wVNwU4xmlAXg2x9/vI8uhm7MmzctV1SdyhzR5jlwa5iD62+pzVQTgoj6ZA==

"@calcom/embed-react@^1.5.0":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@calcom/embed-react/-/embed-react-1.5.0.tgz#843f7ae07c12d7edc18121f3ee72818eed8524d7"
integrity sha512-HREjDsEu9cEuhbB0aP1nqzw+aW3J1LOutCap/i5EGGfAoxUQDvWekDViE8zFk9lsQ0HKZRBaSc73AsG6bc0B3Q==
dependencies:
"@calcom/embed-core" "1.5.0"
"@calcom/embed-snippet" "1.3.0"

"@calcom/[email protected]":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@calcom/embed-snippet/-/embed-snippet-1.3.0.tgz#4ec87efaabf3fcdc7d7ce811017a52d708542052"
integrity sha512-g/JnC02VpDHIDLdRWbrh3/L2xLTTph46zojeH6y7O2GXAqQIDtCDOqakmng2zhvoLHt+cs7KuiiN4a/r+CswKg==
dependencies:
"@calcom/embed-core" "1.5.0"

"@commander-js/[email protected]":
version "9.4.1"
resolved "https://registry.yarnpkg.com/@commander-js/extra-typings/-/extra-typings-9.4.1.tgz#acb75021594519799f509bde8f9210b114f1a0f1"
Expand Down

0 comments on commit 2bcd757

Please sign in to comment.