Skip to content

Commit dd87cc2

Browse files
authored
Merge pull request #105 from LuCEresearchlab/tagging-view-cluster-name
Tagging view cluster name
2 parents b2c0ac6 + 7110406 commit dd87cc2

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

frontend/src/components/v2/TaggingUI.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ function TaggingUI({taggingSession, dispatchTaggingSession, taggingClusterSessio
169169
<Grid container direction={'row'} className={classes.taggingMiscBlock} spacing={2}
170170
component={Paper}
171171
style={{backgroundColor: LIGHT_GREY}}>
172-
<Grid item xs={6}>
172+
<Grid item xs={8}>
173173
<ClusterView
174174
taggingClusterSession={taggingClusterSession}
175175
dispatchTaggingClusterSession={dispatchTaggingClusterSession}
176176
/>
177177
</Grid>
178-
<Grid item xs={6}>
178+
<Grid item xs={4}>
179179
<TagView
180180
misconceptionsAvailable={data}
181181
taggingClusterSession={taggingClusterSession}

frontend/src/components/v2/tagger_component/ClusterView.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {useEffect} from "react"
22
import {Answer, Cluster} from "../../../interfaces/Dataset";
33
import {rangesCompressor} from "../../../util/RangeCompressor";
44
import {HighlightRange, HighlightRangeColor} from "../../../interfaces/HighlightRange";
5-
import {Button, Paper} from "@material-ui/core";
5+
import {Button, Paper, TextField} from "@material-ui/core";
66
import {GREY} from "../../../util/Colors"
77

88
// @ts-ignore
@@ -16,13 +16,19 @@ import {
1616
TaggingClusterSessionDispatch
1717
} from "../../../model/TaggingClusterSession";
1818
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";
2025
import TruthCircle from "../../tagger_component/TruthCircle";
2126
import {FormatColorReset} from "@material-ui/icons";
2227
import {highlightStyle, nthIndex} from "../../../helpers/Util";
2328
import {useFetch} from "../../../hooks/useFetch";
2429
import withKeyboard from "../../../hooks/withKeyboard";
2530
import stringEquals from "../../../util/StringEquals";
31+
import {postClusters} from "../../../helpers/PostHelper";
2632

2733
const {TAGGING_SERVICE_URL} = require('../../../../config.json')
2834

@@ -39,6 +45,19 @@ function ClusterView({taggingClusterSession, dispatchTaggingClusterSession}: Inp
3945

4046
return (
4147
<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+
}}/>
4261
{
4362
currentCluster
4463
.answers
@@ -170,8 +189,8 @@ function ClusterItem({answer, taggingClusterSession, dispatchTaggingClusterSessi
170189

171190
return (
172191
<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'
175194
}}>
176195
<KeyIndication displayKey={"" + displayKey}/>
177196
<TruthCircle value={answer.picked}/>

frontend/src/components/v2/tagger_component/MisconceptionView.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
} from "../../../model/TaggingClusterSessionDispatch";
2323
import MisconceptionColorButton from "../../tagger_component/MisconceptionColorButton";
2424
import MisconceptionInfoButton from "../../tagger_component/MisconceptionInfoButton";
25-
import MisconceptionNoteButton from "../../tagger_component/MisconceptionNoteButton";
2625
import stringEquals from "../../../util/StringEquals";
2726

2827

@@ -35,7 +34,7 @@ const useStyles = makeStyles((theme: Theme) =>
3534
},
3635
divLine: {
3736
display: "inline-flex",
38-
width: '100%'
37+
width: '100%',
3938
}
4039
}),
4140
);
@@ -135,7 +134,6 @@ function MisconceptionView(
135134
tags={tags}
136135
handled_element={FIRST_DYNAMIC_INDEX}
137136
/>
138-
<MisconceptionNoteButton/>
139137
</div>
140138
{
141139
[...Array(Math.max(tags.length - PRE_DYNAMIC_SIZE - 2, 0))]
@@ -165,7 +163,6 @@ function MisconceptionView(
165163
tags={tags}
166164
handled_element={handled_element}
167165
/>
168-
<MisconceptionNoteButton/>
169166
</div>)
170167
}
171168
)

frontend/src/components/v2/tagger_component/TagView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function TagView({misconceptionsAvailable, taggingClusterSession, dispatchTaggin
2626
)
2727

2828
return (
29-
<Paper style={{padding: '1em', backgroundColor: GREY}}>
29+
<Paper style={{padding: '1em', backgroundColor: GREY, marginTop: '2em', paddingTop: 0}}>
3030
<Table>
3131
<TableBody>
3232
<TableRow>

0 commit comments

Comments
 (0)