mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
104 lines
3.5 KiB
TypeScript
104 lines
3.5 KiB
TypeScript
import { useState } from 'react'
|
|
import { toast } from 'sonner'
|
|
import { Button } from 'ui'
|
|
|
|
import {
|
|
ScaffoldSection,
|
|
ScaffoldSectionContent,
|
|
ScaffoldSectionDetail,
|
|
} from '@/components/layouts/Scaffold'
|
|
import { InlineLink } from '@/components/ui/InlineLink'
|
|
import { TextConfirmModal } from '@/components/ui/TextConfirmModalWrapper'
|
|
import { useDpaRequestMutation } from '@/data/documents/dpa-request-mutation'
|
|
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
|
|
import { useProfile } from '@/lib/profile'
|
|
import { useTrack } from '@/lib/telemetry/track'
|
|
|
|
export const DPA = () => {
|
|
const { profile } = useProfile()
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
const slug = organization?.slug
|
|
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
|
|
const track = useTrack()
|
|
const { mutate: requestDpa, isPending: isRequesting } = useDpaRequestMutation({
|
|
onSuccess: () => {
|
|
toast.success('DPA request sent successfully')
|
|
setIsOpen(false)
|
|
},
|
|
})
|
|
|
|
const onConfirmRequest = async () => {
|
|
if (!slug) return toast.error('Organization not found.')
|
|
if (!profile?.primary_email) return toast.error('Profile email not found.')
|
|
requestDpa({ recipient_email: profile?.primary_email, slug: slug })
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<ScaffoldSection className="py-12">
|
|
<ScaffoldSectionDetail>
|
|
<h4 className="mb-5">Data Processing Addendum (DPA)</h4>
|
|
<div className="space-y-2 text-sm text-foreground-light [&_p]:m-0">
|
|
<p>
|
|
All organizations can sign our Data Processing Addendum ("DPA") as part of their GDPR
|
|
compliance.
|
|
</p>
|
|
<p>
|
|
You can review a static PDF version of our latest DPA document{' '}
|
|
<InlineLink
|
|
href="https://supabase.com/downloads/docs/Supabase+DPA+260601.pdf"
|
|
onClick={() => track('dpa_pdf_opened', { source: 'studio' })}
|
|
>
|
|
here
|
|
</InlineLink>
|
|
.
|
|
</p>
|
|
</div>
|
|
</ScaffoldSectionDetail>
|
|
<ScaffoldSectionContent>
|
|
<div className="@lg:flex items-center justify-center h-full">
|
|
<Button
|
|
onClick={() => {
|
|
setIsOpen(true)
|
|
track('dpa_request_button_clicked')
|
|
}}
|
|
variant="default"
|
|
>
|
|
Request DPA
|
|
</Button>
|
|
</div>
|
|
</ScaffoldSectionContent>
|
|
</ScaffoldSection>
|
|
|
|
<TextConfirmModal
|
|
visible={isOpen}
|
|
title="Request executable DPA to sign"
|
|
loading={isRequesting}
|
|
confirmPlaceholder="Enter your email address"
|
|
confirmString={profile?.primary_email ?? ''}
|
|
confirmLabel="Send DPA request"
|
|
errorMessage="Email must match your account email."
|
|
onCancel={() => setIsOpen(false)}
|
|
onConfirm={() => onConfirmRequest()}
|
|
>
|
|
<div className="space-y-2 text-sm">
|
|
<p>
|
|
To make the DPA legally binding, you need to sign and complete the details through a
|
|
PandaDoc document that we prepare.
|
|
</p>
|
|
<p>
|
|
Please enter your email address to request an executable version of the DPA. You will
|
|
receive a document link via PandaDoc in the next 24 hours.
|
|
</p>
|
|
<p>
|
|
Once signed, the DPA will be considered executed and you'll be notified of any future
|
|
updates via this email.
|
|
</p>
|
|
</div>
|
|
</TextConfirmModal>
|
|
</>
|
|
)
|
|
}
|