Skip to content

Commit baa29eb

Browse files
authored
Merge pull request #102 from LuCEresearchlab/question-collapse-feature
Added collapse of question
2 parents 36f3c00 + 6874ea0 commit baa29eb

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

frontend/src/components/v2/TaggingUI.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useEffect, useState} from "react";
2-
import {Grid, Paper, Tab} from "@material-ui/core";
2+
import {Button, Collapse, Grid, Paper, Tab} from "@material-ui/core";
33
import {StyledPagination} from "../styled/StyledPagination";
44
import {createStyles, makeStyles} from "@material-ui/core/styles";
55
import {TabContext, TabList, TabPanel} from "@material-ui/lab";
@@ -41,7 +41,8 @@ const useStyles = makeStyles(() =>
4141
justifyContent: 'center',
4242
position: 'sticky',
4343
top: '100px',
44-
flexGrow: 1
44+
flexGrow: 1,
45+
margin: 0
4546
},
4647
taggingMiscBlock: {
4748
width: '100%',
@@ -64,6 +65,7 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
6465

6566
const [page, setPage] = useState<number>(1)
6667
const [tab, setTab] = useState<string>('1')
68+
const [showQuestion, setShowQuestion] = useState<boolean>(true)
6769

6870

6971
const total_clusters = taggingClusterSession.clusters.length
@@ -94,6 +96,9 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
9496
setPage(1)
9597
}
9698
}
99+
if (command == 'q') {
100+
setShowQuestion(!showQuestion)
101+
}
97102
})
98103

99104

@@ -130,13 +135,18 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
130135

131136
return (
132137
<Grid container direction={'row'} className={classes.root} spacing={10}>
133-
<Grid item xs={4}>
134-
<QuestionSelect
135-
questions={taggingSession.questions}
136-
selectedQuestion={taggingSession.currentQuestion}
137-
setQuestionSelect={selectedChange}/>
138+
<Grid item xs={showQuestion ? 4 : 1}>
139+
<Button onClick={() => {
140+
setShowQuestion(!showQuestion)
141+
}}>Q</Button>
142+
<Collapse in={showQuestion}>
143+
<QuestionSelect
144+
questions={taggingSession.questions}
145+
selectedQuestion={taggingSession.currentQuestion}
146+
setQuestionSelect={selectedChange}/>
147+
</Collapse>
138148
</Grid>
139-
<Grid item xs={8}>
149+
<Grid item xs={showQuestion ? 8 : 10}>
140150
<TabContext value={tab}>
141151
<TabList
142152
indicatorColor='primary'
@@ -200,6 +210,7 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
200210
}
201211
</div>
202212
</Grid>
213+
<Grid item xs={showQuestion ? undefined : 1}/>
203214
</Grid>
204215
)
205216

0 commit comments

Comments
 (0)