Revize 812ee966
Přidáno uživatelem Dominik Poch před téměř 3 roky(ů)
webapp/components/annotation/AnnotationItem.tsx | ||
---|---|---|
34 | 34 |
addOccurrence, |
35 | 35 |
deleteOccurrence, |
36 | 36 |
changePosition, |
37 |
changeNote, |
|
37 | 38 |
changeSentiment, |
38 | 39 |
changeLength, |
39 | 40 |
} = useContext(AnnotationContext); |
... | ... | |
75 | 76 |
changeSentiment(occurrence, val); |
76 | 77 |
}; |
77 | 78 |
|
79 |
const onChangeNote = |
|
80 |
(occurrence: TagInstanceInfo) => (e: ChangeEvent<HTMLTextAreaElement>) => { |
|
81 |
changeNote(occurrence, e.currentTarget.value); |
|
82 |
}; |
|
83 |
|
|
78 | 84 |
/** |
79 | 85 |
* Changes visibility of properties of this annotation. |
80 | 86 |
*/ |
... | ... | |
117 | 123 |
<Row> |
118 | 124 |
<Col> |
119 | 125 |
<Row> |
120 |
<Col |
|
121 |
className="d-flex align-items-center" |
|
122 |
sm="4" |
|
123 |
> |
|
124 |
Pozice: |
|
125 |
</Col> |
|
126 |
<Col> |
|
127 |
<Input |
|
128 |
value={occurrence.position} |
|
129 |
onChange={onChangePosition( |
|
130 |
occurrence |
|
131 |
)} |
|
132 |
/> |
|
133 |
</Col> |
|
126 |
<Col>Pozice: {occurrence.position}</Col> |
|
127 |
</Row> |
|
128 |
<Row> |
|
129 |
<Col>Délka: {occurrence.length}</Col> |
|
134 | 130 |
</Row> |
135 | 131 |
<Row> |
136 | 132 |
<Col |
137 | 133 |
className="d-flex align-items-center" |
138 | 134 |
sm="4" |
139 | 135 |
> |
140 |
Délka:
|
|
136 |
Poznámka:
|
|
141 | 137 |
</Col> |
142 | 138 |
<Col> |
143 |
<Input |
|
144 |
value={occurrence.length}
|
|
145 |
onChange={onChangeLength(occurrence)}
|
|
139 |
<Input.TextArea
|
|
140 |
defaultValue={occurrence.note ?? ''}
|
|
141 |
onChange={onChangeNote(occurrence)}
|
|
146 | 142 |
/> |
147 | 143 |
</Col> |
148 | 144 |
</Row> |
... | ... | |
156 | 152 |
</Col> |
157 | 153 |
<Col> |
158 | 154 |
<Select |
159 |
value={occurrence.sentiment} |
|
155 |
defaultValue={ |
|
156 |
occurrence.sentiment |
|
157 |
} |
|
160 | 158 |
style={{ width: '100%' }} |
161 | 159 |
onChange={onChangeSentiment( |
162 | 160 |
occurrence |
webapp/contexts/AnnotationContext.tsx | ||
---|---|---|
52 | 52 |
*/ |
53 | 53 |
changeLength: (occurrence: TagInstanceInfo, newValue: number) => void; |
54 | 54 |
|
55 |
/** |
|
56 |
* Changes a note of an occurrence of an annotation. |
|
57 |
* @param occurrence Occurrence whose note should be changed. |
|
58 |
* @param newValue New value of the note. |
|
59 |
*/ |
|
60 |
changeNote: (occurrence: TagInstanceInfo, newValue: string) => void; |
|
61 |
|
|
55 | 62 |
/** |
56 | 63 |
* Changes sentiment of an annotation. |
57 | 64 |
* @param occurrence Occurrence whose sentiment should be changed. |
... | ... | |
121 | 128 |
return; |
122 | 129 |
}, |
123 | 130 |
|
131 |
/** |
|
132 |
* Changes a note of an occurrence of an annotation. |
|
133 |
* @param occurrence Occurrence whose note should be changed. |
|
134 |
* @param newValue New value of the note. |
|
135 |
*/ |
|
136 |
changeNote: (occurrence: TagInstanceInfo, newValue: string) => { |
|
137 |
return; |
|
138 |
}, |
|
139 |
|
|
124 | 140 |
/** |
125 | 141 |
* Changes sentiment of an annotation. |
126 | 142 |
* @param occurrence Occurrence whose sentiment should be changed. |
... | ... | |
239 | 255 |
//TODO: Implement method (should use objects from server API) |
240 | 256 |
}; |
241 | 257 |
|
258 |
/** |
|
259 |
* Changes a note of an occurrence of an annotation. |
|
260 |
* @param occurrence Occurrence whose note should be changed. |
|
261 |
* @param newValue New value of the note. |
|
262 |
*/ |
|
263 |
const changeNote = async (occurrence: TagInstanceInfo, newValue: string) => { |
|
264 |
if (!occurrence.occurenceId) { |
|
265 |
console.log('invalid occurrence'); |
|
266 |
return; |
|
267 |
} |
|
268 |
|
|
269 |
const postRes = |
|
270 |
await annotationController.annotationAnnotationIdTagOccurenceIdNotePost( |
|
271 |
props.annotationId, |
|
272 |
occurrence.occurenceId, |
|
273 |
{ note: newValue } |
|
274 |
); |
|
275 |
|
|
276 |
await refreshAnnotation(); |
|
277 |
}; |
|
278 |
|
|
242 | 279 |
/** |
243 | 280 |
* Changes sentiment of an annotation. |
244 | 281 |
* @param occurrence Occurrence whose sentiment should be changed. |
... | ... | |
310 | 347 |
deleteOccurrence, |
311 | 348 |
changeLength, |
312 | 349 |
changePosition, |
350 |
changeNote, |
|
313 | 351 |
changeSentiment, |
314 | 352 |
refreshAnnotation, |
315 | 353 |
annotation, |
Také k dispozici: Unified diff
Added notes