Skip to content

Commit

Permalink
New: Show successful grabs in Interactive Search with green icon
Browse files Browse the repository at this point in the history
(cherry picked from commit 366b2b8b52d8375f1f41719a09893136009a5b48)

Closes #3981
  • Loading branch information
mynameisbogdan committed Aug 10, 2023
1 parent 118220b commit d99e7f9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion frontend/src/InteractiveSearch/InteractiveSearchRow.js
Expand Up @@ -32,6 +32,18 @@ function getDownloadIcon(isGrabbing, isGrabbed, grabError) {
return icons.DOWNLOAD;
}

function getDownloadKind(isGrabbed, grabError, downloadAllowed) {
if (isGrabbed) {
return kinds.SUCCESS;
}

if (grabError || !downloadAllowed) {
return kinds.DANGER;
}

return kinds.DEFAULT;
}

function getDownloadTooltip(isGrabbing, isGrabbed, grabError) {
if (isGrabbing) {
return '';
Expand Down Expand Up @@ -212,7 +224,7 @@ class InteractiveSearchRow extends Component {
{
<SpinnerIconButton
name={getDownloadIcon(isGrabbing, isGrabbed, grabError)}
kind={grabError || !downloadAllowed ? kinds.DANGER : kinds.DEFAULT}
kind={getDownloadKind(isGrabbed, grabError, downloadAllowed)}
title={getDownloadTooltip(isGrabbing, isGrabbed, grabError)}
isSpinning={isGrabbing}
onPress={downloadAllowed ? this.onGrabPress : this.onConfirmGrabPress}
Expand Down

0 comments on commit d99e7f9

Please sign in to comment.