Revize 0e4d7bd0
Přidáno uživatelem Dominik Poch před asi 2 roky(ů)
webapp/components/modals/TagModal.tsx | ||
---|---|---|
1 | 1 |
import React from 'react'; |
2 |
import { Form, Input, Modal } from 'antd'; |
|
2 |
import { Form, Input, Modal, Switch } from 'antd';
|
|
3 | 3 |
|
4 | 4 |
/** |
5 | 5 |
* All values that the modal window can show. |
... | ... | |
8 | 8 |
name?: string; |
9 | 9 |
color?: string; |
10 | 10 |
description?: string; |
11 |
sentimentEnabled?: boolean; |
|
11 | 12 |
} |
12 | 13 |
|
13 | 14 |
/** |
... | ... | |
32 | 33 |
name: props.defaultValues.name ?? '', |
33 | 34 |
color: props.defaultValues.color ?? 'black', |
34 | 35 |
description: props.defaultValues.description ?? '', |
36 |
sentimentEnabled: props.defaultValues.sentimentEnabled ?? false, |
|
35 | 37 |
}; |
36 | 38 |
} else { |
37 | 39 |
values = { |
38 | 40 |
name: '', |
39 | 41 |
color: 'black', |
40 | 42 |
description: '', |
43 |
sentimentEnabled: false, |
|
41 | 44 |
}; |
42 | 45 |
} |
43 | 46 |
/** |
... | ... | |
61 | 64 |
name: values.name, |
62 | 65 |
color: values.color, |
63 | 66 |
description: values.description, |
67 |
sentimentEnabled: values.sentimentEnabled, |
|
64 | 68 |
}); |
65 | 69 |
}; |
66 | 70 |
|
... | ... | |
85 | 89 |
}); |
86 | 90 |
}} |
87 | 91 |
> |
88 |
<Form form={form} labelCol={{ span: 4 }} initialValues={values}>
|
|
92 |
<Form form={form} labelCol={{ span: 8 }} initialValues={values}>
|
|
89 | 93 |
<Form.Item |
90 | 94 |
label="Název" |
91 | 95 |
name="name" |
... | ... | |
100 | 104 |
> |
101 | 105 |
<Input type="color" /> |
102 | 106 |
</Form.Item> |
107 |
<Form.Item |
|
108 |
label="Povolit sentiment" |
|
109 |
name="sentimentEnabled" |
|
110 |
valuePropName="checked" |
|
111 |
rules={[ |
|
112 |
{ |
|
113 |
required: true, |
|
114 |
message: 'Prosím zadejte zda má být povolený sentiment', |
|
115 |
}, |
|
116 |
]} |
|
117 |
> |
|
118 |
<Switch /> |
|
119 |
</Form.Item> |
|
103 | 120 |
<Form.Item label="Popis" name="description"> |
104 | 121 |
<Input.TextArea /> |
105 | 122 |
</Form.Item> |
Také k dispozici: Unified diff
Added sentiment to tags management