diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a2c075d8c..93a801424 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12581,7 +12581,7 @@ snapshots: '@parcel/source-map': 2.1.1 '@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/utils': 2.12.0 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) abortcontroller-polyfill: 1.7.5 base-x: 3.0.10 browserslist: 4.24.0 @@ -12609,7 +12609,7 @@ snapshots: '@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/utils': 2.12.0 '@parcel/watcher': 2.4.1 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) transitivePeerDependencies: - '@swc/helpers' @@ -12683,7 +12683,7 @@ snapshots: '@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) '@parcel/rust': 2.12.0 '@parcel/utils': 2.12.0 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/optimizer-svgo@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))': dependencies: @@ -12715,7 +12715,7 @@ snapshots: '@parcel/node-resolver-core': 3.3.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) '@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/utils': 2.12.0 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@swc/core': 1.7.28(@swc/helpers@0.5.13) semver: 7.6.3 transitivePeerDependencies: @@ -12904,7 +12904,7 @@ snapshots: '@parcel/core': 2.12.0(@swc/helpers@0.5.13) '@parcel/plugin': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) '@parcel/utils': 2.12.0 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) nullthrows: 1.1.1 '@parcel/transformer-js@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))': @@ -12915,7 +12915,7 @@ snapshots: '@parcel/rust': 2.12.0 '@parcel/source-map': 2.1.1 '@parcel/utils': 2.12.0 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@swc/helpers': 0.5.13 browserslist: 4.24.0 nullthrows: 1.1.1 @@ -12988,7 +12988,7 @@ snapshots: '@parcel/fs': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/package-manager': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/source-map': 2.1.1 - '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13)) + '@parcel/workers': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) utility-types: 3.11.0 transitivePeerDependencies: - '@parcel/core' @@ -13066,7 +13066,7 @@ snapshots: '@parcel/watcher-win32-ia32': 2.4.1 '@parcel/watcher-win32-x64': 2.4.1 - '@parcel/workers@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))': + '@parcel/workers@2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13)': dependencies: '@parcel/core': 2.12.0(@swc/helpers@0.5.13) '@parcel/diagnostic': 2.12.0 @@ -13075,6 +13075,8 @@ snapshots: '@parcel/types': 2.12.0(@parcel/core@2.12.0(@swc/helpers@0.5.13))(@swc/helpers@0.5.13) '@parcel/utils': 2.12.0 nullthrows: 1.1.1 + transitivePeerDependencies: + - '@swc/helpers' '@peculiar/asn1-schema@2.3.13': dependencies: diff --git a/src/components/near-org/ComponentWrapperPage.tsx b/src/components/near-org/ComponentWrapperPage.tsx index 7acc273f8..1f1137d18 100644 --- a/src/components/near-org/ComponentWrapperPage.tsx +++ b/src/components/near-org/ComponentWrapperPage.tsx @@ -1,8 +1,5 @@ -import { useEffect } from 'react'; - import { VmComponent } from '@/components/vm/VmComponent'; import { useGatewayEvents } from '@/hooks/useGatewayEvents'; -import { useCurrentComponentStore } from '@/stores/current-component'; import { MetaTags } from '../MetaTags'; @@ -16,26 +13,8 @@ type Props = { }; export function ComponentWrapperPage(props: Props) { - const setCurrentComponentSrc = useCurrentComponentStore((store) => store.setSrc); const { emitGatewayEvent } = useGatewayEvents(); - useEffect(() => { - if ( - props.componentProps && - 'targetComponent' in props.componentProps && - typeof props.componentProps.targetComponent === 'string' - ) { - /* - If we're rendering a wrapper component, we want to display the component being wrapped - (props.componentProps.targetComponent). Without this check, we'd be rendering "GatewayWrapper" - or "TosCheck" as the current component instead of something like "ActivityPage". - */ - setCurrentComponentSrc(props.componentProps.targetComponent); - } else { - setCurrentComponentSrc(props.src); - } - }, [setCurrentComponentSrc, props]); - return ( <> {props.meta && } diff --git a/src/data/links.ts b/src/data/links.ts deleted file mode 100644 index 740a5cf88..000000000 --- a/src/data/links.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const links = { - discoveryDocs: 'https://discovery.near-docs.io/', - discoveryTutorial: 'https://discovery.near-docs.io/tutorial/quickstart', -}; diff --git a/src/hooks/useClearCurrentComponent.ts b/src/hooks/useClearCurrentComponent.ts deleted file mode 100644 index ae35a4a15..000000000 --- a/src/hooks/useClearCurrentComponent.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { useEffect } from 'react'; - -import { useCurrentComponentStore } from '@/stores/current-component'; - -export function useClearCurrentComponent() { - const setComponentSrc = useCurrentComponentStore((store) => store.setSrc); - - useEffect(() => { - setComponentSrc(null); - }, [setComponentSrc]); -} diff --git a/src/pages/[...arbitrary].tsx b/src/pages/[...arbitrary].tsx index 3b515f205..8beb723e6 100644 --- a/src/pages/[...arbitrary].tsx +++ b/src/pages/[...arbitrary].tsx @@ -47,7 +47,6 @@ const finiteRoutes: Record = { import IframeResizer from '@iframe-resizer/react'; import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from 'next'; -import { useClearCurrentComponent } from '@/hooks/useClearCurrentComponent'; import { useDefaultLayout } from '@/hooks/useLayout'; import type { NextPageWithLayout } from '@/utils/types'; @@ -102,7 +101,6 @@ export const getStaticProps: GetStaticProps = async (context) => { }; const IframePage: NextPageWithLayout = (props: InferGetStaticPropsType) => { - useClearCurrentComponent(); return ( <> diff --git a/src/pages/[componentAccountId]/widget/[componentName].tsx b/src/pages/[componentAccountId]/widget/[componentName].tsx index 5e1621f80..6100d71bf 100644 --- a/src/pages/[componentAccountId]/widget/[componentName].tsx +++ b/src/pages/[componentAccountId]/widget/[componentName].tsx @@ -13,7 +13,6 @@ import { useBosComponents } from '@/hooks/useBosComponents'; import { useGatewayEvents } from '@/hooks/useGatewayEvents'; import { useDefaultLayout } from '@/hooks/useLayout'; import { useSignInRedirect } from '@/hooks/useSignInRedirect'; -import { useCurrentComponentStore } from '@/stores/current-component'; import type { NextPageWithLayout } from '@/utils/types'; type ComponentMetaPreview = { @@ -92,7 +91,6 @@ export const getServerSideProps: GetServerSideProps<{ const ViewComponentPage: NextPageWithLayout = ({ meta }: InferGetServerSidePropsType) => { const router = useRouter(); - const setComponentSrc = useCurrentComponentStore((store) => store.setSrc); const componentSrc = `${router.query.componentAccountId}/widget/${router.query.componentName}`; const [componentProps, setComponentProps] = useState>({}); const { wallet, signedAccountId } = useContext(NearContext); @@ -107,10 +105,6 @@ const ViewComponentPage: NextPageWithLayout = ({ meta }: InferGetServerSideProps } }, [signedAccountId, componentProps, requestAuthentication]); - useEffect(() => { - setComponentSrc(componentSrc); - }, [setComponentSrc, componentSrc]); - useEffect(() => { setComponentProps(router.query); }, [router.query]); diff --git a/src/pages/cookies/index.tsx b/src/pages/cookies/index.tsx index a5c599001..080afc41f 100644 --- a/src/pages/cookies/index.tsx +++ b/src/pages/cookies/index.tsx @@ -1,12 +1,10 @@ import { MetaTags } from '@/components/MetaTags'; import { VmComponent } from '@/components/vm/VmComponent'; import { useBosComponents } from '@/hooks/useBosComponents'; -import { useClearCurrentComponent } from '@/hooks/useClearCurrentComponent'; import { useDefaultLayout } from '@/hooks/useLayout'; import type { NextPageWithLayout } from '@/utils/types'; const CookiesOverviewPage: NextPageWithLayout = () => { - useClearCurrentComponent(); const components = useBosComponents(); return ( diff --git a/src/pages/embed/[accountId]/widget/[componentName].tsx b/src/pages/embed/[accountId]/widget/[componentName].tsx index 8936adc1a..3a931b266 100644 --- a/src/pages/embed/[accountId]/widget/[componentName].tsx +++ b/src/pages/embed/[accountId]/widget/[componentName].tsx @@ -8,22 +8,16 @@ import { privacyDomainName, termsDomainName } from '@/config'; import { useBosComponents } from '@/hooks/useBosComponents'; import { useGatewayEvents } from '@/hooks/useGatewayEvents'; import { useSimpleLayout } from '@/hooks/useLayout'; -import { useCurrentComponentStore } from '@/stores/current-component'; import type { NextPageWithLayout } from '@/utils/types'; const EmbedComponentPage: NextPageWithLayout = () => { const router = useRouter(); const components = useBosComponents(); const { wallet } = useContext(NearContext); - const setComponentSrc = useCurrentComponentStore((store) => store.setSrc); const componentSrc = `${router.query.accountId}/widget/${router.query.componentName}`; const [componentProps, setComponentProps] = useState>({}); const { emitGatewayEvent, shouldPassGatewayEventProps } = useGatewayEvents(); - useEffect(() => { - setComponentSrc(componentSrc); - }, [setComponentSrc, componentSrc]); - useEffect(() => { setComponentProps(router.query); }, [router.query]); diff --git a/src/pages/flags.tsx b/src/pages/flags.tsx index a1a4423d1..e71a3771e 100644 --- a/src/pages/flags.tsx +++ b/src/pages/flags.tsx @@ -5,7 +5,6 @@ import type { SubmitHandler } from 'react-hook-form'; import { useForm } from 'react-hook-form'; import styled from 'styled-components'; -import { useClearCurrentComponent } from '@/hooks/useClearCurrentComponent'; import { useFlags } from '@/hooks/useFlags'; import { useDefaultLayout } from '@/hooks/useLayout'; import type { NextPageWithLayout } from '@/utils/types'; @@ -42,8 +41,6 @@ const FlagsPage: NextPageWithLayout = () => { const [flags, setFlags] = useFlags(); const form = useForm(); - useClearCurrentComponent(); - useEffect(() => { form.setValue('bosLoaderUrl', flags?.bosLoaderUrl || ''); }, [form, flags]); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index f80e5557e..89f4cbde8 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -18,6 +18,16 @@ export interface NearBlocks { total_txns: string; } +const Header = styled.div` + display: flex; + align-items: center; + justify-content: center; + min-height: 280px; + background-size: 54px; + padding: 16px 0px; + background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGeSURBVHgB7doxTisxEAbgeY/mvQro6NiSDo6QkpJbcA2OwjWooKQMJ2DpKENJBV7FEYoBeQSIZr9PGk2cItWvsdfZnSBjKHVf6rnUbdD1N8g4K7VX6jhIEaycofaTIEWwcoam0yFYOYe179WiQ7Byhk8+8wnB6munlHNWgmD1tUGyFSYIVl8bJFcOCYLV106s/aBrJ2hNE+qo1GmpRanz2J5aB6X+x/oQv/l+FWz5E/O1iHU4pom0W/u0/uoZahnrgN2VGuv6Jpidl1+o2T5BznkrfKj9MdZT6l9836r+3k2pq1KXMVNz3gpbU7hOmj49AQ7x/lJ0WWsK5xhv2+AYkHQR29vbddDluqFvbNZPQZdg9S07az4gWH3tHZVgJQhW3xjb4XIZyo+Z3nffHN79CZ1gYuXc1b4KEytFsHLGptMhWDlj7Q9BimDlbJ4Ex4AftggHdwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIpXoUVLSWulnzoAAAAASUVORK5CYII='); +`; + const StyledCard = ({ href, title, description }: { href: string; title: string; description: string }) => { return ( @@ -59,16 +69,6 @@ const HomePage: NextPageWithLayout = () => { getAvrTx(); }, [nearStats]); - const Header = styled.div` - display: flex; - align-items: center; - justify-content: center; - min-height: 280px; - background-size: 54px; - padding: 16px 0px; - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGeSURBVHgB7doxTisxEAbgeY/mvQro6NiSDo6QkpJbcA2OwjWooKQMJ2DpKENJBV7FEYoBeQSIZr9PGk2cItWvsdfZnSBjKHVf6rnUbdD1N8g4K7VX6jhIEaycofaTIEWwcoam0yFYOYe179WiQ7Byhk8+8wnB6munlHNWgmD1tUGyFSYIVl8bJFcOCYLV106s/aBrJ2hNE+qo1GmpRanz2J5aB6X+x/oQv/l+FWz5E/O1iHU4pom0W/u0/uoZahnrgN2VGuv6Jpidl1+o2T5BznkrfKj9MdZT6l9836r+3k2pq1KXMVNz3gpbU7hOmj49AQ7x/lJ0WWsK5xhv2+AYkHQR29vbddDluqFvbNZPQZdg9S07az4gWH3tHZVgJQhW3xjb4XIZyo+Z3nffHN79CZ1gYuXc1b4KEytFsHLGptMhWDlj7Q9BimDlbJ4Ex4AftggHdwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIpXoUVLSWulnzoAAAAASUVORK5CYII='); - `; - return (
diff --git a/src/pages/signin.tsx b/src/pages/signin.tsx index 8bfa261f7..a154e9247 100644 --- a/src/pages/signin.tsx +++ b/src/pages/signin.tsx @@ -6,7 +6,6 @@ import styled from 'styled-components'; import { NearContext } from '@/components/wallet-selector/WalletSelector'; import { signInContractId } from '@/config'; -import { useClearCurrentComponent } from '@/hooks/useClearCurrentComponent'; import { useDefaultLayout } from '@/hooks/useLayout'; import { useSignInRedirect } from '@/hooks/useSignInRedirect'; import signedOutRoute from '@/utils/route/signedOutRoute'; @@ -46,8 +45,6 @@ const SignInPage: NextPageWithLayout = () => { } }, [searchParams, wallet]); - useClearCurrentComponent(); - const onSubmit = handleSubmit(async (data) => { if (!data.email || !wallet) return; diff --git a/src/pages/signup.tsx b/src/pages/signup.tsx index ef877587f..340edbeda 100644 --- a/src/pages/signup.tsx +++ b/src/pages/signup.tsx @@ -8,7 +8,6 @@ import styled from 'styled-components'; import { NearContext } from '@/components/wallet-selector/WalletSelector'; import { network, signInContractId } from '@/config'; import { useDefaultLayout } from '@/hooks/useLayout'; -import { useCurrentComponentStore } from '@/stores/current-component'; import type { NextPageWithLayout } from '@/utils/types'; import { accountAddressPatternNoSubaccount, emailPattern, getEmailId, isValidEmail } from '../utils/form-validation'; @@ -19,7 +18,6 @@ const ErrorText = styled.p` const SignUpPage: NextPageWithLayout = () => { const router = useRouter(); - const setComponentSrc = useCurrentComponentStore((store) => store.setSrc); const [isAccountAvailable, setIsAccountAvailable] = useState(null); const [isAccountValid, setIsAccountValid] = useState(null); const { @@ -40,10 +38,6 @@ const SignUpPage: NextPageWithLayout = () => { } }, [router, signedAccountId]); - useEffect(() => { - setComponentSrc(null); - }, [setComponentSrc]); - const checkIsAccountAvailable = useCallback(async (desiredUsername: string) => { // set to null to show loading setIsAccountAvailable(null); diff --git a/src/stores/current-component.ts b/src/stores/current-component.ts deleted file mode 100644 index c12cb8fc6..000000000 --- a/src/stores/current-component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { create } from 'zustand'; - -type CurrentComponentStore = { - src: string | null; - setSrc: (src: string | null) => void; -}; - -export const useCurrentComponentStore = create((set) => ({ - src: null, - setSrc: (src) => set(() => ({ src })), -}));