diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/app/(website)/contact/contact.js b/app/(website)/contact/contact.js index 463e332..842f213 100644 --- a/app/(website)/contact/contact.js +++ b/app/(website)/contact/contact.js @@ -7,7 +7,7 @@ import useWeb3Forms from "@web3forms/react"; import { EnvelopeIcon, PhoneIcon, - ChatBubbleLeftRightIcon + ChatBubbleLeftRightIcon, } from "@heroicons/react/24/outline"; export default function Contact({ settings }) { const { @@ -17,9 +17,9 @@ export default function Contact({ settings }) { watch, control, setValue, - formState: { errors, isSubmitSuccessful, isSubmitting } + formState: { errors, isSubmitSuccessful, isSubmitting }, } = useForm({ - mode: "onTouched" + mode: "onTouched", }); const [isSuccess, setIsSuccess] = useState(false); const [message, setMessage] = useState(false); @@ -40,7 +40,7 @@ export default function Contact({ settings }) { onError: (msg, data) => { setIsSuccess(false); setMessage(msg); - } + }, }); return ( @@ -52,22 +52,20 @@ export default function Contact({ settings }) {

Sign-up here to become a speaker.

-
+

Contact React Denver

-

+

Have something to say? We are here to help.

{settings?.email && ( -
- - - {settings.email} - + )}
@@ -83,21 +81,22 @@ export default function Contact({ settings }) { id="" className="hidden" style={{ display: "none" }} - {...register("botcheck")}> + {...register("botcheck")} + >
{errors.name && ( @@ -117,17 +116,17 @@ export default function Contact({ settings }) { placeholder="Email Address" name="email" autoComplete="false" - className={`w-full px-4 py-3 border-2 placeholder:text-gray-800 dark:text-white rounded-md outline-none dark:placeholder:text-gray-200 dark:bg-gray-900 focus:ring-4 ${ + className={`w-full rounded-md border-2 px-4 py-3 outline-none placeholder:text-gray-800 focus:ring-4 dark:bg-gray-900 dark:text-white dark:placeholder:text-gray-200 ${ errors.email - ? "border-red-600 focus:border-red-600 ring-red-100 dark:ring-0" - : "border-gray-300 focus:border-gray-600 ring-gray-100 dark:border-gray-600 dark:focus:border-white dark:ring-0" + ? "border-red-600 ring-red-100 focus:border-red-600 dark:ring-0" + : "border-gray-300 ring-gray-100 focus:border-gray-600 dark:border-gray-600 dark:ring-0 dark:focus:border-white" }`} {...register("email", { required: "Enter your email", pattern: { value: /^\S+@\S+$/i, - message: "Please enter a valid email" - } + message: "Please enter a valid email", + }, })} /> {errors.email && ( @@ -165,9 +164,10 @@ export default function Contact({ settings }) { name="message" placeholder="Your Talk Description" className={`w-full px-4 py-3 border-2 placeholder:text-gray-800 dark:text-white dark:placeholder:text-gray-200 dark:bg-gray-900 rounded-md outline-none h-36 focus:ring-4 ${ + errors.message - ? "border-red-600 focus:border-red-600 ring-red-100 dark:ring-0" - : "border-gray-300 focus:border-gray-600 ring-gray-100 dark:border-gray-600 dark:focus:border-white dark:ring-0" + ? "border-red-600 ring-red-100 focus:border-red-600 dark:ring-0" + : "border-gray-300 ring-gray-100 focus:border-gray-600 dark:border-gray-600 dark:ring-0 dark:focus:border-white" }`} {...register("message", { required: "Enter your talk description" @@ -242,23 +242,27 @@ export default function Contact({ settings }) { + + {isSubmitSuccessful && registerSuccess && ( +
+ {"Registration Success. Here's your ticket:"} + + {ticketUrl} + +
+ )} + {registerSuccess === false && ( +
+ {"Something went wrong creating a user registration. Please try later."} +
+ )} +
+ + ); +} + +export default EventSignup; diff --git a/next.config.js b/next.config.js index e3b9c86..e47a3dd 100644 --- a/next.config.js +++ b/next.config.js @@ -3,21 +3,21 @@ const nextConfig = { reactStrictMode: true, swcMinify: true, experimental: { - appDir: true + appDir: true, }, images: { formats: ["image/avif", "image/webp"], dangerouslyAllowSVG: true, - remotePatterns: [{ hostname: "cdn.sanity.io" }] + remotePatterns: [{ hostname: "cdn.sanity.io" }], }, typescript: { // Set this to false if you want production builds to abort if there's type errors - ignoreBuildErrors: process.env.VERCEL_ENV === "production" + ignoreBuildErrors: process.env.VERCEL_ENV === "production", }, eslint: { /// Set this to false if you want production builds to abort if there's lint errors - ignoreDuringBuilds: process.env.VERCEL_ENV === "production" - } + ignoreDuringBuilds: process.env.VERCEL_ENV === "production", + }, }; module.exports = nextConfig; diff --git a/pages/api/tito-check-slug.ts b/pages/api/tito-check-slug.ts new file mode 100644 index 0000000..63deb99 --- /dev/null +++ b/pages/api/tito-check-slug.ts @@ -0,0 +1,31 @@ + +export default async function (req, res) { + const headers = { + "Access-Control-Allow-Origin": "*", + "Content-Type": "application/json", + Accept: "application/json", + Authorization: `Token token=${process.env.SECRET_ACCESS_TOKEN}`, + }; + const nextEventSlug = req.query.eventId; + const releaseDate: any = fetch( + `https://api.tito.io/v3/react-denver/${nextEventSlug}/releases`, + { headers: headers } + ) + .then((response) => response.json()) + .then((json) => { + const inPersonId = json?.releases[0].id; + const virtualId = json?.releases[1].id; + + const nextEventResponse = { + nextEvent: nextEventSlug, + inPerson: inPersonId, + virtual: virtualId, + }; + res.status(200).json(nextEventResponse); + }) + .catch((error) => { + res.json(error); + res.status(500).end(); + }); + res.status(200); +} diff --git a/pages/api/tito-create-registration.ts b/pages/api/tito-create-registration.ts new file mode 100644 index 0000000..9547e34 --- /dev/null +++ b/pages/api/tito-create-registration.ts @@ -0,0 +1,33 @@ +export default async function (req, res) { + const { registrationData, nextEvent } = JSON.parse(req.body); + const registrationDataToSend = { registration: registrationData }; + + const headers = { + "Access-Control-Allow-Origin": "*", + "Content-Type": "application/json", + Accept: "application/json", + Authorization: `Token token=${process.env.SECRET_ACCESS_TOKEN}`, + }; + + try { + const response = await fetch( + `https://api.tito.io/v3/react-denver/${nextEvent}/registrations`, + { + method: "POST", + headers: headers, + body: JSON.stringify(registrationDataToSend), + } + ) + .then((response) => response.json()) + .then((json) => { + res.status(201).json({ + ticket: json.registration.tickets[0].unique_url, + }); + }) + .catch((error) => { + console.log(`there was an error ${error}`); + }); + } catch (error) { + console.log(`Something went wrong`); + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 42a87dd..4ec617c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,11 +6,8 @@ settings: dependencies: '@headlessui/react': - specifier: ^1.7.17 + specifier: ^1.7.13 version: 1.7.17(react-dom@18.2.0)(react@18.2.0) - '@headlessui/tailwindcss': - specifier: ^0.2.0 - version: 0.2.0(tailwindcss@3.3.3) '@heroicons/react': specifier: ^2.0.17 version: 2.0.18(react@18.2.0) @@ -1120,15 +1117,6 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false - /@headlessui/tailwindcss@0.2.0(tailwindcss@3.3.3): - resolution: {integrity: sha512-fpL830Fln1SykOCboExsWr3JIVeQKieLJ3XytLe/tt1A0XzqUthOftDmjcCYLW62w7mQI7wXcoPXr3tZ9QfGxw==} - engines: {node: '>=10'} - peerDependencies: - tailwindcss: ^3.0 - dependencies: - tailwindcss: 3.3.3 - dev: false - /@heroicons/react@2.0.18(react@18.2.0): resolution: {integrity: sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==} peerDependencies: