(dashboard): 💅 Add access to v1 banner

This commit is contained in:
Baptiste Arnaud
2022-02-14 16:55:06 +01:00
parent 56bd5fafc3
commit 1fbe324e43
3 changed files with 50 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
import { Flex, HStack, StackProps } from '@chakra-ui/layout'
import { CloseButton } from '@chakra-ui/react'
import React, { useEffect, useState } from 'react'
type VerifyEmailBannerProps = { id: string } & StackProps
export const Banner = ({ id, ...props }: VerifyEmailBannerProps) => {
const [show, setShow] = useState(false)
const localStorageKey = `banner-${id}`
useEffect(() => {
if (!localStorage.getItem(localStorageKey)) setShow(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const handleCloseClick = () => {
localStorage.setItem(localStorageKey, 'hide')
setShow(false)
}
if (!show) return <></>
return (
<HStack
h="50px"
bgColor="blue.400"
color="white"
justifyContent="center"
align="center"
w="full"
{...props}
>
<Flex maxW="1000px" justifyContent="space-between" w="full">
<HStack>{props.children}</HStack>
<CloseButton rounded="full" onClick={handleCloseClick} />
</Flex>
</HStack>
)
}

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react'
import { Flex, Stack } from '@chakra-ui/layout'
import { Flex, Link, Stack, Text } from '@chakra-ui/layout'
import { DashboardHeader } from 'components/dashboard/DashboardHeader'
import { Seo } from 'components/Seo'
import { FolderContent } from 'components/dashboard/FolderContent'
@@ -9,6 +9,7 @@ import { redeemCoupon } from 'services/coupons'
import { Spinner, useToast } from '@chakra-ui/react'
import { pay } from 'services/stripe'
import { useUser } from 'contexts/UserContext'
import { Banner } from 'components/shared/Banner'
const DashboardPage = () => {
const [isLoading, setIsLoading] = useState(false)
@@ -50,6 +51,14 @@ const DashboardPage = () => {
return (
<Stack minH="100vh">
<Banner id={'v1-navigation'}>
<Text>
You are on Typebot 2.0. To access the old version, navigate to
</Text>
<Link href="https://old.typebot.io" isExternal textDecor="underline">
https://old.typebot.io
</Link>
</Banner>
<Seo title="My typebots" />
<DashboardHeader />
<TypebotDndContext>