Skip to content

Commit 2f22205

Browse files
- performance optimization - broken right side
1 parent 4dd7613 commit 2f22205

11 files changed

+93
-93
lines changed

js/components/datasets/crossReferenceDialog.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from './redux/dispatchActions';
1717
import { Button } from '../common/Inputs/Button';
1818
import classNames from 'classnames';
19-
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
19+
// import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
2020
import { colourList, DatasetMoleculeView } from './datasetMoleculeView';
2121
import { NglContext } from '../nglView/nglProvider';
2222
import { VIEWS } from '../../constants/constants';
@@ -131,7 +131,7 @@ export const CrossReferenceDialog = memo(
131131

132132
const { getNglView } = useContext(NglContext);
133133
const stage = getNglView(VIEWS.MAJOR_VIEW) && getNglView(VIEWS.MAJOR_VIEW).stage;
134-
const disableUserInteraction = useDisableUserInteraction();
134+
// const disableUserInteraction = useDisableUserInteraction();
135135

136136
const moleculeList = useSelector(state => getCrossReferenceCompoundListByCompoundName(state));
137137
const isLoadingCrossReferenceScores = useSelector(state => state.datasetsReducers.isLoadingCrossReferenceScores);
@@ -271,7 +271,7 @@ export const CrossReferenceDialog = memo(
271271
onClick={() =>
272272
dispatch(handleAllLigandsOfCrossReferenceDialog(isLigandOn, moleculeList, stage))
273273
}
274-
disabled={disableUserInteraction}
274+
disabled={false}
275275
>
276276
L
277277
</Button>
@@ -288,7 +288,7 @@ export const CrossReferenceDialog = memo(
288288
onClick={() =>
289289
dispatch(removeOrAddAllHitProteinsOfList(isProteinOn, moleculeList, stage))
290290
}
291-
disabled={disableUserInteraction}
291+
disabled={false}
292292
>
293293
P
294294
</Button>
@@ -304,7 +304,7 @@ export const CrossReferenceDialog = memo(
304304
[classes.contColButtonHalfSelected]: isComplexOn === null
305305
})}
306306
onClick={() => dispatch(removeOrAddAllComplexesOfList(isComplexOn, moleculeList, stage))}
307-
disabled={disableUserInteraction}
307+
disabled={false}
308308
>
309309
C
310310
</Button>

js/components/datasets/datasetMoleculeList.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Panel } from '../common/Surfaces/Panel';
2323
import { ComputeSize } from '../../utils/computeSize';
2424
import { VIEWS } from '../../constants/constants';
2525
import { NglContext } from '../nglView/nglProvider';
26-
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
26+
// import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
2727
import classNames from 'classnames';
2828
import {
2929
addDatasetLigand,
@@ -232,7 +232,7 @@ export const DatasetMoleculeList = memo(
232232
const getJoinedMoleculeList = useSelector(state => getMoleculeList(state));
233233
const inspirationMoleculeDataList = useSelector(state => state.datasetsReducers.allInspirationMoleculeDataList);
234234

235-
const disableUserInteraction = useDisableUserInteraction();
235+
// const disableUserInteraction = useDisableUserInteraction();
236236

237237
// TODO Reset Infinity scroll
238238

@@ -529,7 +529,7 @@ export const DatasetMoleculeList = memo(
529529
[classes.contColButtonSelected]: isLigandOn
530530
})}
531531
onClick={() => onButtonToggle('ligand')}
532-
disabled={disableUserInteraction}
532+
disabled={false}
533533
>
534534
L
535535
</Button>
@@ -543,7 +543,7 @@ export const DatasetMoleculeList = memo(
543543
[classes.contColButtonSelected]: isProteinOn
544544
})}
545545
onClick={() => onButtonToggle('protein')}
546-
disabled={disableUserInteraction}
546+
disabled={false}
547547
>
548548
P
549549
</Button>
@@ -558,7 +558,7 @@ export const DatasetMoleculeList = memo(
558558
[classes.contColButtonSelected]: isComplexOn
559559
})}
560560
onClick={() => onButtonToggle('complex')}
561-
disabled={disableUserInteraction}
561+
disabled={false}
562562
>
563563
C
564564
</Button>

js/components/datasets/datasetMoleculeView.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SVGInline from 'react-svg-inline';
1010
import classNames from 'classnames';
1111
import { VIEWS } from '../../constants/constants';
1212
import { NglContext } from '../nglView/nglProvider';
13-
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
13+
// import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
1414
import {
1515
addDatasetLigand,
1616
removeDatasetLigand,
@@ -292,7 +292,7 @@ export const DatasetMoleculeView = memo(
292292

293293
const areArrowsVisible = isLigandOn || isProteinOn || isComplexOn || isSurfaceOn;
294294

295-
const disableUserInteraction = useDisableUserInteraction();
295+
// const disableUserInteraction = useDisableUserInteraction();
296296

297297
const refOnCancelImage = useRef();
298298
const getRandomColor = () => colourList[currentID % colourList.length];
@@ -642,7 +642,7 @@ export const DatasetMoleculeView = memo(
642642
onClick={() => {
643643
dispatch(centerOnLigandByMoleculeID(stage, getDatasetMoleculeID(datasetID, currentID)));
644644
}}
645-
disabled={disableUserInteraction || !isLigandOn}
645+
disabled={false || !isLigandOn}
646646
>
647647
<MyLocation className={classes.myLocation} />
648648
</Button>
@@ -669,7 +669,7 @@ export const DatasetMoleculeView = memo(
669669
onProtein(true);
670670
onComplex(true);
671671
}}
672-
disabled={disableUserInteraction}
672+
disabled={false}
673673
>
674674
A
675675
</Button>
@@ -683,7 +683,7 @@ export const DatasetMoleculeView = memo(
683683
[classes.contColButtonSelected]: isLigandOn
684684
})}
685685
onClick={() => onLigand()}
686-
disabled={disableUserInteraction}
686+
disabled={false}
687687
>
688688
L
689689
</Button>
@@ -697,7 +697,7 @@ export const DatasetMoleculeView = memo(
697697
[classes.contColButtonSelected]: isProteinOn
698698
})}
699699
onClick={() => onProtein()}
700-
disabled={disableUserInteraction}
700+
disabled={false}
701701
>
702702
P
703703
</Button>
@@ -712,7 +712,7 @@ export const DatasetMoleculeView = memo(
712712
[classes.contColButtonSelected]: isComplexOn
713713
})}
714714
onClick={() => onComplex()}
715-
disabled={disableUserInteraction}
715+
disabled={false}
716716
>
717717
C
718718
</Button>
@@ -726,7 +726,7 @@ export const DatasetMoleculeView = memo(
726726
[classes.contColButtonSelected]: isSurfaceOn
727727
})}
728728
onClick={() => onSurface()}
729-
disabled={disableUserInteraction}
729+
disabled={false}
730730
>
731731
S
732732
</Button>
@@ -752,7 +752,7 @@ export const DatasetMoleculeView = memo(
752752
setRef(ref.current);
753753
}
754754
}}
755-
disabled={disableUserInteraction}
755+
disabled={false}
756756
>
757757
F
758758
</Button>
@@ -774,7 +774,7 @@ export const DatasetMoleculeView = memo(
774774
setRef(ref.current);
775775
}
776776
}}
777-
disabled={true || disableUserInteraction}
777+
disabled={true || false}
778778
>
779779
X
780780
</Button>
@@ -835,7 +835,7 @@ export const DatasetMoleculeView = memo(
835835
<IconButton
836836
color="primary"
837837
size="small"
838-
disabled={disableUserInteraction || !previousItemData || !areArrowsVisible}
838+
disabled={false || !previousItemData || !areArrowsVisible}
839839
onClick={handleClickOnUpArrow}
840840
>
841841
<ArrowUpward className={areArrowsVisible ? classes.arrow : classes.invisArrow} />
@@ -845,7 +845,7 @@ export const DatasetMoleculeView = memo(
845845
<IconButton
846846
color="primary"
847847
size="small"
848-
disabled={disableUserInteraction || !nextItemData || !areArrowsVisible}
848+
disabled={false || !nextItemData || !areArrowsVisible}
849849
onClick={handleClickOnDownArrow}
850850
>
851851
<ArrowDownward className={areArrowsVisible ? classes.arrow : classes.invisArrow} />

js/components/datasets/inspirationDialog.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { debounce } from 'lodash';
3131
import { setInspirationMoleculeDataList, setIsOpenInspirationDialog } from './redux/actions';
3232
import { Button } from '../common/Inputs/Button';
3333
import classNames from 'classnames';
34-
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
34+
// import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
3535
import { colourList } from './datasetMoleculeView';
3636
import { NglContext } from '../nglView/nglProvider';
3737
import { VIEWS } from '../../constants/constants';
@@ -160,7 +160,7 @@ export const InspirationDialog = memo(
160160
const vectorOnList = useSelector(state => state.selectionReducers.vectorOnList);
161161

162162
const dispatch = useDispatch();
163-
const disableUserInteraction = useDisableUserInteraction();
163+
// const disableUserInteraction = useDisableUserInteraction();
164164

165165
useEffect(() => {
166166
if (inspirationFragmentList && inspirationFragmentList.length > 0) {
@@ -347,7 +347,7 @@ export const InspirationDialog = memo(
347347
[classes.contColButtonHalfSelected]: isLigandOn === null
348348
})}
349349
onClick={() => onButtonToggle('ligand')}
350-
disabled={disableUserInteraction}
350+
disabled={false}
351351
>
352352
L
353353
</Button>
@@ -362,7 +362,7 @@ export const InspirationDialog = memo(
362362
[classes.contColButtonHalfSelected]: isProteinOn === null
363363
})}
364364
onClick={() => onButtonToggle('protein')}
365-
disabled={disableUserInteraction}
365+
disabled={false}
366366
>
367367
P
368368
</Button>
@@ -378,7 +378,7 @@ export const InspirationDialog = memo(
378378
[classes.contColButtonHalfSelected]: isComplexOn === null
379379
})}
380380
onClick={() => onButtonToggle('complex')}
381-
disabled={disableUserInteraction}
381+
disabled={false}
382382
>
383383
C
384384
</Button>

js/components/header/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { URLS } from '../routes/constants';
3434
import { useCombinedRefs } from '../../utils/refHelpers';
3535
import { ComputeSize } from '../../utils/computeSize';
3636
import { DJANGO_CONTEXT } from '../../utils/djangoContext';
37-
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
37+
// import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';
3838
import { useHistory } from 'react-router-dom';
3939
import { IssueReport } from '../userFeedback/issueReport';
4040
import { IdeaReport } from '../userFeedback/ideaReport';
@@ -90,7 +90,7 @@ export default memo(
9090
let history = useHistory();
9191
const classes = useStyles();
9292
const { isLoading, headerNavbarTitle, setHeaderNavbarTitle, headerButtons } = useContext(HeaderContext);
93-
const disableUserInteraction = useDisableUserInteraction();
93+
// const disableUserInteraction = useDisableUserInteraction();
9494

9595
const [openMenu, setOpenMenu] = useState(false);
9696
const [openFunders, setOpenFunders] = useState(false);
@@ -270,7 +270,8 @@ export default memo(
270270
</Grid>
271271
</Grid>
272272
</Grid>
273-
{(isLoading === true || disableUserInteraction === true) && (
273+
{//TODO this needs to be reworked if the optimizations help
274+
(isLoading === true || false === true) && (
274275
<LinearProgress color="secondary" className={classes.loadingProgress} variant="query" />
275276
)}
276277
</AppBar>

js/components/preview/molecule/moleculeList.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { ComputeSize } from '../../../utils/computeSize';
2828
import { moleculeProperty } from './helperConstants';
2929
import { VIEWS } from '../../../constants/constants';
3030
import { NglContext } from '../../nglView/nglProvider';
31-
import { useDisableUserInteraction } from '../../helpers/useEnableUserInteracion';
31+
// import { useDisableUserInteraction } from '../../helpers/useEnableUserInteracion';
3232
import classNames from 'classnames';
3333
import {
3434
addVector,
@@ -261,7 +261,7 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
261261

262262
const filterRef = useRef();
263263

264-
const disableUserInteraction = useDisableUserInteraction();
264+
// const disableUserInteraction = useDisableUserInteraction();
265265

266266
// TODO Reset Infinity scroll
267267
/*useEffect(() => {
@@ -536,7 +536,7 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
536536
)
537537
}}
538538
onChange={handleSearch}
539-
disabled={disableUserInteraction || (getJoinedMoleculeList && getJoinedMoleculeList.length === 0)}
539+
disabled={false || (getJoinedMoleculeList && getJoinedMoleculeList.length === 0)}
540540
/>,
541541

542542
<IconButton
@@ -670,7 +670,7 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
670670
[classes.contColButtonHalfSelected]: isLigandOn === null
671671
})}
672672
onClick={() => onButtonToggle('ligand')}
673-
disabled={disableUserInteraction}
673+
disabled={false}
674674
>
675675
L
676676
</Button>
@@ -685,7 +685,7 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
685685
[classes.contColButtonHalfSelected]: isProteinOn === null
686686
})}
687687
onClick={() => onButtonToggle('protein')}
688-
disabled={disableUserInteraction}
688+
disabled={false}
689689
>
690690
P
691691
</Button>
@@ -701,7 +701,7 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
701701
[classes.contColButtonHalfSelected]: isComplexOn === null
702702
})}
703703
onClick={() => onButtonToggle('complex')}
704-
disabled={disableUserInteraction}
704+
disabled={false}
705705
>
706706
C
707707
</Button>
@@ -745,6 +745,11 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
745745
previousItemData={index > 0 && array[index - 1]}
746746
nextItemData={index < array?.length && array[index + 1]}
747747
removeOfAllSelectedTypes={removeOfAllSelectedTypes}
748+
L={fragmentDisplayList.includes(data.id)}
749+
P={proteinList.includes(data.id)}
750+
C={complexList.includes(data.id)}
751+
S={surfaceList.includes(data.id)}
752+
V={vectorOnList.includes(data.id)}
748753
/>
749754
))}
750755
</InfiniteScroll>

0 commit comments

Comments
 (0)