@@ -3,7 +3,13 @@ import { Panel } from '../common/Surfaces/Panel';
3
3
import { CircularProgress , Grid , makeStyles , Typography , Button } from '@material-ui/core' ;
4
4
import { CloudDownload } from '@material-ui/icons' ;
5
5
import { useDispatch , useSelector } from 'react-redux' ;
6
- import { getMoleculesObjectIDListOfCompoundsToBuy } from './redux/selectors' ;
6
+ import {
7
+ getMoleculesObjectIDListOfCompoundsToBuy ,
8
+ getListOfSelectedComplexOfAllDatasets ,
9
+ getListOfSelectedLigandOfAllDatasets ,
10
+ getListOfSelectedProteinOfAllDatasets ,
11
+ getListOfSelectedSurfaceOfAllDatasets
12
+ } from './redux/selectors' ;
7
13
import InfiniteScroll from 'react-infinite-scroller' ;
8
14
import { colourList , DatasetMoleculeView } from './datasetMoleculeView' ;
9
15
import { InspirationDialog } from './inspirationDialog' ;
@@ -15,11 +21,10 @@ import {
15
21
removeDatasetComplex ,
16
22
removeDatasetHitProtein ,
17
23
removeDatasetLigand ,
18
- removeDatasetSurface
24
+ removeDatasetSurface
19
25
} from './redux/dispatchActions' ;
20
26
import { NglContext } from '../nglView/nglProvider' ;
21
27
import { VIEWS } from '../../constants/constants' ;
22
- import { getMoleculeList } from '../preview/molecule/redux/selectors' ;
23
28
import FileSaver from 'file-saver' ;
24
29
import JSZip from 'jszip' ;
25
30
@@ -52,7 +57,8 @@ export const SelectedCompoundList = memo(({ height }) => {
52
57
const moleculesPerPage = 5 ;
53
58
const dispatch = useDispatch ( ) ;
54
59
const [ currentPage , setCurrentPage ] = useState ( 0 ) ;
55
- const moleculesObjectIDListOfCompoundsToBuy = useSelector ( getMoleculesObjectIDListOfCompoundsToBuy ) ; const isOpenInspirationDialog = useSelector ( state => state . datasetsReducers . isOpenInspirationDialog ) ;
60
+ const moleculesObjectIDListOfCompoundsToBuy = useSelector ( getMoleculesObjectIDListOfCompoundsToBuy ) ;
61
+ const isOpenInspirationDialog = useSelector ( state => state . datasetsReducers . isOpenInspirationDialog ) ;
56
62
const isOpenCrossReferenceDialog = useSelector ( state => state . datasetsReducers . isOpenCrossReferenceDialog ) ;
57
63
const [ selectedMoleculeRef , setSelectedMoleculeRef ] = useState ( null ) ;
58
64
const inspirationDialogRef = useRef ( ) ;
@@ -70,6 +76,11 @@ export const SelectedCompoundList = memo(({ height }) => {
70
76
const currentMolecules = moleculesObjectIDListOfCompoundsToBuy . slice ( 0 , listItemOffset ) ;
71
77
const canLoadMore = listItemOffset < moleculesObjectIDListOfCompoundsToBuy . length ;
72
78
79
+ const ligandList = useSelector ( state => getListOfSelectedLigandOfAllDatasets ( state ) ) ;
80
+ const proteinList = useSelector ( state => getListOfSelectedProteinOfAllDatasets ( state ) ) ;
81
+ const complexList = useSelector ( state => getListOfSelectedComplexOfAllDatasets ( state ) ) ;
82
+ const surfaceList = useSelector ( state => getListOfSelectedSurfaceOfAllDatasets ( state ) ) ;
83
+
73
84
const ligandListAllDatasets = useSelector ( state => state . datasetsReducers . ligandLists ) ;
74
85
const proteinListAllDatasets = useSelector ( state => state . datasetsReducers . proteinLists ) ;
75
86
const complexListAllDatasets = useSelector ( state => state . datasetsReducers . complexLists ) ;
@@ -142,7 +153,7 @@ export const SelectedCompoundList = memo(({ height }) => {
142
153
moleculesObjectIDListOfCompoundsToBuy . forEach ( compound => {
143
154
data += `\n${ compound . molecule . smiles } ,${ compound . datasetID } ` ;
144
155
} ) ;
145
- const dataBlob = new Blob ( [ data ] , { type : 'text/csv;charset=utf-8' } ) ;
156
+ const dataBlob = new Blob ( [ data ] , { type : 'text/csv;charset=utf-8' } ) ;
146
157
147
158
FileSaver . saveAs ( dataBlob , 'selectedCompounds.csv' ) ;
148
159
} ;
@@ -168,25 +179,25 @@ export const SelectedCompoundList = memo(({ height }) => {
168
179
} ;
169
180
170
181
return (
171
- < Panel hasHeader title = "Selected Compounds" withTooltip headerActions = { [
172
- < Button
173
- color = "inherit "
174
- variant = "text"
175
- onClick = { downloadAsCsv }
176
- startIcon = { < CloudDownload /> }
177
- >
178
- Download CSV
179
- </ Button > ,
180
- < Button
181
- color = "inherit "
182
- variant = "text"
183
- className = { classes . sdfButton }
184
- onClick = { downloadAsSdf }
185
- startIcon = { < CloudDownload /> }
186
- >
187
- Download SDF
188
- </ Button >
189
- ] } >
182
+ < Panel
183
+ hasHeader
184
+ title = "Selected Compounds "
185
+ withTooltip
186
+ headerActions = { [
187
+ < Button color = "inherit" variant = "text" onClick = { downloadAsCsv } startIcon = { < CloudDownload /> } >
188
+ Download CSV
189
+ </ Button > ,
190
+ < Button
191
+ color = "inherit"
192
+ variant = "text "
193
+ className = { classes . sdfButton }
194
+ onClick = { downloadAsSdf }
195
+ startIcon = { < CloudDownload /> }
196
+ >
197
+ Download SDF
198
+ </ Button >
199
+ ] }
200
+ >
190
201
{ isOpenInspirationDialog && (
191
202
< InspirationDialog
192
203
open
@@ -238,10 +249,10 @@ export const SelectedCompoundList = memo(({ height }) => {
238
249
previousItemData = { index > 0 && array [ index - 1 ] }
239
250
nextItemData = { index < array ?. length && array [ index + 1 ] }
240
251
removeOfAllSelectedTypes = { removeOfAllSelectedTypes }
241
- L = { ligandListAllDatasets [ data . datasetID ] . includes ( data . molecule . id ) }
242
- P = { proteinListAllDatasets [ data . datasetID ] . includes ( data . molecule . id ) }
243
- C = { complexListAllDatasets [ data . datasetID ] . includes ( data . molecule . id ) }
244
- S = { surfaceListAllDatasets [ data . datasetID ] . includes ( data . molecule . id ) }
252
+ L = { ligandList . includes ( data . molecule . id ) }
253
+ P = { proteinList . includes ( data . molecule . id ) }
254
+ C = { complexList . includes ( data . molecule . id ) }
255
+ S = { surfaceList . includes ( data . molecule . id ) }
245
256
V = { false }
246
257
/>
247
258
) ) }
0 commit comments