The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add enterprise contact form
Alaister Young47f929fa0479
diff --git a/www/components/EnterpriseContactForm.tsx b/www/components/EnterpriseContactForm.tsxnew file mode 100644index 00000000000..e817c39e265--- /dev/null+++ b/www/components/EnterpriseContactForm.tsx@@ -0,0 +1,161 @@+import { Button, Form, Input, Select } from '@supabase/ui'+import { useState } from 'react'+import countries from '~/data/Countries.json'+import supabase from '~/lib/supabase'++const INITIAL_VALUES = {+ companyName: '',+ contactName: '',+ contactEmail: '',+ contactPhone: '',+ companySize: '',+ details: '',+ country: 'US',+}++const validate = (values: any) => {+ const errors: any = {}++ if (!values.companyName) {+ errors.companyName = 'Required'+ }++ if (!values.contactName) {+ errors.contactName = '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<boolean>(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.contactName,+ contact_email: values.contactEmail,+ contact_phone: values.contactPhone,+ company_size: values.companySize,+ details: values.details,+ country: values.country,+ },+ ],+ { returning: 'minimal' }+ )++ // TODO: handle error+ console.log('error:', error)+ if (!error) {+ resetForm()++ setFormSubmitted(true)+ }+ }++ return (+ <div>+ <Form initialValues={INITIAL_VALUES} validate={validate} onSubmit={handleFormSubmit}>+ {({ isSubmitting }: any) => (+ <div className="flex flex-col space-y-4">+ <div>+ <Input+ label="Company Name *"+ id="companyName"+ name="companyName"+ layout="vertical"+ placeholder="Supa Inc."+ />+ </div>++ <div>+ <Input+ label="Your Name *"+ id="contactName"+ name="contactName"+ layout="vertical"+ placeholder="Jane Doe"+ />+ </div>++ <div>+ <Input+ label="Your Business Email *"+ id="contactEmail"+ name="contactEmail"+ layout="vertical"+ placeholder="[email protected]"+ />+ </div>++ <div>+ <Select label="Company Size" id="companySize" name="companySize" layout="vertical">+ <Select.Option value="">{'--'}</Select.Option>+ <Select.Option value="1-10">1-10 Employees</Select.Option>+ <Select.Option value="11-50">11-50 Employees</Select.Option>+ <Select.Option value="51-200">51-200 Employees</Select.Option>+ <Select.Option value="201-500">201-500 Employees</Select.Option>+ <Select.Option value="501-1000">501-1000 Employees</Select.Option>+ <Select.Option value="1001-5000">1001-5000 Employees</Select.Option>+ <Select.Option value="5001+">5001+ Employees</Select.Option>+ </Select>+ </div>++ <div>+ <Input+ label="Your Phone Number"+ id="contactPhone"+ name="contactPhone"+ layout="vertical"+ placeholder="+65 1234 1234"+ />+ </div>++ <div>+ <Select label="Country / Main Timezone" id="country" name="country" layout="vertical">+ {countries.map(({ code, name }) => (+ <Select.Option value={code}>{name}</Select.Option>+ ))}+ </Select>+ </div>++ <div className="">+ <Input.TextArea+ id="details"+ name="details"+ label="Additional Details"+ placeholder="Tell us about your projects, clients, and technology..."+ rows={10}+ />+ </div>++ <div className="flex flex-row-reverse w-full col-span-2 pt-4">+ <Button+ size="xlarge"+ disabled={isSubmitting}+ loading={isSubmitting}+ htmlType="submit"+ >+ Send+ </Button>+ </div>+ </div>+ )}+ </Form>++ {formSubmitted && (+ <h3 className="mt-12 text-center h3">Thanks, we'll reach out to you shortly.</h3>+ )}+ </div>+ )+}++export default EnterpriseContactFormdiff --git a/www/pages/contact/enterprise.tsx b/www/pages/contact/enterprise.tsxnew file mode 100644index 00000000000..96fbf7f47f1--- /dev/null+++ b/www/pages/contact/enterprise.tsx@@ -0,0 +1,36 @@+import { NextSeo } from 'next-seo'+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 EnterpriseContactPage = () => {+ const router = useRouter()++ return (+ <DefaultLayout>+ <NextSeo+ title={meta_title}+ description={meta_description}+ openGraph={{+ title: meta_title,+ description: meta_description,+ url: `https://supabase.com/${router.pathname}`,+ images: [+ {+ url: `https://supabase.com/images/og/og-image.jpg`,+ },+ ],+ }}+ />++ <div className="max-w-xl px-4 mx-auto my-16 md:my-20 lg:my-24 xl:my-32">+ <EnterpriseContactForm />+ </div>+ </DefaultLayout>+ )+}++export default EnterpriseContactPagediff --git a/www/pages/pricing/index.tsx b/www/pages/pricing/index.tsxindex 12693ca4aed..83936b0d2a3 100644--- a/www/pages/pricing/index.tsx+++ b/www/pages/pricing/index.tsx@@ -61,7 +61,7 @@ export default function IndexPage() {},{name: 'Enterprise',- href: 'mailto:[email protected]',+ href: '/contact/enterprise',description: 'For large-scale applications managing serious workloads.',features: ['Point in time recovery',@@ -459,7 +459,7 @@ export default function IndexPage() {Designated support team, account manager and technical specialist</p>- <Link href="mailto:[email protected]" as="mailto:[email protected]">+ <Link href="/contact/enterprise"><a><Button size="medium" type="default">Contact Us@@ -515,7 +515,7 @@ export default function IndexPage() {</td><td className="px-6 pt-5">- <Link href="mailto:[email protected]" as="mailto:[email protected]">+ <Link href="/contact/enterprise"><a><Button size="medium" type="default" block>Contact usdiff --git a/www/schema.sql b/www/schema.sqlindex 3445399df14..eb956aa59aa 100644--- a/www/schema.sql+++ b/www/schema.sql@@ -49,3 +49,18 @@ alter table partners enable row level security;create policy "Enable public read access" on partners for select using (true);+create table enterprise_contacts (+ id bigint generated by default as identity primary key,+ created_at timestamp with time zone default timezone('utc'::text, now()) not null,+ company_name text not null,+ contact_name text not null,+ contact_email text not null,+ contact_phone text,+ company_size text,+ details text,+ country text+);+alter table enterprise_contacts enable row level security;++create policy "Enable public insert" on enterprise_contacts for insert with check (true);+