Skip to content

Commit

Permalink
(dashboard): 💅 Add access to v1 banner
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Feb 14, 2022
1 parent 56bd5fa commit 1fbe324
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
38 changes: 38 additions & 0 deletions apps/builder/components/shared/Banner.tsx
Original file line number Diff line number Diff line change
@@ -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>
)
}
11 changes: 10 additions & 1 deletion apps/builder/pages/typebots.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions apps/landing-page/assets/icons/CloseIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { SVGProps } from "react";
import React, { SVGProps } from 'react'

export const CloseIcon = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand All @@ -10,4 +10,4 @@ export const CloseIcon = (props: SVGProps<SVGSVGElement>) => (
<title>Close Circle</title>
<path d="M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm75.31 260.69a16 16 0 11-22.62 22.62L256 278.63l-52.69 52.68a16 16 0 01-22.62-22.62L233.37 256l-52.68-52.69a16 16 0 0122.62-22.62L256 233.37l52.69-52.68a16 16 0 0122.62 22.62L278.63 256z" />
</svg>
);
)

3 comments on commit 1fbe324

@vercel
Copy link

@vercel vercel bot commented on 1fbe324 Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

typebot-viewer.vercel.app
viewer-v2-typebot-io.vercel.app
viewer-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 1fbe324 Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

landing-page-v2 – ./apps/landing-page

landing-page-v2-git-main-typebot-io.vercel.app
landing-page-v2-jade.vercel.app
landing-page-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 1fbe324 Feb 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
next.typebot.io

Please sign in to comment.