Revize dee53692
Přidáno uživatelem Jaroslav Hrubý před asi 2 roky(ů)
webapp/components/annotation/TagItem.tsx | ||
---|---|---|
5 | 5 |
import React, { useContext, useState } from 'react'; |
6 | 6 |
import { SubTagItem } from './SubTagItem'; |
7 | 7 |
import { TagCategoryContext } from '../../contexts/TagCategoryContext'; |
8 |
import { AnnotationContext } from '../../contexts/AnnotationContext'; |
|
8 | 9 |
|
9 | 10 |
/** |
10 | 11 |
* Creates a single tag item in a tag panel. |
... | ... | |
22 | 23 |
*/ |
23 | 24 |
const { selectTag } = useContext(TagCategoryContext); |
24 | 25 |
|
26 |
/** |
|
27 |
* Annotation context |
|
28 |
*/ |
|
29 |
const { submitting } = useContext(AnnotationContext); |
|
30 |
|
|
25 | 31 |
/** |
26 | 32 |
* Button icon. |
27 | 33 |
*/ |
... | ... | |
55 | 61 |
icon={buttonIcon} |
56 | 62 |
onClick={changeSubTagsVisibility} |
57 | 63 |
className="w-100 text-start rounded" |
64 |
disabled={submitting} |
|
58 | 65 |
> |
59 | 66 |
{props.tag.name} |
60 | 67 |
<TagOutlined style={{ color: props.tag.color ?? 'black' }} /> |
61 | 68 |
</Button> |
62 | 69 |
)} |
63 | 70 |
{!hasSubTags && ( |
64 |
<Button onClick={onSelectTag} className="w-100 text-start rounded"> |
|
71 |
<Button |
|
72 |
onClick={onSelectTag} |
|
73 |
className="w-100 text-start rounded" |
|
74 |
disabled={submitting} |
|
75 |
> |
|
65 | 76 |
{props.tag.name} |
66 | 77 |
<TagOutlined style={{ color: props.tag.color ?? 'black' }} /> |
67 | 78 |
</Button> |
Také k dispozici: Unified diff
Disabling tag buttons when adding new tag occurrence