@@ -43,6 +43,7 @@ import { isString } from 'lodash';
43
43
import { SvgTooltip } from '../common' ;
44
44
import { getMolImage } from '../preview/molecule/redux/dispatchActions' ;
45
45
import { MOL_TYPE } from '../preview/molecule/redux/constants' ;
46
+ import { deselectVectorCompound , isCompoundFromVectorSelector , showHideLigand } from '../preview/compounds/redux/dispatchActions' ;
46
47
47
48
const useStyles = makeStyles ( theme => ( {
48
49
container : {
@@ -264,10 +265,12 @@ export const DatasetMoleculeView = memo(
264
265
P,
265
266
C,
266
267
S,
267
- V
268
+ V,
269
+ fromSelectedCompounds = false
268
270
} ) => {
269
271
const selectedAll = useRef ( false ) ;
270
- const currentID = ( data && data . id ) || undefined ;
272
+ const currentID = ( data && data . id ) || ( data && data . smiles ) || undefined ;
273
+ const isFromVectorSelector = isCompoundFromVectorSelector ( data ) ;
271
274
const classes = useStyles ( ) ;
272
275
const ref = useRef ( null ) ;
273
276
const dispatch = useDispatch ( ) ;
@@ -299,7 +302,11 @@ export const DatasetMoleculeView = memo(
299
302
const hasAllValuesOn = isLigandOn && isProteinOn && isComplexOn ;
300
303
const hasSomeValuesOn = ! hasAllValuesOn && ( isLigandOn || isProteinOn || isComplexOn || isSurfaceOn ) ;
301
304
302
- const areArrowsVisible = isLigandOn || isProteinOn || isComplexOn || isSurfaceOn ;
305
+ let areArrowsVisible = isLigandOn || isProteinOn || isComplexOn || isSurfaceOn ;
306
+
307
+ if ( fromSelectedCompounds ) {
308
+ areArrowsVisible = false ;
309
+ }
303
310
304
311
// const disableUserInteraction = useDisableUserInteraction();
305
312
@@ -359,10 +366,14 @@ export const DatasetMoleculeView = memo(
359
366
} else if ( calledFromSelectAll && selectedAll . current === false ) {
360
367
removeSelectedLigand ( calledFromSelectAll ) ;
361
368
} else if ( ! calledFromSelectAll ) {
362
- if ( isLigandOn === false ) {
363
- addNewLigand ( ) ;
369
+ if ( isFromVectorSelector ) {
370
+ dispatch ( showHideLigand ( data , stage ) ) ;
364
371
} else {
365
- removeSelectedLigand ( ) ;
372
+ if ( isLigandOn === false ) {
373
+ addNewLigand ( ) ;
374
+ } else {
375
+ removeSelectedLigand ( ) ;
376
+ }
366
377
}
367
378
}
368
379
} ;
@@ -558,6 +569,7 @@ export const DatasetMoleculeView = memo(
558
569
dispatch ( appendMoleculeToCompoundsOfDatasetToBuy ( datasetID , currentID , moleculeTitle ) ) ;
559
570
} else {
560
571
dispatch ( removeMoleculeFromCompoundsOfDatasetToBuy ( datasetID , currentID , moleculeTitle ) ) ;
572
+ dispatch ( deselectVectorCompound ( data ) ) ;
561
573
}
562
574
} }
563
575
/>
@@ -646,7 +658,7 @@ export const DatasetMoleculeView = memo(
646
658
onProtein ( true ) ;
647
659
onComplex ( true ) ;
648
660
} }
649
- disabled = { false }
661
+ disabled = { isFromVectorSelector }
650
662
>
651
663
A
652
664
</ Button >
@@ -674,7 +686,7 @@ export const DatasetMoleculeView = memo(
674
686
[ classes . contColButtonSelected ] : isProteinOn
675
687
} ) }
676
688
onClick = { ( ) => onProtein ( ) }
677
- disabled = { false }
689
+ disabled = { isFromVectorSelector }
678
690
>
679
691
P
680
692
</ Button >
@@ -689,7 +701,7 @@ export const DatasetMoleculeView = memo(
689
701
[ classes . contColButtonSelected ] : isComplexOn
690
702
} ) }
691
703
onClick = { ( ) => onComplex ( ) }
692
- disabled = { false }
704
+ disabled = { isFromVectorSelector }
693
705
>
694
706
C
695
707
</ Button >
@@ -703,7 +715,7 @@ export const DatasetMoleculeView = memo(
703
715
[ classes . contColButtonSelected ] : isSurfaceOn
704
716
} ) }
705
717
onClick = { ( ) => onSurface ( ) }
706
- disabled = { false }
718
+ disabled = { isFromVectorSelector }
707
719
>
708
720
S
709
721
</ Button >
@@ -729,7 +741,7 @@ export const DatasetMoleculeView = memo(
729
741
setRef ( ref . current ) ;
730
742
}
731
743
} }
732
- disabled = { false }
744
+ disabled = { isFromVectorSelector }
733
745
>
734
746
F
735
747
</ Button >
@@ -751,7 +763,7 @@ export const DatasetMoleculeView = memo(
751
763
setRef ( ref . current ) ;
752
764
}
753
765
} }
754
- disabled = { false }
766
+ disabled = { isFromVectorSelector }
755
767
>
756
768
X
757
769
</ Button >
@@ -776,7 +788,10 @@ export const DatasetMoleculeView = memo(
776
788
filteredScoreProperties [ datasetID ] &&
777
789
filteredScoreProperties [ datasetID ] . map ( score => {
778
790
//const item = scoreCompoundMap && scoreCompoundMap[data?.compound]?.find(o => o.score.id === score.id);
779
- const value = allScores [ score . name ] ;
791
+ let value = allScores [ score . name ] ;
792
+ if ( ! value ) {
793
+ value = data [ score . name ] ;
794
+ }
780
795
return (
781
796
< Tooltip title = { `${ score . name } - ${ score . description } : ${ value } ` } key = { score . name } >
782
797
{ ( value && (
0 commit comments