Skip to content

Commit

Permalink
Revert "Hide pool deal creation + disable participation buttons (#1066)"
Browse files Browse the repository at this point in the history
This reverts commit 7450f98.
  • Loading branch information
0xlinus committed Aug 7, 2023
1 parent 1af6218 commit 3cf6a17
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 23 deletions.
10 changes: 0 additions & 10 deletions middleware.ts

This file was deleted.

64 changes: 64 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
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)

Expand All @@ -23,6 +46,47 @@ const Home: NextPage = () => {
<title>Aelin - Pools List</title>
</Head>
<LeftSidebarLayout>
<Container>
<SectionIntro
backgroundImage={
isLizardTheme ? `/resources/lizards/violet-lizard.png` : `/resources/svg/bg-deals.svg`
}
backgroundPosition="100% 110%"
backgroundSize={isLizardTheme ? '100px 85px' : 'auto auto'}
button={[
{
title: 'Create deal',
onClick: () => 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.
</SectionIntro>
<SectionIntro
backgroundImage={
isLizardTheme ? `/resources/lizards/green-lizard.png` : `/resources/svg/bg-pools.svg`
}
backgroundPosition={isLizardTheme ? '100% 100%' : '100% 120px'}
backgroundSize={isLizardTheme ? '100px 85px' : 'auto auto'}
button={[
{
title: 'Create pool',
onClick: () => 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.
</SectionIntro>
</Container>

<VouchedPools />
{!isLizardTheme && <ListWithFilters userPoolsInvested={userResponse?.poolsInvested} />}
</LeftSidebarLayout>
Expand Down
12 changes: 11 additions & 1 deletion src/components/pools/actions/AcceptDeal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,17 @@ function AcceptDeal({ pool }: Props) {
setValue={setTokenInputValue}
value={tokenInputValue}
/>
<ButtonGradient disabled={true} onClick={handleAcceptDeal}>
<ButtonGradient
disabled={
!address ||
!isAppConnected ||
isSubmitting ||
!tokenInputValue ||
BigNumber.from(tokenInputValue).eq(0) ||
Boolean(inputError)
}
onClick={handleAcceptDeal}
>
Accept deal
</ButtonGradient>
</Wrapper>
Expand Down
7 changes: 6 additions & 1 deletion src/components/pools/actions/Approve.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ export default function Approve({
{allowance && symbol && <Allowance allowance={allowance} symbol={symbol} />}
<Contents>{description}</Contents>
<ButtonsWrapper>
<ButtonGradient disabled={true} onClick={approveInvestmentToken}>
<ButtonGradient
disabled={
!address || !isAppConnected || isSubmitting || noEnoughBalance || !userBalance?.gt(0)
}
onClick={approveInvestmentToken}
>
Approve
</ButtonGradient>
</ButtonsWrapper>
Expand Down
18 changes: 14 additions & 4 deletions src/components/pools/actions/Deposit/Deposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,23 @@ function Deposit({ pool, poolHelpers }: Props) {
/>
)}
<ButtonsWrapper>
<ButtonGradient disabled={true} onClick={depositTokens}>
<ButtonGradient
disabled={
!address ||
!isAppConnected ||
poolHelpers.capReached ||
isSubmitting ||
!tokenInputValue ||
Boolean(inputError) ||
(pool.hasNftList && !hasStoredSelectedNft) ||
isHiddenPool(pool.address)
}
onClick={depositTokens}
>
Deposit
</ButtonGradient>
{pool.hasNftList && (
<ButtonGradient disabled={true} onClick={handleOpenNftSelectionModal}>
Select NFT
</ButtonGradient>
<ButtonGradient onClick={handleOpenNftSelectionModal}>Select NFT</ButtonGradient>
)}
</ButtonsWrapper>
</>
Expand Down
15 changes: 11 additions & 4 deletions src/components/pools/actions/Deposit/DepositDirectDeal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,24 @@ function DepositDirectDeal({ pool, poolHelpers }: Props) {

<ButtonsWrapper>
<ButtonGradient
disabled={true}
disabled={
!address ||
!isAppConnected ||
poolHelpers.capReached ||
isSubmitting ||
!tokenInputValue ||
Boolean(inputError) ||
(pool.hasNftList && !hasStoredSelectedNft) ||
isHiddenPool(pool.address)
}
onClick={() => {
depositTokens()
}}
>
{pool?.upfrontDeal ? 'Accept Deal' : 'Deposit'}
</ButtonGradient>
{pool.hasNftList && (
<ButtonGradient disabled={true} onClick={handleOpenNftSelectionModal}>
Select NFT
</ButtonGradient>
<ButtonGradient onClick={handleOpenNftSelectionModal}>Select NFT</ButtonGradient>
)}
</ButtonsWrapper>
</>
Expand Down
5 changes: 4 additions & 1 deletion src/components/pools/actions/HolderDeposit/HolderDeposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ function HolderDeposit({ pool }: Props) {
return (
<>
<ButtonsWrapper>
<ButtonGradient disabled={true} onClick={depositTokens}>
<ButtonGradient
disabled={!isAppConnected || isSubmitting || disabledAfterDeposit || noEnoughBalance}
onClick={depositTokens}
>
Fund Deal
</ButtonGradient>
</ButtonsWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ function HolderDepositUpfrontDeal({ pool }: Props) {
return (
<>
<ButtonsWrapper>
<ButtonGradient disabled={true} onClick={depositTokens}>
<ButtonGradient
disabled={!isAppConnected || isSubmitting || disabledAfterDeposit || noEnoughBalance}
onClick={depositTokens}
>
Fund Deal
</ButtonGradient>
</ButtonsWrapper>
Expand Down
5 changes: 4 additions & 1 deletion src/components/pools/actions/Vouch/Vouch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ const Vouch: React.FC<{ pool: ParsedAelinPool }> = genericSuspense(({ pool }) =>
<>Vouching not supported</>
)}
</Contents>
<VouchButton disabled={true} onClick={handleVouchClick}>
<VouchButton
disabled={!userAddress || isSubmitting || !supportsVouch || wrongNetwork}
onClick={handleVouchClick}
>
{hasVouched ? 'Disavow' : 'Vouch'}
</VouchButton>
<SeeAllButton disabled={!supportsVouch} onClick={handleOpenVouchersModal}>
Expand Down

1 comment on commit 3cf6a17

@vercel
Copy link

@vercel vercel bot commented on 3cf6a17 Aug 7, 2023

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:

aelin-ui-v2 – ./

aelin-ui-v2-aelin.vercel.app
aelin-ui-v2-git-main-aelin.vercel.app
app.aelin.xyz

Please sign in to comment.