Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 4e91ed40

Přidáno uživatelem Dominik Poch před asi 2 roky(ů)

Annotation panel events

Added events that propagate changes between panels in the annotation view

Zobrazit rozdíly:

webapp/components/annotation/annotationPanel.tsx
1
import AnnotationItem from './annotationItem';
1
import { Stack } from 'react-bootstrap';
2
import { AnnotationItem } from './annotationItem';
3
import { Occurrence, Tag } from '../models/tag';
4

  
5
type AnnotationPanelProps = {
6
    tags: Tag[];
7
    onAddOccurrence: (tag: Tag) => void;
8
    onDeleteOccurrence: (occurrence: Occurrence) => void;
9
    onChangeVisibility: (tag: Tag) => void;
10
    onChangePosition: (occurrence: Occurrence, newValue: number) => void;
11
    onChangeLength: (occurrence: Occurrence, newValue: number) => void;
12
};
2 13

  
3 14
/**
4 15
 * Creates a panel in the annotation screen that contains a list of annotations.
5 16
 * @returns Panel with a list of annotations.
6 17
 */
7
export function AnnotationPanel() {
18
export function AnnotationPanel(props: AnnotationPanelProps) {
8 19
    return (
9 20
        <div>
10 21
            <p>Panel with a list of annotations</p>
11
            <AnnotationItem name={'tag a'} category={'kategorie 1'} occurrences={[]} />
12
            <AnnotationItem name={'tag b'} category={'kategorie 2'} occurrences={[]} />
22
            <Stack>
23
                {props.tags.map((tag, index) => {
24
                    return (
25
                        <AnnotationItem
26
                            key={index}
27
                            tag={tag}
28
                            onAddOccurrence={props.onAddOccurrence}
29
                            onDeleteOccurrence={props.onDeleteOccurrence}
30
                            onChangeVisibility={props.onChangeVisibility}
31
                            onChangePosition={props.onChangePosition}
32
                            onChangeLength={props.onChangeLength}
33
                        />
34
                    );
35
                })}
36
            </Stack>
13 37
        </div>
14 38
    );
15 39
}

Také k dispozici: Unified diff