-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move into separate components for readability
- Loading branch information
1 parent
adb087e
commit e8a4303
Showing
5 changed files
with
141 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
import { useAtomValue } from 'jotai' | ||
|
||
import ConnectWallet from '@components/Positions/ConnectWallet' | ||
import Positions from '@components/Positions/Positions' | ||
import Positions from '@components/Positions' | ||
import { useInitCrabMigration } from '@state/crabMigration/hooks' | ||
import { addressAtom, supportedNetworkAtom } from '@state/wallet/atoms' | ||
import DefaultSiteSeo from '@components/DefaultSiteSeo/DefaultSiteSeo' | ||
import Nav from '@components/Nav' | ||
|
||
const PositionsPage = () => { | ||
const address = useAtomValue(addressAtom) | ||
const supportedNetwork = useAtomValue(supportedNetworkAtom) | ||
useInitCrabMigration() | ||
|
||
if (address && supportedNetwork) { | ||
return <Positions /> | ||
} | ||
return <ConnectWallet /> | ||
} | ||
|
||
const Wrapper = () => { | ||
return ( | ||
<> | ||
<DefaultSiteSeo /> | ||
<Nav /> | ||
|
||
<PositionsPage /> | ||
<Positions /> | ||
</> | ||
) | ||
} | ||
|
||
export default Wrapper | ||
export default PositionsPage |
20 changes: 20 additions & 0 deletions
20
packages/frontend/src/components/Positions/LPPositions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { useAtomValue } from 'jotai' | ||
import { Typography } from '@material-ui/core' | ||
|
||
import { activePositionsAtom } from '@state/positions/atoms' | ||
import { poolAtom } from '@state/squeethPool/atoms' | ||
import { LPTable } from '@components/Lp/LPTable' | ||
|
||
const LPPositions: React.FC = () => { | ||
const pool = useAtomValue(poolAtom) | ||
const activePositions = useAtomValue(activePositionsAtom) | ||
|
||
if (activePositions.length === 0) { | ||
return <Typography variant="body1">No active LP position</Typography> | ||
} | ||
|
||
return <LPTable isLPage={false} pool={pool!} /> | ||
} | ||
|
||
export default LPPositions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Typography } from '@material-ui/core' | ||
|
||
import TxHistory from '@components/Positions/TxHistory' | ||
import useStyles from './useStyles' | ||
import YourVaults from './YourVaults' | ||
import LPPositions from './LPPositions' | ||
import Positions from './Positions' | ||
import HeaderBar from './HeaderBar' | ||
|
||
export default function PositionsUI() { | ||
const classes = useStyles() | ||
|
||
return ( | ||
<div className={classes.container}> | ||
<HeaderBar /> | ||
|
||
<div className={classes.sectionHeaderFirst}> | ||
<Typography variant="h4" className={classes.sectionTitle}> | ||
Your Positions | ||
</Typography> | ||
</div> | ||
<div className={classes.sectionContent}> | ||
<Positions /> | ||
</div> | ||
|
||
<div className={classes.sectionHeader}> | ||
<Typography variant="h4" className={classes.sectionTitle}> | ||
Your LP Positions | ||
</Typography> | ||
</div> | ||
<div className={classes.sectionContent}> | ||
<LPPositions /> | ||
</div> | ||
|
||
<div className={classes.sectionHeader}> | ||
<Typography variant="h4" className={classes.sectionTitle}> | ||
Your Vaults | ||
</Typography> | ||
</div> | ||
<div className={classes.sectionContent}> | ||
<YourVaults /> | ||
</div> | ||
|
||
<div className={classes.sectionHeader}> | ||
<Typography variant="h4" className={classes.sectionTitle}> | ||
Transaction History | ||
</Typography> | ||
</div> | ||
<div className={classes.sectionContent}> | ||
<TxHistory /> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters