@campxdev/shared 0.5.4 → 0.5.6
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 +1 -1
- package/src/components/ChangePassword.tsx +151 -151
- package/src/components/Layout/Header/AppsMenu.tsx +1 -1
- package/src/components/Layout/Header/applications.ts +85 -0
- package/src/components/Layout/Header/assets/campx_square_small.svg +9 -0
- package/src/components/Layout/Header/assets/exams_small.svg +12 -0
- package/src/components/Layout/Header/assets/hostel_small.svg +13 -0
- package/src/components/Layout/Header/assets/index.ts +21 -23
- package/src/components/Layout/Header/assets/pay_small.svg +16 -0
- package/src/components/Layout/Header/assets/people_small.svg +9 -0
- package/src/contexts/Providers.tsx +25 -8
- package/src/hooks/useAppInit.ts +22 -0
- package/src/hooks/useAuth.ts +74 -72
- package/src/permissions/PermissionsStore.ts +271 -267
- package/src/utils/logout.ts +1 -1
- package/src/components/Layout/Header/applications.tsx +0 -74
- package/src/components/Layout/Header/assets/CampxHeader.svg +0 -14
- package/src/components/Layout/Header/assets/enrollxHeader.svg +0 -14
- package/src/components/Layout/Header/assets/examxHeader.svg +0 -17
- package/src/components/Layout/Header/assets/hostelxHeader.svg +0 -18
package/package.json
CHANGED
|
@@ -1,164 +1,164 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from
|
|
12
|
-
import {
|
|
13
|
-
import CloseIcon from
|
|
14
|
-
import {
|
|
15
|
-
import React, {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import axios, {
|
|
20
|
-
import {
|
|
2
|
+
Button,
|
|
3
|
+
CircularProgress,
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogTitle,
|
|
6
|
+
IconButton,
|
|
7
|
+
InputAdornment,
|
|
8
|
+
Stack,
|
|
9
|
+
styled,
|
|
10
|
+
Typography,
|
|
11
|
+
} from '@mui/material'
|
|
12
|
+
import {isDevelopment} from '../constants/isDevelopment'
|
|
13
|
+
import CloseIcon from '@mui/icons-material/Close'
|
|
14
|
+
import {Visibility, VisibilityOff} from '@mui/icons-material'
|
|
15
|
+
import React, {useState} from 'react'
|
|
16
|
+
import {useForm} from 'react-hook-form'
|
|
17
|
+
import {useModal} from './DrawerWrapper/DrawerWrapper'
|
|
18
|
+
import {FormTextField} from '.'
|
|
19
|
+
import axios, {axiosErrorToast} from '../config/axios'
|
|
20
|
+
import {toast} from 'react-toastify'
|
|
21
21
|
|
|
22
22
|
export interface DialogProps {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
open: boolean
|
|
24
|
+
onClose: any
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function ChangePassword(props: DialogProps) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const {onClose, open} = props
|
|
29
|
+
const handleClose = () => {
|
|
30
|
+
onClose()
|
|
31
|
+
}
|
|
32
|
+
const modal = useModal()
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
34
|
+
const [showPassword, setShowPassword] = useState({
|
|
35
|
+
oldPassword: false,
|
|
36
|
+
newPassword: false,
|
|
37
|
+
confirmPassword: false,
|
|
38
|
+
})
|
|
39
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
40
|
+
const {handleSubmit, control, reset} = useForm()
|
|
41
|
+
const onSubmit = async (formData) => {
|
|
42
|
+
setIsLoading(true)
|
|
43
|
+
const {oldPassword, newPassword, confirmPassword} = formData
|
|
44
|
+
if (newPassword === confirmPassword) {
|
|
45
|
+
try {
|
|
46
|
+
await axios.post(
|
|
47
|
+
isDevelopment
|
|
48
|
+
? 'https://auth-api.campx.dev/auth/change-password'
|
|
49
|
+
: 'https://auth-api.campx.in/auth/change-password',
|
|
50
|
+
{
|
|
51
|
+
oldPassword,
|
|
52
|
+
newPassword,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
toast.success('Password Changed Successfully')
|
|
56
|
+
setIsLoading(false)
|
|
57
|
+
reset()
|
|
58
|
+
handleClose()
|
|
59
|
+
} catch (error) {
|
|
60
|
+
axiosErrorToast(error)
|
|
61
|
+
setIsLoading(false)
|
|
62
|
+
reset()
|
|
63
|
+
handleClose()
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
toast.error('New Password, Confirm Password must be same')
|
|
67
|
+
setIsLoading(false)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
const fields = [
|
|
72
|
+
{label: 'Old Password', name: 'oldPassword'},
|
|
73
|
+
{label: 'New Password', name: 'newPassword'},
|
|
74
|
+
{label: 'Confirm Password', name: 'confirmPassword'},
|
|
75
|
+
]
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
77
|
+
return (
|
|
78
|
+
<Dialog
|
|
79
|
+
open={open}
|
|
80
|
+
PaperProps={{
|
|
81
|
+
sx: {
|
|
82
|
+
borderRadius: '20px',
|
|
83
|
+
width: '500px',
|
|
84
|
+
padding: '20px',
|
|
85
|
+
},
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
<StyledDialogTitle>
|
|
89
|
+
<Typography variant='h3'>Change Password</Typography>
|
|
90
|
+
<IconButton onClick={handleClose}>
|
|
91
|
+
<CloseIcon />
|
|
92
|
+
</IconButton>
|
|
93
|
+
</StyledDialogTitle>
|
|
94
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
95
|
+
<Stack gap={2} direction='column'>
|
|
96
|
+
{fields.map((item) => {
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<FormTextField
|
|
100
|
+
label={item.label}
|
|
101
|
+
control={control}
|
|
102
|
+
name={item.name}
|
|
103
|
+
type={showPassword[item.name] ? 'text' : 'password'}
|
|
104
|
+
required
|
|
105
|
+
InputProps={{
|
|
106
|
+
endAdornment: (
|
|
107
|
+
<InputAdornment position='end'>
|
|
108
|
+
<IconButton
|
|
109
|
+
size='small'
|
|
110
|
+
onClick={() =>
|
|
111
|
+
setShowPassword((prev) => ({
|
|
112
|
+
...prev,
|
|
113
|
+
[item.name]: !prev[item.name],
|
|
114
|
+
}))
|
|
115
|
+
}
|
|
116
|
+
edge='end'
|
|
117
|
+
>
|
|
118
|
+
{showPassword[item.name] ? (
|
|
119
|
+
<VisibilityOff />
|
|
120
|
+
) : (
|
|
121
|
+
<Visibility />
|
|
122
|
+
)}
|
|
123
|
+
</IconButton>
|
|
124
|
+
</InputAdornment>
|
|
125
|
+
),
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</>
|
|
129
|
+
)
|
|
130
|
+
})}
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
132
|
+
<Stack direction={'row'} gap={2} sx={{marginTop: '20px'}}>
|
|
133
|
+
<Button variant='outlined' onClick={handleClose}>
|
|
134
|
+
Cancel
|
|
135
|
+
</Button>
|
|
136
|
+
<Button
|
|
137
|
+
type='submit'
|
|
138
|
+
endIcon={
|
|
139
|
+
isLoading && (
|
|
140
|
+
<CircularProgress
|
|
141
|
+
style={{color: 'white'}}
|
|
142
|
+
size='30px'
|
|
143
|
+
thickness={1.7}
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
Submit
|
|
149
|
+
</Button>
|
|
150
|
+
</Stack>
|
|
151
|
+
</Stack>
|
|
152
|
+
</form>
|
|
153
|
+
</Dialog>
|
|
154
|
+
)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
const StyledDialogTitle = styled(DialogTitle)({
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
})
|
|
164
|
-
export default ChangePassword
|
|
158
|
+
display: 'flex',
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
justifyContent: 'space-between',
|
|
161
|
+
padding: '10px',
|
|
162
|
+
marginBottom: '20px',
|
|
163
|
+
})
|
|
164
|
+
export default ChangePassword
|
|
@@ -79,7 +79,7 @@ const MenuItem = ({data}) => {
|
|
|
79
79
|
return (
|
|
80
80
|
<StyledMenuItem>
|
|
81
81
|
<Box>
|
|
82
|
-
<img src={data.icon} style={{width: '
|
|
82
|
+
<img src={data.icon} style={{width: '32px', height: '32px'}} />
|
|
83
83
|
</Box>
|
|
84
84
|
<Box>
|
|
85
85
|
<Typography variant='h1' sx={{marginBottom: '7px'}}>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {isDevelopment} from '../../../constants'
|
|
2
|
+
import {
|
|
3
|
+
campxSquareSmall,
|
|
4
|
+
examsSmall,
|
|
5
|
+
hostelSmall,
|
|
6
|
+
paySmall,
|
|
7
|
+
peopleSmall,
|
|
8
|
+
} from './assets'
|
|
9
|
+
|
|
10
|
+
const origins = {
|
|
11
|
+
ums: {
|
|
12
|
+
dev: 'https://ums.campx.dev',
|
|
13
|
+
prod: 'https://ums.campx.in',
|
|
14
|
+
},
|
|
15
|
+
payments: {
|
|
16
|
+
dev: 'https://payments.campx.dev',
|
|
17
|
+
prod: 'https://payments.campx.in',
|
|
18
|
+
},
|
|
19
|
+
exams: {
|
|
20
|
+
dev: 'https://exams.campx.dev',
|
|
21
|
+
prod: 'https://exams.campx.in',
|
|
22
|
+
},
|
|
23
|
+
people: {
|
|
24
|
+
dev: 'https://people.campx.dev',
|
|
25
|
+
prod: 'https://people.campx.in',
|
|
26
|
+
},
|
|
27
|
+
hostel: {
|
|
28
|
+
dev: 'https://hostel.campx.dev',
|
|
29
|
+
prod: 'https://hostel.campx.in',
|
|
30
|
+
},
|
|
31
|
+
commute: {
|
|
32
|
+
dev: 'https://commute.campx.dev',
|
|
33
|
+
prod: 'https://commute.campx.in',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const applications = [
|
|
38
|
+
{
|
|
39
|
+
title: 'CollegeX',
|
|
40
|
+
path: isDevelopment ? origins.ums.dev : origins.ums.prod,
|
|
41
|
+
icon: campxSquareSmall,
|
|
42
|
+
key: 'ums',
|
|
43
|
+
description: 'Manage Complete Campus Activities',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
title: 'ExamX',
|
|
47
|
+
key: 'exams',
|
|
48
|
+
path: isDevelopment ? origins.exams.dev : origins.exams.prod,
|
|
49
|
+
icon: examsSmall,
|
|
50
|
+
description: 'Manage all Examinations in the Campus',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
title: 'PayX',
|
|
54
|
+
key: 'payments',
|
|
55
|
+
path: isDevelopment ? origins.payments.dev : origins.payments.prod,
|
|
56
|
+
icon: paySmall,
|
|
57
|
+
description: 'Manage Online Payments in the Campus',
|
|
58
|
+
},
|
|
59
|
+
...(isDevelopment && [
|
|
60
|
+
{
|
|
61
|
+
title: 'PeopleX',
|
|
62
|
+
path: isDevelopment ? origins.people.dev : origins.people.prod,
|
|
63
|
+
icon: peopleSmall,
|
|
64
|
+
description: 'Manage People in the Campus',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: 'HostelX',
|
|
68
|
+
path: isDevelopment ? origins.hostel.dev : origins.hostel.prod,
|
|
69
|
+
icon: hostelSmall,
|
|
70
|
+
description: 'Manage Hostels in the Campus',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
title: 'CommuteX',
|
|
74
|
+
path: isDevelopment ? origins.commute.dev : origins.commute.prod,
|
|
75
|
+
icon: hostelSmall,
|
|
76
|
+
description: 'Manage Commute in the Campus',
|
|
77
|
+
},
|
|
78
|
+
]),
|
|
79
|
+
// {
|
|
80
|
+
// title: 'EnrollX',
|
|
81
|
+
// path: '/hostel',
|
|
82
|
+
// icon: enrollHeaderLogo,
|
|
83
|
+
// // description: 'Manage Admissions in the Campus',
|
|
84
|
+
// },
|
|
85
|
+
]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="320" height="320.001" viewBox="0 0 320 320.001">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#596e79"/>
|
|
5
|
+
<stop offset="1" stop-color="#7c909b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<path id="Subtraction_37" data-name="Subtraction 37" d="M2495-5403H2175v-320h320v320Zm-260-260v200h200v-200Z" transform="translate(-2175 5723)" fill="url(#linear-gradient)"/>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="310.624" height="320" viewBox="0 0 310.624 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#d86b00"/>
|
|
5
|
+
<stop offset="1" stop-color="#ed9035"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4477" data-name="Group 4477" transform="translate(-342.295 -263.508)">
|
|
9
|
+
<path id="Subtraction_34" data-name="Subtraction 34" d="M310.612,320H233.034l-.016-.023L.015,320,0,319.977,38.785,266.6l.015.019L116.266,160,38.8,53.383l-.015.022L0,.024.015,0H310.609l.015.024L271.837,53.4l-.016-.022L194.354,160l77.467,106.615.016-.019,38.788,53.38-.016.022Zm-155.3-106.994-32.527,44.782,65-.04-32.476-44.742ZM122.788,62.154l32.525,44.783,32.476-44.742-65-.041Z" transform="translate(342.295 263.508)" fill="url(#linear-gradient)"/>
|
|
10
|
+
<rect id="Rectangle_4307" data-name="Rectangle 4307" width="3.696" height="133.935" transform="translate(495.759 356.565)" fill="#fff"/>
|
|
11
|
+
</g>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="464.103" height="320" viewBox="0 0 464.103 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#573dab"/>
|
|
5
|
+
<stop offset="1" stop-color="#7251dd"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4511" data-name="Group 4511" transform="translate(-270.758 -251.98)">
|
|
9
|
+
<path id="Subtraction_9" data-name="Subtraction 9" d="M79.763,164.484H.016L0,164.46l39.875-54.878.015.021L118.681,1.165,157.727,54.9l.015-.021.827,1.138L79.763,164.483ZM198.442,1.137h0L197.615,0h.431l.8.58-.4.555Z" transform="translate(384.15 407.496)" fill="url(#linear-gradient)"/>
|
|
10
|
+
<path id="Union_40" data-name="Union 40" d="M79.765,320H.017L0,319.974,39.878,265.1l.013.019,78.793-108.439.185.253,34.4-47.349.016.022,78.79-108.44.389.534.239-.333L350.791,163.9l-.077.058,73.5,101.155.016-.019L464.1,319.974l-.017.023H384.339L305.533,211.531l.031-.042L265.677,156.63l-.014.019,0,0v0l-.4-.554.02-.014-7.844-10.789.1.016-25.226-34.717-39.155,53.891h-.379l-35.728,49.138L79.765,320v0ZM152.94,1.392l-1-1.367L151.96,0h1.991L152.94,1.392v0Zm158.893-.256L311.008,0h.431l.8.583-.4.554Z" transform="translate(270.757 251.98)" fill="url(#linear-gradient)"/>
|
|
11
|
+
<path id="Subtraction_10" data-name="Subtraction 10" d="M198.046,164.484h-78.52L40.883,56.246,80.756,1.366,198.845,163.9l-.8.58ZM1,1.393h0L0,.024.015,0H2.006L1,1.392Z" transform="translate(422.701 407.495)" fill="url(#linear-gradient)"/>
|
|
12
|
+
</g>
|
|
13
|
+
</svg>
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import collegex from
|
|
2
|
-
const enrollx = require(
|
|
3
|
-
import examx from
|
|
4
|
-
import payx from
|
|
5
|
-
const peoplex = require(
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import hostelHeaderLogo from "./hostelxHeader.svg";
|
|
1
|
+
import collegex from './campx.png'
|
|
2
|
+
const enrollx = require('./enrollx.png')
|
|
3
|
+
import examx from './newexamx.png'
|
|
4
|
+
import payx from './newpayx.png'
|
|
5
|
+
const peoplex = require('./peoplex.png')
|
|
6
|
+
import campxSquareSmall from './campx_square_small.svg'
|
|
7
|
+
import examsSmall from './exams_small.svg'
|
|
8
|
+
import paySmall from './pay_small.svg'
|
|
9
|
+
import peopleSmall from './people_small.svg'
|
|
10
|
+
import hostelSmall from './hostel_small.svg'
|
|
12
11
|
|
|
13
12
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
13
|
+
collegex,
|
|
14
|
+
enrollx,
|
|
15
|
+
examx,
|
|
16
|
+
payx,
|
|
17
|
+
peoplex,
|
|
18
|
+
campxSquareSmall,
|
|
19
|
+
examsSmall,
|
|
20
|
+
paySmall,
|
|
21
|
+
peopleSmall,
|
|
22
|
+
hostelSmall,
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="225.228" height="320" viewBox="0 0 225.228 320">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.222" y1="1" x2="0.787" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#88b053"/>
|
|
5
|
+
<stop offset="1" stop-color="#50840b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<g id="Group_4464" data-name="Group 4464" transform="translate(-1597.6 -781.55)">
|
|
9
|
+
<g id="Group_4461" data-name="Group 4461" transform="translate(1597.6 781.55)">
|
|
10
|
+
<g id="Group_4460" data-name="Group 4460" transform="translate(0 0)">
|
|
11
|
+
<path id="Subtraction_8" data-name="Subtraction 8" d="M79.79,164.485,198.873.58l-.8-.58H119.553L39.916,109.605l-.015-.022L.026,164.462l.015.023H79.79Z" transform="translate(26.355 155.515)" fill="url(#linear-gradient)"/>
|
|
12
|
+
<path id="Subtraction_8-2" data-name="Subtraction 8" d="M119.109,0,.026,163.9l.8.58H79.346L158.983,54.88,159,54.9,198.873.023,198.858,0H119.109Z" transform="translate(-0.026 0)" fill="url(#linear-gradient)"/>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</g>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="426.29" height="320.001" viewBox="0 0 426.29 320.001">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="linear-gradient" x1="0.5" x2="0.5" y2="1" gradientUnits="objectBoundingBox">
|
|
4
|
+
<stop offset="0" stop-color="#d0002b"/>
|
|
5
|
+
<stop offset="1" stop-color="#ea4a6b"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<path id="Union_42" data-name="Union 42" d="M-1429.646-7174l-50.322-69.259-9.444,13,40.5,55.514-1.027.747h-182.829l-.021-.03,40.96-56.372-9.342-12.857L-1651.493-7174h-102.486l-.021-.03,51.243-70.524.019.026,101.257-139.358.5.683,0,0,60.424,82.832,60.775-82.837.006.008.306-.421,151.761,208.879-1.027.747Zm-92.314-279.665v0A40.334,40.334,0,0,1-1481.627-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1521.96-7453.664Zm-119.905,0v0A40.334,40.334,0,0,1-1601.532-7494a40.335,40.335,0,0,1,40.334,40.334v0a40.335,40.335,0,0,1-40.334,40.333A40.333,40.333,0,0,1-1641.865-7453.664Z" transform="translate(1753.999 7494)" fill="url(#linear-gradient)"/>
|
|
9
|
+
</svg>
|
|
@@ -9,16 +9,17 @@ import {ToastContainer} from '../components'
|
|
|
9
9
|
import LoginFormProvider from './LoginFormProvider'
|
|
10
10
|
import {ReactNode} from 'react'
|
|
11
11
|
import {isDevelopment} from '../constants'
|
|
12
|
+
import useAppInit from '../hooks/useAppInit'
|
|
13
|
+
import Cookies from 'js-cookie'
|
|
12
14
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}) {
|
|
15
|
+
export const campxTenantKey = Cookies.get('campx_tenant')
|
|
16
|
+
|
|
17
|
+
export default function Providers({children}: {children: ReactNode}) {
|
|
18
|
+
const {isInvalid} = useAppInit()
|
|
19
|
+
|
|
20
|
+
if (isInvalid) return <InvalidClientKey />
|
|
20
21
|
return (
|
|
21
|
-
<BrowserRouter basename={isDevelopment ? 'campx_dev' :
|
|
22
|
+
<BrowserRouter basename={isDevelopment ? 'campx_dev' : campxTenantKey}>
|
|
22
23
|
<QueryClientProvider>
|
|
23
24
|
<MuiThemeProvider>
|
|
24
25
|
<DialogProvider>
|
|
@@ -33,3 +34,19 @@ export default function Providers({
|
|
|
33
34
|
</BrowserRouter>
|
|
34
35
|
)
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
const InvalidClientKey = () => {
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
style={{
|
|
42
|
+
height: '95vh',
|
|
43
|
+
width: '95vw',
|
|
44
|
+
display: 'grid',
|
|
45
|
+
placeItems: 'center',
|
|
46
|
+
fontFamily: 'sans-serif',
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<h1>Invalid Tenant Key</h1>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Cookies from 'js-cookie'
|
|
2
|
+
import {useEffect, useState} from 'react'
|
|
3
|
+
import {isDevelopment} from '../constants'
|
|
4
|
+
import {campxTenantKey} from '../contexts/Providers'
|
|
5
|
+
|
|
6
|
+
export default function useAppInit() {
|
|
7
|
+
const [isInvalid, setIsInvalid] = useState(false)
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!isDevelopment && !campxTenantKey) {
|
|
10
|
+
setIsInvalid(true)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (window.location.pathname === '/' && isDevelopment) {
|
|
14
|
+
Cookies.set('campx_tenant', 'campx_dev')
|
|
15
|
+
window.location.href = window.location.origin + '/campx_dev'
|
|
16
|
+
}
|
|
17
|
+
}, [])
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
isInvalid,
|
|
21
|
+
}
|
|
22
|
+
}
|