diff --git a/ui/components/app/snaps/snap-authorship-expanded/snap-authorship-expanded.js b/ui/components/app/snaps/snap-authorship-expanded/snap-authorship-expanded.js index ac3fefd72d27..11d88073810b 100644 --- a/ui/components/app/snaps/snap-authorship-expanded/snap-authorship-expanded.js +++ b/ui/components/app/snaps/snap-authorship-expanded/snap-authorship-expanded.js @@ -1,38 +1,36 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; import { getSnapPrefix } from '@metamask/snaps-utils'; +import classnames from 'classnames'; +import PropTypes from 'prop-types'; +import React from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import Box from '../../../ui/box'; import { + AlignItems, BackgroundColor, - TextColor, - FLEX_DIRECTION, - TextVariant, + BlockSize, BorderColor, - AlignItems, - DISPLAY, - BLOCK_SIZES, - JustifyContent, + BorderRadius, BorderStyle, Color, - BorderRadius, + Display, + FlexDirection, FontWeight, + JustifyContent, + TextColor, + TextVariant, } from '../../../../helpers/constants/design-system'; import { formatDate, getSnapName, removeSnapIdPrefix, } from '../../../../helpers/utils/util'; - -import { ButtonLink, Text } from '../../../component-library'; -import { getTargetSubjectMetadata } from '../../../../selectors'; -import SnapAvatar from '../snap-avatar'; import { useI18nContext } from '../../../../hooks/useI18nContext'; -import Tooltip from '../../../ui/tooltip/tooltip'; -import ToggleButton from '../../../ui/toggle-button'; -import { disableSnap, enableSnap } from '../../../../store/actions'; import { useOriginMetadata } from '../../../../hooks/useOriginMetadata'; +import { getTargetSubjectMetadata } from '../../../../selectors'; +import { disableSnap, enableSnap } from '../../../../store/actions'; +import { Box, ButtonLink, Text } from '../../../component-library'; +import ToggleButton from '../../../ui/toggle-button'; +import Tooltip from '../../../ui/tooltip/tooltip'; +import SnapAvatar from '../snap-avatar'; import SnapVersion from '../snap-version/snap-version'; const SnapAuthorshipExpanded = ({ snapId, className, snap }) => { @@ -47,7 +45,7 @@ const SnapAuthorshipExpanded = ({ snapId, className, snap }) => { const packageName = snapId && removeSnapIdPrefix(snapId); const isNPM = snapPrefix === 'npm:'; const url = isNPM - ? `https://www.npmjs.com/package/${packageName}` + ? `https://www.npmjs.com/package/${packageName}/v/${snap?.version}` : packageName; const subjectMetadata = useSelector((state) => @@ -76,13 +74,13 @@ const SnapAuthorshipExpanded = ({ snapId, className, snap }) => { backgroundColor={BackgroundColor.backgroundDefault} borderColor={BorderColor.borderDefault} borderWidth={1} - width={BLOCK_SIZES.FULL} + width={BlockSize.Full} borderRadius={BorderRadius.LG} > { @@ -110,69 +108,67 @@ const SnapAuthorshipExpanded = ({ snapId, className, snap }) => { - - - - {t('enabled')} - - - - - - + + + {t('enabled')} + + + + + - - {installOrigin && installInfo && ( - - - {t('installOrigin')} - - - - {installOrigin.host} - - - {t('installedOn', [ - formatDate(installInfo.date, 'dd MMM yyyy'), - ])} - - - - )} + + + {installOrigin && installInfo && ( - {t('version')} + {t('installOrigin')} - + + + {installOrigin.host} + + + {t('installedOn', [ + formatDate(installInfo.date, 'dd MMM yyyy'), + ])} + + + )} + + + {t('version')} + + diff --git a/ui/components/app/snaps/snap-authorship-header/snap-authorship-header.js b/ui/components/app/snaps/snap-authorship-header/snap-authorship-header.js index fd0848677e28..a96306f2d3e7 100644 --- a/ui/components/app/snaps/snap-authorship-header/snap-authorship-header.js +++ b/ui/components/app/snaps/snap-authorship-header/snap-authorship-header.js @@ -35,14 +35,15 @@ const SnapAuthorshipHeader = ({ const snapPrefix = snapId && getSnapPrefix(snapId); const packageName = snapId && removeSnapIdPrefix(snapId); const isNPM = snapPrefix === 'npm:'; - const url = isNPM - ? `https://www.npmjs.com/package/${packageName}` - : packageName; const subjectMetadata = useSelector((state) => getTargetSubjectMetadata(state, snapId), ); + const url = isNPM + ? `https://www.npmjs.com/package/${packageName}/v/${subjectMetadata?.version}` + : packageName; + const friendlyName = snapId && getSnapName(snapId, subjectMetadata); return (