diff --git a/lib/contentful/pages/nm1booking.ts b/lib/contentful/pages/nm1booking.ts new file mode 100644 index 00000000..6ab451be --- /dev/null +++ b/lib/contentful/pages/nm1booking.ts @@ -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(data, "pageAbout"); +} diff --git a/next.config.js b/next.config.js index 7d66a342..458e89cf 100644 --- a/next.config.js +++ b/next.config.js @@ -12,4 +12,13 @@ module.exports = { scrollRestoration: true, }, transpilePackages: ["@radix-ui"], + async redirects() { + return [ + { + source: '/bookings', + destination: '/studio-bookings', + permanent: false, + }, + ]; + }, }; diff --git a/package.json b/package.json index 8ed54ec5..16cb0cb0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pages/nm1/bookings.tsx b/pages/nm1/bookings.tsx new file mode 100644 index 00000000..10761da5 --- /dev/null +++ b/pages/nm1/bookings.tsx @@ -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) { + return ( + + + + + + +
+
+ {/* {RenderRichTextWithImages(content)} */} +

Page under development

+
+
+
+
+ ); +} diff --git a/pages/bookings.tsx b/pages/studio-bookings.tsx similarity index 54% rename from pages/bookings.tsx rename to pages/studio-bookings.tsx index 20bb0fb5..f0360849 100644 --- a/pages/bookings.tsx +++ b/pages/studio-bookings.tsx @@ -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); @@ -11,13 +14,33 @@ export default function BookingsPage() { passwordCorrectSet(true); }, []); + useEffect(() => { + (async function () { + const Cal = await getCalApi(); + Cal("ui", { + theme: "light", + hideEventTypeDetails: false, + }); + })(); + }, []); + return ( - - + + + + {passwordCorrect ? (
- +
+ +
) : (
diff --git a/yarn.lock b/yarn.lock index 2ea5eb61..be713236 100644 --- a/yarn.lock +++ b/yarn.lock @@ -85,6 +85,26 @@ "@babel/helper-validator-identifier" "^7.22.5" to-fast-properties "^2.0.0" +"@calcom/embed-core@1.5.0": + 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/embed-snippet@1.3.0": + 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/extra-typings@9.4.1": version "9.4.1" resolved "https://registry.yarnpkg.com/@commander-js/extra-typings/-/extra-typings-9.4.1.tgz#acb75021594519799f509bde8f9210b114f1a0f1"