Revize 5593c10b
Přidáno uživatelem Dominik Poch před asi 2 roky(ů)
webapp/components/annotation/TagPanel.tsx | ||
---|---|---|
1 | 1 |
import { CategoryItem } from './CategoryItem'; |
2 | 2 |
import { TagCategoryInfo } from '../../api'; |
3 | 3 |
import { Stack } from 'react-bootstrap'; |
4 |
import { useContext } from 'react'; |
|
5 |
import { TagCategoryContext } from '../../contexts/TagCategoryContext'; |
|
4 | 6 |
|
5 | 7 |
/** |
6 | 8 |
* Creates a panel in the annotation screen that contains a list of tag. |
7 | 9 |
* @returns Panel with a list of tags. |
8 | 10 |
*/ |
9 | 11 |
export function TagPanel() { |
10 |
const tags: TagCategoryInfo[] = [ |
|
11 |
{ |
|
12 |
name: 'kategorie 1', |
|
13 |
color: '#FF0000', |
|
14 |
tags: [ |
|
15 |
{ |
|
16 |
name: 'tag 1', |
|
17 |
color: '#CD5C5C', |
|
18 |
subTags: [{ name: 'subTag 1' }, { name: 'subTag 2' }], |
|
19 |
}, |
|
20 |
{ name: 'tag 2', color: '#F08080' }, |
|
21 |
], |
|
22 |
}, |
|
23 |
{ |
|
24 |
name: 'kategorie 2', |
|
25 |
color: '#0000FF', |
|
26 |
tags: [{ name: 'tag 3', color: '#3498DB' }], |
|
27 |
}, |
|
28 |
]; |
|
12 |
const { tagCategories } = useContext(TagCategoryContext); |
|
29 | 13 |
|
30 | 14 |
return ( |
31 | 15 |
<div> |
32 | 16 |
<Stack> |
33 |
{tags.map((category, index) => (
|
|
17 |
{tagCategories?.map((category, index) => (
|
|
34 | 18 |
<CategoryItem category={category} key={index} /> |
35 | 19 |
))} |
36 | 20 |
</Stack> |
Také k dispozici: Unified diff
Connected tag panel to server