2
0

refactor: ♻️ Toast component

This commit is contained in:
Baptiste Arnaud
2022-06-02 07:54:48 +02:00
parent 43fb8a7be0
commit 12f2e40152
26 changed files with 148 additions and 177 deletions

View File

@ -1,6 +1,7 @@
import { Flex, useDisclosure, useToast } from '@chakra-ui/react'
import { Flex, useDisclosure } from '@chakra-ui/react'
import { StatsCards } from 'components/analytics/StatsCards'
import { Graph } from 'components/shared/Graph'
import { useToast } from 'components/shared/hooks/useToast'
import { UpgradeModal } from 'components/shared/modals/UpgradeModal'
import { GraphProvider } from 'contexts/GraphContext'
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
@ -11,14 +12,10 @@ import { useAnswersCount } from 'services/analytics'
export const AnalyticsContent = ({ stats }: { stats?: Stats }) => {
const { isOpen, onOpen, onClose } = useDisclosure()
const { typebot, publishedTypebot } = useTypebot()
const toast = useToast({
position: 'top-right',
status: 'error',
})
const { showToast } = useToast()
const { answersCounts } = useAnswersCount({
typebotId: publishedTypebot && typebot?.id,
onError: (err) => toast({ title: err.name, description: err.message }),
onError: (err) => showToast({ title: err.name, description: err.message }),
})
return (
<Flex