Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨Feature: Pools page #580

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/component/liquidity.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../styles/globals.css';
import MockRouter from '../utils/router';
import Providers from 'components/Providers/Providers';
import AddLiquidityComponent from 'components/Liquidity/Add/AddLiquidityComponent';
import AddLiquidityComponent from 'components/Pools/Add/AddLiquidityComponent';
import { mockedFreighterConnector, sleep, testnetXLM } from '../utils/utils';
import { useApiTokens } from 'hooks/tokens/useApiTokens';

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/flows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ describe('Navigation flow', () => {
cy.visit('/');
cy.get('[data-testid="navbar__container"]').click();
// cy.wait(1500);
cy.contains('Liquidity').click();
cy.contains('Pools').click();
// cy.wait(3000);
cy.contains('List of your liquidity positions');
cy.contains('Liquidity pools');
});
it('should navigate to bridge', () => {
cy.visit('/');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"react-window": "^1.8.9",
"redux": "^4.2.1",
"soroswap-router-sdk": "1.4.6",
"soroswap-ui": "^1.0.0",
"soroswap-ui": "^1.1.0",
"swr": "^2.2.0",
"typescript": "5.3.3",
"use-resize-observer": "^9.1.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useSorobanReact } from '@soroban-react/core';
import AddLiquidityComponent from 'components/Liquidity/Add/AddLiquidityComponent';
import AddLiquidityComponent from 'components/Pools/Add/AddLiquidityComponent';
import SEO from 'components/SEO';
import { xlmTokenList } from 'constants/xlmToken';
import { useRouter } from 'next/router';
Expand Down
4 changes: 2 additions & 2 deletions pages/liquidity/add/index.tsx → pages/pools/add/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AddLiquidityComponent from 'components/Liquidity/Add/AddLiquidityComponent';
import AddLiquidityComponent from 'components/Pools/Add/AddLiquidityComponent';
import SEO from 'components/SEO';
import { useApiTokens } from 'hooks/tokens/useApiTokens';
import { useRouter } from 'next/router';
Expand All @@ -12,7 +12,7 @@ export default function AddLiquidityPage() {
if (!tokens) return;

const xlm = tokens.find((token) => token.code === 'XLM');
if (xlm) router.push(`/liquidity/add/${xlm.contract}`);
if (xlm) router.push(`/pools/add/${xlm.contract}`);
}, [tokens, router]);

return (
Expand Down
37 changes: 26 additions & 11 deletions pages/liquidity/index.tsx → pages/pools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useSorobanReact } from '@soroban-react/core';
import { ButtonPrimary } from 'components/Buttons/Button';
import { WalletButton } from 'components/Buttons/WalletButton';
import { AutoColumn } from 'components/Column';
import LiquidityPoolInfoModal from 'components/Liquidity/LiquidityPoolInfoModal';
import { LPPercentage } from 'components/Liquidity/styleds';
import LiquidityPoolInfoModal from 'components/Pools/LiquidityPoolInfoModal';
import { LPPercentage } from 'components/Pools/styleds';
import CurrencyLogo from 'components/Logo/CurrencyLogo';
import { Dots } from 'components/Pool/styleds';
import { AutoRow } from 'components/Row';
Expand All @@ -18,6 +18,9 @@ import { useContext, useState } from 'react';
import SEO from '../../src/components/SEO';
import { DEFAULT_SLIPPAGE_INPUT_VALUE } from 'components/Settings/MaxSlippageSettings';

import { PoolsTable } from 'components/Pools/PoolsTable';


const PageWrapper = styled(AutoColumn)`
position: relative;
background: ${({ theme }) => `linear-gradient(${theme.palette.customBackground.bg2}, ${theme.palette.customBackground.bg2
Expand All @@ -29,8 +32,8 @@ const PageWrapper = styled(AutoColumn)`
border-radius: 16px;
padding: 32px;
transition: transform 250ms ease;
max-width: 875px;
width: 100%;
max-width: 99vw;
width: 95vw;
display: flex;
flex-direction: column;
align-items: center;
Expand Down Expand Up @@ -76,6 +79,7 @@ const StatusWrapper = styled('div')`
border-radius: 16px;
`;


export default function LiquidityPage() {
const sorobanContext = useSorobanReact();
const { address } = sorobanContext;
Expand All @@ -102,15 +106,19 @@ export default function LiquidityPage() {
return (
<>
<SEO title="Liquidity - Soroswap" description="Soroswap Liquidity Pool" />
<PageWrapper>
<PageWrapper style={{ width: '99vw' }}>
<div style={{ width: '100%' }}>
<AutoRow style={{ justifyContent: 'space-between' }}>
<SubHeader>Your liquidity</SubHeader>
<SettingsTab autoSlippage={DEFAULT_SLIPPAGE_INPUT_VALUE} />
<SubHeader>Liquidity Pools</SubHeader>
{address ? (
<ButtonPrimary style={{ width: 200 }} onClick={() => router.push('/pools/add')}>
+ Add Liquidity
</ButtonPrimary>
) : (
<WalletButton style={{ width: 200 }} />
)}
</AutoRow>
<div>
<BodySmall>List of your liquidity positions</BodySmall>
</div>
<PoolsTable />
</div>
{!address ? (
<LPTokensContainer>
Expand All @@ -128,6 +136,13 @@ export default function LiquidityPage() {
</LPTokensContainer>
) : lpTokens && lpTokens?.length > 0 ? (
<LPTokensContainer>
<AutoRow style={{ justifyContent: 'space-between' }} mt={4}>
<SubHeader>Your liquidity</SubHeader>
<SettingsTab autoSlippage={DEFAULT_SLIPPAGE_INPUT_VALUE} />
</AutoRow>
<div>
<BodySmall>List of your liquidity positions</BodySmall>
</div>
{lpTokens.map((obj: any, index: number) => (
<LPCard onClick={() => handleLPClick(obj)} key={index}>
<AutoRow gap={'2px'}>
Expand All @@ -154,7 +169,7 @@ export default function LiquidityPage() {
</LPTokensContainer>
)}
{address ? (
<ButtonPrimary onClick={() => router.push('/liquidity/add')}>
<ButtonPrimary onClick={() => router.push('/pools/add')}>
+ Add Liquidity
</ButtonPrimary>
) : (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import RemoveLiquidityComponent from "components/Liquidity/Remove/RemoveLiquidityComponent";
import RemoveLiquidityComponent from "components/Pools/Remove/RemoveLiquidityComponent";
import SEO from "components/SEO";

export default function MintPage() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Bridge/BridgeConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { ButtonPrimary } from 'components/Buttons/Button';
import { CloseButton } from 'components/Buttons/CloseButton';
import { AutoColumn } from 'components/Column';
import CopyTxHash from 'components/CopyTxHash/CopyTxHash';
import { DetailRowValue } from 'components/Liquidity/Add/AddModalFooter';
import { Label } from 'components/Liquidity/Add/AddModalHeader';
import { DetailRowValue } from 'components/Pools/Add/AddModalFooter';
import { Label } from 'components/Pools/Add/AddModalHeader';
import {
AnimatedEntranceConfirmationIcon,
LoadingIndicatorOverlay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default function AddLiquidityComponent({
handleAddLiquidity,
]);

const baseRoute = `/liquidity/add/`;
const baseRoute = `/pools/add/`;

const handleCurrencyASelect = useCallback(
(currencyA: TokenType) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function AddRemoveTabs({
<Tabs>
<RowBetween style={{ padding: '1rem 1rem 0 1rem' }}>
<StyledHistoryLink
href={'/liquidity'}
href={'/pools'}
// onClick={() => {
// if (adding) {
// // not 100% sure both of these are needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { formatTokenAmount } from 'helpers/format';
import { useRouter } from 'next/router';
import { LPPercentage } from './styleds';

const ContentWrapper = styled('div')<{ isMobile: boolean }>`
const ContentWrapper = styled('div') <{ isMobile: boolean }>`
display: flex;
flex-direction: column;
gap: 24px;
Expand All @@ -37,12 +37,12 @@ export default function LiquidityPoolInfoModal({
if (!selectedLP) return null;

const handleAddClick = () => {
router.push(`/liquidity/add/${selectedLP.token_0?.contract}/${selectedLP.token_1?.contract}`);
router.push(`/pools/add/${selectedLP.token_0?.contract}/${selectedLP.token_1?.contract}`);
};

const handleRemoveClick = () => {
router.push(
`/liquidity/remove/${selectedLP.token_0?.contract}/${selectedLP.token_1?.contract}`,
`/pools/remove/${selectedLP.token_0?.contract}/${selectedLP.token_1?.contract}`,
);
};

Expand Down
Loading
Loading