Skip to content

Commit 4b59040

Browse files
committed
conditional rendering message, update another button too
1 parent cf0c25c commit 4b59040

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed

frontend/src/components/BrutalismButton.jsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ export default function BrutalismButton({
4040
position: "relative",
4141
width: "auto",
4242
height: "auto",
43-
background: backgroundColor,
44-
border: `2px solid ${borderColor}`,
43+
backgroundColor: disabled ? "gray" : backgroundColor,
44+
border: disabled
45+
? "gray"
46+
: borderColor
47+
? `2px solid ${borderColor}`
48+
: `2px solid ${backgroundColor}`,
4549
boxShadow: boxShadowStyle,
4650
borderRadius: "4.8px",
4751
fontSize: "16px",
48-
color: color,
52+
color: disabled ? "black" : color,
4953
fontWeight: "bold",
5054
margin: "8px 8px 0 0",
5155
whiteSpace: "nowrap",
@@ -68,19 +72,19 @@ export default function BrutalismButton({
6872
>
6973
{children}
7074
<span style={{ marginLeft: 10 }}></span>
71-
72-
{
73-
noArrow ? null : <svg
74-
xmlns="http://www.w3.org/2000/svg"
75-
width="14"
76-
height="14"
77-
fill="currentColor"
78-
className="bi bi-arrow-right-circle-fill"
79-
viewBox="0 0 16 16"
80-
>
81-
<path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z" />
82-
</svg>
83-
}
75+
76+
{noArrow ? null : (
77+
<svg
78+
xmlns="http://www.w3.org/2000/svg"
79+
width="14"
80+
height="14"
81+
fill="currentColor"
82+
className="bi bi-arrow-right-circle-fill"
83+
viewBox="0 0 16 16"
84+
>
85+
<path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z" />
86+
</svg>
87+
)}
8488
</a>
8589
</Button>
8690
);

frontend/src/pages/BulkImport/BulkImportTask.jsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -499,16 +499,22 @@ const BulkImportTask = observer(() => {
499499
>
500500
<FormattedMessage id="BULK_IMPORT_SEND_TO_IDENTIFICATION" />
501501
</MainButton>
502-
<p
503-
style={{
504-
color: theme.grayColors.gray500,
505-
}}
506-
>
507-
<FormattedMessage
508-
id="BULK_IMPORT_SEND_TO_IDENTIFICATION_DISABLED_DESC"
509-
defaultMessage="Button is disabled if detection or initial identification task is incomplete"
510-
/>
511-
</p>
502+
{((!userRoles?.includes("admin") &&
503+
!userRoles?.includes("researcher")) ||
504+
!store.locationIDString ||
505+
task?.status !== "complete" ||
506+
task?.iaSummary?.detectionStatus !== "complete") && (
507+
<p
508+
style={{
509+
color: theme.grayColors.gray500,
510+
}}
511+
>
512+
<FormattedMessage
513+
id="BULK_IMPORT_SEND_TO_IDENTIFICATION_DISABLED_DESC"
514+
defaultMessage="Button is disabled if detection or initial identification task is incomplete"
515+
/>
516+
</p>
517+
)}
512518
</Col>
513519
</Row>
514520
<Row>

0 commit comments

Comments
 (0)