Skip to content

Commit

Permalink
Add translation variables and fix tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Feb 16, 2023
1 parent 1b5fcd9 commit ad73413
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
font-weight: bold;
}
}

.tooltip-label-item {
font-weight: bold;
}
61 changes: 51 additions & 10 deletions ui/helpers/utils/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
</span>,
path.join('/'),
]),
description: t('permission_viewNamedBip32PublicKeysDescription'),
description: t('permission_viewBip32PublicKeysDescription', [
<span
className="tooltip-label-item"
key={`description-${path.join('/')}`}
>
{friendlyName}
</span>,
path.join('/'),
]),
};
}

Expand All @@ -81,7 +89,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
</span>,
curve,
]),
description: t('permission_viewNamedBip32PublicKeysDescription'),
description: t('permission_viewBip32PublicKeysDescription', [
<span
className="tooltip-label-item"
key={`description-${path.join('/')}`}
>
{path.join('/')}
</span>,
path.join('/'),
]),
};
}),
[RestrictedMethods.snap_getBip32Entropy]: (t, _, permissionValue) =>
Expand All @@ -102,7 +118,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
</span>,
path.join('/'),
]),
description: t('permission_manageNamedBip32KeysDescription'),
description: t('permission_manageBip32KeysDescription', [
<span
className="tooltip-label-item"
key={`description-${path.join('/')}`}
>
{friendlyName}
</span>,
curve,
]),
};
}

Expand All @@ -114,7 +138,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
</span>,
curve,
]),
description: t('permission_manageBip32KeysDescription'),
description: t('permission_manageBip32KeysDescription', [
<span
className="tooltip-label-item"
key={`description-${path.join('/')}`}
>
{path.join('/')}
</span>,
curve,
]),
};
}),
[RestrictedMethods.snap_getBip44Entropy]: (t, _, permissionValue) =>
Expand All @@ -125,7 +157,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
`${coinType} (Unrecognized protocol)`}
</span>,
]),
description: t('permission_manageBip44KeysDescription'),
description: t('permission_manageBip44KeysDescription', [
<span
className="tooltip-label-item"
key={`description-coin-type-${coinType}`}
>
{coinTypeToProtocolName(coinType) ||
`${coinType} (Unrecognized protocol)`}
</span>,
]),
leftIcon: 'fas fa-door-open',
rightIcon: 'fa fa-exclamation-triangle',
weight: 1,
Expand Down Expand Up @@ -161,14 +201,14 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
{friendlyName}
</span>,
]),
description: t('permission_accessSnapDescription'),
description: t('permission_accessSnapDescription', [friendlyName]),
};
}

return {
...baseDescription,
label: t('permission_accessSnap', [snapId]),
description: t('permission_accessSnapDescription'),
description: t('permission_accessSnapDescription', [snapId]),
};
},
[EndowmentPermissions['endowment:network-access']]: (t) => ({
Expand Down Expand Up @@ -247,15 +287,15 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
results.push({
...baseDescription,
label: t('permission_rpc', [t('otherSnaps')]),
description: t('permission_rpcDescription'),
description: t('permission_rpcDescription', [t('otherSnaps')]),
});
}

if (dapps) {
results.push({
...baseDescription,
label: t('permission_rpc', [t('websites')]),
description: t('permission_rpcDescription'),
description: t('permission_rpcDescription', [t('websites')]),
});
}

Expand Down Expand Up @@ -360,7 +400,8 @@ export function getRightIcon({ rightIcon, description, weight }) {
'permission__tooltip-icon',
weight === 1 && 'permission__tooltip-icon__warning',
)}
html={description}
html={<div>{description}</div>}
position="bottom"
>
<i className={rightIcon} />
</Tooltip>
Expand Down

0 comments on commit ad73413

Please sign in to comment.