2
0
Files
bot/apps/builder/src/features/blocks/integrations/googleSheets/components/GoogleSheetsConnectModal.tsx

78 lines
2.0 KiB
TypeScript
Raw Normal View History

import {
Modal,
ModalOverlay,
ModalContent,
ModalHeader,
ModalCloseButton,
ModalBody,
Stack,
Text,
Image,
Button,
ModalFooter,
Flex,
} from '@chakra-ui/react'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
2022-11-02 19:45:46 +01:00
import Link from 'next/link'
import React from 'react'
import { AlertInfo } from '@/components/AlertInfo'
import { GoogleLogo } from '@/components/GoogleLogo'
import { getGoogleSheetsConsentScreenUrlQuery } from '../queries/getGoogleSheetsConsentScreenUrlQuery'
type Props = {
isOpen: boolean
2022-06-11 07:27:38 +02:00
blockId: string
onClose: () => void
}
2022-06-11 07:27:38 +02:00
export const GoogleSheetConnectModal = ({
blockId,
isOpen,
onClose,
}: Props) => {
2022-05-13 15:22:44 -07:00
const { workspace } = useWorkspace()
return (
<Modal isOpen={isOpen} onClose={onClose} size="lg">
<ModalOverlay />
<ModalContent>
<ModalHeader>Connect Spreadsheets</ModalHeader>
<ModalCloseButton />
<ModalBody as={Stack} spacing="6">
<AlertInfo>
Typebot needs access to Google Drive in order to list all your
spreadsheets. It also needs access to your spreadsheets in order to
fetch or inject data in it.
</AlertInfo>
<Text>
Make sure to check all the permissions so that the integration works
as expected:
</Text>
<Image
src="/images/google-spreadsheets-scopes.jpeg"
alt="Google Spreadsheets checkboxes"
/>
<Flex>
<Button
2022-11-02 19:45:46 +01:00
as={Link}
leftIcon={<GoogleLogo />}
data-testid="google"
isLoading={['loading', 'authenticated'].includes(status)}
variant="outline"
href={getGoogleSheetsConsentScreenUrlQuery(
window.location.href,
2022-06-11 07:27:38 +02:00
blockId,
2022-05-13 15:22:44 -07:00
workspace?.id
)}
mx="auto"
>
Continue with Google
</Button>
</Flex>
</ModalBody>
<ModalFooter />
</ModalContent>
</Modal>
)
}