-
-
Notifications
You must be signed in to change notification settings - Fork 267
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 <[email protected]> review fix: new modal
- Loading branch information
1 parent
560819f
commit 2a0724b
Showing
24 changed files
with
309 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 { Button, Icon, Link, NewModal, Row, Column, Text, Card } 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" />} | ||
description={<Translation id="TR_CARDANO_WITHDRAW_MODAL_TITLE_DESCRIPTION" />} | ||
> | ||
<Row padding={{ top: spacings.xl }}> | ||
<Column> | ||
<Row padding={{ bottom: spacings.md }}> | ||
<Text> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_SUB_TITLE" /> | ||
</Text> | ||
</Row> | ||
<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> | ||
<Row padding={{ top: spacings.xl }}> | ||
<Button onClick={() => voteDelegate()}> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_BUTTON_DELEGATE" /> | ||
</Button> | ||
<Row padding={{ left: spacings.sm }}> | ||
<Button onClick={() => voteAbstain()} variant="tertiary"> | ||
<Translation id="TR_CARDANO_WITHDRAW_MODAL_BUTTON_ABSTAIN" /> | ||
</Button> | ||
</Row> | ||
</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.