chore: sync with 4.x webui

This commit is contained in:
Juan Picado @jotadeveloper
2019-03-27 23:39:06 +01:00
parent e2d478d65b
commit 133a5f0171
88 changed files with 1302 additions and 1656 deletions

View File

@@ -1,13 +1,15 @@
/**
* @prettier
*/
import { DetailContextConsumer } from '../../pages/version/index';
import { formatDateDistance } from '../../utils/package';
import { Heading, Spacer, ListItemText } from './styles';
import React from 'react';
import List from '@material-ui/core/List/index';
import ListItem from '@material-ui/core/ListItem/index';
import React from 'react';
import { DetailContextConsumer } from '../../pages/version/index';
import NoItems from '../NoItems';
import { formatDateDistance } from '../../utils/package';
import { Heading, Spacer, ListItemText } from './styles';
class UpLinks extends React.PureComponent<any> {
render() {
@@ -15,7 +17,7 @@ class UpLinks extends React.PureComponent<any> {
// $FlowFixMe
<DetailContextConsumer>
{({ packageMeta }) => {
return this.renderContent(packageMeta._uplinks);
return this.renderContent(packageMeta._uplinks, packageMeta.latest);
}}
</DetailContextConsumer>
);
@@ -35,15 +37,18 @@ class UpLinks extends React.PureComponent<any> {
</List>
);
renderContent(uplinks) {
return (
uplinks && (
<>
<Heading variant={'subheading'}>{'Uplinks'}</Heading>
{this.renderUpLinksList(uplinks)}
</>
)
);
renderContent(uplinks, { name }) {
if (Object.keys(uplinks).length > 0) {
return (
uplinks && (
<>
<Heading variant={'subheading'}>{'Uplinks'}</Heading>
{this.renderUpLinksList(uplinks)}
</>
)
);
}
return <NoItems text={`${name} has no uplinks.`} />;
}
}