Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2003 from mrfelton/fix/unknown-wallet-name
Browse files Browse the repository at this point in the history
fix(launchpad): fallback wallet name incase host unknown
  • Loading branch information
mrfelton authored Apr 11, 2019
2 parents 4b706d9 + 522fc83 commit 905c46f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions renderer/components/Util/WalletName.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ const WalletName = ({ wallet }) => {
if (!wallet) {
return null
}
const { name, host, type, id } = wallet

if (wallet.type === 'local') {
return wallet.name || `Wallet #${wallet.id}`
// For local wallets, display the wallet name if set.
// Otherwise fallback to the wallet id.
if (type === 'local') {
return name || `Wallet #${id}`
}
return wallet.name || wallet.host.split(':')[0]

// For remote wallets, use the wallet name if set.
// Otherwise use the hostname.
// If neither are set, provide a fallback value.
return name || (host && host.split(':')[0]) || '[unnamed]'
}

WalletName.propTypes = {
Expand Down

0 comments on commit 905c46f

Please sign in to comment.