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 ( return (
<button className={className} onClick={props.onClick}> <button
className={className}
onClick={props.onClick}
disabled={props.disabled}
>
{tooltip} {tooltip}
{props.label} {props.label}
</button> </button>

@ -60,3 +60,8 @@
opacity: 100%; opacity: 100%;
transition: opacity 0.5s; 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> <label>{props.label}</label>
<input type="text" value={props.value} disabled="disabled" /> <input type="text" value={props.value} disabled="disabled" />
<Button label="Upload" kind="inline" onClick={onClickUpload} /> <Button label="Upload" kind="inline" onClick={onClickUpload} />
<Button label="Download" kind="inline" onClick={props.onDownload} /> <Button
<Button label="Clear" kind="inline" onClick={props.onClear} /> 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} /> <Button label="Template" kind="inline" onClick={props.onTemplate} />
{tooltip} {tooltip}
<input <input

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

Loading…
Cancel
Save