From 059d0ec66f83b58257dce2d28d4d6925da720d4d Mon Sep 17 00:00:00 2001 From: Long Hoang Date: Fri, 16 Dec 2022 14:34:56 +0700 Subject: [PATCH] Redirect to new enterprise form --- apps/www/components/EnterpriseContactForm.tsx | 206 ------------------ apps/www/lib/redirects.js | 5 + apps/www/pages/contact/enterprise.tsx | 17 +- 3 files changed, 18 insertions(+), 210 deletions(-) delete mode 100644 apps/www/components/EnterpriseContactForm.tsx diff --git a/apps/www/components/EnterpriseContactForm.tsx b/apps/www/components/EnterpriseContactForm.tsx deleted file mode 100644 index f0eda1f785d..00000000000 --- a/apps/www/components/EnterpriseContactForm.tsx +++ /dev/null @@ -1,206 +0,0 @@ -import { Button, Form, Input, Listbox } from 'ui' -import { useState } from 'react' -import countries from '~/data/Countries.json' -import supabase from '~/lib/supabase' - -const INITIAL_VALUES = { - companyName: '', - contactFirstName: '', - contactLastName: '', - contactEmail: '', - contactPhone: '', - companySize: '', - details: '', - country: 'US', -} - -const validate = (values: any) => { - const errors: any = {} - - if (!values.companyName) { - errors.companyName = 'Required' - } - - if (!values.contactFirstName) { - errors.contactFirstName = 'Required' - } - - if (!values.contactLastName) { - errors.contactLastName = 'Required' - } - - if (!values.contactEmail) { - errors.contactEmail = 'Required' - } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(values.contactEmail)) { - errors.contactEmail = 'Invalid email address' - } - - return errors -} - -const EnterpriseContactForm = () => { - const [formSubmitted, setFormSubmitted] = useState(false) - - const handleFormSubmit = async (values: typeof INITIAL_VALUES, { resetForm }: any) => { - const { error } = await supabase.from('enterprise_contacts').insert([ - { - company_name: values.companyName, - contact_name: `${values.contactFirstName} ${values.contactLastName}`, - contact_first_name: values.contactFirstName, - contact_last_name: values.contactLastName, - contact_email: values.contactEmail, - contact_phone: values.contactPhone, - company_size: values.companySize, - details: values.details, - country: values.country, - }, - ]) - - // TODO: handle error - console.log('error:', error) - if (!error) { - resetForm() - - setFormSubmitted(true) - } - } - - return ( -
-
- {({ values, isSubmitting }: any) => { - const selectedCountry = countries.find((country) => country.code === values['country']) - const phonePlaceholder = - selectedCountry !== undefined ? `+${selectedCountry.phone_code}` : '' - - return ( -
-
- -
- -
-
- -
- -
- -
-
- -
- -
- -
- - - {'---'} - - - 1-10 Employees - - - 11-50 Employees - - - 51-200 Employees - - - 201-500 Employees - - - 501-1000 Employees - - - 1001-5000 Employees - - - 5001+ Employees - - -
- -
- -
- -
- - {countries.map(({ code, name }) => ( - - {name} - - ))} - -
- -
- -
- -
- -
-
- ) - }} -
- - {formSubmitted && ( -

Thanks, we'll reach out to you shortly.

- )} -
- ) -} - -export default EnterpriseContactForm diff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.js index d6993424732..e94dbf1ce9f 100644 --- a/apps/www/lib/redirects.js +++ b/apps/www/lib/redirects.js @@ -1877,4 +1877,9 @@ module.exports = [ source: '/docs/handbook/supasquad', destination: '/supasquad', }, + { + permanent: true, + source: '/contact/enterprise', + destination: 'https://forms.supabase.com/enterprise', + }, ] diff --git a/apps/www/pages/contact/enterprise.tsx b/apps/www/pages/contact/enterprise.tsx index 6e58c4e80f5..bb62ead0624 100644 --- a/apps/www/pages/contact/enterprise.tsx +++ b/apps/www/pages/contact/enterprise.tsx @@ -1,14 +1,23 @@ import { NextSeo } from 'next-seo' +import { useEffect } from 'react' import { useRouter } from 'next/router' -import EnterpriseContactForm from '~/components/EnterpriseContactForm' import DefaultLayout from '~/components/Layouts/Default' const meta_title = 'Enterprise Contact | Supabase' const meta_description = 'Contact Supabase for enterprise sales and pricing.' +const enterprise_form_url = 'https://forms.supabase.com/enterprise' const EnterpriseContactPage = () => { const router = useRouter() + useEffect(() => { + if (!router.isReady) { + return + } + + router.push(enterprise_form_url) + }) + return ( { />
-

Contact Enterprise Sales

- - +

+ Redirecting... Click here to get redirected immediately +

)