diff --git a/apps/index/app/home-page.tsx b/apps/index/app/home-page.tsx index de3d80eb..26c71a52 100644 --- a/apps/index/app/home-page.tsx +++ b/apps/index/app/home-page.tsx @@ -1,6 +1,7 @@ 'use client' import Footer from '@/components/Footer' import HomeDemo from '@/components/HomeDemo' +import {typeformAtom} from '@/store/core' import { Box, Button, @@ -10,8 +11,9 @@ import { alpha, keyframes, } from '@mui/material' +import {useAtom} from 'jotai' import {NextPage} from 'next' -import {FORM_URL, LITEPAPER_URL} from '../constants' +import {LITEPAPER_URL} from '../constants' import HomeBar from './home-bar' const textOpen = keyframes` @@ -24,6 +26,7 @@ const textOpen = keyframes` ` const Page: NextPage = () => { + const [typeform] = useAtom(typeformAtom) return ( @@ -75,10 +78,11 @@ const Page: NextPage = () => { diff --git a/apps/index/components/GlobalStyles.tsx b/apps/index/components/GlobalStyles.tsx index 97f98242..0a86e2c4 100644 --- a/apps/index/components/GlobalStyles.tsx +++ b/apps/index/components/GlobalStyles.tsx @@ -7,6 +7,7 @@ import { lighten, type Theme, } from '@mui/material' +import '@typeform/embed/build/css/popup.css' import {type FC} from 'react' const talismanConnectStyles = (theme: Theme): SerializedStyles => css` diff --git a/apps/index/components/HomeDemo/Progress.tsx b/apps/index/components/HomeDemo/Progress.tsx index c34d9899..46537069 100644 --- a/apps/index/components/HomeDemo/Progress.tsx +++ b/apps/index/components/HomeDemo/Progress.tsx @@ -1,6 +1,6 @@ 'use client' /* eslint-disable @typescript-eslint/naming-convention */ -import {currentTaskAtom, fromChainAtom} from '@/store/core' +import {currentTaskAtom, fromChainAtom, typeformAtom} from '@/store/core' import { Chip, CircularProgress, @@ -17,7 +17,6 @@ import { } from '@mui/material' import {useAtom} from 'jotai' import {useMemo, type FC} from 'react' -import {FORM_URL} from '../../constants' const activeProps = { StepIconComponent: () => , @@ -28,6 +27,7 @@ const Progress: FC = ({ solution, ...props }) => { + const [typeform] = useAtom(typeformAtom) const [currentTask] = useAtom(currentTaskAtom) const [fromChain] = useAtom(fromChainAtom) // const {data: simulateResults} = useSimulateResults() @@ -79,7 +79,13 @@ const Progress: FC = ({ {steps == null ? ( Oops, It’s currently not been supported yet,{' '} - + { + typeform.survey.open() + }} + > tell us what you want . diff --git a/apps/index/components/HomeDemo/index.tsx b/apps/index/components/HomeDemo/index.tsx index 583b9332..4c3720dc 100644 --- a/apps/index/components/HomeDemo/index.tsx +++ b/apps/index/components/HomeDemo/index.tsx @@ -1,4 +1,5 @@ 'use client' +import {typeformAtom} from '@/store/core' import {ArrowUpward, PlayArrow, Replay} from '@mui/icons-material' import {LoadingButton} from '@mui/lab' import { @@ -14,10 +15,10 @@ import { Typography, alpha, } from '@mui/material' +import {useAtom} from 'jotai' import {useEffect, useState, type FC} from 'react' import useSWRMutation from 'swr/mutation' import wretch from 'wretch' -import {FORM_URL} from '../../constants' import Confirmation from './Confirmation' import Progress from './Progress' @@ -61,6 +62,7 @@ async function apiFetcher( } const HomeDemo: FC = () => { + const [typefrom] = useAtom(typeformAtom) const [fromChain, setFromChain] = useState() const [toChain, setToChain] = useState() const [fromAmount, setFromAmount] = useState() @@ -132,7 +134,13 @@ const HomeDemo: FC = () => { - + { + typefrom.survey.open() + }} + > Share your thoughts on inDEX by taking a quick survey. diff --git a/apps/index/constants.ts b/apps/index/constants.ts index d13b557f..b5099f73 100644 --- a/apps/index/constants.ts +++ b/apps/index/constants.ts @@ -1,2 +1,3 @@ -export const FORM_URL = 'https://n599e53glte.typeform.com/to/IYgPw9cs' +export const WAITLIST_FORM_ID = 'w1QYBd8V' +export const SURVEY_FORM_ID = 'IYgPw9cs' export const LITEPAPER_URL = 'https://docsend.com/view/xp62vjpi25nxddpj' diff --git a/apps/index/package.json b/apps/index/package.json index 5b477955..1b1e9359 100644 --- a/apps/index/package.json +++ b/apps/index/package.json @@ -28,6 +28,7 @@ "@talismn/connect-components": "^1.1.7", "@talismn/connect-ui": "^1.1.2", "@talismn/connect-wallets": "^1.2.3", + "@typeform/embed": "^4.4.0", "decimal.js": "^10.4.3", "ethers": "^6.9.0", "jotai": "^2.6.0", diff --git a/apps/index/store/core.ts b/apps/index/store/core.ts index 6a726743..32fb2f43 100644 --- a/apps/index/store/core.ts +++ b/apps/index/store/core.ts @@ -2,8 +2,10 @@ import {assetMap, assets, type Asset} from '@/config/common' import {ERROR_MESSAGES, type Error} from '@/config/error' import {type Client, type EvmChain, type SubstrateChain} from '@phala/index' import {polkadotAccountAtom} from '@phala/store' +import {createPopup} from '@typeform/embed' import {atom} from 'jotai' import {atomWithReset, atomWithStorage} from 'jotai/utils' +import {SURVEY_FORM_ID, WAITLIST_FORM_ID} from '../constants' import {evmAccountAtom} from './ethers' const getAssets = (chainId: string): Asset[] => { @@ -112,3 +114,8 @@ export const errorMessageAtom = atom((get) => { if (error === null) return null return ERROR_MESSAGES[error] }) + +export const typeformAtom = atom({ + waitlist: createPopup(WAITLIST_FORM_ID, {size: 70}), + survey: createPopup(SURVEY_FORM_ID, {size: 70}), +}) diff --git a/yarn.lock b/yarn.lock index 2d65a642..54a70cc4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3923,6 +3923,7 @@ __metadata: "@talismn/connect-components": "npm:^1.1.7" "@talismn/connect-ui": "npm:^1.1.2" "@talismn/connect-wallets": "npm:^1.2.3" + "@typeform/embed": "npm:^4.4.0" "@types/js-cookie": "npm:^3.0.6" "@types/lodash-es": "npm:^4.17.12" "@types/node": "npm:^18.18.13" @@ -5876,6 +5877,13 @@ __metadata: languageName: node linkType: hard +"@typeform/embed@npm:^4.4.0": + version: 4.4.0 + resolution: "@typeform/embed@npm:4.4.0" + checksum: 87bbca22434992f7104482a7240d87015415da136dbc2b7b61676d42c9fa327e1993739369d95d6a25c2af32be73fff019dc62b34759c9e365e3e2c218118471 + languageName: node + linkType: hard + "@types/aria-query@npm:^5.0.1": version: 5.0.3 resolution: "@types/aria-query@npm:5.0.3"