Skip to content

Commit

Permalink
updated snaps description
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Sep 14, 2023
1 parent 8076485 commit b5e4de0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
7 changes: 7 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 24 additions & 10 deletions ui/pages/connected-accounts/connected-accounts.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ export default function ConnectedAccounts({
permissionSubjects[originOfActiveTab]?.origin ===
connectedSubjectsMetadata?.origin;
const connectedSubjects = [connectedSubjectsMetadata];
const permissionSubjectsLength = Object.keys(
permissionSubjects[originOfActiveTab]?.permissions?.wallet_snap.caveats[0]
.value,
).length;

const connectedAccountsDescription =
connectedAccounts.length > 0
? t('connectedAccountsDescriptionPlural', [connectedAccounts.length])
: t('connectedAccountsDescriptionSingular');

let subtitle;
if (connectedAccounts.length && !isPermissionSubject) {
subtitle = connectedAccountsDescription;
} else if (isPermissionSubject && !connectedAccounts.length) {
subtitle = t('connectedSnapAndNoAccountDescription');
} else if (connectedAccounts.length && isPermissionSubject) {
subtitle = t('connectedAccountsAndSnapDescription', [
connectedAccounts.length,
permissionSubjectsLength,
]);
} else {
subtitle = t('connectedAccountsEmptyDescription');
}

const onDisconnect = (connectedOrigin) => {
const caveatValue =
Expand All @@ -59,23 +82,14 @@ export default function ConnectedAccounts({
}
};

const connectedAccountsDescription =
connectedAccounts.length > 0
? t('connectedAccountsDescriptionPlural', [connectedAccounts.length])
: t('connectedAccountsDescriptionSingular');

return (
<Popover
title={
isActiveTabExtension
? t('currentExtension')
: getURLHost(activeTabOrigin)
}
subtitle={
connectedAccounts.length
? connectedAccountsDescription
: t('connectedAccountsEmptyDescription')
}
subtitle={subtitle}
onClose={() => history.push(mostRecentOverviewPage)}
footerClassName="connected-accounts__footer"
footer={
Expand Down

0 comments on commit b5e4de0

Please sign in to comment.