1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Show snap version on install (#13931)

* Add version to Snap install page

* Fix text sizing inconsistency

* Use a localized string for shorthand versions
This commit is contained in:
Frederik Bolding 2022-03-14 18:40:21 +01:00 committed by GitHub
parent f9ea6f5185
commit c81912f6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 8 deletions

View File

@ -2769,6 +2769,10 @@
"settingsSearchMatchingNotFound": { "settingsSearchMatchingNotFound": {
"message": "No matching results found" "message": "No matching results found"
}, },
"shorthandVersion": {
"message": "v$1",
"description": "$1 is replaced by a version string (e.g. 1.2.3)"
},
"show": { "show": {
"message": "Show" "message": "Show"
}, },

View File

@ -180,7 +180,7 @@ const SnapSettingsCard = ({
tag="span" tag="span"
className="snap-settings-card__version" className="snap-settings-card__version"
> >
v {version} {t('shorthandVersion', [version])}
</Typography> </Typography>
</> </>
)} )}

View File

@ -5,12 +5,24 @@ import Box from '../../ui/box';
import { import {
FLEX_DIRECTION, FLEX_DIRECTION,
JUSTIFY_CONTENT, JUSTIFY_CONTENT,
///: BEGIN:ONLY_INCLUDE_IN(flask)
COLORS,
TYPOGRAPHY,
TEXT_ALIGN,
///: END:ONLY_INCLUDE_IN
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
import SnapsAuthorshipPill from '../flask/snaps-authorship-pill'; import SnapsAuthorshipPill from '../flask/snaps-authorship-pill';
import Typography from '../../ui/typography';
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
export default class PermissionsConnectHeader extends Component { export default class PermissionsConnectHeader extends Component {
///: BEGIN:ONLY_INCLUDE_IN(flask)
static contextTypes = {
t: PropTypes.func,
};
///: END:ONLY_INCLUDE_IN
static propTypes = { static propTypes = {
iconUrl: PropTypes.string, iconUrl: PropTypes.string,
iconName: PropTypes.string.isRequired, iconName: PropTypes.string.isRequired,
@ -20,6 +32,7 @@ export default class PermissionsConnectHeader extends Component {
headerText: PropTypes.string, headerText: PropTypes.string,
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
npmPackageName: PropTypes.string, npmPackageName: PropTypes.string,
snapVersion: PropTypes.string,
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
}; };
@ -47,10 +60,12 @@ export default class PermissionsConnectHeader extends Component {
headerText, headerText,
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
npmPackageName, npmPackageName,
snapVersion,
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
} = this.props; } = this.props;
///: BEGIN:ONLY_INCLUDE_IN(flask) ///: BEGIN:ONLY_INCLUDE_IN(flask)
const npmPackageUrl = `https://www.npmjs.com/package/${npmPackageName}`; const npmPackageUrl = `https://www.npmjs.com/package/${npmPackageName}`;
const { t } = this.context;
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
return ( return (
<Box <Box
@ -71,6 +86,24 @@ export default class PermissionsConnectHeader extends Component {
) : null ) : null
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
} }
{
///: BEGIN:ONLY_INCLUDE_IN(flask)
snapVersion && (
<Typography
boxProps={{
margin: [2, 0],
}}
color={COLORS.TEXT_MUTED}
variant={TYPOGRAPHY.H7}
align={TEXT_ALIGN.CENTER}
tag="span"
className="version"
>
{t('shorthandVersion', [snapVersion])}
</Typography>
)
///: END:ONLY_INCLUDE_IN
}
<div className="permissions-connect-header__subtitle">{headerText}</div> <div className="permissions-connect-header__subtitle">{headerText}</div>
</Box> </Box>
); );

View File

@ -22,6 +22,10 @@
} }
} }
.version {
font-family: monospace;
}
.page-container__footer { .page-container__footer {
width: 100%; width: 100%;
margin-top: 12px; margin-top: 12px;

View File

@ -75,16 +75,18 @@ export default function SnapInstall({
headerText={null} // TODO(ritave): Add header text when snaps support description headerText={null} // TODO(ritave): Add header text when snaps support description
siteOrigin={targetSubjectMetadata.origin} siteOrigin={targetSubjectMetadata.origin}
npmPackageName={npmId} npmPackageName={npmId}
snapVersion={targetSubjectMetadata.version}
boxProps={{ alignItems: ALIGN_ITEMS.CENTER }} boxProps={{ alignItems: ALIGN_ITEMS.CENTER }}
/> />
<Typography></Typography> <Typography
<Box boxProps={{
className="snap-requests-permission" padding: [4, 4, 0, 4],
padding={4} }}
tag={TYPOGRAPHY.H7} variant={TYPOGRAPHY.H7}
tag="span"
> >
<span>{t('snapRequestsPermission')}</span> {t('snapRequestsPermission')}
</Box> </Typography>
<PermissionsConnectPermissionList <PermissionsConnectPermissionList
permissions={request.permissions || {}} permissions={request.permissions || {}}
/> />
@ -149,5 +151,6 @@ SnapInstall.propTypes = {
name: PropTypes.string, name: PropTypes.string,
origin: PropTypes.string.isRequired, origin: PropTypes.string.isRequired,
sourceCode: PropTypes.string, sourceCode: PropTypes.string,
version: PropTypes.string,
}).isRequired, }).isRequired,
}; };