Skip to content

Commit

Permalink
Render the right name for the wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
neuodev committed Nov 25, 2021
1 parent 103f3e0 commit b352f0f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ const messages = defineMessages({
},
});

function checkForNetworks(wallets: Array<PublicDeriverCache>) {
function walletExistInWebsitsList(
whitelistEntries: Array<WhitelistEntry>,
publicDeriverId: number) {
for(const website of whitelistEntries) {
if (website.publicDeriverId === publicDeriverId) return true
}
return false
}

function checkForNetworks(
wallets: Array<PublicDeriverCache>,
whitelistEntries: Array<WhitelistEntry>
) {
/**
* Form a list of cached wallets. will look if the list has ergo wallets or cardano wallts
* or both.
Expand All @@ -41,6 +53,9 @@ function checkForNetworks(wallets: Array<PublicDeriverCache>) {
let isCardanoExist = false

for (const wallet of wallets) {
if(!walletExistInWebsitsList(whitelistEntries, wallet.publicDeriver.getPublicDeriverId())) {
continue
}
if (isErgo(wallet.publicDeriver.getParent().getNetworkInfo())) {
isErgoExist = true
} else {
Expand Down Expand Up @@ -82,7 +97,7 @@ export default class ConnectedWebsitesPage extends Component<Props> {
if (whitelistEntries.length === 0) {
return genNoResult();
}
const { isCardanoExist, isErgoExist } = checkForNetworks(wallets)
const { isCardanoExist, isErgoExist } = checkForNetworks(wallets, whitelistEntries)
return (
<div className={styles.component}>
<div className={styles.container}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class WalletRow extends Component<Props, State> {
<div className={styles.dapp}>
<div>
<p className={styles.url}>{url}</p>
{true && <p className={styles.status}>Active</p>}
{isActiveSite && <p className={styles.status}>Active</p>}
</div>
</div>
<div className={styles.delete}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
display: grid;
grid-template-columns: 5fr 5fr 2fr;
grid-gap: 5px;
margin-bottom: 10px;
align-items: center;
padding: 12px;
border: 1px solid #ffff;
Expand Down Expand Up @@ -30,9 +31,12 @@
line-height: 22px;
& .avatar {
margin-right: 12px;
background-color: greenyellow;
overflow: hidden;
width: 32px;
height: 32px;
border-radius: 50%;
img {
width: 32px;
height: 32px;
object-fit: cover;
}
}
Expand Down

0 comments on commit b352f0f

Please sign in to comment.