mars-v2-frontend/pages/portfolio.tsx

124 lines
3.3 KiB
TypeScript
Raw Normal View History

import Card from 'components/Card'
import FormattedNumber from 'components/FormattedNumber'
import Text from 'components/Text'
2022-09-08 06:23:02 +00:00
const mockedAccounts = [
{
id: 1,
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
label: 'Subaccount 1',
2022-09-08 06:23:02 +00:00
networth: 100000,
totalPositionValue: 150000,
debt: 50000,
profit: 25000,
leverage: 3,
maxLeverage: 5,
},
{
id: 2,
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
label: 'Subaccount 2',
2022-09-08 06:34:05 +00:00
networth: 33000,
totalPositionValue: 11000,
debt: 20000,
profit: -11366,
leverage: 2,
maxLeverage: 10,
2022-09-08 06:23:02 +00:00
},
{
id: 3,
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
label: 'Subaccount 3',
2022-09-08 06:34:05 +00:00
networth: 0,
totalPositionValue: 12938129,
debt: 9999999999,
profit: -99999999,
2022-09-08 06:23:02 +00:00
leverage: 3,
maxLeverage: 5,
},
{
id: 4,
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
label: 'Subaccount 4',
2022-09-08 06:34:05 +00:00
networth: 33653.22,
totalPositionValue: 100000,
debt: 50001.9,
2022-09-08 06:23:02 +00:00
profit: 25000,
leverage: 3,
maxLeverage: 5,
},
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
]
2022-09-08 06:23:02 +00:00
const Portfolio = () => {
return (
<div className='flex w-full items-start gap-4'>
<Card className='flex-1'>
<Text size='lg' uppercase={true}>
Portfolio Module
</Text>
</Card>
<div className='grid grid-cols-2 gap-4'>
2022-09-08 06:23:02 +00:00
{mockedAccounts.map((account) => (
<Card key={account.id}>
<Text size='lg' uppercase={true} className='mb-4 text-center'>
{account.label}
</Text>
<div className='grid grid-cols-3 gap-4'>
2022-09-08 06:34:05 +00:00
<div>
<Text>
<FormattedNumber amount={account.networth} animate prefix='$' />
</Text>
<Text size='sm' className='text-white/40'>
Net worth
</Text>
2022-09-08 06:34:05 +00:00
</div>
<div>
<Text>
<FormattedNumber amount={account.totalPositionValue} animate prefix='$' />
</Text>
<Text size='sm' className='text-white/40'>
Total Position Value
</Text>
2022-09-08 06:34:05 +00:00
</div>
<div>
<Text>
<FormattedNumber amount={account.debt} animate prefix='$' />
</Text>
<Text size='sm' className='text-white/40'>
Debt
</Text>
2022-09-08 06:34:05 +00:00
</div>
<div>
<Text className={account.profit > 0 ? 'text-green-400' : 'text-red-500'}>
<FormattedNumber
amount={account.debt}
animate
prefix={account.profit > 0 ? '+$' : '$'}
/>
</Text>
<Text size='sm' className='text-white/40'>
P&L
</Text>
2022-09-08 06:34:05 +00:00
</div>
<div>
<Text>
<FormattedNumber amount={account.leverage} minDecimals={0} suffix='x' />
</Text>
<Text size='sm' className='text-white/40'>
Current Leverage
</Text>
2022-09-08 06:34:05 +00:00
</div>
<div>
<Text>
<FormattedNumber amount={account.maxLeverage} minDecimals={0} suffix='x' />
</Text>
<Text size='sm' className='text-white/40'>
Max Leverage
</Text>
2022-09-08 06:34:05 +00:00
</div>
</div>
</Card>
2022-09-08 06:23:02 +00:00
))}
</div>
</div>
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
)
}
WIP (#12) * osmosis initial setup and nft contract queries/mutations * display errors on ui * fix: create credit account queryMsg and contract * client initialization. loading indicator when pending io * added tx feedback on toast * remove unused wallet store code * fetch credit accounts moved to external hook * navigation copy * file name typo * remove console logs and unused imports * fix: credit accounts query msg * credit manager store. create credit account hook created * delete credit account hook. fees declaration moved to utils * update selected account when a new one is created * type inference for mutation hooks * loading indicator for async actions. onSuccess toast * credit accounts popover * minor improvements credit account slice * credit manager module state and respective markup * fix: credit account list threshold * credit manager component. currency formatter function update * update contract addresses * borrow screen initial setup * error handling mutation queries * update credit account list when address changes * update credit accounts query key to include address * update selected account when nothing is selected * credit manager wip. deposit and listing positions on credit account * FundAccount component moved to different file * removed unused code * lending assets switch * minor refactor injective balance hook to be more generic * style: font size minor adjustments * borrow action initial. display liabilities and borrow positions on credit manager * positions amount formatting * preserve selected account on local storage * prettier custom settings and respective files formatting * credit manager container moved to external file * removed threshold variable. nav elements moved to array declaration * Navigation component naming and minor cleanup * react query keys enum * query keys improvements * initial generated smart contract api type definitions
2022-09-29 19:21:31 +00:00
export default Portfolio