@campxdev/shared 1.11.11 → 1.11.13

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.11",
3
+ "version": "1.11.13",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -50,14 +50,13 @@ export const ErrorModalTemplate = ({ handleClose, modal, setModal }) => {
50
50
  <StyledImage>
51
51
  <img src={animatedImage} alt="Error Image" />
52
52
  </StyledImage>
53
-
53
+ {console.log(modal.errorMessage, 'errmessage')}
54
54
  <MessageContainer>
55
55
  <Typography
56
56
  variant="h6"
57
57
  sx={{ textAlign: 'center', lineHeight: 1.7 }}
58
- >
59
- {modal?.errorMessage}
60
- </Typography>
58
+ dangerouslySetInnerHTML={{ __html: modal?.errorMessage }}
59
+ />
61
60
  </MessageContainer>
62
61
  {modal.content && modal.content({ close: handleClose })}
63
62
  <Button
@@ -29,8 +29,9 @@ export default function ErrorModalProvider({ children }) {
29
29
  const fallbackMessage = props.fallBack ?? 'Something went wrong.'
30
30
  const errorMessage =
31
31
  typeof props.error?.response?.data?.message !== 'string'
32
- ? props.error?.response?.data?.message?.join('\n') ?? fallbackMessage
33
- : props.error?.response?.data?.message
32
+ ? props.error?.response?.data?.message?.replace(/\n/g, '<br>') ??
33
+ fallbackMessage
34
+ : props.error?.response?.data?.message.replace(/\n/g, '<br>')
34
35
 
35
36
  setModal({
36
37
  ...modal,
@@ -35,6 +35,7 @@ const imageMap = {
35
35
  interface AppHeaderProps {
36
36
  clientLogo: string
37
37
  fullName: string
38
+ profileUrl: string
38
39
  userBoxActions: {
39
40
  label: ReactNode
40
41
  icon?: ReactNode
@@ -50,6 +51,7 @@ export default function AppHeader({
50
51
  userBoxActions = [],
51
52
  cogWheelMenu = [],
52
53
  customHeaderActions,
54
+ profileUrl,
53
55
  }: AppHeaderProps) {
54
56
  return (
55
57
  <StyledHeader>
@@ -65,6 +67,7 @@ export default function AppHeader({
65
67
  cogWheelMenu={cogWheelMenu}
66
68
  fullName={fullName}
67
69
  userBoxActions={userBoxActions}
70
+ profileUrl={profileUrl}
68
71
  />
69
72
  )}
70
73
  </Box>
@@ -10,6 +10,7 @@ export default function HeaderActions({
10
10
  cogWheelMenu,
11
11
  fullName,
12
12
  userBoxActions,
13
+ profileUrl,
13
14
  }) {
14
15
  return (
15
16
  <>
@@ -25,7 +26,11 @@ export default function HeaderActions({
25
26
  Help ?
26
27
  </IconButton>
27
28
  {cogWheelMenu?.length ? <CogWheelMenu menu={cogWheelMenu} /> : null}
28
- <UserBox fullName={fullName} actions={userBoxActions} />
29
+ <UserBox
30
+ fullName={fullName}
31
+ actions={userBoxActions}
32
+ profileUrl={profileUrl}
33
+ />
29
34
  </>
30
35
  )
31
36
  }
@@ -19,16 +19,18 @@ export default function UserBox({
19
19
  fullName,
20
20
  actions,
21
21
  customActions = [],
22
+ profileUrl,
22
23
  }: {
23
24
  fullName: string
24
25
  actions: IMenuItemProps[] | []
25
26
  customActions?: IMenuItemProps[] | []
27
+ profileUrl: string
26
28
  }) {
27
29
  const navigate = useNavigate()
28
30
  return (
29
31
  <DropDownButton
30
32
  anchor={({ open }) => (
31
- <StyledAvatar onClick={open}>
33
+ <StyledAvatar src={profileUrl} onClick={open}>
32
34
  {getStartingLetters(fullName)}
33
35
  </StyledAvatar>
34
36
  )}
@@ -87,6 +87,7 @@ const MyProfile = ({ close }) => {
87
87
  ''
88
88
  }
89
89
  }
90
+ console.log(userProfile)
90
91
 
91
92
  return (
92
93
  <>
@@ -111,7 +112,7 @@ const MyProfile = ({ close }) => {
111
112
  <Box
112
113
  sx={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}
113
114
  >
114
- <StyledAvatar>
115
+ <StyledAvatar src={userProfile?.picture?.url}>
115
116
  <Typography
116
117
  sx={{
117
118
  fontSize: '50px',