@campxdev/shared 1.11.6 → 1.11.7-0.alpha-22
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/.vscode/settings.json +3 -0
- package/exports.ts +4 -0
- package/package.json +17 -9
- package/src/assets/images/X.png +0 -0
- package/src/assets/images/active_devices.svg +3 -0
- package/src/assets/images/animation.gif +0 -0
- package/src/assets/images/change_password.svg +6 -0
- package/src/assets/images/clog_wheel.svg +6 -0
- package/src/assets/images/index.ts +28 -3
- package/src/assets/images/location.svg +6 -0
- package/src/assets/images/logout_icon.svg +6 -0
- package/src/assets/images/lottery.svg +22 -0
- package/src/assets/images/mobile.svg +7 -0
- package/src/assets/images/no_devices.svg +734 -0
- package/src/assets/images/notifications.svg +3 -0
- package/src/assets/images/profile.svg +6 -0
- package/src/assets/images/web.svg +13 -0
- package/src/components/ActiveDevices/ActiveDevices.tsx +60 -0
- package/src/components/ActiveDevices/DeviceInformationCard.tsx +97 -0
- package/src/components/ActiveDevices/index.ts +1 -0
- package/src/components/ActivityLog/ActivityLog.tsx +268 -0
- package/src/components/ActivityLog/Styles.tsx +35 -0
- package/src/components/ActivityLog/index.ts +1 -0
- package/src/components/ApplicationProfile/ApplicationProfile.tsx +1 -0
- package/src/components/ApplicationProfile/UserProfileRelation.tsx +4 -1
- package/src/components/DatabaseConfiguration/DatabaseConfiguration.tsx +28 -0
- package/src/components/DatabaseConfiguration/DatabaseConfigurationForm.tsx +87 -0
- package/src/components/DatabaseConfiguration/components/AddConnectionDrawerButton.tsx +30 -0
- package/src/components/DatabaseConfiguration/components/ConnectionCard.tsx +79 -0
- package/src/components/DatabaseConfiguration/index.ts +5 -0
- package/src/components/DatabaseConfiguration/service.ts +6 -0
- package/src/components/DatabaseConfiguration/styles.ts +30 -0
- package/src/components/DrawerWrapper/DialogTemplate.tsx +58 -0
- package/src/components/DrawerWrapper/DrawerWrapper.tsx +23 -7
- package/src/components/DrawerWrapper/ErrorTemplate.tsx +77 -0
- package/src/components/ErrorModal.tsx +88 -0
- package/src/components/ErrorModalWrapper/ErrorModalTemplate.tsx +118 -0
- package/src/components/ErrorModalWrapper/ErrorModalWrapper.tsx +76 -0
- package/src/components/FilterComponents/SearchBar.tsx +5 -2
- package/src/components/Form/Form.tsx +4 -1
- package/src/components/HookForm/AutoCompleteSearch.tsx +3 -0
- package/src/components/HookForm/MultiSelect.tsx +1 -0
- package/src/components/HookForm/SingleSelect.tsx +2 -2
- package/src/components/ImageUpload.tsx +4 -1
- package/src/components/Input/MultiSelect.tsx +1 -0
- package/src/components/Input/SearchSingleSelect.tsx +1 -1
- package/src/components/Input/SingleSelect.tsx +7 -7
- package/src/components/Institutions/InsititutionsDialog.tsx +2 -2
- package/src/components/Layout/Header/AppHeader.tsx +23 -6
- package/src/components/Layout/Header/HeaderActions/CogWheelMenu.tsx +2 -2
- package/src/components/Layout/Header/HeaderActions/HeaderActions.tsx +41 -16
- package/src/components/Layout/Header/HeaderActions/UserBox.tsx +48 -6
- package/src/components/Layout/Header/applications.ts +43 -30
- package/src/components/Layout/LayoutWrapper.tsx +82 -4
- package/src/components/Layout/SideNav.tsx +42 -9
- package/src/components/LoginForm.tsx +53 -1
- package/src/components/MongoCharts/MongoDashboard.tsx +146 -0
- package/src/components/MongoCharts/index.tsx +1 -0
- package/src/components/MyProfile/MyProfile.tsx +1 -1
- package/src/components/ReportHeader.tsx +2 -2
- package/src/components/Selectors/ClassRoomSelector.tsx +2 -2
- package/src/components/Selectors/CourseSelector.tsx +2 -2
- package/src/components/Selectors/DepartmentSelector.tsx +2 -2
- package/src/components/Selectors/ExamGroupSelector.tsx +19 -10
- package/src/components/Selectors/FacultySelector.tsx +2 -2
- package/src/components/Selectors/FeeTypeSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormClassRoomSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormCourseSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormDepartmentSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormExamGroupSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormFacultySelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormFeeTypeSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormProgramSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/FormQuotaSelector.tsx +3 -3
- package/src/components/Selectors/FormSelectors/FormSemesterSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/MultiSelect/MultiFacultySelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/MultiSelect/MultiFeeTypeSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/MultiSelect/MultiProgramSelector.tsx +2 -2
- package/src/components/Selectors/FormSelectors/MultiSelect/MultiQuotaSelector.tsx +2 -2
- package/src/components/Selectors/ProgramSelector.tsx +3 -3
- package/src/components/Selectors/QuotaSelector.tsx +3 -3
- package/src/components/Selectors/SemesterSelector.tsx +2 -2
- package/src/components/SignatureFooter.tsx +35 -0
- package/src/components/SwitchButton.tsx +6 -1
- package/src/components/Tables/2DTable/Table.tsx +20 -23
- package/src/components/Tables/BasicTable/Table.tsx +22 -13
- package/src/components/Tables/BasicTable/TableFooter.tsx +35 -9
- package/src/components/Tables/BasicTable/styles.ts +1 -1
- package/src/components/Tables/ReactTable/ReactTable.tsx +42 -8
- package/src/components/Tables/common/types.ts +1 -0
- package/src/components/Tabs/TabsContainer.tsx +5 -5
- package/src/components/Tabs/styles.tsx +1 -0
- package/src/components/ToastContainer/ToastContainer.tsx +2 -3
- package/src/components/UploadButton/UploadButton.tsx +3 -1
- package/src/components/UploadButton/types.ts +2 -2
- package/src/components/UploadDocument.tsx +3 -0
- package/src/components/UploadFileDialog/UploadFileDialog.tsx +20 -9
- package/src/components/index.ts +5 -0
- package/src/config/axios.ts +5 -19
- package/src/constants/UIConstants.ts +65 -2
- package/src/constants/isDevelopment.ts +0 -1
- package/src/contexts/Providers.tsx +5 -43
- package/src/hooks/useAuth.ts +7 -0
- package/src/layouts/Components/styles.tsx +25 -7
- package/src/permissions/PermissionsStore.ts +658 -55
- package/src/permissions/ValidateAccess.tsx +37 -8
- package/src/shared-state/PermissionsStore.ts +779 -85
- package/src/theme/theme.d.ts +69 -35
- package/src/utils/debounce.ts +11 -0
- package/src/utils/getUrlParams.ts +13 -0
- package/src/utils/index.ts +6 -3
- package/src/utils/logout.ts +4 -8
|
@@ -14,9 +14,12 @@ import {
|
|
|
14
14
|
} from '@mui/material'
|
|
15
15
|
import { ReactNode, useEffect, useRef, useState } from 'react'
|
|
16
16
|
import { toast } from 'react-toastify'
|
|
17
|
-
import axios
|
|
17
|
+
import axios from '../../config/axios'
|
|
18
18
|
import { buffertoCSV } from '../../utils'
|
|
19
|
+
import { useErrorModal } from '../ErrorModalWrapper/ErrorModalWrapper'
|
|
19
20
|
import { DeleteButton, EditButton } from '../IconButtons'
|
|
21
|
+
import { getAccept } from '../UploadButton/UploadButton'
|
|
22
|
+
import { UploadButtonProps } from '../UploadButton/types'
|
|
20
23
|
const animatedImage = require('./AnimatedUploadFile.gif')
|
|
21
24
|
|
|
22
25
|
const StyledDialogHeader = styled(Box)(({ theme }) => ({
|
|
@@ -79,8 +82,10 @@ interface UploadFileDialogProps {
|
|
|
79
82
|
sampleFileDownloadUrl?: string
|
|
80
83
|
uploadUrl: string
|
|
81
84
|
successMessage?: string
|
|
82
|
-
refetchFn:
|
|
83
|
-
|
|
85
|
+
refetchFn?: (res: any) => void
|
|
86
|
+
onUpload?: () => void
|
|
87
|
+
postBody?: { [key: string]: string | any }
|
|
88
|
+
type?: UploadButtonProps['type']
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
export default function UploadFileDialog({
|
|
@@ -94,10 +99,12 @@ export default function UploadFileDialog({
|
|
|
94
99
|
refetchFn,
|
|
95
100
|
sampleFileDownloadUrl,
|
|
96
101
|
postBody = {},
|
|
102
|
+
onUpload,
|
|
103
|
+
type = 'excel',
|
|
97
104
|
}: UploadFileDialogProps) {
|
|
98
105
|
const inputRef: any = useRef(null)
|
|
99
106
|
const [loading, setLoading] = useState(false)
|
|
100
|
-
|
|
107
|
+
const errorModal = useErrorModal()
|
|
101
108
|
const [file, setFile] = useState(null)
|
|
102
109
|
const [open, setOpen] = useState(false)
|
|
103
110
|
const onClose = () => {
|
|
@@ -114,6 +121,7 @@ export default function UploadFileDialog({
|
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
const handleOnUpload = () => {
|
|
124
|
+
onUpload && onUpload()
|
|
117
125
|
if (!file) return ``
|
|
118
126
|
const formData = new FormData()
|
|
119
127
|
formData.append('file', file)
|
|
@@ -128,25 +136,27 @@ export default function UploadFileDialog({
|
|
|
128
136
|
.post(uploadUrl, formData)
|
|
129
137
|
.then((res) => {
|
|
130
138
|
setLoading(false)
|
|
131
|
-
refetchFn()
|
|
139
|
+
refetchFn && refetchFn(res)
|
|
132
140
|
setOpen(false)
|
|
133
141
|
toast.success(successMessage ?? 'Successful')
|
|
134
142
|
setFile(null)
|
|
135
143
|
})
|
|
136
144
|
.catch((err) => {
|
|
145
|
+
// eslint-disable-next-line no-console
|
|
137
146
|
console.log(err)
|
|
138
147
|
setLoading(false)
|
|
139
|
-
axiosErrorToast(err)
|
|
148
|
+
// axiosErrorToast(err)
|
|
149
|
+
errorModal({ error: err })
|
|
140
150
|
})
|
|
141
151
|
}
|
|
142
152
|
|
|
143
153
|
const handleSampleFileDownload = async () => {
|
|
144
154
|
try {
|
|
145
155
|
const res = await axios.get(sampleFileDownloadUrl)
|
|
146
|
-
|
|
147
156
|
buffertoCSV({ data: res.data, filename: `${dialogTitle}` })
|
|
148
157
|
} catch (error) {
|
|
149
|
-
|
|
158
|
+
errorModal({ error: error })
|
|
159
|
+
// axiosErrorToast(error)
|
|
150
160
|
}
|
|
151
161
|
}
|
|
152
162
|
|
|
@@ -194,7 +204,8 @@ export default function UploadFileDialog({
|
|
|
194
204
|
<input
|
|
195
205
|
onChange={handleImageChange}
|
|
196
206
|
hidden
|
|
197
|
-
type
|
|
207
|
+
accept={getAccept(type)}
|
|
208
|
+
type={'file'}
|
|
198
209
|
ref={inputRef}
|
|
199
210
|
/>
|
|
200
211
|
<StyledChooseFileButton
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ActivityLog from './ActivityLog'
|
|
1
2
|
import ApplicationProfile from './ApplicationProfile'
|
|
2
3
|
import ChangePassword from './ChangePassword'
|
|
3
4
|
import Chips from './Chips'
|
|
@@ -27,6 +28,7 @@ import { DialogButton, DrawerButton } from './ModalButtons'
|
|
|
27
28
|
import { CustomDialog } from './ModalButtons/DialogButton'
|
|
28
29
|
import { CustomDrawer } from './ModalButtons/DrawerButton'
|
|
29
30
|
import PopoverButton from './ModalButtons/PopoverButton'
|
|
31
|
+
import MongoDashboard from './MongoCharts'
|
|
30
32
|
import PageNotFound from './PageNotFound'
|
|
31
33
|
import ReactJoyRide from './ReactJoyRide'
|
|
32
34
|
import ResetPassword from './ResetPassword'
|
|
@@ -60,6 +62,7 @@ export { default as PageHeader } from './PageHeader'
|
|
|
60
62
|
export { default as useConfirm } from './PopupConfirm/useConfirm'
|
|
61
63
|
export { default as ReportHeader } from './ReportHeader'
|
|
62
64
|
export { default as ReportPageHeader } from './ReportPageHeader'
|
|
65
|
+
export { default as SignatureFooter } from './SignatureFooter'
|
|
63
66
|
export { default as Spinner } from './Spinner'
|
|
64
67
|
export { default as PaymentStepper } from './Stepper'
|
|
65
68
|
export { default as SwitchButton } from './SwitchButton'
|
|
@@ -70,6 +73,7 @@ export { default as ReactTable } from './Tables/ReactTable'
|
|
|
70
73
|
export { default as Tabs } from './Tabs/Tabs'
|
|
71
74
|
export { default as ToastContainer } from './ToastContainer'
|
|
72
75
|
export {
|
|
76
|
+
ActivityLog,
|
|
73
77
|
AppHeader,
|
|
74
78
|
ApplicationProfile,
|
|
75
79
|
AsyncSearchSelect,
|
|
@@ -94,6 +98,7 @@ export {
|
|
|
94
98
|
LayoutWrapper,
|
|
95
99
|
ListItemButton,
|
|
96
100
|
LoginForm,
|
|
101
|
+
MongoDashboard,
|
|
97
102
|
NavigationTabs,
|
|
98
103
|
PageNotFound,
|
|
99
104
|
PopoverButton,
|
package/src/config/axios.ts
CHANGED
|
@@ -2,12 +2,12 @@ import Axios, { AxiosRequestConfig } from 'axios'
|
|
|
2
2
|
import Cookies from 'js-cookie'
|
|
3
3
|
import { toast } from 'react-toastify'
|
|
4
4
|
import { NetworkStore } from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
5
|
-
import { isDevelopment, isSetup } from '../constants'
|
|
6
|
-
import { InstitutionsStore } from '../shared-state/InstitutionsStore'
|
|
7
5
|
|
|
8
6
|
const sessionKey = Cookies.get('campx_session_key')
|
|
9
|
-
const
|
|
10
|
-
|
|
7
|
+
const tenantId =
|
|
8
|
+
Cookies.get('campx_tenant') ?? window.location.hostname.split('.')[0]
|
|
9
|
+
const institutionId =
|
|
10
|
+
Cookies.get('campx_institution') ?? window.location.pathname.split('/')[1]
|
|
11
11
|
const openPaymentsKey = Cookies.get('campx_open_payments_key')
|
|
12
12
|
|
|
13
13
|
export const formatParams = (params) => {
|
|
@@ -23,26 +23,12 @@ let axios = Axios.create({
|
|
|
23
23
|
baseURL: process.env.REACT_APP_API_HOST,
|
|
24
24
|
withCredentials: true,
|
|
25
25
|
headers: {
|
|
26
|
-
'x-tenant-id':
|
|
27
|
-
...((isDevelopment || isSetup) && sessionKey
|
|
28
|
-
? { campx_session_key: sessionKey }
|
|
29
|
-
: {}),
|
|
30
|
-
|
|
31
|
-
...(openPaymentsKey && {
|
|
32
|
-
campx_open_payments_key: openPaymentsKey,
|
|
33
|
-
}),
|
|
26
|
+
'x-tenant-id': tenantId,
|
|
34
27
|
},
|
|
35
28
|
})
|
|
36
29
|
|
|
37
30
|
axios.interceptors.request.use(
|
|
38
31
|
function (config: AxiosRequestConfig) {
|
|
39
|
-
const { current } = InstitutionsStore.getRawState()
|
|
40
|
-
if (current) {
|
|
41
|
-
config.headers['x-institution-code'] = current.code
|
|
42
|
-
} else {
|
|
43
|
-
config.headers['x-institution-code'] = institutionId
|
|
44
|
-
}
|
|
45
|
-
|
|
46
32
|
const params = formatParams(config?.params)
|
|
47
33
|
NetworkStore.update((s) => {
|
|
48
34
|
s.loading = true
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react'
|
|
2
|
+
|
|
1
3
|
export const batchOptions = Array.from({ length: 12 }, (_, i) => {
|
|
2
|
-
return `${
|
|
3
|
-
})
|
|
4
|
+
return `${new Date().getFullYear() - i} - ${new Date().getFullYear() - i + 1}`
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const getYears = () => {
|
|
8
|
+
const start = 2019
|
|
9
|
+
const end = new Date().getFullYear() + 3
|
|
10
|
+
const values = new Array(end - start).fill(0).map((_, i) => ({
|
|
11
|
+
label: `${start + i}`,
|
|
12
|
+
value: `${start + i}`,
|
|
13
|
+
}))
|
|
14
|
+
return values.reverse()
|
|
15
|
+
}
|
|
4
16
|
|
|
5
17
|
export const examGroupBatches = Array.from({ length: 10 }, (_, i) => {
|
|
6
18
|
return `${2012 + i} - ${2012 + i + 1}`
|
|
@@ -125,4 +137,55 @@ export const ProfileApplicationType = [
|
|
|
125
137
|
label: 'PeopleX',
|
|
126
138
|
value: 'hrms',
|
|
127
139
|
},
|
|
140
|
+
{
|
|
141
|
+
label: 'AdminX',
|
|
142
|
+
value: 'admin',
|
|
143
|
+
},
|
|
128
144
|
]
|
|
145
|
+
|
|
146
|
+
export interface Option {
|
|
147
|
+
label: string | ReactNode
|
|
148
|
+
value: any
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface GenerateLabelValueProps {
|
|
152
|
+
labelKey?: string
|
|
153
|
+
valueKey?: string
|
|
154
|
+
useIndexAsValue?: boolean
|
|
155
|
+
startFromOne?: boolean
|
|
156
|
+
showAll?: boolean
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const generateLabelValueOptions = (
|
|
160
|
+
options: any[],
|
|
161
|
+
{
|
|
162
|
+
labelKey,
|
|
163
|
+
valueKey,
|
|
164
|
+
useIndexAsValue,
|
|
165
|
+
startFromOne,
|
|
166
|
+
showAll,
|
|
167
|
+
}: GenerateLabelValueProps = {
|
|
168
|
+
labelKey: null,
|
|
169
|
+
valueKey: null,
|
|
170
|
+
useIndexAsValue: false,
|
|
171
|
+
startFromOne: false,
|
|
172
|
+
showAll: false,
|
|
173
|
+
},
|
|
174
|
+
): Option[] => {
|
|
175
|
+
let result
|
|
176
|
+
if (labelKey == null) {
|
|
177
|
+
result = options.map((option, index) => ({
|
|
178
|
+
label: option[0].toUpperCase() + option.slice(1),
|
|
179
|
+
value: useIndexAsValue ? (startFromOne ? index + 1 : index) : option,
|
|
180
|
+
}))
|
|
181
|
+
} else {
|
|
182
|
+
result = options.map((option) => ({
|
|
183
|
+
label: option[labelKey],
|
|
184
|
+
value: option[valueKey],
|
|
185
|
+
}))
|
|
186
|
+
}
|
|
187
|
+
if (showAll) {
|
|
188
|
+
result.unshift({ label: 'All', value: 'all' })
|
|
189
|
+
}
|
|
190
|
+
return result
|
|
191
|
+
}
|
|
@@ -4,63 +4,25 @@ import MuiThemeProvider from '../theme/MuiThemeProvider'
|
|
|
4
4
|
import QueryClientProvider from './QueryClientProvider'
|
|
5
5
|
|
|
6
6
|
import Cookies from 'js-cookie'
|
|
7
|
-
import { ReactNode
|
|
7
|
+
import { ReactNode } from 'react'
|
|
8
8
|
import { ToastContainer } from '../components'
|
|
9
9
|
import DialogProvider from '../components/DrawerWrapper/DrawerWrapper'
|
|
10
10
|
import GlobalNetworkLoadingIndicator from '../components/ErrorBoundary/GlobalNetworkLoadingIndicator'
|
|
11
|
-
import
|
|
11
|
+
import ErrorModalProvider from '../components/ErrorModalWrapper/ErrorModalWrapper'
|
|
12
12
|
import RootModal from './RootModal'
|
|
13
|
-
import { isDevelopment } from '../constants'
|
|
14
13
|
|
|
15
14
|
export const campxTenantKey = Cookies.get('campx_tenant')
|
|
16
|
-
export const urlTenantKey =
|
|
15
|
+
export const urlTenantKey = Cookies.get('campx_tenant')
|
|
17
16
|
export const instituitionKey = window.location.pathname.split('/')[2]
|
|
18
17
|
|
|
19
18
|
export default function Providers({ children }: { children: ReactNode }) {
|
|
20
|
-
const localInstituitionKey = localStorage.getItem('institution_key')
|
|
21
|
-
|
|
22
|
-
const getInstituitionKey = () => {
|
|
23
|
-
if (instituitionKey) {
|
|
24
|
-
return instituitionKey
|
|
25
|
-
} else {
|
|
26
|
-
if (!urlTenantKey) return null
|
|
27
|
-
if (localInstituitionKey) {
|
|
28
|
-
return localInstituitionKey
|
|
29
|
-
} else {
|
|
30
|
-
return null
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!urlTenantKey) {
|
|
37
|
-
if (isDevelopment) {
|
|
38
|
-
window.location.replace(window.location.origin + `/aupulse`)
|
|
39
|
-
}
|
|
40
|
-
if (campxTenantKey)
|
|
41
|
-
window.location.replace(window.location.origin + `/${campxTenantKey}`)
|
|
42
|
-
} else {
|
|
43
|
-
if (!instituitionKey) {
|
|
44
|
-
if (localInstituitionKey) {
|
|
45
|
-
window.location.replace(
|
|
46
|
-
window.location.origin + `/${urlTenantKey}/${localInstituitionKey}`,
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}, [])
|
|
52
|
-
|
|
53
|
-
const baseName = getInstituitionKey()
|
|
54
|
-
? `${urlTenantKey}/${getInstituitionKey()}`
|
|
55
|
-
: urlTenantKey
|
|
56
|
-
|
|
57
19
|
return (
|
|
58
|
-
<BrowserRouter
|
|
20
|
+
<BrowserRouter>
|
|
59
21
|
<QueryClientProvider>
|
|
60
22
|
<MuiThemeProvider>
|
|
61
23
|
<ConfirmContextProvider>
|
|
62
24
|
<DialogProvider>
|
|
63
|
-
{children}
|
|
25
|
+
<ErrorModalProvider>{children}</ErrorModalProvider>
|
|
64
26
|
<GlobalNetworkLoadingIndicator />
|
|
65
27
|
<RootModal />
|
|
66
28
|
<ToastContainer />
|
package/src/hooks/useAuth.ts
CHANGED
|
@@ -26,10 +26,12 @@ type AuthResponse = {
|
|
|
26
26
|
logo: string
|
|
27
27
|
logo_square: string
|
|
28
28
|
}
|
|
29
|
+
isHomePageEnabled?: boolean
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
const ApplicationObj = {
|
|
34
|
+
admin: 'admin',
|
|
33
35
|
enroll: 'enroll_x',
|
|
34
36
|
ums: 'square',
|
|
35
37
|
payments: 'payments',
|
|
@@ -231,6 +233,11 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
231
233
|
s.institutionType = res.data?.institutionType
|
|
232
234
|
s.masterInstitutionUniqueId = res.data?.masterInstitutionUniqueId
|
|
233
235
|
s.masterInstitutionId = res.data?.masterInstitutionId
|
|
236
|
+
s.isMasterInstitutionUser = res.data?.institutions
|
|
237
|
+
?.map((institution) => institution?.id)
|
|
238
|
+
?.includes(res?.data?.masterInstitutionUniqueId)
|
|
239
|
+
s.isMasterInstitution = res.data?.isMasterInstitution
|
|
240
|
+
s.isHomePageEnabled = res.data?.isHomePageEnabled
|
|
234
241
|
})
|
|
235
242
|
AssetsStore.update((s) => {
|
|
236
243
|
s.logo = res.data?.assets.logo
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
1
|
import { styled as muiStyled } from '@mui/material'
|
|
2
|
+
import styled from 'styled-components'
|
|
3
3
|
|
|
4
4
|
export const headerHeight = '64px'
|
|
5
5
|
export const sideNavWidth = '220px'
|
|
@@ -51,24 +51,42 @@ export const StyledLeftNavContainer = muiStyled('aside')(({ theme }) => ({
|
|
|
51
51
|
}))
|
|
52
52
|
|
|
53
53
|
export const StyledMainContentContainer = muiStyled('main')(() => ({
|
|
54
|
-
width:
|
|
54
|
+
width:
|
|
55
|
+
window.innerWidth > 1024
|
|
56
|
+
? `calc(100% - ${sideNavWidth})`
|
|
57
|
+
: '100% !important',
|
|
55
58
|
height: `calc(100vh - ${headerHeight})`,
|
|
56
59
|
position: 'fixed',
|
|
57
60
|
top: headerHeight,
|
|
58
|
-
left: sideNavWidth,
|
|
61
|
+
left: window.innerWidth > 1024 ? sideNavWidth : 0,
|
|
62
|
+
right: window.innerWidth > 1024 ? 'unset' : 0,
|
|
63
|
+
bottom: window.innerWidth > 1024 ? 'unset' : 0,
|
|
59
64
|
overflowY: 'auto',
|
|
60
65
|
|
|
61
66
|
'&::-webkit-scrollbar': {
|
|
62
|
-
width: '0.
|
|
63
|
-
height: '0.
|
|
67
|
+
width: '0.4em',
|
|
68
|
+
height: '0.4em',
|
|
64
69
|
},
|
|
65
70
|
|
|
66
71
|
'&::-webkit-scrollbar-thumb': {
|
|
67
|
-
backgroundColor: 'rgba(0,0,0, 0.
|
|
72
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
68
73
|
borderRadius: '3px',
|
|
69
|
-
|
|
70
74
|
'&:hover': {
|
|
71
75
|
background: 'rgba(0,0,0, 0.4)',
|
|
72
76
|
},
|
|
73
77
|
},
|
|
78
|
+
|
|
79
|
+
// '&::-webkit-scrollbar': {
|
|
80
|
+
// width: '0.6em',
|
|
81
|
+
// height: '0.6em',
|
|
82
|
+
// },
|
|
83
|
+
|
|
84
|
+
// '&::-webkit-scrollbar-thumb': {
|
|
85
|
+
// backgroundColor: 'rgba(0,0,0, 0.3)',
|
|
86
|
+
// borderRadius: '3px',
|
|
87
|
+
|
|
88
|
+
// '&:hover': {
|
|
89
|
+
// background: 'rgba(0,0,0, 0.4)',
|
|
90
|
+
// },
|
|
91
|
+
// },
|
|
74
92
|
}))
|