Skip to content

Commit

Permalink
Nav management overview + table updates (#2122)
Browse files Browse the repository at this point in the history
* Update layout so that button isn't hidden under wallet component

* Show nav-management menu when toggle is enabled

* Move asset table to new file

* Add basic layout for nav summary and overview table

* Move hook to own file

* Add rest of calcs

* Fix summary

* Remove collection id from createPool since it's not used

* Fix change it asset valuation calcs

* Prefill price for assets and add row clickable

* Remove last of collectionId

* Remove unused variable

* Make input editable

* Add reserve row to nav table

* Fix total calc

* Hide input on reserve row and update reserve logo

* Fix link on reserve click
  • Loading branch information
sophialittlejohn authored May 16, 2024
1 parent e5d29bf commit ba568a3
Show file tree
Hide file tree
Showing 9 changed files with 517 additions and 362 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function PoolPerformanceChart() {

// querying chain for more accurate data, since data for today from subquery is not necessarily up to date
const todayAssetValue = pool?.nav.total.toDecimal().toNumber() || 0
const todayReserve = pool?.reserve.total.toDecimal().toNumber() || 0

const chartData = data.slice(-rangeNumber)

Expand Down
8 changes: 4 additions & 4 deletions centrifuge-app/src/components/Menu/NavManagementMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, IconChevronDown, IconChevronRight, IconMonitor, Menu, MenuItemGrou
import * as React from 'react'
import { useRouteMatch } from 'react-router'
import { useTheme } from 'styled-components'
import { usePoolsForWhichAccountIsFeeder } from '../../pages/NavManagement/Overview'
import { usePoolsForWhichAccountIsFeeder } from '../../utils/usePoolsForWhichAccountIsFeeder'
import { PoolLink } from './PoolLink'
import { Toggle } from './Toggle'

Expand All @@ -22,7 +22,7 @@ export function NavManagementMenu({ stacked }: NavManagementMenuProps) {

return (
allowedPools &&
allowedPools?.length > 1 && (
allowedPools?.length >= 1 && (
<Box position={['static', 'static', 'relative', 'static']}>
{open && (
<Box
Expand All @@ -46,9 +46,9 @@ export function NavManagementMenu({ stacked }: NavManagementMenuProps) {
isActive={isActive}
stacked={stacked}
>
<IconMonitor />
<IconMonitor size={['iconMedium', 'iconMedium', 'iconSmall']} />
NAV management
{!stacked && (open ? <IconChevronDown /> : <IconChevronRight />)}
{!stacked && (open ? <IconChevronDown size="iconSmall" /> : <IconChevronRight size="iconSmall" />)}
</Toggle>

<Box
Expand Down
5 changes: 1 addition & 4 deletions centrifuge-app/src/pages/IssuerCreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ function CreatePoolForm() {
aoProxy: string,
adminProxy: string,
poolId: string,
collectionId: string,
tranches: TrancheInput[],
currency: CurrencyKey,
maxReserve: BN,
Expand All @@ -232,7 +231,7 @@ function CreatePoolForm() {
],
options
) => {
const [transferToMultisig, aoProxy, adminProxy, , , , , , { adminMultisig }] = args
const [transferToMultisig, aoProxy, adminProxy, , , , , { adminMultisig }] = args
const multisigAddr = adminMultisig && createKeyMulti(adminMultisig.signers, adminMultisig.threshold)
const poolArgs = args.slice(2) as any
return combineLatest([
Expand Down Expand Up @@ -403,7 +402,6 @@ function CreatePoolForm() {
const currency = currencies.find((c) => c.symbol === values.currency)!

const poolId = await centrifuge.pools.getAvailablePoolId()
const collectionId = await centrifuge.nfts.getAvailableCollectionId()
if (!values.poolIcon || !values.executiveSummary) {
return
}
Expand Down Expand Up @@ -479,7 +477,6 @@ function CreatePoolForm() {
aoProxy,
adminProxy,
poolId,
collectionId,
tranches,
currency.key,
CurrencyBalance.fromFloat(values.maxReserve, currency.decimals),
Expand Down
65 changes: 31 additions & 34 deletions centrifuge-app/src/pages/MultisigApproval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,35 @@ export default function MultisigApprovalPage() {
const suitableAccount = accounts?.find((acc) => multisig.signers.includes(acc.address))
return (
<LayoutBase>
<PageHeader
title="Approve multisig transaction"
subtitle={`Call hash: ${truncate(hash)}`}
actions={
selectedAddress && !multisig.signers.includes(selectedAddress) ? (
<PageHeader title="Approve multisig transaction" subtitle={`Call hash: ${truncate(hash)}`}></PageHeader>
<PageSection>
<Shelf justifyContent="space-between">
{isCallDataNeeded && !callString && (
<>
<TextAreaInput
label="Call data"
placeholder="0x..."
value={callFormInput}
onChange={(e) => setCallFormInput(e.target.value)}
/>
{callInputError && (
<Text variant="label2" color="statusCritical">
Calldata doesn't match hash
</Text>
)}
</>
)}
{callString && (
<details>
<Text as="summary" variant="heading2">
Call details
</Text>
<Text as="pre" variant="body2" style={{ whiteSpace: 'pre-wrap' }}>
{callString}
</Text>
</details>
)}
{selectedAddress && !multisig.signers.includes(selectedAddress) ? (
<Shelf gap={2}>
<Text variant="body2">selected account not signer to multisig</Text>
{suitableAccount && (
Expand All @@ -63,35 +87,8 @@ export default function MultisigApprovalPage() {
<Button onClick={approveOrReject} loading={transactionIsPending}>
{isReject ? 'Reject' : 'Approve'}
</Button>
)
}
></PageHeader>
<PageSection>
{isCallDataNeeded && !callString && (
<>
<TextAreaInput
label="Call data"
placeholder="0x..."
value={callFormInput}
onChange={(e) => setCallFormInput(e.target.value)}
/>
{callInputError && (
<Text variant="label2" color="statusCritical">
Calldata doesn't match hash
</Text>
)}
</>
)}
{callString && (
<details>
<Text as="summary" variant="heading2">
Call details
</Text>
<Text as="pre" variant="body2" style={{ whiteSpace: 'pre-wrap' }}>
{callString}
</Text>
</details>
)}
)}
</Shelf>
</PageSection>
</LayoutBase>
)
Expand Down
Loading

0 comments on commit ba568a3

Please sign in to comment.