Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 67683ef3

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

Changed default tag color

Default color in tag modal changed to color of a category

Zobrazit rozdíly:

webapp/components/modals/CategoryModal.tsx
5 5
 * All values that the modal window can show.
6 6
 */
7 7
export interface CategoryModalValues {
8
    name: string;
9
    color: string;
10
    description: string;
11
    disabledForAnnotators: boolean;
8
    name?: string;
9
    color?: string;
10
    description?: string;
11
    disabledForAnnotators?: boolean;
12 12
}
13 13

  
14 14
/**
......
23 23
    onSubmit: (val: CategoryModalValues) => void; // Method called when the modal is submitted
24 24
    defaultValues?: CategoryModalValues; // Default values of a form that contains properties of the category.
25 25
}) {
26
    /**
26
    /*
27 27
     * Initialize default values if they were not set in props.
28 28
     */
29
    const values = props.defaultValues ?? {
30
        name: '',
31
        color: 'black',
32
        description: '',
33
        disabledForAnnotators: false,
34
    };
29
    let values: CategoryModalValues;
30

  
31
    if (props.defaultValues) {
32
        values = {
33
            name: props.defaultValues.name ?? '',
34
            color: props.defaultValues.color ?? 'black',
35
            description: props.defaultValues.description ?? '',
36
            disabledForAnnotators: props.defaultValues.disabledForAnnotators ?? false,
37
        };
38
    } else {
39
        values = {
40
            name: '',
41
            color: 'black',
42
            description: '',
43
            disabledForAnnotators: false,
44
        };
45
    }
35 46

  
36 47
    /**
37 48
     * The form.
webapp/components/modals/SubTagModal.tsx
5 5
 * All values that the modal window can show.
6 6
 */
7 7
export interface SubTagModalValues {
8
    name: string;
9
    description: string;
8
    name?: string;
9
    description?: string;
10 10
}
11 11

  
12 12
/**
......
24 24
    /**
25 25
     * Initialize default values if they were not set in props.
26 26
     */
27
    const values = props.defaultValues ?? {
28
        name: '',
29
        description: '',
30
    };
27
    let values: SubTagModalValues;
28

  
29
    if (props.defaultValues) {
30
        values = {
31
            name: props.defaultValues.name ?? '',
32
            description: props.defaultValues.description ?? '',
33
        };
34
    } else {
35
        values = {
36
            name: '',
37
            description: '',
38
        };
39
    }
31 40

  
32 41
    /**
33 42
     * The form.
webapp/components/modals/TagModal.tsx
5 5
 * All values that the modal window can show.
6 6
 */
7 7
export interface TagModalValues {
8
    name: string;
9
    color: string;
10
    description: string;
8
    name?: string;
9
    color?: string;
10
    description?: string;
11 11
}
12 12

  
13 13
/**
......
25 25
    /**
26 26
     * Initialize default values if they were not set in props.
27 27
     */
28
    const values = props.defaultValues ?? {
29
        name: '',
30
        color: 'black',
31
        description: '',
32
    };
28
    let values: TagModalValues;
33 29

  
30
    if (props.defaultValues) {
31
        values = {
32
            name: props.defaultValues.name ?? '',
33
            color: props.defaultValues.color ?? 'black',
34
            description: props.defaultValues.description ?? '',
35
        };
36
    } else {
37
        values = {
38
            name: '',
39
            color: 'black',
40
            description: '',
41
        };
42
    }
34 43
    /**
35 44
     * The form.
36 45
     */
webapp/pages/tags/index.tsx
394 394
                    submitText="Přidat"
395 395
                    onCancel={cancelAddTagModal}
396 396
                    onSubmit={submitAddTagModal}
397
                    defaultValues={{ color: selectedRecord.color }}
397 398
                />
398 399
            )}
399 400

  

Také k dispozici: Unified diff