@campxdev/shared 1.8.11 → 1.8.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,5 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from 'react'
|
|
2
|
-
import {
|
|
1
|
+
import { ReactElement, ReactNode } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
ErrorBoundary as ReactErrorBoundary,
|
|
4
|
+
FallbackProps,
|
|
5
|
+
} from 'react-error-boundary'
|
|
3
6
|
import { QueryErrorResetBoundary } from 'react-query'
|
|
4
7
|
import { useLocation } from 'react-router-dom'
|
|
5
8
|
import ErrorFallback from './ErrorFallback'
|
|
@@ -7,9 +10,11 @@ import ErrorFallback from './ErrorFallback'
|
|
|
7
10
|
export default function ErrorBoundary({
|
|
8
11
|
children,
|
|
9
12
|
resetKey,
|
|
13
|
+
customFallback,
|
|
10
14
|
}: {
|
|
11
15
|
children: ReactNode
|
|
12
16
|
resetKey?: string
|
|
17
|
+
customFallback?: (props: FallbackProps) => JSX.Element
|
|
13
18
|
}) {
|
|
14
19
|
const location = useLocation()
|
|
15
20
|
return (
|
|
@@ -17,7 +22,7 @@ export default function ErrorBoundary({
|
|
|
17
22
|
{({ reset }) => (
|
|
18
23
|
<ReactErrorBoundary
|
|
19
24
|
key={resetKey ?? location?.pathname}
|
|
20
|
-
fallbackRender={ErrorFallback}
|
|
25
|
+
fallbackRender={customFallback ?? ErrorFallback}
|
|
21
26
|
onReset={reset}
|
|
22
27
|
>
|
|
23
28
|
{children}
|
|
@@ -14,6 +14,7 @@ import { PermissionsStore } from '../../shared-state'
|
|
|
14
14
|
import axios from '../../config/axios'
|
|
15
15
|
|
|
16
16
|
const StyledAlert = styled(Alert)(({ theme }) => ({
|
|
17
|
+
height: '60px',
|
|
17
18
|
border: `1px solid ${theme.palette.error.main}`,
|
|
18
19
|
display: 'flex',
|
|
19
20
|
alignItems: 'center',
|
|
@@ -66,7 +67,7 @@ export default function ErrorFallback({ error, resetErrorBoundary }) {
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
return (
|
|
69
|
-
<Box sx={{ marginTop: '16px', padding: '
|
|
70
|
+
<Box sx={{ marginTop: '16px', padding: '20px' }}>
|
|
70
71
|
<StyledAlert severity="error">
|
|
71
72
|
{error?.response?.data?.message ?? error?.message}
|
|
72
73
|
<Button
|
|
@@ -139,7 +140,11 @@ export function InternalServer({ resetBoundary, error }) {
|
|
|
139
140
|
Internal Server Error.
|
|
140
141
|
</Typography>
|
|
141
142
|
<Typography variant="body1">
|
|
142
|
-
{error?.response?.data?.message
|
|
143
|
+
{error?.response?.data?.message
|
|
144
|
+
? typeof error?.response?.data?.message === 'string'
|
|
145
|
+
? error?.response?.data?.message
|
|
146
|
+
: JSON.stringify(error?.response?.data?.message)
|
|
147
|
+
: 'Internal Server Error'}
|
|
143
148
|
</Typography>
|
|
144
149
|
<Button
|
|
145
150
|
size="small"
|
|
@@ -234,6 +234,8 @@ export enum Permission {
|
|
|
234
234
|
CAN_INTERNAL_MARKS_VIEW = 'can_internal_marks_view',
|
|
235
235
|
CAN_INTERNAL_MARKS_ADD = 'can_internal_marks_add',
|
|
236
236
|
CAN_INTERNAL_MARKS_EDIT = 'can_internal_marks_edit',
|
|
237
|
+
CAN_INTERNAL_MARKS_IMPORT = 'can_internal_marks_import',
|
|
238
|
+
CAN_INTERANL_MARKS_IMPORT_LMS = 'can_internal_marks_import_lms',
|
|
237
239
|
|
|
238
240
|
// External Marks
|
|
239
241
|
CAN_EXTERNAL_MARKS_VIEW = 'can_external_marks_view',
|
|
@@ -261,6 +263,13 @@ export enum Permission {
|
|
|
261
263
|
CAN_TIME_SLOTS_ADD = 'can_time_slots_add',
|
|
262
264
|
CAN_TIME_SLOTS_EDIT = 'can_time_slots_edit',
|
|
263
265
|
CAN_TIME_SLOTS_DELETE = 'can_time_slots_delete',
|
|
266
|
+
|
|
267
|
+
// Grades
|
|
268
|
+
|
|
269
|
+
CAN_GRADES_ADD = 'can_grades_add',
|
|
270
|
+
CAN_GRADES_EDIT = 'can_grades_edit',
|
|
271
|
+
CAN_GRADES_DELETE = 'can_grades_delete',
|
|
272
|
+
CAN_GRADES_VIEW = 'can_grades_view',
|
|
264
273
|
}
|
|
265
274
|
|
|
266
275
|
export interface IPermissions {
|
|
@@ -358,6 +367,12 @@ export interface IPermissions {
|
|
|
358
367
|
can_tasks_delete: boolean
|
|
359
368
|
can_classroom_subject_attendance_edit: boolean
|
|
360
369
|
can_classroom_subjects_view: boolean
|
|
370
|
+
can_internal_marks_import: boolean
|
|
371
|
+
can_internal_marks_import_lms: boolean
|
|
372
|
+
can_grades_add: boolean
|
|
373
|
+
can_grades_edit: boolean
|
|
374
|
+
can_grades_delete: boolean
|
|
375
|
+
can_grades_view: boolean
|
|
361
376
|
}
|
|
362
377
|
|
|
363
378
|
interface IPermissionsStore {
|