-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DDW-131] Connecting a hardware wallet (#2016)
* [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet - fixing lint/flow issues * [DDW-131] - Connecting a hardware wallet - adding translations + scss color variables * [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet * [DDW-131] - Connecting a hardware wallet - adding storybook items * [DDW-131] - Connecting a hardware wallet - adding storybook items * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - fixing issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues * [DDW-131] - Connecting a hardware wallet - flow issues Co-authored-by: Nikola Glumac <niglumac@gmail.com>
- Loading branch information
1 parent
fc4cd62
commit 95a21f9
Showing
50 changed files
with
1,413 additions
and
41 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
6 changes: 6 additions & 0 deletions
6
source/renderer/app/assets/images/hardware-wallet/check.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
source/renderer/app/assets/images/hardware-wallet/close-cross-red.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
source/renderer/app/assets/images/hardware-wallet/disconnected.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
source/renderer/app/assets/images/hardware-wallet/export.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
source/renderer/app/assets/images/hardware-wallet/ledger-bold-ic.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
source/renderer/app/assets/images/hardware-wallet/ledger-cropped.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
...renderer/app/assets/images/hardware-wallet/ledger-x-cropped-outlines.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
source/renderer/app/assets/images/hardware-wallet/trezor-ledger.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
source/renderer/app/assets/images/sidebar/hardware-wallet-ic.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions
71
source/renderer/app/components/hardware-wallet/layouts/HardwareWalletWithNavigation.js
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,71 @@ | ||
// @flow | ||
import React, { Component } from 'react'; | ||
import type { Node } from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import HardwareWalletNavigation from '../navigation/HardwareWalletNavigation'; | ||
import styles from './HardwareWalletWithNavigation.scss'; | ||
import ConnectHardwareWallet from '../settings/ConnectHardwareWallet'; | ||
|
||
type Props = { | ||
children?: Node, | ||
activeItem: string, | ||
hasNotification?: boolean, | ||
walletNotConnected: boolean, | ||
isActiveScreen: Function, | ||
onOpenExternalLink: Function, | ||
onWalletNavItemClick: Function, | ||
isLedger: boolean, | ||
isTrezor: boolean, | ||
isDeviceConnected: boolean, | ||
fetchingDevice: boolean, | ||
exportingExtendedPublicKey: boolean, | ||
isExportingPublicKeyAborted: boolean, | ||
}; | ||
|
||
@observer | ||
export default class HardwareWalletWithNavigation extends Component<Props> { | ||
render() { | ||
const { | ||
children, | ||
activeItem, | ||
hasNotification, | ||
walletNotConnected, | ||
isActiveScreen, | ||
onWalletNavItemClick, | ||
onOpenExternalLink, | ||
isLedger, | ||
isTrezor, | ||
isDeviceConnected, | ||
fetchingDevice, | ||
exportingExtendedPublicKey, | ||
isExportingPublicKeyAborted, | ||
} = this.props; | ||
|
||
return ( | ||
<div className={styles.component}> | ||
{walletNotConnected ? ( | ||
<ConnectHardwareWallet | ||
onOpenExternalLink={onOpenExternalLink} | ||
isLedger={isLedger} | ||
isTrezor={isTrezor} | ||
isDeviceConnected={isDeviceConnected} | ||
fetchingDevice={fetchingDevice} | ||
exportingExtendedPublicKey={exportingExtendedPublicKey} | ||
isExportingPublicKeyAborted={isExportingPublicKeyAborted} | ||
/> | ||
) : ( | ||
<div className={styles.navigation}> | ||
<HardwareWalletNavigation | ||
isActiveNavItem={isActiveScreen} | ||
onNavItemClick={onWalletNavItemClick} | ||
activeItem={activeItem} | ||
hasNotification={hasNotification} | ||
/> | ||
</div> | ||
)} | ||
|
||
<div className={styles.page}>{children}</div> | ||
</div> | ||
); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
source/renderer/app/components/hardware-wallet/layouts/HardwareWalletWithNavigation.scss
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,29 @@ | ||
.component { | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
overflow-y: overlay; | ||
} | ||
|
||
.navigation { | ||
flex-shrink: 0; | ||
height: 50px; | ||
position: relative; | ||
} | ||
|
||
.page { | ||
align-items: center; | ||
display: flex; | ||
height: calc(100% - 50px); | ||
justify-content: center; | ||
overflow: overlay; | ||
position: relative; | ||
|
||
> div { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.settingsTabPage { | ||
overflow: hidden; | ||
} |
67 changes: 67 additions & 0 deletions
67
source/renderer/app/components/hardware-wallet/navigation/HardwareWalletNavigation.js
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,67 @@ | ||
// @flow | ||
import React, { Component } from 'react'; | ||
import { observer } from 'mobx-react'; | ||
import { includes } from 'lodash'; | ||
import { defineMessages, intlShape } from 'react-intl'; | ||
import { | ||
WALLET_NAV_IDS, | ||
ITN_LEGACY_WALLET_EXCLUDED_NAV_ITEMS, | ||
} from '../../../config/walletNavigationConfig'; | ||
import Navigation from '../../navigation/Navigation'; | ||
import summaryIcon from '../../../assets/images/wallet-nav/summary-ic.inline.svg'; | ||
import type { | ||
NavButtonProps, | ||
NavDropdownProps, | ||
} from '../../navigation/Navigation'; | ||
|
||
const messages = defineMessages({ | ||
summary: { | ||
id: 'wallet.navigation.summary', | ||
defaultMessage: '!!!Summary', | ||
description: 'Label for the "Summary" nav button in the wallet navigation.', | ||
}, | ||
}); | ||
|
||
type Props = { | ||
activeItem: string, | ||
isActiveNavItem: Function, | ||
onNavItemClick: Function, | ||
}; | ||
|
||
@observer | ||
export default class WalletNavigation extends Component<Props> { | ||
static contextTypes = { | ||
intl: intlShape.isRequired, | ||
}; | ||
|
||
render() { | ||
const { isActiveNavItem, onNavItemClick, activeItem } = this.props; | ||
const { intl } = this.context; | ||
const { isIncentivizedTestnet } = global; | ||
const items: Array<NavButtonProps | NavDropdownProps> = [ | ||
{ | ||
id: WALLET_NAV_IDS.SUMMARY, | ||
label: intl.formatMessage(messages.summary), | ||
icon: summaryIcon, | ||
}, | ||
].filter( | ||
item => | ||
!( | ||
isIncentivizedTestnet && | ||
includes(ITN_LEGACY_WALLET_EXCLUDED_NAV_ITEMS, item.id) | ||
) | ||
); | ||
return ( | ||
<> | ||
{activeItem ? ( | ||
<Navigation | ||
activeItem={activeItem} | ||
isActiveNavItem={isActiveNavItem} | ||
onNavItemClick={onNavItemClick} | ||
items={items} | ||
/> | ||
) : null} | ||
</> | ||
); | ||
} | ||
} |
Oops, something went wrong.