forked from trezor/trezor-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cardano review modal with governance
fix: modal heading fix: text Update packages/suite/src/components/suite/modals/ReduxModal/CardanoWithdrawModal.tsx Co-authored-by: Marek Mahut <marek.mahut@fivebinaries.com> review fix: new modal fix: modal fix: migration fix(suite): Cardano withdraw modal UI fix(suite): Cardano withdraw modal UI - buttons
- Loading branch information
1 parent
b6de9c9
commit ef6f94f
Showing
25 changed files
with
317 additions
and
59 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
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
2 changes: 1 addition & 1 deletion
2
packages/suite/src/actions/wallet/constants/cardanoStakingConstants.ts
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export const ADD_PENDING_STAKE_TX = '@cardano-staking/set-pending-stake-tx'; | ||
export const REMOVE_PENDING_STAKE_TX = '@cardano-staking/remove-pending-stake-tx'; | ||
export const IS_LOADING = '@cardano-staking/is-loading'; | ||
export const SET_TREZOR_POOLS = '@cardano-staking/set-trezor-pools'; | ||
export const SET_TREZOR_DATA = '@cardano-staking/set-trezor-data'; | ||
export const SET_FETCH_LOADING = '@cardano-staking/set-fetch-loading'; | ||
export const SET_FETCH_ERROR = '@cardano-staking/set-fetch-error'; |
61 changes: 61 additions & 0 deletions
61
packages/suite/src/components/suite/modals/ReduxModal/CardanoWithdrawModal.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,61 @@ | ||
import { Icon, Link, NewModal, Row, Column, Text, Card, Paragraph } from '@trezor/components'; | ||
import { spacings } from '@trezor/theme'; | ||
import { getNetworkName } from '@suite-common/wallet-utils'; | ||
|
||
import { useSelector } from 'src/hooks/suite/useSelector'; | ||
import { useCardanoStaking } from 'src/hooks/wallet/useCardanoStaking'; | ||
import { Translation } from 'src/components/suite'; | ||
import { selectSelectedAccount } from 'src/reducers/wallet/selectedAccountReducer'; | ||
|
||
export const CardanoWithdrawModal = ({ onCancel }: { onCancel: () => void }) => { | ||
const { voteAbstain, voteDelegate } = useCardanoStaking(); | ||
const account = useSelector(state => selectSelectedAccount(state)); | ||
|
||
if (!account || account.networkType !== 'cardano') { | ||
throw Error( | ||
'CardanoWithdrawModal used for other network or account in selectedAccount is undefined', | ||
); | ||
} | ||
|
||
const cardanoNetwork = getNetworkName(account.symbol); | ||
const { trezorDRep } = useSelector(state => state.wallet.cardanoStaking[cardanoNetwork]); | ||
const trezorDRepBech32 = trezorDRep?.drep.bech32; | ||
|
||
return ( | ||
<NewModal | ||
onCancel={onCancel} | ||
heading={<Translation id="TR_CARDANO_WITHDRAW_MODAL_TITLE" />} | ||
bottomContent={ | ||
<> | ||
<NewModal.Button onClick={() => voteDelegate()}> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_BUTTON_DELEGATE" /> | ||
</NewModal.Button> | ||
<NewModal.Button onClick={() => voteAbstain()} variant="tertiary"> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_BUTTON_ABSTAIN" /> | ||
</NewModal.Button> | ||
</> | ||
} | ||
> | ||
<Paragraph variant="tertiary"> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_TITLE_DESCRIPTION" /> | ||
</Paragraph> | ||
<Row padding={{ top: spacings.xl }}> | ||
<Column gap={spacings.md}> | ||
<Text> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_SUB_TITLE" /> | ||
</Text> | ||
<Card> | ||
<Row> | ||
{trezorDRepBech32} | ||
<Link href={`https://gov.tools/drep_directory/${trezorDRepBech32}`}> | ||
<Row padding={{ left: spacings.sm }}> | ||
<Icon name="link" size={16} /> | ||
</Row> | ||
</Link> | ||
</Row> | ||
</Card> | ||
</Column> | ||
</Row> | ||
</NewModal> | ||
); | ||
}; |
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.