Skip to content

Commit 24e2ad9

Browse files
authored
v2.0.1 (#10)
* Place dropdown menu above the subheader componen * Allow gif upload and set max image file size to 5 MB * Update ticket number description * Update introduction text * Collapse menu button if page width is too small * Minor css update * Update ProgressBar.js Fix hover/tooltip text * Update version.js
1 parent 9826bd9 commit 24e2ad9

9 files changed

Lines changed: 75 additions & 42 deletions

File tree

server/routes/upload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const router = express.Router();
1111
// Todo: Change file upload limit to 5? MB when understanding why openshift server is not able to handle files larger than 1MB. nginx client_max_body_size?
1212

1313
// Configure the file upload middleware
14-
const maxFileSizeMB = 1;
14+
const maxFileSizeMB = 5;
1515
const sizeLimitMessage = `File size limit exceeded. Maximum file size is ${maxFileSizeMB} MB.`
1616

17-
const maxFileSize = maxFileSizeMB * 1024 * 1024; // 1 MB
17+
const maxFileSize = maxFileSizeMB * 1024 * 1024; // File size in MB
1818
const uploadOptions = { limits: { fileSize: maxFileSize }, debug:true, useTempFiles:true, abortOnLimit:true, responseOnLimit:sizeLimitMessage}
1919
router.use( fileUpload(uploadOptions) );
2020

src/App.css

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
height: 30px;
7474
}
7575

76-
.gradient {
76+
.container-gradient {
7777
background-image: linear-gradient(to left, var(--ebrains-color-light), var(--ebrains-color-medium), var(--ebrains-color-dark));
7878
min-height: 1vh;
7979
display: flex;
@@ -82,27 +82,32 @@
8282
justify-content: center;
8383
font-size: calc(10px + 2vmin);
8484
color: white;
85+
z-index: 9996;
8586
}
8687

87-
.subheader {
88+
.container-subheader {
8889
background-color: var(--form-background-color);
8990
margin-bottom: 40px;
9091
position: -webkit-sticky; /* Safari */
9192
position: sticky;
92-
z-index: 9999;
93+
z-index: 9998;
9394
top: 0;
9495
box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px, rgba(0, 0, 0, 0.05) 0px 1px 4px 0px, rgba(0, 0, 0, 0.05) 0px 2px 8px 0px;
9596
}
97+
.ant-dropdown {
98+
z-index: 9999;
99+
}
96100

97101
.privacy-notice {
98-
width: 80%;
102+
width: 70%;
99103
display: inline-block;
100104
text-align: left;
101105
margin: 0 auto;
102106
}
103107

104108
.subheader-menu {
105-
width: 20%;
109+
width: 30%;
110+
padding-right: 0px;
106111
padding-top: 5px;
107112
padding-bottom: 5px;
108113
display: inline-block;
@@ -142,7 +147,7 @@
142147
margin-left: auto;
143148
margin-right: auto;
144149
padding: 5px 60px 5px 60px;
145-
max-width: var(--max-content-width);;
150+
max-width: var(--max-content-width);
146151
}
147152

148153
.container-header {
@@ -153,6 +158,7 @@
153158
padding: 0px 60px 0px 60px;
154159
max-width: var(--max-content-width);
155160
border-radius: 20px;
161+
z-index: 9997;
156162
}
157163

158164
.container-form {

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const App = () => {
3131
<a href="/"><img src="EBRAINS-Curation-Services.png" alt="EBRAINS Curation Services Logo" width="100%" style={{"margin":"10px","display":"block","marginLeft":"auto","marginRight":"auto"}} /></a>
3232
</div>
3333
</header>
34-
<div className="gradient"></div>
34+
<div className="container-gradient"></div>
3535

3636
<BrowserRouter>
3737
<Routes>
@@ -43,7 +43,7 @@ const App = () => {
4343

4444
<Route path="/" element={
4545
<div>
46-
<div className="subheader">
46+
<div className="container-subheader">
4747
<div className="content-container">
4848
<div className="privacy-notice">
4949
<PrivacyBanner />

src/components/DropdownMenu.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react';
12
import { DownloadOutlined, UploadOutlined, DeleteOutlined, MenuOutlined } from '@ant-design/icons';
23
import { Dropdown, Space } from 'antd';
34
import ConfigProvider from './ConfigProvider';
@@ -22,6 +23,19 @@ const items = [
2223

2324
const DropdownMenu = ({handleMenuSelection}) => {
2425

26+
const [isCollapsed, setIsCollapsed] = React.useState(false);
27+
28+
React.useEffect(() => {
29+
function handleResize() {
30+
if (window.innerWidth < 700) {
31+
setIsCollapsed(true)
32+
} else {
33+
setIsCollapsed(false)
34+
}
35+
}
36+
window.addEventListener('resize', handleResize)
37+
})
38+
2539
const handleMenuClick = (item) => {
2640
handleMenuSelection(items[item.key - 1].label) }
2741

@@ -37,8 +51,8 @@ const DropdownMenu = ({handleMenuSelection}) => {
3751
return (
3852
<Space wrap>
3953
<ConfigProvider componentSize={"large"}>
40-
<Dropdown.Button menu={menuProps} onClick={handleButtonClick} icon={<MenuOutlined />}>
41-
Download form data
54+
<Dropdown.Button menu={menuProps} onClick={handleButtonClick} icon={<MenuOutlined />} title={'Download form data'}>
55+
{ isCollapsed ? <DownloadOutlined /> : "Download form data" }
4256
</Dropdown.Button>
4357
</ConfigProvider>
4458
</Space>

src/components/ImageUpload.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,17 @@ const ImageUpload = ({oldFileList, onImageUploadedFcn}) => {
5555
// };
5656

5757
const beforeUpload = (file) => {
58-
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
59-
if (!isJpgOrPng) {
60-
message.error('You can only upload JPG/PNG file!');
58+
const isValidImageFormat = file.type === 'image/jpeg' || file.type === 'image/png'; // Todo: add gif
59+
if (!isValidImageFormat) {
60+
message.error('You can only upload a JPG/PNG/GIF file!');
6161
}
6262

63-
const isLt2M = file.size / 1024 / 1024 < 5;
64-
if (!isLt2M) {
63+
const isLt5M = file.size / 1024 / 1024 < 5;
64+
if (!isLt5M) {
6565
message.error('Image must smaller than 5MB!');
6666
}
67-
return isJpgOrPng && isLt2M;
67+
68+
return isValidImageFormat && isLt5M;
6869
};
6970

7071
const uploadButton = (
@@ -83,7 +84,7 @@ const ImageUpload = ({oldFileList, onImageUploadedFcn}) => {
8384
<ImgCrop quality={1} grid>
8485
<Upload
8586
action='/api/upload/previewImage'
86-
accept=".png,.jpg"
87+
accept=".png,.jpg,.gif"
8788
listType="picture"
8889
fileList={fileList}
8990
beforeUpload={beforeUpload}

src/components/ProgressBar.js

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,35 @@ import ConfigProvider from './ConfigProvider';
77
const WIZARD_STEP_NAMES = [ "Introduction", "Dataset part 1", "Dataset part 2", "Funding", "Contributors", "Experiments" ];
88
const NUM_STEPS = WIZARD_STEP_NAMES.length;
99

10-
const customDot = (dot, { status, index }) => (
11-
<Popover
12-
content={
13-
<span>
14-
Step {index+1} of {NUM_STEPS} - Status: {status}
15-
</span>
16-
}
17-
>
18-
{dot}
19-
</Popover>
20-
);
10+
const customDot = (dot, { status, index }) => {
11+
12+
// Update status message
13+
switch (status) {
14+
case 'process':
15+
status = 'In progress';
16+
break;
17+
case 'finish':
18+
status = 'Completed';
19+
break;
20+
case 'wait':
21+
status = 'Incomplete';
22+
break;
23+
default:
24+
status = 'Incomplete';
25+
}
26+
27+
return (
28+
<Popover
29+
content={
30+
<span>
31+
Step {index+1} of {NUM_STEPS} - Status: {status}
32+
</span>
33+
}
34+
>
35+
{dot}
36+
</Popover>
37+
);
38+
};
2139
//const description = 'Incomplete';
2240

2341
const ProgressBar = ({step, status, onChanged}) => {

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const wizardVersion = '2.0.0';
1+
const wizardVersion = '2.0.1';
22
export default wizardVersion

templates/source_schemas/general.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"ticketNumber": {
1111
"title": "Ticket number",
1212
"type": "string",
13-
"description": "If you have a ticket number, please enter it here. The ticket number can be found in the subject line in email correspondence with the curation team, e.g Ticket#4815613."
13+
"description": "This field might be pre-filled. If not, you can find the ticket number in the subject line of email correspondence with the curation team, e.g Ticket#4815613. If you have not yet received a ticket number, you can leave this field blank."
1414
},
1515
"contactperson": {
1616
"title": "Contact person",
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
<p>
2-
Thank you for choosing EBRAINS to share your research data. This form helps you describe key aspects of your dataset so that other researchers will be able to find, reuse and cite your work. We collect information in the following categories:
2+
Thank you for choosing EBRAINS to share your research data. In this form, you can describe key aspects of your dataset so that other researchers will be able to find, reuse and cite your work. You can use the navigation bar above to explore the different sections and categories of metadata collected through this form.
33
</p>
44

55
<p>
6-
<ul>
7-
<li>Data owner and contributors
8-
<li>Experimental methods and subjects
9-
<li>Licensing, embargo and funding
10-
<li>Related publications
11-
</ul>
6+
While filling out the form, please <b>remember to consider all data</b> related to the dataset that you wish to publish on EBRAINS. Once you complete the form, metadata describing your dataset will be curated according to the <a href='https://github.com/HumanBrainProject/openMINDS' target='_blank' rel='noreferrer'>openMINDS</a> standard.
127
</p>
13-
148
<p>
15-
While filling out the form, please <b>remember to consider all data</b> related to the dataset that you wish to publish on EBRAINS. Once you complete the form, metadata describing your dataset will be curated according to the openMINDS standard (<a href='https://github.com/HumanBrainProject/openMINDS' target='_blank' rel='noreferrer'>open Metadata Initiative for Neuroscience Data Structures</a>).
16-
</p>
9+
<b>Note:</b> If you are interrupted or unable to complete the form in one session, you can download the form as a JSON using the "Download form data" button on the top of the page, and then re-upload it later to continue where you left off.
10+
</p>

0 commit comments

Comments
 (0)