@buerokratt-ria/common-gui-components 0.0.50 → 0.0.52
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
CHANGED
|
@@ -4,6 +4,14 @@ All changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
|
|
6
6
|
|
|
7
|
+
## [0.0.52] - 05.05.2026
|
|
8
|
+
|
|
9
|
+
- Updated loading logic
|
|
10
|
+
|
|
11
|
+
## [0.0.51] - 05.05.2026
|
|
12
|
+
|
|
13
|
+
- History page header alignment
|
|
14
|
+
|
|
7
15
|
## [0.0.50] - 04.05.2026
|
|
8
16
|
|
|
9
17
|
- Added authenticated person column
|
package/package.json
CHANGED
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
width: 40%;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.header-container {
|
|
11
|
+
align-items: center;
|
|
12
|
+
display: flex;
|
|
13
|
+
gap: 24px;
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
.card-drawer-container {
|
|
11
17
|
display: flex;
|
|
12
18
|
width: 100%;
|
|
@@ -79,3 +85,15 @@
|
|
|
79
85
|
overflow-y: auto;
|
|
80
86
|
padding: get-spacing(haapsalu);
|
|
81
87
|
}
|
|
88
|
+
|
|
89
|
+
.spinner {
|
|
90
|
+
height: 24px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.history-content {
|
|
94
|
+
&--loading {
|
|
95
|
+
opacity: 0.5;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
user-select: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -126,6 +126,8 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
126
126
|
const showTest = envVal === undefined ? true : envVal.toLowerCase() === 'true';
|
|
127
127
|
const [loading, setLoading] = useState(false);
|
|
128
128
|
const abortRef = useRef<AbortController | null>(null);
|
|
129
|
+
const loadingTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
130
|
+
const timeoutAbortRef = useRef(false);
|
|
129
131
|
|
|
130
132
|
const parseDateParam = (dateString: string | null) => {
|
|
131
133
|
if (!dateString) return new Date();
|
|
@@ -334,8 +336,32 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
334
336
|
setTotalPages(res?.data?.response[0]?.totalPages ?? 1);
|
|
335
337
|
setTotalCount(res?.data?.response[0]?.totalCount ?? null);
|
|
336
338
|
},
|
|
339
|
+
onError: (error: AxiosError) => {
|
|
340
|
+
if (error.code === 'ERR_CANCELED' && !timeoutAbortRef.current) return;
|
|
341
|
+
timeoutAbortRef.current = false;
|
|
342
|
+
toast?.open({
|
|
343
|
+
type: 'error',
|
|
344
|
+
title: t('global.notificationError'),
|
|
345
|
+
message: 'Veateade',
|
|
346
|
+
});
|
|
347
|
+
},
|
|
337
348
|
});
|
|
338
349
|
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
if (getAllEndedChats.isPending) {
|
|
352
|
+
loadingTimeoutRef.current = setTimeout(() => {
|
|
353
|
+
timeoutAbortRef.current = true;
|
|
354
|
+
abortRef.current?.abort();
|
|
355
|
+
}, 10000);
|
|
356
|
+
} else if (loadingTimeoutRef.current) {
|
|
357
|
+
clearTimeout(loadingTimeoutRef.current);
|
|
358
|
+
loadingTimeoutRef.current = null;
|
|
359
|
+
}
|
|
360
|
+
return () => {
|
|
361
|
+
if (loadingTimeoutRef.current) clearTimeout(loadingTimeoutRef.current);
|
|
362
|
+
};
|
|
363
|
+
}, [getAllEndedChats.isPending]);
|
|
364
|
+
|
|
339
365
|
const getChatById = useMutation({
|
|
340
366
|
mutationFn: () =>
|
|
341
367
|
apiDev.post('chats/get', {
|
|
@@ -1038,19 +1064,28 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
1038
1064
|
|
|
1039
1065
|
return (
|
|
1040
1066
|
<>
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1067
|
+
<div className="header-container">
|
|
1068
|
+
{displayTitle && (
|
|
1069
|
+
<h1>{t('chat.history.title')}{totalCount === null ? '' : ` (${totalCount.toLocaleString('et-EE')})`}</h1>
|
|
1070
|
+
)}
|
|
1044
1071
|
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1072
|
+
{showDownload && (
|
|
1073
|
+
<div>
|
|
1074
|
+
<Button
|
|
1075
|
+
type="button"
|
|
1076
|
+
appearance={"secondary"}
|
|
1077
|
+
size="s"
|
|
1078
|
+
style={{ marginTop: '4px' }}
|
|
1079
|
+
onClick={downloadChatHistory}
|
|
1080
|
+
>
|
|
1081
|
+
{loading && <CgSpinner className="spinner" />}
|
|
1082
|
+
{!loading && t('files.download_xlsx')}
|
|
1083
|
+
</Button>
|
|
1084
|
+
</div>
|
|
1085
|
+
)}
|
|
1086
|
+
</div>
|
|
1053
1087
|
|
|
1088
|
+
<div className={`history-content${getAllEndedChats.isPending ? ' history-content--loading' : ''}`}>
|
|
1054
1089
|
<Card>
|
|
1055
1090
|
<Track gap={16}>
|
|
1056
1091
|
{displaySearchBar && (
|
|
@@ -1425,6 +1460,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
|
|
|
1425
1460
|
</>
|
|
1426
1461
|
)}
|
|
1427
1462
|
</div>
|
|
1463
|
+
</div>
|
|
1428
1464
|
|
|
1429
1465
|
{statusChangeModal && (
|
|
1430
1466
|
<Dialog
|
|
@@ -50,15 +50,17 @@
|
|
|
50
50
|
|
|
51
51
|
&--secondary {
|
|
52
52
|
background-color: get-color(white);
|
|
53
|
-
box-shadow: inset 0 0 0 2px get-color(
|
|
54
|
-
color: get-color(
|
|
53
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
54
|
+
color: get-color(sapphire-blue-10);
|
|
55
55
|
|
|
56
56
|
&:hover,
|
|
57
57
|
&:active {
|
|
58
|
-
|
|
58
|
+
background-color: get-color(sapphire-blue-0);
|
|
59
|
+
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
&:focus {
|
|
63
|
+
background-color: get-color(sapphire-blue-0);
|
|
62
64
|
box-shadow: inset 0 0 0 2px get-color(sapphire-blue-10);
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -145,6 +147,8 @@
|
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
&--s {
|
|
148
|
-
|
|
150
|
+
font-size: $veera-font-size-80;
|
|
151
|
+
padding: 4px 14px;
|
|
152
|
+
font-weight: 700;
|
|
149
153
|
}
|
|
150
154
|
}
|