@@ -2,7 +2,7 @@ import React, {useEffect} from "react"
2
2
import { Answer , Cluster } from "../../../interfaces/Dataset" ;
3
3
import { rangesCompressor } from "../../../util/RangeCompressor" ;
4
4
import { HighlightRange , HighlightRangeColor } from "../../../interfaces/HighlightRange" ;
5
- import { Button , Paper } from "@material-ui/core" ;
5
+ import { Button , Paper , TextField } from "@material-ui/core" ;
6
6
import { GREY } from "../../../util/Colors"
7
7
8
8
// @ts -ignore
@@ -16,13 +16,19 @@ import {
16
16
TaggingClusterSessionDispatch
17
17
} from "../../../model/TaggingClusterSession" ;
18
18
import KeyIndication from "./KeyIndication" ;
19
- import { clusterSessionPost , setRanges , setTagsAndRanges } from "../../../model/TaggingClusterSessionDispatch" ;
19
+ import {
20
+ clusterSessionPost ,
21
+ setClusters ,
22
+ setRanges ,
23
+ setTagsAndRanges
24
+ } from "../../../model/TaggingClusterSessionDispatch" ;
20
25
import TruthCircle from "../../tagger_component/TruthCircle" ;
21
26
import { FormatColorReset } from "@material-ui/icons" ;
22
27
import { highlightStyle , nthIndex } from "../../../helpers/Util" ;
23
28
import { useFetch } from "../../../hooks/useFetch" ;
24
29
import withKeyboard from "../../../hooks/withKeyboard" ;
25
30
import stringEquals from "../../../util/StringEquals" ;
31
+ import { postClusters } from "../../../helpers/PostHelper" ;
26
32
27
33
const { TAGGING_SERVICE_URL } = require ( '../../../../config.json' )
28
34
@@ -39,6 +45,19 @@ function ClusterView({taggingClusterSession, dispatchTaggingClusterSession}: Inp
39
45
40
46
return (
41
47
< div >
48
+ < TextField value = { currentCluster . name }
49
+ InputProps = { { disableUnderline : true } }
50
+ onChange = { ( e ) => {
51
+ const clusters = taggingClusterSession . clusters
52
+ clusters [ taggingClusterSession . currentCluster ] . name = e . target . value
53
+ postClusters (
54
+ taggingClusterSession . dataset_id ,
55
+ taggingClusterSession . question_id ,
56
+ taggingClusterSession . user_id ,
57
+ [ ...clusters ]
58
+ )
59
+ dispatchTaggingClusterSession ( setClusters ( [ ...clusters ] ) )
60
+ } } />
42
61
{
43
62
currentCluster
44
63
. answers
@@ -170,8 +189,8 @@ function ClusterItem({answer, taggingClusterSession, dispatchTaggingClusterSessi
170
189
171
190
return (
172
191
< Paper style = { {
173
- padding : '1em ' , backgroundColor : GREY , display : 'flex' , flexDirection : 'row' ,
174
- marginBottom : '2em '
192
+ padding : '0.5em ' , backgroundColor : GREY , display : 'flex' , flexDirection : 'row' ,
193
+ marginBottom : '1em '
175
194
} } >
176
195
< KeyIndication displayKey = { "" + displayKey } />
177
196
< TruthCircle value = { answer . picked } />
0 commit comments