-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ENG-3340] feat: Add UI warning about the Non default sighash Ledger …
…alert (#97) * [ENG-3340] feat: Add UI warning about the Non default sighash Ledger alert * Fix tooltip hiding * Update the info message copy * Create a separate LedgerStepView component * Remove the unused imports * Remove the Steps enum duplicate
- Loading branch information
Showing
11 changed files
with
154 additions
and
61 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
87 changes: 87 additions & 0 deletions
87
src/app/components/confirmBtcTransaction/ledgerStepView.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,87 @@ | ||
import InfoIcon from '@assets/img/info.svg'; | ||
import ledgerConnectDefaultIcon from '@assets/img/ledger/ledger_connect_default.svg'; | ||
import ledgerConnectBtcIcon from '@assets/img/ledger/ledger_import_connect_btc.svg'; | ||
import LedgerConnectionView, { | ||
ConnectLedgerContainer, | ||
ConnectLedgerText, | ||
} from '@components/ledger/connectLedgerView'; | ||
import LedgerFailView from '@components/ledger/failLedgerView'; | ||
import { | ||
ConnectLedgerTitle, | ||
InfoImage, | ||
} from '@screens/ledger/confirmLedgerTransaction/index.styled'; | ||
import { TFunction } from 'react-i18next'; | ||
|
||
export enum Steps { | ||
ConnectLedger = 0, | ||
ExternalInputs = 1, | ||
ConfirmTransaction = 2, | ||
} | ||
|
||
type Props = { | ||
currentStep: Steps; | ||
isConnectSuccess: boolean; | ||
isConnectFailed: boolean; | ||
isTxRejected: boolean; | ||
t: TFunction<'translation', 'CONFIRM_TRANSACTION'>; | ||
signatureRequestTranslate: TFunction<'translation', 'SIGNATURE_REQUEST'>; | ||
}; | ||
|
||
function LedgerStepView({ | ||
currentStep, | ||
isConnectSuccess, | ||
isConnectFailed, | ||
isTxRejected, | ||
t, | ||
signatureRequestTranslate, | ||
}: Props) { | ||
switch (currentStep) { | ||
case Steps.ConnectLedger: | ||
return ( | ||
<LedgerConnectionView | ||
title={signatureRequestTranslate('LEDGER.CONNECT.TITLE')} | ||
text={signatureRequestTranslate('LEDGER.CONNECT.SUBTITLE', { name: 'Bitcoin' })} | ||
titleFailed={signatureRequestTranslate('LEDGER.CONNECT.ERROR_TITLE')} | ||
textFailed={signatureRequestTranslate('LEDGER.CONNECT.ERROR_SUBTITLE')} | ||
imageDefault={ledgerConnectBtcIcon} | ||
isConnectSuccess={isConnectSuccess} | ||
isConnectFailed={isConnectFailed} | ||
/> | ||
); | ||
case Steps.ExternalInputs: | ||
if (isTxRejected || isConnectFailed) { | ||
return ( | ||
<LedgerFailView title={t('CONFIRM.ERROR_TITLE')} text={t('CONFIRM.ERROR_SUBTITLE')} /> | ||
); | ||
} | ||
|
||
return ( | ||
<div> | ||
<ConnectLedgerContainer> | ||
<InfoImage src={InfoIcon} alt="external inputs warning" /> | ||
<ConnectLedgerTitle textAlign="center"> | ||
{t('LEDGER.INPUTS_WARNING.EXTERNAL_INPUTS')} / <br /> | ||
{t('LEDGER.INPUTS_WARNING.NON_DEFAULT_SIGHASH')} | ||
</ConnectLedgerTitle> | ||
<ConnectLedgerText>{t('LEDGER.INPUTS_WARNING.SUBTITLE')}</ConnectLedgerText> | ||
</ConnectLedgerContainer> | ||
</div> | ||
); | ||
case Steps.ConfirmTransaction: | ||
return ( | ||
<LedgerConnectionView | ||
title={signatureRequestTranslate('LEDGER.CONFIRM.TITLE')} | ||
text={signatureRequestTranslate('LEDGER.CONFIRM.SUBTITLE')} | ||
titleFailed={signatureRequestTranslate('LEDGER.CONFIRM.ERROR_TITLE')} | ||
textFailed={signatureRequestTranslate('LEDGER.CONFIRM.ERROR_SUBTITLE')} | ||
imageDefault={ledgerConnectDefaultIcon} | ||
isConnectSuccess={false} | ||
isConnectFailed={isTxRejected} | ||
/> | ||
); | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
export default LedgerStepView; |
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
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
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