From eb741e74d4173c33df24e4fb0969c64efe88a902 Mon Sep 17 00:00:00 2001 From: Linuz Date: Tue, 1 Aug 2023 16:08:54 +0200 Subject: [PATCH] remove create pool/deal sections + redirect w/middleware --- middleware.ts | 10 +++++++ pages/index.tsx | 64 --------------------------------------------- src/web3/onboard.ts | 1 + 3 files changed, 11 insertions(+), 64 deletions(-) create mode 100644 middleware.ts diff --git a/middleware.ts b/middleware.ts new file mode 100644 index 00000000..f3691abd --- /dev/null +++ b/middleware.ts @@ -0,0 +1,10 @@ +import { NextResponse } from 'next/server' +import type { NextRequest } from 'next/server' + +export function middleware(request: NextRequest) { + const url = request.nextUrl.clone() + if (url.pathname === '/pool/create' || url.pathname === '/deal/create') { + url.pathname = '/' + return NextResponse.redirect(url) + } +} diff --git a/pages/index.tsx b/pages/index.tsx index 0aa2f78a..96d1f7d6 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,38 +1,15 @@ import type { NextPage } from 'next' import Head from 'next/head' -import { useRouter } from 'next/router' -import styled from 'styled-components' import { LeftSidebarLayout } from '@/src/components/layout/LeftSidebarLayout' import { ListWithFilters } from '@/src/components/pools/list/ListWithFilters' import { VouchedPools } from '@/src/components/pools/list/Vouched' -import { ButtonType } from '@/src/components/pureStyledComponents/buttons/Button' -import { SectionIntro as BaseSectionIntro } from '@/src/components/section/SectionIntro' import { ThemeType } from '@/src/constants/types' import useAelinUser from '@/src/hooks/aelin/useAelinUser' import { useThemeContext } from '@/src/providers/themeContextProvider' import { useWeb3Connection } from '@/src/providers/web3ConnectionProvider' -const Container = styled.div` - display: flex; - flex-direction: row; - width: 100%; - gap: 1.5rem; -` - -const SectionIntro = styled(BaseSectionIntro)` - display: flex; - flex-direction: column; - flex: 1 1 0px; - justify-content: space-between; - - @media (min-width: ${({ theme }) => theme.themeBreakPoints.tabletPortraitStart}) { - max-height: 260px; - } -` - const Home: NextPage = () => { - const router = useRouter() const { address } = useWeb3Connection() const { data: userResponse } = useAelinUser(address) @@ -46,47 +23,6 @@ const Home: NextPage = () => { Aelin - Pools List - - router.push('/deal/create'), - type: ButtonType.Secondary, - }, - ]} - title="Deals" - > - Direct Deals are for new and established protocols looking to raise capital from - investors at pre-established deal terms. Aelin Deals allow for customizable features, - such as a defined vesting period and a vesting cliff. - - router.push('/pool/create'), - type: ButtonType.Primary, - }, - ]} - title="Pools" - > - Pools are for protocols/sponsors that don't have set deal terms yet but are gauging - investor interest. Pools are best suited for protocols without a set target valuation - and sponsors using Aelin to source a future deal. Aelin Pools are most similar to SPACs. - - - {!isLizardTheme && } diff --git a/src/web3/onboard.ts b/src/web3/onboard.ts index a437e0b2..76e6d509 100644 --- a/src/web3/onboard.ts +++ b/src/web3/onboard.ts @@ -19,6 +19,7 @@ const injected = injectedModule() const gnosis = gnosisModule() const walletConnect = walletConnectModule({ projectId: WALLET_CONNECT_PROJECT_ID, version: 2 }) const coinbase = coinbaseModule() +// @ts-ignore const ledger = ledgerModule({ projectId: WALLET_CONNECT_PROJECT_ID, walletConnectVersion: 2 }) const trezor = trezorModule({ email: EMAIL_CONTACT,