docs(dashboard): 📝 Add 2.0 annoucement modal
This commit is contained in:
@ -6,15 +6,17 @@ import {
|
|||||||
Portal,
|
Portal,
|
||||||
Skeleton,
|
Skeleton,
|
||||||
Stack,
|
Stack,
|
||||||
|
useDisclosure,
|
||||||
useEventListener,
|
useEventListener,
|
||||||
useToast,
|
useToast,
|
||||||
Wrap,
|
Wrap,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { useTypebotDnd } from 'contexts/TypebotDndContext'
|
import { useTypebotDnd } from 'contexts/TypebotDndContext'
|
||||||
import { Typebot } from 'models'
|
import { Typebot } from 'models'
|
||||||
import React, { useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { createFolder, useFolders } from 'services/folders'
|
import { createFolder, useFolders } from 'services/folders'
|
||||||
import { patchTypebot, useTypebots } from 'services/typebots'
|
import { patchTypebot, useTypebots } from 'services/typebots'
|
||||||
|
import { AnnoucementModal } from './annoucements/AnnoucementModal'
|
||||||
import { BackButton } from './FolderContent/BackButton'
|
import { BackButton } from './FolderContent/BackButton'
|
||||||
import { CreateBotButton } from './FolderContent/CreateBotButton'
|
import { CreateBotButton } from './FolderContent/CreateBotButton'
|
||||||
import { CreateFolderButton } from './FolderContent/CreateFolderButton'
|
import { CreateFolderButton } from './FolderContent/CreateFolderButton'
|
||||||
@ -41,6 +43,7 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
y: 0,
|
y: 0,
|
||||||
})
|
})
|
||||||
const [typebotDragCandidate, setTypebotDragCandidate] = useState<Typebot>()
|
const [typebotDragCandidate, setTypebotDragCandidate] = useState<Typebot>()
|
||||||
|
const { isOpen, onOpen, onClose } = useDisclosure()
|
||||||
|
|
||||||
const toast = useToast({
|
const toast = useToast({
|
||||||
position: 'top-right',
|
position: 'top-right',
|
||||||
@ -68,6 +71,18 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
typebots &&
|
||||||
|
typebots.length === 0 &&
|
||||||
|
folders &&
|
||||||
|
folders.length === 0 &&
|
||||||
|
folder?.id === undefined
|
||||||
|
)
|
||||||
|
onOpen()
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [typebots, folders, folder])
|
||||||
|
|
||||||
const moveTypebotToFolder = async (typebotId: string, folderId: string) => {
|
const moveTypebotToFolder = async (typebotId: string, folderId: string) => {
|
||||||
if (!typebots) return
|
if (!typebots) return
|
||||||
const { error } = await patchTypebot(typebotId, {
|
const { error } = await patchTypebot(typebotId, {
|
||||||
@ -144,6 +159,7 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex w="full" flex="1" justify="center">
|
<Flex w="full" flex="1" justify="center">
|
||||||
|
<AnnoucementModal isOpen={isOpen} onClose={onClose} />
|
||||||
<Stack w="1000px" spacing={6}>
|
<Stack w="1000px" spacing={6}>
|
||||||
<Skeleton isLoaded={folder?.name !== undefined}>
|
<Skeleton isLoaded={folder?.name !== undefined}>
|
||||||
<Heading as="h1">{folder?.name}</Heading>
|
<Heading as="h1">{folder?.name}</Heading>
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
import {
|
||||||
|
Modal,
|
||||||
|
ModalOverlay,
|
||||||
|
ModalContent,
|
||||||
|
ModalHeader,
|
||||||
|
ModalCloseButton,
|
||||||
|
ModalBody,
|
||||||
|
Text,
|
||||||
|
Stack,
|
||||||
|
Link,
|
||||||
|
} from '@chakra-ui/react'
|
||||||
|
import React, { useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
isOpen: boolean
|
||||||
|
onClose: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const localStorageKey = 'typebot-20-modal'
|
||||||
|
export const AnnoucementModal = ({ isOpen, onClose }: Props) => {
|
||||||
|
const [show, setShow] = useState(false)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!localStorage.getItem(localStorageKey)) setShow(true)
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const handleCloseClick = () => {
|
||||||
|
localStorage.setItem(localStorageKey, 'hide')
|
||||||
|
setShow(false)
|
||||||
|
onClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!show) return <></>
|
||||||
|
return (
|
||||||
|
<Modal isOpen={isOpen} onClose={handleCloseClick} size="2xl">
|
||||||
|
<ModalOverlay />
|
||||||
|
<ModalContent>
|
||||||
|
<ModalHeader>What's new in Typebot 2.0?</ModalHeader>
|
||||||
|
<ModalCloseButton />
|
||||||
|
<ModalBody as={Stack} spacing="6" pb="10">
|
||||||
|
<Text>Typebo 2.0 has been launched February the 15th 🎉.</Text>
|
||||||
|
<iframe
|
||||||
|
width="620"
|
||||||
|
height="315"
|
||||||
|
src="https://www.youtube.com/embed/u8FZHvlYviw"
|
||||||
|
title="YouTube video player"
|
||||||
|
frameBorder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
|
allowFullScreen
|
||||||
|
style={{ borderRadius: '5px' }}
|
||||||
|
/>
|
||||||
|
<Text>
|
||||||
|
Most questions are answered in this{' '}
|
||||||
|
<Link
|
||||||
|
href="https://docs.typebot.io"
|
||||||
|
color="blue.500"
|
||||||
|
textDecor="underline"
|
||||||
|
>
|
||||||
|
FAQ
|
||||||
|
</Link>
|
||||||
|
. If you have other questions, open up the bot on the bottom right
|
||||||
|
corner. 😃
|
||||||
|
</Text>
|
||||||
|
<Text>Baptiste.</Text>
|
||||||
|
</ModalBody>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
@ -9,7 +9,7 @@ import { redeemCoupon } from 'services/coupons'
|
|||||||
import { Spinner, useToast } from '@chakra-ui/react'
|
import { Spinner, useToast } from '@chakra-ui/react'
|
||||||
import { pay } from 'services/stripe'
|
import { pay } from 'services/stripe'
|
||||||
import { useUser } from 'contexts/UserContext'
|
import { useUser } from 'contexts/UserContext'
|
||||||
import { Banner } from 'components/shared/Banner'
|
import { Banner } from 'components/dashboard/annoucements/AnnoucementBanner'
|
||||||
|
|
||||||
const DashboardPage = () => {
|
const DashboardPage = () => {
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
Reference in New Issue
Block a user