@campxdev/shared 1.11.66 → 1.11.68

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.66",
3
+ "version": "1.11.68",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -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.data
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.flatMap((page) => page) : []
57
+ const activitesData = data ? data?.pages?.flatMap((page) => page) : []
58
58
 
59
59
  if (isLoading) return <Spinner />
60
60
 
61
- if (data.pages.length === 0 || !activitesData.length) {
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).local().format('DD MMM YYYY - hh:mm A'),
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("'").map((text: string, index: number) =>
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.length - 1 && (
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.split("'").map((text: string, index: number) =>
209
- index % 2 === 0 ? (
210
- <span key={index}>{text}</span>
211
- ) : (
212
- <Typography
213
- key={index}
214
- sx={{ display: 'inline', fontWeight: 900 }}
215
- >
216
- {text}
217
- </Typography>
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.charAt(0).toUpperCase()}
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.length - 1 && hasNextPage && (
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.current) observer.current.disconnect()
258
+ if (observer?.current) observer?.current?.disconnect()
257
259
  observer.current = new IntersectionObserver((entries) => {
258
- if (entries[0].isIntersecting) callback()
260
+ if (entries[0]?.isIntersecting) callback()
259
261
  })
260
- if (node) observer.current.observe(node)
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 `${2012 + i} - ${2012 + i + 1}`
5
- }).reverse()
4
+ return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
5
+ })
6
6
 
7
7
  export const getYears = () => {
8
8
  const start = 2019
@@ -2,37 +2,48 @@ import { ThemeOptions as MuiThemeOptions } from '@mui/material/styles'
2
2
 
3
3
  declare module '@mui/material/styles' {
4
4
  interface Theme {
5
- borders: {
6
- grayLight: string
7
- primary: string
5
+ borders?: {
6
+ grayLight?: string
7
+ primary?: string
8
8
  }
9
- palette: {
10
- primary: {
11
- dark: string
12
- main: string
13
- light: string
14
- lighter: string
15
- }
16
- secondary: {
17
- main: string
18
- light: string
19
- dark: string
20
- lighter: string
21
- }
22
- common: {
23
- black: string
24
- white: string
25
- green: string
26
- yellow: string
27
- blue: string
28
- }
29
- error: {
30
- main: string
31
- }
32
- text: {
33
- primary: string
34
- secondary: string
35
- disabled: string
9
+ palette?: {
10
+ mode?: string
11
+ primary?: {
12
+ dark?: string
13
+ main?: string
14
+ light?: string
15
+ lighter?: string
16
+ }
17
+ secondary?: {
18
+ main?: string
19
+ light?: string
20
+ dark?: string
21
+ lighter?: string
22
+ }
23
+ highlight?: {
24
+ main?: string
25
+ }
26
+ grey?: {
27
+ main?: string
28
+ }
29
+ common?: {
30
+ black?: string
31
+ white?: string
32
+ green?: string
33
+ yellow?: string
34
+ blue?: string
35
+ }
36
+ error?: {
37
+ main?: string
38
+ }
39
+ text?: {
40
+ primary?: string
41
+ secondary?: string
42
+ disabled?: string
43
+ }
44
+ background?: {
45
+ paper?: string
46
+ default?: string
36
47
  }
37
48
  }
38
49
  }
@@ -40,20 +51,28 @@ declare module '@mui/material/styles' {
40
51
  interface CustomThemeOptions extends MuiThemeOptions {
41
52
  borders?: {
42
53
  grayLight?: string
54
+ primary?: string
43
55
  }
44
- palette: {
45
- secondary?: {
56
+ palette?: {
57
+ mode?: string
58
+ primary?: {
59
+ dark?: string
46
60
  main?: string
47
61
  light?: string
48
- dark?: string
49
62
  lighter?: string
50
63
  }
51
- primary?: {
52
- dark?: string
64
+ secondary?: {
53
65
  main?: string
54
66
  light?: string
67
+ dark?: string
55
68
  lighter?: string
56
69
  }
70
+ highlight?: {
71
+ main?: string
72
+ }
73
+ grey?: {
74
+ main?: string
75
+ }
57
76
  common?: {
58
77
  black?: string
59
78
  white?: string
@@ -69,9 +88,21 @@ declare module '@mui/material/styles' {
69
88
  secondary?: string
70
89
  disabled?: string
71
90
  }
91
+ background?: {
92
+ paper?: string
93
+ default?: string
94
+ }
72
95
  }
73
96
  components?: Components<Omit<Theme, 'components'>>
74
97
  typography?: TypographyOptions | ((palette: Palette) => TypographyOptions)
75
98
  }
76
99
  export function createTheme(options?: CustomThemeOptions): CustomTheme
77
100
  }
101
+
102
+ declare module '@mui/material/Typography' {
103
+ interface TypographyPropsVariantOverrides {
104
+ label1: true
105
+ label2: true
106
+ subtitle3: true
107
+ }
108
+ }