-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
4,132 additions
and
992 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v0.3.4 | ||
v0.3.5 |
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
111 changes: 111 additions & 0 deletions
111
packages/neuron-ui/src/components/HardwareSign/HardwareSignOnPage.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,111 @@ | ||
import React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { useState as useGlobalState } from 'states' | ||
import { errorFormatter, useGoBack } from 'utils' | ||
import AlertDialog from 'widgets/AlertDialog' | ||
import Button from 'widgets/Button' | ||
import { Export, Sign } from 'widgets/Icons/icon' | ||
import HDWalletSign from '../HDWalletSign' | ||
import useHardwareSign, { HardwareSignProps } from './hooks' | ||
import styles from './hardwareSign.module.scss' | ||
|
||
const HardwareSignOnPage = ({ | ||
signType, | ||
signMessage, | ||
wallet, | ||
onDismiss, | ||
offlineSignJSON, | ||
offlineSignType, | ||
walletID, | ||
actionType, | ||
multisigConfig, | ||
onSuccess, | ||
}: HardwareSignProps & State.PasswordRequest) => { | ||
const { | ||
app: { | ||
send: { description, generatedTx }, | ||
loadings: { sending: isSending = false }, | ||
}, | ||
experimental, | ||
} = useGlobalState() | ||
const [t] = useTranslation() | ||
const onGoBack = useGoBack() | ||
const { | ||
offlineSignActionType, | ||
status, | ||
error, | ||
isLoading, | ||
isNotAvailableToSign, | ||
productName, | ||
signAndExportFromGenerateTx, | ||
sign, | ||
reconnect, | ||
exportTransaction, | ||
} = useHardwareSign({ | ||
signType, | ||
signMessage, | ||
wallet, | ||
offlineSignJSON, | ||
offlineSignType, | ||
description, | ||
generatedTx, | ||
isSending, | ||
passwordRequest: { walletID, actionType, multisigConfig, onSuccess }, | ||
experimental, | ||
}) | ||
|
||
if (error) { | ||
return <AlertDialog show message={errorFormatter(error, t)} type="failed" onCancel={onDismiss || onGoBack} /> | ||
} | ||
|
||
return ( | ||
<div title={t('hardware-sign.title')} className={styles.hardwareSignInPage}> | ||
<div className={styles.container}> | ||
<p> | ||
{t('hardware-sign.device')} | ||
<span>{productName}</span> | ||
</p> | ||
<p> | ||
{t('hardware-sign.status.label')} | ||
<span className={isNotAvailableToSign ? styles.warning : ''}>{status}</span> | ||
</p> | ||
|
||
<div>{wallet.isHD && generatedTx ? <HDWalletSign tx={generatedTx} /> : null}</div> | ||
|
||
{offlineSignJSON === undefined && signType === 'transaction' ? ( | ||
<div className={styles.footer}> | ||
<Button type="text" onClick={exportTransaction} disabled={isLoading}> | ||
{t('offline-sign.export')} <Export /> | ||
</Button> | ||
<div className={styles.divider} /> | ||
<Button | ||
type="text" | ||
className={styles.signAndExportFromGenerateTx} | ||
onClick={signAndExportFromGenerateTx} | ||
disabled={isNotAvailableToSign} | ||
loading={!isNotAvailableToSign && isLoading} | ||
> | ||
{t('offline-sign.sign-and-export')} <Sign /> | ||
</Button> | ||
</div> | ||
) : null} | ||
</div> | ||
<div className={styles.actions}> | ||
<Button type="cancel" onClick={onDismiss || onGoBack} label={t('common.cancel')} /> | ||
{(actionType || offlineSignActionType) !== 'send-from-multisig' ? ( | ||
<Button | ||
type="submit" | ||
label={isNotAvailableToSign ? t('hardware-sign.actions.rescan') : t('sign-and-verify.sign')} | ||
loading={isLoading} | ||
disabled={isLoading} | ||
onClick={isNotAvailableToSign ? reconnect : sign} | ||
/> | ||
) : null} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
HardwareSignOnPage.displayName = 'HardwareSignOnPage' | ||
|
||
export default HardwareSignOnPage |
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.
4792496
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.
Packaging for test is done in 7634732521