@campxdev/shared 1.11.65 → 1.11.67
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campxdev/shared",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.67",
|
|
4
4
|
"main": "./exports.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@emotion/react": "^11.11.1",
|
|
32
32
|
"@emotion/styled": "^11.11.0",
|
|
33
33
|
"@hookform/resolvers": "^2.9.10",
|
|
34
|
-
"@mui/icons-material": "^5.
|
|
34
|
+
"@mui/icons-material": "^5.15.18",
|
|
35
35
|
"@mui/lab": "^5.0.0-alpha.146",
|
|
36
|
-
"@mui/material": "^5.
|
|
36
|
+
"@mui/material": "^5.15.18",
|
|
37
37
|
"@mui/x-date-pickers": "^6.16.0",
|
|
38
38
|
"axios": "^0.27.2",
|
|
39
39
|
"date-fns": "^2.28.0",
|
|
@@ -39,7 +39,7 @@ export default function ActivityLog({
|
|
|
39
39
|
const fetchActivities = async ({ pageParam = 0 }) => {
|
|
40
40
|
try {
|
|
41
41
|
const response = await axios.get(endPoint, { params: { ...params } })
|
|
42
|
-
return response
|
|
42
|
+
return response?.data
|
|
43
43
|
} catch (error) {
|
|
44
44
|
// eslint-disable-next-line no-console
|
|
45
45
|
console.log(error)
|
|
@@ -54,11 +54,11 @@ export default function ActivityLog({
|
|
|
54
54
|
},
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
const activitesData = data ? data?.pages
|
|
57
|
+
const activitesData = data ? data?.pages?.flatMap((page) => page) : []
|
|
58
58
|
|
|
59
59
|
if (isLoading) return <Spinner />
|
|
60
60
|
|
|
61
|
-
if (data
|
|
61
|
+
if (data?.pages?.length === 0 || !activitesData?.length) {
|
|
62
62
|
return (
|
|
63
63
|
<NoDataIllustration
|
|
64
64
|
imageSrc=""
|
|
@@ -122,7 +122,7 @@ const columns = [
|
|
|
122
122
|
dataIndex: 'timestamp',
|
|
123
123
|
key: 'timestamp',
|
|
124
124
|
render: (timestamp) =>
|
|
125
|
-
moment.utc(timestamp)
|
|
125
|
+
moment.utc(timestamp)?.local().format('DD MMM YYYY - hh:mm A'),
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
title: 'Action',
|
|
@@ -140,7 +140,7 @@ const columns = [
|
|
|
140
140
|
key: 'message',
|
|
141
141
|
render: (message) => (
|
|
142
142
|
<Typography sx={{ fontSize: '16px' }} variant="subtitle1">
|
|
143
|
-
{message?.split("'")
|
|
143
|
+
{message?.split("'")?.map((text: string, index: number) =>
|
|
144
144
|
index % 2 === 0 ? (
|
|
145
145
|
<span key={index}>{text}</span>
|
|
146
146
|
) : (
|
|
@@ -184,7 +184,7 @@ export const TimeLineComponent = ({
|
|
|
184
184
|
<StyledTimeLineDot>
|
|
185
185
|
<StyledCircleIcon />
|
|
186
186
|
</StyledTimeLineDot>
|
|
187
|
-
{index < activitesData
|
|
187
|
+
{index < activitesData?.length - 1 && (
|
|
188
188
|
<Box
|
|
189
189
|
sx={{
|
|
190
190
|
width: '1px',
|
|
@@ -205,18 +205,20 @@ export const TimeLineComponent = ({
|
|
|
205
205
|
.format('DD MMM YYYY - hh:mm A')}
|
|
206
206
|
</Typography>
|
|
207
207
|
<Typography sx={{ fontSize: '16px' }} variant="subtitle1">
|
|
208
|
-
{item?.message
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
208
|
+
{item?.message
|
|
209
|
+
?.split("'")
|
|
210
|
+
?.map((text: string, index: number) =>
|
|
211
|
+
index % 2 === 0 ? (
|
|
212
|
+
<span key={index}>{text}</span>
|
|
213
|
+
) : (
|
|
214
|
+
<Typography
|
|
215
|
+
key={index}
|
|
216
|
+
sx={{ display: 'inline', fontWeight: 900 }}
|
|
217
|
+
>
|
|
218
|
+
{text}
|
|
219
|
+
</Typography>
|
|
220
|
+
),
|
|
221
|
+
)}
|
|
220
222
|
</Typography>
|
|
221
223
|
<Typography
|
|
222
224
|
style={{
|
|
@@ -226,7 +228,7 @@ export const TimeLineComponent = ({
|
|
|
226
228
|
}}
|
|
227
229
|
>
|
|
228
230
|
<StyledAvatar>
|
|
229
|
-
{item?.userName
|
|
231
|
+
{item?.userName?.charAt(0)?.toUpperCase()}
|
|
230
232
|
</StyledAvatar>
|
|
231
233
|
<Typography sx={{ fontSize: '13px', fontWeight: 900 }}>
|
|
232
234
|
{item?.userName}
|
|
@@ -235,7 +237,7 @@ export const TimeLineComponent = ({
|
|
|
235
237
|
</Box>
|
|
236
238
|
</TimelineContent>
|
|
237
239
|
</TimelineItem>
|
|
238
|
-
{isFetchingNextPage && index === items
|
|
240
|
+
{isFetchingNextPage && index === items?.length - 1 && hasNextPage && (
|
|
239
241
|
<StyledSpinnerBox>
|
|
240
242
|
<Spinner />
|
|
241
243
|
</StyledSpinnerBox>
|
|
@@ -253,11 +255,11 @@ function useIntersectionObserver<T extends HTMLDivElement>(
|
|
|
253
255
|
|
|
254
256
|
const handleObserver = useCallback(
|
|
255
257
|
(node: T) => {
|
|
256
|
-
if (observer
|
|
258
|
+
if (observer?.current) observer?.current?.disconnect()
|
|
257
259
|
observer.current = new IntersectionObserver((entries) => {
|
|
258
|
-
if (entries[0]
|
|
260
|
+
if (entries[0]?.isIntersecting) callback()
|
|
259
261
|
})
|
|
260
|
-
if (node) observer
|
|
262
|
+
if (node) observer?.current?.observe(node)
|
|
261
263
|
},
|
|
262
264
|
[callback],
|
|
263
265
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react'
|
|
2
2
|
|
|
3
3
|
export const batchOptions = Array.from({ length: 12 }, (_, i) => {
|
|
4
|
-
return `${
|
|
5
|
-
})
|
|
4
|
+
return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
|
|
5
|
+
})
|
|
6
6
|
|
|
7
7
|
export const getYears = () => {
|
|
8
8
|
const start = 2019
|