Disable download button when no data is available

feature/gui
Alinson S. Xavier 4 years ago
parent 310f5c389e
commit 01a4c6626d
No known key found for this signature in database
GPG Key ID: DCA0DAD4D2F58624

@ -12,7 +12,11 @@ const Button = (props) => {
}
return (
<button className={className} onClick={props.onClick}>
<button
className={className}
onClick={props.onClick}
disabled={props.disabled}
>
{tooltip}
{props.label}
</button>

@ -60,3 +60,8 @@
opacity: 100%;
transition: opacity 0.5s;
}
.Button:disabled {
color: rgba(0, 0, 0, 0.25);
cursor: default;
}

@ -31,8 +31,18 @@ const FileInputRow = (props) => {
<label>{props.label}</label>
<input type="text" value={props.value} disabled="disabled" />
<Button label="Upload" kind="inline" onClick={onClickUpload} />
<Button label="Download" kind="inline" onClick={props.onDownload} />
<Button label="Clear" kind="inline" onClick={props.onClear} />
<Button
label="Download"
kind="inline"
onClick={props.onDownload}
disabled={props.disableDownload}
/>
<Button
label="Clear"
kind="inline"
onClick={props.onClear}
disabled={props.disableClear}
/>
<Button label="Template" kind="inline" onClick={props.onTemplate} />
{tooltip}
<input

@ -91,8 +91,12 @@ const ProductBlock = (props) => {
};
let description = "Not initially available";
let notInitiallyAvailable = true;
const nCenters = Object.keys(props.value["initial amounts"]).length;
if (nCenters > 0) description = `${nCenters} collection centers`;
if (nCenters > 0) {
description = `${nCenters} collection centers`;
notInitiallyAvailable = false;
}
return (
<>
@ -109,6 +113,8 @@ const ProductBlock = (props) => {
onDownload={onInitialAmountsDownload}
onClear={onInitialAmountsClear}
onTemplate={onInitialAmountsTemplate}
disableDownload={notInitiallyAvailable}
disableClear={notInitiallyAvailable}
/>
<h1 style={{ display: nCenters == 0 ? "none" : "block" }}>

Loading…
Cancel
Save