Add snap version to details page (#14110)

* Start to add snap version to details page

* Show install date

* Clean up

* Address PR comments
feature/default_network_editable
Frederik Bolding 3 years ago committed by GitHub
parent 7e7b97d7c9
commit 0556feb142
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/_locales/en/messages.json
  2. 17
      ui/pages/settings/flask/view-snap/index.scss
  3. 24
      ui/pages/settings/flask/view-snap/view-snap.js

@ -2895,6 +2895,10 @@
"message": "$1 snap has access to:", "message": "$1 snap has access to:",
"description": "$1 represents the name of the snap" "description": "$1 represents the name of the snap"
}, },
"snapAdded": {
"message": "Added on $1 from $2",
"description": "$1 represents the date the snap was installed, $2 represents which origin installed the snap."
},
"snapError": { "snapError": {
"message": "Snap Error: '$1'. Error Code: '$2'", "message": "Snap Error: '$1'. Error Code: '$2'",
"description": "This is shown when a snap encounters an error. $1 is the error message from the snap, and $2 is the error code." "description": "This is shown when a snap encounters an error. $1 is the error message from the snap, and $2 is the error code."

@ -8,14 +8,14 @@
&__subheader { &__subheader {
padding: 16px 4px; padding: 16px 4px;
border-bottom: 1px solid var(--color-border-muted); border-bottom: 1px solid var(--color-border-muted);
margin-right: 24px; margin-inline-end: 24px;
height: 72px; height: 72px;
align-items: center; align-items: center;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
margin-right: 0; margin-inline-end: 0;
padding: 0 0 16px; padding: 0 0 16px;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -24,6 +24,19 @@
} }
} }
&__install-details {
border-bottom: 1px solid var(--color-border-muted);
margin-inline-end: 24px;
@media screen and (max-width: $break-small) {
margin-inline-end: 0;
}
}
&__version {
font-family: monospace;
}
&__title { &__title {
@media screen and (max-width: $break-small) { @media screen and (max-width: $break-small) {
padding-bottom: 16px; padding-bottom: 16px;

@ -25,6 +25,7 @@ import {
removePermissionsFor, removePermissionsFor,
} from '../../../../store/actions'; } from '../../../../store/actions';
import { getSnaps, getSubjectsWithPermission } from '../../../../selectors'; import { getSnaps, getSubjectsWithPermission } from '../../../../selectors';
import { formatDate } from '../../../../helpers/utils/util';
function ViewSnap() { function ViewSnap() {
const t = useI18nContext(); const t = useI18nContext();
@ -71,6 +72,10 @@ function ViewSnap() {
if (!snap) { if (!snap) {
return null; return null;
} }
const versionHistory = snap.versionHistory ?? [];
const [firstInstall] = versionHistory;
return ( return (
<div className="view-snap"> <div className="view-snap">
<div className="settings-page__content-row"> <div className="settings-page__content-row">
@ -100,6 +105,25 @@ function ViewSnap() {
</Box> </Box>
</Box> </Box>
</div> </div>
<Box
className="view-snap__install-details"
display="flex"
justifyContent="space-between"
alignItems="center"
padding={2}
>
{firstInstall && (
<Typography variant={TYPOGRAPHY.H8}>
{t('snapAdded', [
formatDate(firstInstall.date, 'MMMM d, y'),
firstInstall.origin,
])}
</Typography>
)}
<Typography className="view-snap__version" variant={TYPOGRAPHY.H7}>
{t('shorthandVersion', [snap.version])}
</Typography>
</Box>
<Box <Box
className="view-snap__content-container" className="view-snap__content-container"
width={FRACTIONS.SEVEN_TWELFTHS} width={FRACTIONS.SEVEN_TWELFTHS}

Loading…
Cancel
Save