Skip to content

Commit c94193f

Browse files
author
Stefano Malagò
committed
Removed console.log
Changed color of index when highlighting to make answer more readable
1 parent 8760dac commit c94193f

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,20 @@ function ClusterItem({answer, taggingClusterSession, dispatchTaggingClusterSessi
200200
// hack to support indexes for words
201201
if (command.startsWith('' + displayKey + 'h')) {
202202
let counter: number = 0
203-
letters.forEach(letter => {
203+
letters.forEach((letter: any) => {
204204
const content = letter.textContent
205205
if (content == ' ') {
206206
counter++
207207
letter.textContent = `[${counter}] `
208+
letter.style.color = HIGHLIGHT_COLOR_ELEMENT
208209
}
209210
})
210211
} else {
211-
letters.forEach(letter => {
212+
letters.forEach((letter: any) => {
212213
const content = letter.textContent
213214
if (content?.indexOf(' ') != -1) {
214215
letter.textContent = ' '
216+
letter.style.color = ""
215217
}
216218
})
217219
}
@@ -229,7 +231,7 @@ function ClusterItem({answer, taggingClusterSession, dispatchTaggingClusterSessi
229231
}}>
230232
<KeyIndication
231233
displayKey={"" + displayKey}
232-
highlighted={stringEquals('' + displayKey + 'h', localCommand)}
234+
highlighted={localCommand.startsWith('' + displayKey + 'h')}
233235
/>
234236
<TruthCircle value={answer.picked}/>
235237
<div id={"Highlightable|" + displayKey} style={{padding: 'inherit'}}>

frontend/src/helpers/PostHelper.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ const post_answer_url = TAGGING_SERVICE_URL + '/datasets/tagged-answer'
88

99

1010
function post(url: string, data: any) {
11-
console.log('posting to ' + url)
12-
console.log(data)
1311
fetch(url, {
1412
method: 'POST',
1513
headers: {
1614
'Content-Type': 'application/json;charset=utf-8'
1715
},
1816
body: JSON.stringify(data)
19-
}).then((response: Response) => console.log(response.status));
17+
}).then((response: Response) => {
18+
if (response.status != 200) console.log(response.status)
19+
});
2020
}
2121

2222
export function postHelper(dataset_id: string,
@@ -45,9 +45,6 @@ export function postClusters(dataset_id: string,
4545
question_id: string,
4646
user_id: string,
4747
clusters: Cluster[]) {
48-
console.log(`posting to ${TAGGING_SERVICE_URL}/clusters/dataset/${dataset_id}/question/${question_id}/user/${
49-
user_id}`)
50-
console.log(clusters)
5148
post(`${TAGGING_SERVICE_URL}/clusters/dataset/${dataset_id}/question/${question_id}/user/${user_id}`,
5249
clusters)
5350
}

frontend/src/model/TaggingClusterSession.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ function init(state: TaggingClusterSession,
106106
currentColor: string,
107107
history: string[]
108108
}) {
109-
console.log("init")
110109
return {
111110
...state,
112111
dataset_id: payload.dataset_id,
@@ -138,7 +137,6 @@ function setTags(state: TaggingClusterSession, tags: (string | null)[]): Tagging
138137
const new_tags = loadedTagsFormatAndSet(state, tags)
139138

140139
if (arrayFilteredNotNullEquals(new_tags, state.tags)) return state // no change
141-
console.log("setTags")
142140
return {
143141
...state,
144142
tags: new_tags,
@@ -147,7 +145,6 @@ function setTags(state: TaggingClusterSession, tags: (string | null)[]): Tagging
147145

148146
function setRangesList(state: TaggingClusterSession, rangesList: HighlightRange[][]): TaggingClusterSession {
149147
if (arrayFilteredNotNullEquals(rangesList, state.tags)) return state
150-
console.log("setRangesList")
151148
return {
152149
...state,
153150
rangesList
@@ -159,7 +156,6 @@ function setRanges(state: TaggingClusterSession, payload: { answer: Answer, rang
159156
const ranges: HighlightRange[] = payload.ranges
160157
const idx = getCurrentCluster(state).answers.findIndex(ans => stringEquals(ans.answer_id, answer.answer_id))
161158
if (idx === -1) return state
162-
console.log("setRanges")
163159
const new_ranges = [...state.rangesList]
164160
new_ranges[idx] = ranges
165161
return {
@@ -176,7 +172,6 @@ function setTagsAndRanges(state: TaggingClusterSession,
176172
ranges: HighlightRange[]
177173
}): TaggingClusterSession {
178174

179-
console.log("setTagsAndRanges")
180175

181176
const answer: Answer = payload.answer
182177
const tags: (string | null)[] = payload.tags

0 commit comments

Comments
 (0)