Files
supabase/apps/studio/components/interfaces/Auth/ThirdPartyAuthForm/AddIntegrationDropdown.tsx
Ivan Vasilov 9ac44f5985 feat: Add Third Party Auth settings (#27564)
* Add queries and mutations for third party auth.

* Show the ThirdPartyAuth form in the auth settings.

* Minor fixes to the mutations.

* Add a comment for TODO.

* Add all components for third party auth.

* Minor fixes.

* Update the firebase icons.

* Update the api-types.

* Fix the barrel file imports.

* Make the sheets more intuitive.

* Add a dialog for adding RLS policies for the firebase integration.

* Hide the 3rd party auth section behind a form.

* Fix a type error.

* Update the wording on the Add RLS policy dialog.

* Replace the sheets with dialogs.

* Add fixes for the comments on github.

* Minor fixes.

* Fix a type error.

* Make the delete integration awaitable.
2024-07-25 11:07:09 +02:00

57 lines
1.5 KiB
TypeScript

import { ChevronDown } from 'lucide-react'
import Image from 'next/image'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from 'ui'
import {
INTEGRATION_TYPES,
getIntegrationTypeIcon,
getIntegrationTypeLabel,
} from './ThirdPartyAuthForm.utils'
interface AddIntegrationDropdownProps {
buttonText?: string
onSelectIntegrationType: (type: INTEGRATION_TYPES) => void
}
const Providers: INTEGRATION_TYPES[] = ['firebase', 'auth0', 'awsCognito']
export const AddIntegrationDropdown = ({
onSelectIntegrationType,
}: AddIntegrationDropdownProps) => {
return (
<DropdownMenu modal={false}>
<DropdownMenuTrigger asChild>
<Button type="primary" iconRight={<ChevronDown size={14} strokeWidth={1} />}>
Add provider
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{Providers.map((type) => {
const name = getIntegrationTypeLabel(type)
return (
<DropdownMenuItem
key={name}
onClick={() => onSelectIntegrationType(type)}
className="flex items-center gap-x-2 p-2"
>
<Image
src={getIntegrationTypeIcon(type)}
width={16}
height={16}
alt={`${name} icon`}
/>
<span>{name}</span>
</DropdownMenuItem>
)
})}
</DropdownMenuContent>
</DropdownMenu>
)
}