From 1fbe324e4396b562a52d01d9cd99111eebccdb80 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 14 Feb 2022 16:55:06 +0100 Subject: [PATCH] =?UTF-8?q?(dashboard):=20=F0=9F=92=85=20Add=20access=20to?= =?UTF-8?q?=20v1=20banner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/builder/components/shared/Banner.tsx | 38 ++++++++++++++++++++ apps/builder/pages/typebots.tsx | 11 +++++- apps/landing-page/assets/icons/CloseIcon.tsx | 4 +-- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 apps/builder/components/shared/Banner.tsx diff --git a/apps/builder/components/shared/Banner.tsx b/apps/builder/components/shared/Banner.tsx new file mode 100644 index 000000000..20b66fc14 --- /dev/null +++ b/apps/builder/components/shared/Banner.tsx @@ -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 ( + + + {props.children} + + + + ) +} diff --git a/apps/builder/pages/typebots.tsx b/apps/builder/pages/typebots.tsx index abbd013b5..9a0ba71ed 100644 --- a/apps/builder/pages/typebots.tsx +++ b/apps/builder/pages/typebots.tsx @@ -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 ( + + + You are on Typebot 2.0. To access the old version, navigate to + + + https://old.typebot.io + + diff --git a/apps/landing-page/assets/icons/CloseIcon.tsx b/apps/landing-page/assets/icons/CloseIcon.tsx index 8c1a3dedd..8b11310e7 100644 --- a/apps/landing-page/assets/icons/CloseIcon.tsx +++ b/apps/landing-page/assets/icons/CloseIcon.tsx @@ -1,4 +1,4 @@ -import React, { SVGProps } from "react"; +import React, { SVGProps } from 'react' export const CloseIcon = (props: SVGProps) => ( ) => ( Close Circle -); +)