Skip to content

Commit 019bcb0

Browse files
authored
v2.4.0 (#22)
* initial biorepository collections presentation * add max height to biorepository collections * fix bio repo collections overflow property * update core-components * fix data ava app release doi checks * portal-core-components v2.4.0, sync assets * prepare v2.4.0
1 parent 8c8796f commit 019bcb0

28 files changed

+159
-34
lines changed

apps/data-availability/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-availability",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"private": true,
55
"homepage": "https://localhost/visualizations/data-availability",
66
"dependencies": {
@@ -19,7 +19,7 @@
1919
"core-js": "^3.30.0",
2020
"lodash": "^4.17.21",
2121
"moment": "^2.29.4",
22-
"portal-core-components": "github:NEONScience/portal-core-components#v2.3.0",
22+
"portal-core-components": "github:NEONScience/portal-core-components#v2.4.0",
2323
"prop-types": "^15.8.1",
2424
"react": "^17.0.2",
2525
"react-dom": "^17.0.2",

apps/data-availability/public/assets/css/drupal-theme.98af391f0797dc8df157fb52a8a37b1d.min.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/data-availability/public/assets/css/drupal-theme.e17db4d4671c58da18ec4cfa8dd9d2ee.min.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

apps/data-availability/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<link
1717
rel="stylesheet"
1818
data-meta="drupal-theme"
19-
href="%PUBLIC_URL%/assets/css/drupal-theme.e17db4d4671c58da18ec4cfa8dd9d2ee.min.css"
19+
href="%PUBLIC_URL%/assets/css/drupal-theme.98af391f0797dc8df157fb52a8a37b1d.min.css"
2020
/>
2121
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
2222
<!-- jQuery needed for drupal header -->

apps/data-availability/src/components/release/TombstoneNotice.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ const TombstoneNotice: React.FC = (): JSX.Element => {
3434
const state: TombstoneNoticeState = useTombstoneNoticdSelector();
3535
const classes = useStyles(Theme);
3636
const { isTombstoned, focalProductReleaseDoi }: TombstoneNoticeState = state;
37-
if (!(isTombstoned === true) || !exists(focalProductReleaseDoi)) {
37+
if (!(isTombstoned === true)
38+
|| !exists(focalProductReleaseDoi)
39+
|| (Array.isArray(focalProductReleaseDoi) && (focalProductReleaseDoi.length <= 0))) {
3840
return <></>;
3941
}
4042
let citationReleases: DataProductReleaseDoi[] = [];

apps/data-product-detail/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "portal-data-products",
3-
"version": "2.3.1",
3+
"version": "2.4.0",
44
"private": true,
55
"homepage": "http://localhost/data-products/",
66
"dependencies": {
@@ -15,7 +15,7 @@
1515
"lodash": "^4.17.21",
1616
"material-table": "^1.69.3",
1717
"moment": "2.29.4",
18-
"portal-core-components": "github:NEONScience/portal-core-components#v2.3.0",
18+
"portal-core-components": "github:NEONScience/portal-core-components#v2.4.0",
1919
"prop-types": "^15.8.1",
2020
"react": "^17.0.2",
2121
"react-copy-to-clipboard": "^5.1.0",

apps/data-product-detail/public/assets/css/drupal-theme.98af391f0797dc8df157fb52a8a37b1d.min.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/data-product-detail/public/assets/css/drupal-theme.e17db4d4671c58da18ec4cfa8dd9d2ee.min.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

apps/data-product-detail/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<link
1717
rel="stylesheet"
1818
data-meta="drupal-theme"
19-
href="%PUBLIC_URL%/assets/css/drupal-theme.e17db4d4671c58da18ec4cfa8dd9d2ee.min.css"
19+
href="%PUBLIC_URL%/assets/css/drupal-theme.98af391f0797dc8df157fb52a8a37b1d.min.css"
2020
/>
2121
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
2222
<!-- jQuery needed for drupal header -->
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import React from 'react';
2+
3+
import { makeStyles } from '@material-ui/core/styles';
4+
import IconButton from '@material-ui/core/IconButton';
5+
import List from '@material-ui/core/List';
6+
import ListItem from '@material-ui/core/ListItem';
7+
import ListItemText from '@material-ui/core/ListItemText';
8+
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
9+
import Tooltip from '@material-ui/core/Tooltip';
10+
11+
import DownloadIcon from '@material-ui/icons/SaveAlt';
12+
13+
import Theme from 'portal-core-components/lib/components/Theme';
14+
import { existsNonEmpty, isStringNonEmpty } from 'portal-core-components/lib/util/typeUtil';
15+
16+
import DataProductContext from '../DataProductContext';
17+
import Detail from './Detail';
18+
19+
const useStyles = makeStyles((theme) => ({
20+
list: {
21+
padding: theme.spacing(0),
22+
marginTop: theme.spacing(-1),
23+
marginBottom: theme.spacing(1),
24+
maxHeight: '440px',
25+
overflowY: 'auto',
26+
},
27+
listItemLink: {
28+
borderRadius: theme.spacing(0.5),
29+
border: '0.5px solid #ffffff00',
30+
'&:hover': {
31+
border: `0.5px solid ${theme.palette.primary.main}`,
32+
},
33+
},
34+
listItemLinkSecondary: {
35+
'& p': {
36+
color: theme.palette.primary.main,
37+
textDecoration: 'underline',
38+
marginTop: theme.spacing(0.5),
39+
'&:hover': {
40+
color: Theme.colors.LIGHT_BLUE[400],
41+
},
42+
},
43+
},
44+
}));
45+
46+
const downloadCollection = (url) => {
47+
if (!isStringNonEmpty(url)) {
48+
return;
49+
}
50+
try {
51+
const link = window.document.createElement('a');
52+
link.href = url;
53+
link.setAttribute('download', url);
54+
link.setAttribute('rel', 'noopener noreferrer');
55+
window.document.body.appendChild(link);
56+
link.click();
57+
window.document.body.removeChild(link);
58+
} catch (e) {
59+
// eslint-disable-next-line no-console
60+
console.error(e);
61+
}
62+
};
63+
64+
const BioRepoCollectionsDetail = () => {
65+
const classes = useStyles(Theme);
66+
const [state] = DataProductContext.useDataProductContextState();
67+
const product = DataProductContext.getCurrentProductFromState(state);
68+
const { biorepositoryCollections: collections } = product;
69+
if (!existsNonEmpty(collections)) {
70+
return null;
71+
}
72+
return (
73+
<Detail title="Biorepository Collections">
74+
<List dense className={classes.list}>
75+
{collections.map((collection) => {
76+
const {
77+
collectionCode,
78+
collectionName,
79+
collectionContentUrl,
80+
collectionDownloadUrl,
81+
} = collection;
82+
const showDownload = isStringNonEmpty(collectionDownloadUrl);
83+
if (!isStringNonEmpty(collectionCode) || !isStringNonEmpty(collectionName)) {
84+
return null;
85+
}
86+
return (
87+
<ListItem
88+
key={`${collectionCode}-${collectionName}`}
89+
className={`${classes.listItemLink} ${classes.listItemLinkSecondary}`}
90+
component="a"
91+
href={collectionContentUrl}
92+
target="_blank"
93+
rel="noopener noreferrer"
94+
button
95+
>
96+
<ListItemText primary={collectionName} secondary={collectionCode} />
97+
{!showDownload ? null : (
98+
<ListItemSecondaryAction>
99+
<Tooltip
100+
style={{ flex: 0 }}
101+
placement="left"
102+
title="Download collection"
103+
>
104+
<IconButton
105+
color="primary"
106+
onClick={() => { downloadCollection(collectionDownloadUrl); }}
107+
>
108+
<DownloadIcon />
109+
</IconButton>
110+
</Tooltip>
111+
</ListItemSecondaryAction>
112+
)}
113+
</ListItem>
114+
);
115+
})}
116+
</List>
117+
</Detail>
118+
);
119+
};
120+
121+
export default BioRepoCollectionsDetail;

0 commit comments

Comments
 (0)