-
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.
🎛️ Add support for the Argo bridge constraints proposal (#4856)
* Update schema * Add the AnonymousAccount component * Add the AddressesPreview renderer * Display UpdateArgoBridgeConstraints proposals * Patch `@joystream/types` * Improve account components stories * Add the FieldList component * Simplify the isValidAddress function * Adjust the FieldList component * Add UpdateArgoBridgeConstraints proposal creation * Add a component story for `UpdateArgoBridgeConstraints` * Test the UpdateArgoBridgeConstraints proposal creation * Fix transaction button * Fix validation * Upgrade `@joystream/types` to `4.6.0` * Fix linting * Improve account components stories * Fix the `UpdateArgoBridgeConstraints` stories name
- Loading branch information
Showing
54 changed files
with
993 additions
and
240 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
19 changes: 19 additions & 0 deletions
19
packages/ui/src/accounts/components/AccountInfo.stories.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,19 @@ | ||
import { Meta } from '@storybook/react' | ||
|
||
import { AccountInfo } from './AccountInfo' | ||
|
||
export default { | ||
title: 'Accounts/AccountInfo', | ||
component: AccountInfo, | ||
args: { | ||
account: { | ||
name: 'Alice', | ||
address: 'j4VdDQVdwFYfQ2MvEdLT2EYZx4ALPQQ6yMyZopKoZEQmXcJrT', | ||
}, | ||
lockType: 'Invitation', | ||
}, | ||
} as Meta | ||
|
||
export const Default = { | ||
name: 'AccountInfo', | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/ui/src/accounts/components/AnonymousAccount.stories.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,32 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import BN from 'bn.js' | ||
import React from 'react' | ||
|
||
import { Row } from '@/common/components/storybookParts/previewStyles' | ||
import { joy } from '@/mocks/helpers' | ||
|
||
import { AnonymousAccount } from './AnonymousAccount' | ||
|
||
type Args = { | ||
address: string | ||
amount?: number | ||
} | ||
|
||
export default { | ||
title: 'Accounts/AnonymousAccount', | ||
component: AnonymousAccount, | ||
args: { | ||
address: 'j4VdDQVdwFYfQ2MvEdLT2EYZx4ALPQQ6yMyZopKoZEQmXcJrT', | ||
amount: 10, | ||
}, | ||
} as Meta<Args> | ||
|
||
export const Default: StoryObj<Args> = { | ||
name: 'AnonymousAccount', | ||
render: ({ address, amount }) => ( | ||
<Row> | ||
<AnonymousAccount address={address} amount={amount ? new BN(joy(amount)) : undefined} /> | ||
<AnonymousAccount address={address} /> | ||
</Row> | ||
), | ||
} |
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,59 @@ | ||
import { Identicon } from '@polkadot/react-identicon' | ||
import BN from 'bn.js' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
|
||
import { CopyComponent } from '@/common/components/CopyComponent' | ||
import { AccountRow, InfoTitle, InfoValue } from '@/common/components/Modal' | ||
import { TokenValue } from '@/common/components/typography' | ||
import { Colors } from '@/common/constants' | ||
import { shortenAddress } from '@/common/model/formatters' | ||
|
||
type Props = { | ||
address: string | ||
amount?: BN | ||
addressLength?: number | ||
} | ||
|
||
export const AnonymousAccount = ({ address, amount, addressLength }: Props) => { | ||
return ( | ||
<StyledAccountRow> | ||
<Identicon size={40} theme={'beachball'} value={address} /> | ||
<Info> | ||
<AccountCopyAddress altText={shortenAddress(address, addressLength)} copyText={address} /> | ||
{amount && ( | ||
<BalanceInfo> | ||
<InfoTitle>Total Balance: </InfoTitle> | ||
<InfoValue> | ||
<TokenValue value={amount} size="xs" /> | ||
</InfoValue> | ||
</BalanceInfo> | ||
)} | ||
</Info> | ||
</StyledAccountRow> | ||
) | ||
} | ||
|
||
const StyledAccountRow = styled(AccountRow)` | ||
display: grid; | ||
grid-template-columns: 40px 1fr; | ||
gap: 12px; | ||
align-items: center; | ||
` | ||
|
||
const Info = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 4px; | ||
` | ||
|
||
const AccountCopyAddress = styled(CopyComponent)` | ||
font-size: 16px; | ||
color: ${Colors.Black[900]}; | ||
` | ||
|
||
const BalanceInfo = styled.div` | ||
display: flex; | ||
align-items: center; | ||
gap: 4px; | ||
` |
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
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
54 changes: 0 additions & 54 deletions
54
packages/ui/src/app/pages/Election/BlacklistedAccounts/BlacklistedAccount.tsx
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.