Skip to content

Commit

Permalink
update: display the type of proxy on multisig view
Browse files Browse the repository at this point in the history
  • Loading branch information
bolajahmad committed Jan 26, 2024
1 parent aaaa221 commit ff0fdbf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/ui/cypress/support/page-objects/multisigPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const multisigPage = {
multisigDetailsContainer: () => cy.get('[data-cy=container-multisig-details]'),
multisigAccountSummary: () => cy.get('[data-cy=container-multisig-account-summary]'),
thresholdListItem: () => cy.get('[data-cy=list-item-threshold]'),
proxyTypeListItem: () => cy.get('[data-cy=list-item-proxy-type]]'),
balanceListItem: () => cy.get('[data-cy=list-item-balance]'),
signatoriesAccordion: () => cy.get('[data-cy=accordion-signatories]'),
expandSignatoriesIcon: () => cy.get('[data-cy=icon-expand-signatories-summary]'),
Expand Down
16 changes: 15 additions & 1 deletion packages/ui/src/pages/Home/MultisigView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import AccountDisplay from '../../components/AccountDisplay'
import { AccountBadge } from '../../types'
// import MultisigActionMenu from './MultisigActionMenu'
import { styled } from '@mui/material/styles'
import { Chip } from '@mui/material'
import { Chip, Typography } from '@mui/material'
import { useMultiProxy } from '../../contexts/MultiProxyContext'
import MultisigAccordion from './MultisigAccordion'
import { Balance } from '../../components/library'
import { renderProxyTypeToText } from '../../utils/proxyTypeRendererUtils'

const MultisigView = () => {
const { selectedMultiProxy, selectedHasProxy } = useMultiProxy()
Expand All @@ -26,6 +27,7 @@ const MultisigView = () => {
<MultisigList>
{selectedMultiProxy &&
selectedMultiProxy.multisigs.map((multisig) => {
console.log({ multisig })
return (
<MultisigWrapperStyled
selectedHasProxy={selectedHasProxy}
Expand All @@ -46,6 +48,12 @@ const MultisigView = () => {
<ListFieldText>Threshold</ListFieldText>
<ChipStyled label={`${multisig.threshold}/${multisig.signatories?.length}`} />
</ListElement>
{multisig.type && (
<ListElement data-cy="list-item-proxy-type">
<ListFieldText>Proxy Type</ListFieldText>
<ListFieldValue as="p">{renderProxyTypeToText(multisig.type)}</ListFieldValue>
</ListElement>
)}
{selectedHasProxy && (
<ListElement data-cy="list-item-balance">
<ListFieldText>Balance</ListFieldText>
Expand Down Expand Up @@ -134,6 +142,12 @@ const ListFieldText = styled('div')`
color: ${({ theme }) => theme.custom.gray[800]};
`

const ListFieldValue = styled(Typography)`
color: ${({ theme }) => theme.custom.gray[800]};
font-size: 1rem;
font-weight: 400;
`

const AccountDisplayWrapperStyled = styled('div')`
width: 100%;
display: flex;
Expand Down
19 changes: 19 additions & 0 deletions packages/ui/src/utils/proxyTypeRendererUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ProxyType } from '../../types-and-hooks'

export const ProxyEnumToTextMap: Record<ProxyType, string> = {
[ProxyType.NonTransfer]: 'Non Transfer',
[ProxyType.IdentityJudgement]: 'Identity Judgement',
[ProxyType.CancelProxy]: 'Cancel Proxy',
[ProxyType.SudoBalances]: 'Sudo Balances',
[ProxyType.NominationPools]: 'Nomination Pools',
[ProxyType.Any]: 'Any',
[ProxyType.Auction]: 'Auction',
[ProxyType.Governance]: 'Governance',
[ProxyType.Society]: 'Society',
[ProxyType.Staking]: 'Staking',
[ProxyType.Unknown]: 'Unknown'
}

export function renderProxyTypeToText(proxy: ProxyType) {
return ProxyEnumToTextMap[proxy]
}

0 comments on commit ff0fdbf

Please sign in to comment.