-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Funding request multiple recipient preview #4509
Merged
thesan
merged 35 commits into
Joystream:dev
from
vrrayz:funding-request-multiple-recipient-preview
Sep 6, 2023
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
254936f
preview multiple receipients modal
vrrayz dead262
multiple funding request validation
vrrayz 4d0bfa0
csv reg exp pattern
vrrayz 30651dc
Preview And Validate Modal validation
vrrayz e7517cc
lint fix
vrrayz e7d4b82
Tx fail fix
vrrayz 51ddf50
suggestions
vrrayz dc0fb3d
Merge branch 'dev' of https://github.com/vrrayz/pioneer into issue-2365
vrrayz 383089d
lint fix
vrrayz d06d0ca
side drawer
vrrayz 1abf1d0
csv pattern change and cleanup
vrrayz 283dd51
Multiple funding request test
vrrayz 91cb882
lint
vrrayz f4477df
Merge branch 'Joystream:dev' into issue-2365
vrrayz e018470
Merge branch 'issue-2365' of https://github.com/vrrayz/pioneer into i…
vrrayz 855aa76
Update packages/ui/src/app/pages/Proposals/CurrentProposals.stories.tsx
vrrayz 44dcd9a
requested changes
vrrayz 8fdbc0b
Merge branch 'Joystream:dev' into issue-2365
vrrayz 172518f
lint
vrrayz 617ab12
disable preview button
vrrayz 18b3cf5
Merge branch 'dev' of https://github.com/vrrayz/pioneer into issue-2365
vrrayz 904d370
Merge branch 'Joystream:dev' into issue-2365
vrrayz 59f10f2
updated storybook test for multiple funding request
vrrayz 9a3d8bb
Merge branch 'issue-2365' of https://github.com/vrrayz/pioneer into i…
vrrayz 313eb98
requested changes
vrrayz f58a6fb
requested changes
vrrayz 548fc6d
Preview multi recipients proposal in storybook
thesan 48e898d
Fix the story
thesan 81d9d19
Merge branch 'feature/multi-recipient-story' of https://github.com/th…
vrrayz 397bc2c
Preview fix
vrrayz 733d99b
build fix
vrrayz 2da82e8
requested changes
vrrayz ba0c7ab
requested changes
vrrayz 6b04de3
council budget added to funding proposal
vrrayz 9c64ed7
council budget added to funding proposal
vrrayz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
102 changes: 102 additions & 0 deletions
102
packages/ui/src/proposals/components/ProposalDetails/renderers/DestinationsPreview.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,102 @@ | ||
import BN from 'bn.js' | ||
import React, { useEffect, useState } from 'react' | ||
|
||
import { AccountInfo } from '@/accounts/components/AccountInfo' | ||
import { useMyAccounts } from '@/accounts/hooks/useMyAccounts' | ||
import { accountOrNamed } from '@/accounts/model/accountOrNamed' | ||
import { AccountOption } from '@/accounts/types' | ||
import { CloseButton } from '@/common/components/buttons' | ||
import { ArrowRightIcon } from '@/common/components/icons' | ||
import { | ||
BalanceInfoInRow, | ||
InfoTitle, | ||
InfoValue, | ||
ModalFooter, | ||
Row, | ||
TransactionInfoContainer, | ||
} from '@/common/components/Modal' | ||
import { RowGapBlock } from '@/common/components/page/PageContent' | ||
import { SidePaneGlass, SidePaneTitle, SidePanelTop } from '@/common/components/SidePane' | ||
import { StatisticButton } from '@/common/components/statistics/StatisticButton' | ||
import { TransactionFee } from '@/common/components/TransactionFee' | ||
import { TextInlineBig, TokenValue } from '@/common/components/typography' | ||
import { | ||
CustomAccountRow, | ||
PreviewPanel, | ||
PreviewPanelBody, | ||
PreviewPanelHeader, | ||
} from '@/proposals/modals/AddNewProposal/components/SpecificParameters/modals/PreviewAndValidate' | ||
|
||
interface Props { | ||
label: string | ||
value: { account: string; amount: BN }[] | ||
} | ||
export const DestinationsPreview = ({ label, value }: Props) => { | ||
const [isDescriptionVisible, setDescriptionVisible] = useState(false) | ||
const [totalAmount, setTotalAmount] = useState<BN>(new BN(0)) | ||
const { allAccounts } = useMyAccounts() | ||
const accounts = allAccounts as AccountOption[] | ||
|
||
const onBackgroundClick = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => { | ||
if (e.target === e.currentTarget) { | ||
setDescriptionVisible(false) | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
let total = new BN(0) | ||
value?.map((item) => { | ||
total = total.add(item.amount) | ||
}) | ||
setTotalAmount(total) | ||
}, []) | ||
return ( | ||
<> | ||
<StatisticButton | ||
title="Payment Details" | ||
onClick={() => { | ||
setDescriptionVisible(true) | ||
}} | ||
icon={<ArrowRightIcon />} | ||
> | ||
<TextInlineBig bold value> | ||
{label} | ||
</TextInlineBig> | ||
</StatisticButton> | ||
{isDescriptionVisible && ( | ||
<SidePaneGlass onClick={onBackgroundClick}> | ||
<PreviewPanel> | ||
<PreviewPanelHeader> | ||
<SidePanelTop> | ||
<SidePaneTitle>{label}</SidePaneTitle> | ||
<CloseButton onClick={() => setDescriptionVisible(false)} /> | ||
</SidePanelTop> | ||
</PreviewPanelHeader> | ||
<PreviewPanelBody> | ||
<RowGapBlock gap={8}> | ||
<Row> | ||
{value?.map((previewAccount, i) => ( | ||
<CustomAccountRow key={i}> | ||
<AccountInfo account={accountOrNamed(accounts, previewAccount.account, 'Unknown Member')} /> | ||
<BalanceInfoInRow> | ||
<InfoTitle>Amount</InfoTitle> | ||
<InfoValue> | ||
<TokenValue value={previewAccount.amount} /> | ||
</InfoValue> | ||
</BalanceInfoInRow> | ||
</CustomAccountRow> | ||
))} | ||
</Row> | ||
</RowGapBlock> | ||
</PreviewPanelBody> | ||
<ModalFooter> | ||
<TransactionInfoContainer> | ||
<TransactionFee title={'Total amount'} value={totalAmount} /> | ||
</TransactionInfoContainer> | ||
</ModalFooter> | ||
</PreviewPanel> | ||
</SidePaneGlass> | ||
)} | ||
</> | ||
) | ||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one !
You even fixed the Update Working Group Budget council budget preview as a bonus !
E.g https://pioneerapp.xyz/#/proposals/preview/519