1
1
import React , { useEffect , useState } from "react" ;
2
- import { Grid , Paper } from "@material-ui/core" ;
2
+ import { Grid , Paper , Tab } from "@material-ui/core" ;
3
3
import { useFetch } from "../../helpers/LoaderHelper" ;
4
4
import { StyledPagination } from "../styled/StyledPagination" ;
5
5
import { createStyles , makeStyles } from "@material-ui/core/styles" ;
6
+ import { TabContext , TabList , TabPanel } from "@material-ui/lab" ;
6
7
import { MisconceptionElement } from "../../interfaces/MisconceptionElement" ;
7
8
import QuestionSelect from "../question_component/QuestionSelect" ;
8
9
import TagView from "./tagger_component/TagView" ;
@@ -15,6 +16,7 @@ import {
15
16
} from "../../model/TaggingClusterSession" ;
16
17
import { TaggingSession , TaggingSessionDispatch } from "../../model/TaggingSession" ;
17
18
import { setClusters , setCurrentCluster } from "../../model/TaggingClusterSessionDispatch" ;
19
+ import ClusterHandler from "./cluster_handler_component/ClusterHandler" ;
18
20
19
21
const { TAGGING_SERVICE_URL } = require ( '../../../config.json' )
20
22
@@ -55,6 +57,7 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
55
57
const get_available_url = TAGGING_SERVICE_URL + '/progmiscon_api/misconceptions'
56
58
57
59
const [ page , setPage ] = useState < number > ( 1 )
60
+ const [ tab , setTab ] = useState < string > ( '1' )
58
61
59
62
60
63
const paginationChange = ( event : any , value : number ) => {
@@ -96,28 +99,61 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
96
99
setQuestionSelect = { selectedChange } />
97
100
</ Grid >
98
101
< Grid item xs = { 8 } >
99
- < Grid container direction = { 'row' } className = { classes . taggingMiscBlock } spacing = { 2 } component = { Paper }
100
- style = { { backgroundColor : LIGHT_GREY } } >
101
- < Grid item xs = { 6 } >
102
- < ClusterView
103
- taggingClusterSession = { taggingClusterSession }
104
- dispatchTaggingClusterSession = { dispatchTaggingClusterSession }
102
+ < TabContext value = { tab } >
103
+ < TabList
104
+ indicatorColor = 'primary'
105
+ textColor = 'primary'
106
+ centered = { true }
107
+ onChange = { ( _ , e : string ) => {
108
+ setTab ( e )
109
+ } }
110
+ >
111
+ < Tab
112
+ label = { 'Tagging' }
113
+ value = { '1' }
114
+ />
115
+ < Tab
116
+ label = { 'Clusters' }
117
+ value = { '2' }
105
118
/>
106
- </ Grid >
107
- < Grid item xs = { 6 } >
108
- < TagView
109
- misconceptionsAvailable = { data }
119
+ </ TabList >
120
+ < TabPanel value = { '1' } >
121
+ < Grid container direction = { 'row' } className = { classes . taggingMiscBlock } spacing = { 2 }
122
+ component = { Paper }
123
+ style = { { backgroundColor : LIGHT_GREY } } >
124
+ < Grid item xs = { 6 } >
125
+ < ClusterView
126
+ taggingClusterSession = { taggingClusterSession }
127
+ dispatchTaggingClusterSession = { dispatchTaggingClusterSession }
128
+ />
129
+ </ Grid >
130
+ < Grid item xs = { 6 } >
131
+ < TagView
132
+ misconceptionsAvailable = { data }
133
+ taggingClusterSession = { taggingClusterSession }
134
+ dispatchTaggingClusterSession = { dispatchTaggingClusterSession }
135
+ />
136
+ </ Grid >
137
+ < StyledPagination
138
+ count = { total_clusters }
139
+ page = { page }
140
+ onChange = { paginationChange }
141
+ siblingCount = { 5 }
142
+ />
143
+ </ Grid >
144
+ </ TabPanel >
145
+ < TabPanel value = { '2' } >
146
+ < ClusterHandler
147
+ taggingSession = { taggingSession }
110
148
taggingClusterSession = { taggingClusterSession }
111
149
dispatchTaggingClusterSession = { dispatchTaggingClusterSession }
150
+ setCluster = { ( value : number ) => {
151
+ setTab ( '1' )
152
+ paginationChange ( null , value )
153
+ } }
112
154
/>
113
- </ Grid >
114
- < StyledPagination
115
- count = { total_clusters }
116
- page = { page }
117
- onChange = { paginationChange }
118
- siblingCount = { 5 }
119
- />
120
- </ Grid >
155
+ </ TabPanel >
156
+ </ TabContext >
121
157
</ Grid >
122
158
</ Grid >
123
159
)
0 commit comments