@buerokratt-ria/common-gui-components 0.0.58 → 0.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/templates/history-page/src/History.scss +15 -1
- package/templates/history-page/src/components/ChatMetadataPanel/ChatMetadataPanel.scss +18 -0
- package/templates/history-page/src/components/ChatMetadataPanel/index.tsx +206 -0
- package/templates/history-page/src/components/ChatMetadataPanelItem/index.tsx +17 -0
- package/templates/history-page/src/components/FilterTag/FilterTag.scss +42 -0
- package/templates/history-page/src/components/FilterTag/index.tsx +16 -0
- package/templates/history-page/src/components/HeaderCombobox/index.tsx +66 -0
- package/templates/history-page/src/components/QualitySettings/QualitySettings.scss +19 -0
- package/templates/history-page/src/components/QualitySettings/index.tsx +115 -0
- package/templates/history-page/src/components/SelectedFilterTags/SelectedFilterTags.scss +36 -0
- package/templates/history-page/src/components/SelectedFilterTags/index.tsx +224 -0
- package/templates/history-page/src/components/index.tsx +6 -0
- package/templates/history-page/src/index.tsx +941 -207
- package/templates/history-page/src/types/index.ts +17 -0
- package/translations/en/common.json +22 -2
- package/translations/et/common.json +22 -2
- package/types/chat.ts +3 -0
- package/ui-components/FormElements/FormCombobox/FormCombobox.scss +252 -0
- package/ui-components/FormElements/FormCombobox/index.tsx +334 -0
- package/ui-components/FormElements/index.tsx +1 -0
- package/ui-components/Icon/index.tsx +1 -0
- package/ui-components/index.tsx +2 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { MdFilterList } from 'react-icons/md';
|
|
4
|
+
|
|
5
|
+
import { ClearFiltersButton } from '../../../../../ui-components';
|
|
6
|
+
import { FilterTag } from '../FilterTag';
|
|
7
|
+
|
|
8
|
+
import './SelectedFilterTags.scss';
|
|
9
|
+
|
|
10
|
+
type SelectedFilterTagsProps = {
|
|
11
|
+
readonly csaFilterTagValues: string[];
|
|
12
|
+
readonly getCsaFilterTagLabel: (value: string) => string;
|
|
13
|
+
readonly showAuthenticatedPerson?: boolean;
|
|
14
|
+
readonly showTestFilter: boolean;
|
|
15
|
+
readonly isTestFilter?: boolean;
|
|
16
|
+
readonly isPreserveFilter?: boolean;
|
|
17
|
+
readonly domains: string[];
|
|
18
|
+
readonly feedbackRatings: string[];
|
|
19
|
+
readonly status: string[];
|
|
20
|
+
readonly theme: string[];
|
|
21
|
+
readonly responseQuality: string[];
|
|
22
|
+
readonly followUpStatus: string[];
|
|
23
|
+
readonly onRemove: (filter: SelectedFilterTagFilter, value: SelectedFilterTagValue) => void;
|
|
24
|
+
readonly onClearFiltersClick: () => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type SelectedFilterTagFilter =
|
|
28
|
+
| 'csaIdCodesFilter'
|
|
29
|
+
| 'showAuthenticatedPerson'
|
|
30
|
+
| 'isTestFilter'
|
|
31
|
+
| 'isPreserveFilter'
|
|
32
|
+
| 'domains'
|
|
33
|
+
| 'feedbackRatings'
|
|
34
|
+
| 'status'
|
|
35
|
+
| 'theme'
|
|
36
|
+
| 'responseQuality'
|
|
37
|
+
| 'followUpStatus';
|
|
38
|
+
|
|
39
|
+
type SelectedFilterTagValue = string | boolean;
|
|
40
|
+
|
|
41
|
+
const SelectedFilterTags: FC<SelectedFilterTagsProps> = ({
|
|
42
|
+
csaFilterTagValues,
|
|
43
|
+
getCsaFilterTagLabel,
|
|
44
|
+
showAuthenticatedPerson,
|
|
45
|
+
showTestFilter,
|
|
46
|
+
isTestFilter,
|
|
47
|
+
isPreserveFilter,
|
|
48
|
+
domains,
|
|
49
|
+
feedbackRatings,
|
|
50
|
+
status,
|
|
51
|
+
theme,
|
|
52
|
+
responseQuality,
|
|
53
|
+
followUpStatus,
|
|
54
|
+
onRemove,
|
|
55
|
+
onClearFiltersClick,
|
|
56
|
+
}) => {
|
|
57
|
+
const { t } = useTranslation();
|
|
58
|
+
const hasSelectedFilterTags =
|
|
59
|
+
csaFilterTagValues.length !== 0 ||
|
|
60
|
+
showAuthenticatedPerson !== undefined ||
|
|
61
|
+
(showTestFilter && isTestFilter !== undefined) ||
|
|
62
|
+
isPreserveFilter !== undefined ||
|
|
63
|
+
domains.length !== 0 ||
|
|
64
|
+
feedbackRatings.length !== 0 ||
|
|
65
|
+
status.length !== 0 ||
|
|
66
|
+
theme.length !== 0 ||
|
|
67
|
+
responseQuality.length !== 0 ||
|
|
68
|
+
followUpStatus.length !== 0;
|
|
69
|
+
|
|
70
|
+
if (!hasSelectedFilterTags) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div className="selected-filters__container">
|
|
76
|
+
<MdFilterList size="24" color="#878A97" style={{ width: '24px' }} />
|
|
77
|
+
<div className="selected-filters">
|
|
78
|
+
{csaFilterTagValues.length !== 0 && (
|
|
79
|
+
<>
|
|
80
|
+
<p className="selected-filters__label">{t('chat.history.csaName')}:</p>
|
|
81
|
+
<div className="selected-filters__items">
|
|
82
|
+
{csaFilterTagValues.map((item, index) => (
|
|
83
|
+
<FilterTag
|
|
84
|
+
key={index}
|
|
85
|
+
text={getCsaFilterTagLabel(item)}
|
|
86
|
+
onClick={() => onRemove('csaIdCodesFilter', item)}
|
|
87
|
+
/>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
</>
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
{showAuthenticatedPerson !== undefined && (
|
|
94
|
+
<>
|
|
95
|
+
<p className="selected-filters__label">{t('chat.history.authenticatedPerson')}:</p>
|
|
96
|
+
<div className="selected-filters__items">
|
|
97
|
+
<FilterTag
|
|
98
|
+
text={showAuthenticatedPerson ? t('global.yes') : t('global.no')}
|
|
99
|
+
onClick={() => onRemove('showAuthenticatedPerson', showAuthenticatedPerson)}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{showTestFilter && isTestFilter !== undefined && (
|
|
106
|
+
<>
|
|
107
|
+
<p className="selected-filters__label">{t('global.test')}:</p>
|
|
108
|
+
<div className="selected-filters__items">
|
|
109
|
+
<FilterTag
|
|
110
|
+
text={isTestFilter ? t('global.yes') : t('global.no')}
|
|
111
|
+
onClick={() => onRemove('isTestFilter', isTestFilter)}
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
{isPreserveFilter !== undefined && (
|
|
118
|
+
<>
|
|
119
|
+
<p className="selected-filters__label">{t('global.preserve')}:</p>
|
|
120
|
+
<div className="selected-filters__items">
|
|
121
|
+
<FilterTag
|
|
122
|
+
text={isPreserveFilter ? t('global.yes') : t('global.no')}
|
|
123
|
+
onClick={() => onRemove('isPreserveFilter', isPreserveFilter)}
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
</>
|
|
127
|
+
)}
|
|
128
|
+
|
|
129
|
+
{domains.length !== 0 && (
|
|
130
|
+
<>
|
|
131
|
+
<p className="selected-filters__label">{t('chat.history.www')}:</p>
|
|
132
|
+
<div className="selected-filters__items">
|
|
133
|
+
{domains.map((item, index) => (
|
|
134
|
+
<FilterTag
|
|
135
|
+
key={index}
|
|
136
|
+
text={item}
|
|
137
|
+
onClick={() => onRemove('domains', item)}
|
|
138
|
+
/>
|
|
139
|
+
))}
|
|
140
|
+
</div>
|
|
141
|
+
</>
|
|
142
|
+
)}
|
|
143
|
+
|
|
144
|
+
{feedbackRatings.length !== 0 && (
|
|
145
|
+
<>
|
|
146
|
+
<p className="selected-filters__label">{t('chat.history.rating')}:</p>
|
|
147
|
+
<div className="selected-filters__items">
|
|
148
|
+
{feedbackRatings.map((item, index) => (
|
|
149
|
+
<FilterTag
|
|
150
|
+
key={index}
|
|
151
|
+
text={item}
|
|
152
|
+
onClick={() => onRemove('feedbackRatings', item)}
|
|
153
|
+
/>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
</>
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
{status.length !== 0 && (
|
|
160
|
+
<>
|
|
161
|
+
<p className="selected-filters__label">{t('global.status')}:</p>
|
|
162
|
+
<div className="selected-filters__items">
|
|
163
|
+
{status.map((item, index) => (
|
|
164
|
+
<FilterTag
|
|
165
|
+
key={index}
|
|
166
|
+
text={t(`chat.plainEvents.${item}`)}
|
|
167
|
+
onClick={() => onRemove('status', item)}
|
|
168
|
+
/>
|
|
169
|
+
))}
|
|
170
|
+
</div>
|
|
171
|
+
</>
|
|
172
|
+
)}
|
|
173
|
+
|
|
174
|
+
{theme.length !== 0 && (
|
|
175
|
+
<>
|
|
176
|
+
<p className="selected-filters__label">{t('chat.history.theme')}:</p>
|
|
177
|
+
<div className="selected-filters__items">
|
|
178
|
+
{theme.map((item, index) => (
|
|
179
|
+
<FilterTag
|
|
180
|
+
key={index}
|
|
181
|
+
text={item}
|
|
182
|
+
onClick={() => onRemove('theme', item)}
|
|
183
|
+
/>
|
|
184
|
+
))}
|
|
185
|
+
</div>
|
|
186
|
+
</>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{responseQuality.length !== 0 && (
|
|
190
|
+
<>
|
|
191
|
+
<p className="selected-filters__label">{t('chat.history.responseQuality')}:</p>
|
|
192
|
+
<div className="selected-filters__items">
|
|
193
|
+
{responseQuality.map((item, index) => (
|
|
194
|
+
<FilterTag
|
|
195
|
+
key={index}
|
|
196
|
+
text={item}
|
|
197
|
+
onClick={() => onRemove('responseQuality', item)}
|
|
198
|
+
/>
|
|
199
|
+
))}
|
|
200
|
+
</div>
|
|
201
|
+
</>
|
|
202
|
+
)}
|
|
203
|
+
|
|
204
|
+
{followUpStatus.length !== 0 && (
|
|
205
|
+
<>
|
|
206
|
+
<p className="selected-filters__label">{t('chat.history.followUpStatus')}:</p>
|
|
207
|
+
<div className="selected-filters__items">
|
|
208
|
+
{followUpStatus.map((item, index) => (
|
|
209
|
+
<FilterTag
|
|
210
|
+
key={index}
|
|
211
|
+
text={item}
|
|
212
|
+
onClick={() => onRemove('followUpStatus', item)}
|
|
213
|
+
/>
|
|
214
|
+
))}
|
|
215
|
+
</div>
|
|
216
|
+
</>
|
|
217
|
+
)}
|
|
218
|
+
</div>
|
|
219
|
+
<ClearFiltersButton onClick={onClearFiltersClick} />
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export { SelectedFilterTags };
|