Revize 80244bde
Přidáno uživatelem Lukáš Vlček před téměř 3 roky(ů)
webapp/components/annotation/AnnotationItem.tsx | ||
---|---|---|
12 | 12 |
} from '@ant-design/icons'; |
13 | 13 |
import { AnnotationContext } from '../../contexts/AnnotationContext'; |
14 | 14 |
import { ETagSentiment, TagInstanceInfo } from '../../api'; |
15 |
import { getTextMaxLength } from '../../utils/strings'; |
|
15 | 16 |
|
16 | 17 |
const { Option } = Select; |
17 | 18 |
|
... | ... | |
157 | 158 |
<Col> |
158 | 159 |
<Row> |
159 | 160 |
<Col>Pozice: {occurrence.position}</Col> |
161 |
<Col>Délka: {occurrence.length}</Col> |
|
160 | 162 |
</Row> |
161 | 163 |
<Row> |
162 |
<Col>Délka: {occurrence.length}</Col> |
|
164 |
<i title={occurrence.selectedText ?? ''}> |
|
165 |
{getTextMaxLength( |
|
166 |
occurrence.selectedText ?? '', |
|
167 |
35 |
|
168 |
)} |
|
169 |
</i> |
|
163 | 170 |
</Row> |
164 | 171 |
<Row> |
165 | 172 |
<Col |
... | ... | |
172 | 179 |
<Input.TextArea |
173 | 180 |
defaultValue={occurrence.note ?? ''} |
174 | 181 |
onBlur={onChangeNote(occurrence)} |
182 |
rows={1} |
|
175 | 183 |
/> |
176 | 184 |
</Col> |
177 | 185 |
</Row> |
webapp/utils/strings.ts | ||
---|---|---|
7 | 7 |
|
8 | 8 |
export function getNameTruncated(user: UserInfo, maxLength: number = 15) { |
9 | 9 |
const name = getName(user); |
10 |
if (name.length > maxLength) { |
|
11 |
return name.substring(0, maxLength - 3) + '...'; |
|
10 |
return getTextMaxLength(name, maxLength); |
|
11 |
} |
|
12 |
|
|
13 |
export function getTextMaxLength(text: string, maxLength: number) { |
|
14 |
if (text.length > maxLength) { |
|
15 |
return text.substring(0, maxLength - 3) + '...'; |
|
12 | 16 |
} else { |
13 |
return name;
|
|
17 |
return text;
|
|
14 | 18 |
} |
15 | 19 |
} |
16 | 20 |
|
Také k dispozici: Unified diff
AnnotationItem selected text showing, other minor improvements