@@ -7,6 +7,7 @@ import Button from "@material-ui/core/Button"
77import * as colors from "@material-ui/core/colors"
88import Checkbox from "@material-ui/core/Checkbox"
99import without from "lodash/without"
10+ import WorkspaceContainer from "../WorkspaceContainer"
1011
1112const brightColors = [
1213 colors . blue [ 600 ] ,
@@ -52,29 +53,6 @@ const Image = styled("img")({
5253 objectFit : "contain" ,
5354} )
5455
55- const Nav = styled ( "div" ) ( {
56- display : "flex" ,
57- justifyContent : "center" ,
58- marginTop : 4 ,
59- flexShrink : 0 ,
60- } )
61- const NavItem = styled ( "div" ) ( {
62- backgroundColor : "#000" ,
63- color : "#fff" ,
64- display : "flex" ,
65- alignItems : "center" ,
66- justifyContent : "center" ,
67- "& > span" : {
68- padding : 16 ,
69- } ,
70- } )
71- const NavButton = styled ( Button ) ( {
72- color : "#fff" ,
73- padding : 8 ,
74- paddingLeft : 16 ,
75- paddingRight : 16 ,
76- } )
77-
7856const ButtonsContainer = styled ( "div" ) ( {
7957 paddingLeft : 50 ,
8058 paddingRight : 50 ,
@@ -210,56 +188,44 @@ export default ({
210188 } , [ hotkeyMap ] )
211189
212190 return (
213- < Container
214- style = { {
215- height : containerProps . height || "calc(100% - 70px)" ,
216- minHeight : 600 ,
217- } }
191+ < WorkspaceContainer
192+ onNext = { onNextNoSave }
193+ onPrev = { onPrev }
194+ onClickHeaderItem = { onDone }
195+ numberOfSamples = { samples . length }
196+ currentSampleIndex = { sampleIndex }
197+ globalSampleIndex = { globalSampleIndex }
218198 >
219- < ImageContainer >
220- < Image src = { samples [ sampleIndex ] . imageUrl } />
221- </ ImageContainer >
222- < Nav >
223- < NavItem >
224- < NavButton onClick = { onPrev } > Prev (backspace)</ NavButton >
225- </ NavItem >
226- { samples . length > 1 ? (
227- < NavItem >
228- < span >
229- ({ sampleIndex + 1 } /{ samples . length } )
230- </ span >
231- </ NavItem >
232- ) : globalSampleIndex !== undefined ? (
233- < NavItem >
234- < span > [{ globalSampleIndex } ]</ span >
235- </ NavItem >
236- ) : null }
237- < NavItem >
238- < NavButton onClick = { onNextNoSave } > Next (space)</ NavButton >
239- </ NavItem >
240- < NavItem >
241- < NavButton onClick = { onDone } > Done (enter)</ NavButton >
242- </ NavItem >
243- </ Nav >
244- < ButtonsContainer >
245- { labels . map ( ( label ) => (
246- < CheckButton
247- key = { label . id }
248- onClick = { ( ) => onClickLabel ( label ) }
249- style = { {
250- backgroundColor : getRandomColor ( label ) ,
251- transform : enlargedLabel === label ? "scale(1.1,1.1)" : undefined ,
252- } }
253- >
254- < Checkbox
255- style = { { color : "#fff" } }
256- checked = { currentOutput . includes ( label . id ) }
257- />
258- { label . id }
259- { labelKeyMap [ label . id ] ? ` (${ labelKeyMap [ label . id ] } )` : "" }
260- </ CheckButton >
261- ) ) }
262- </ ButtonsContainer >
263- </ Container >
199+ < Container
200+ style = { {
201+ height : containerProps . height || "calc(100% - 70px)" ,
202+ minHeight : 600 ,
203+ } }
204+ >
205+ < ImageContainer >
206+ < Image src = { samples [ sampleIndex ] . imageUrl } />
207+ </ ImageContainer >
208+ < ButtonsContainer >
209+ { labels . map ( ( label ) => (
210+ < CheckButton
211+ key = { label . id }
212+ onClick = { ( ) => onClickLabel ( label ) }
213+ style = { {
214+ backgroundColor : getRandomColor ( label ) ,
215+ transform :
216+ enlargedLabel === label ? "scale(1.1,1.1)" : undefined ,
217+ } }
218+ >
219+ < Checkbox
220+ style = { { color : "#fff" } }
221+ checked = { currentOutput . includes ( label . id ) }
222+ />
223+ { label . id }
224+ { labelKeyMap [ label . id ] ? ` (${ labelKeyMap [ label . id ] } )` : "" }
225+ </ CheckButton >
226+ ) ) }
227+ </ ButtonsContainer >
228+ </ Container >
229+ </ WorkspaceContainer >
264230 )
265231}
0 commit comments