1
- import React , { useEffect , useState , useContext , useRef } from 'react' ;
1
+ import React , { useEffect , useState , useContext } from 'react' ;
2
2
import { makeStyles } from '@material-ui/core/styles' ;
3
3
import AppBar from '@material-ui/core/AppBar' ;
4
4
import Button from '@material-ui/core/Button' ; // replace with icons down the line
@@ -9,142 +9,18 @@ import Typography from '@material-ui/core/Typography';
9
9
import Snackbar from '@material-ui/core/Snackbar' ;
10
10
import TablePagination from '@material-ui/core/TablePagination' ;
11
11
12
- import { LocationOn } from '@material-ui/icons' ;
13
12
import TableChartIcon from '@material-ui/icons/TableChart' ;
14
13
import CaptureImageCard from './CaptureImageCard' ;
15
14
import SidePanel from './../SidePanel' ;
15
+ import styles from './CaptureGalllery.styles' ;
16
16
import { countToLocaleString } from '../../common/numbers' ;
17
- import {
18
- selectedHighlightColor ,
19
- SIDE_PANEL_WIDTH ,
20
- } from '../../common/variables.js' ;
21
17
import { CapturesContext } from '../../context/CapturesContext' ;
22
18
import { SpeciesContext } from '../../context/SpeciesContext' ;
23
19
import { TagsContext } from '../../context/TagsContext' ;
24
20
25
21
const log = require ( 'loglevel' ) . getLogger ( '../components/Verify' ) ;
26
22
27
- const useStyles = makeStyles ( ( theme ) => ( {
28
- wrapper : {
29
- padding : theme . spacing ( 2 , 8 , 4 , 8 ) ,
30
- } ,
31
- cornerTable : {
32
- margin : theme . spacing ( 1 ) ,
33
- '&>*' : {
34
- display : 'inline-flex' ,
35
- margin : theme . spacing ( 1 , 1 ) ,
36
- } ,
37
- } ,
38
- cardImg : {
39
- width : '100%' ,
40
- height : 'auto' ,
41
- } ,
42
- cardTitle : {
43
- color : '#f00' ,
44
- } ,
45
- card : {
46
- cursor : 'pointer' ,
47
- '&:hover $cardMedia' : {
48
- transform : 'scale(1.04)' ,
49
- } ,
50
- } ,
51
- cardCheckbox : {
52
- position : 'absolute' ,
53
- height : '1.2em' ,
54
- width : '1.2em' ,
55
- top : '0.2rem' ,
56
- left : '0.3rem' ,
57
- pointerEvents : 'none' ,
58
- display : 'flex' ,
59
- alignItems : 'center' ,
60
- justifyContent : 'center' ,
61
- zIndex : 1 ,
62
- } ,
63
- cardSelected : {
64
- backgroundColor : theme . palette . action . selected ,
65
- } ,
66
- cardContent : {
67
- padding : '87% 0 0 0' ,
68
- position : 'relative' ,
69
- overflow : 'hidden' ,
70
- } ,
71
- selected : {
72
- border : `2px ${ selectedHighlightColor } solid` ,
73
- } ,
74
- cardMedia : {
75
- position : 'absolute' ,
76
- top : 0 ,
77
- bottom : 0 ,
78
- left : 0 ,
79
- right : 0 ,
80
- transform : 'scale(1)' ,
81
- transition : theme . transitions . create ( 'transform' , {
82
- easing : theme . transitions . easing . easeInOut ,
83
- duration : '0.2s' ,
84
- } ) ,
85
- } ,
86
- cardWrapper : {
87
- position : 'relative' ,
88
- padding : theme . spacing ( 2 ) ,
89
- } ,
90
- placeholderCard : {
91
- pointerEvents : 'none' ,
92
- '& $card' : {
93
- background : '#eee' ,
94
- '& *' : {
95
- opacity : 0 ,
96
- } ,
97
- } ,
98
- } ,
99
- title : {
100
- padding : theme . spacing ( 2 , 8 ) ,
101
- } ,
102
- snackbar : {
103
- bottom : 20 ,
104
- } ,
105
- snackbarContent : {
106
- backgroundColor : theme . palette . action . active ,
107
- } ,
108
- cardActions : {
109
- display : 'flex' ,
110
- padding : theme . spacing ( 0 , 2 ) ,
111
- } ,
112
- button : {
113
- marginRight : '8px' ,
114
- } ,
115
- body : {
116
- width : `calc(100% - ${ SIDE_PANEL_WIDTH } px)` ,
117
- display : 'flex' ,
118
- flexDirection : 'column' ,
119
- overflow : 'auto' ,
120
- height : '100%' ,
121
- } ,
122
- bodyInner : {
123
- display : 'flex' ,
124
- flexDirection : 'column' ,
125
- } ,
126
- tooltip : {
127
- maxWidth : 'none' ,
128
- } ,
129
- MuiDialogActionsSpacing : {
130
- paddingLeft : '16px' ,
131
- paddingRight : '16px' ,
132
- } ,
133
- sidePanelSubmitButton : {
134
- width : '128px' ,
135
- } ,
136
- mb : {
137
- marginBottom : '1rem' ,
138
- } ,
139
- activeFilters : {
140
- width : theme . spacing ( 5 ) ,
141
- height : theme . spacing ( 5 ) ,
142
- marginLeft : '0.75rem' ,
143
- backgroundColor : theme . palette . stats . green ,
144
- fontSize : 'smaller' ,
145
- fontWeight : 'bold' ,
146
- } ,
147
- } ) ) ;
23
+ const useStyles = makeStyles ( styles ) ;
148
24
149
25
const CaptureGallery = ( {
150
26
setShowGallery,
@@ -174,12 +50,9 @@ const CaptureGallery = ({
174
50
const classes = useStyles ( ) ;
175
51
const [ complete , setComplete ] = useState ( 0 ) ;
176
52
177
- // const [isLoading, setIsLoading] = useState(false);
178
- const refContainer = useRef ( ) ;
179
-
180
53
/* to display progress */
181
54
useEffect ( ( ) => {
182
- // console. log('-- approve all complete');
55
+ log . debug ( '-- approve all complete' ) ;
183
56
setComplete ( approveAllComplete ) ;
184
57
} , [ approveAllComplete ] ) ;
185
58
@@ -217,8 +90,8 @@ const CaptureGallery = ({
217
90
}
218
91
219
92
async function handleSubmit ( approveAction ) {
220
- // log.debug('approveAction:', approveAction);
221
- //check selection
93
+ log . debug ( 'approveAction:' , approveAction ) ;
94
+ // check selection
222
95
if ( capturesSelected . length === 0 ) {
223
96
window . alert ( 'Please select one or more captures' ) ;
224
97
return ;
@@ -229,7 +102,7 @@ const CaptureGallery = ({
229
102
console . log ( 'species id:' , speciesId ) ;
230
103
}
231
104
232
- //create/retrieve tags
105
+ // create/retrieve tags
233
106
approveAction . tags = await tagsContext . createTags ( ) ;
234
107
const result = await approveAll ( approveAction ) ;
235
108
if ( ! result ) {
0 commit comments