@campxdev/shared 1.11.32 → 1.11.34
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
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
StyledLeftNavContainer,
|
|
3
3
|
StyledMainContentContainer,
|
|
4
4
|
} from '../../layouts/Components/styles'
|
|
5
|
+
import { PermissionsStore } from '../../shared-state'
|
|
5
6
|
import ErrorBoundary from '../ErrorBoundary'
|
|
6
7
|
import SideNav from './SideNav'
|
|
7
8
|
interface Props {
|
|
@@ -15,12 +16,29 @@ export default function LayoutWrapper({
|
|
|
15
16
|
menu,
|
|
16
17
|
sideMenuHeader,
|
|
17
18
|
}: Props) {
|
|
19
|
+
const permissions = PermissionsStore.useState()
|
|
20
|
+
|
|
18
21
|
return (
|
|
19
22
|
<ErrorBoundary>
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
{!permissions.isHomePageEnabled && (
|
|
24
|
+
<StyledLeftNavContainer>
|
|
25
|
+
<SideNav menuItems={menu as any[]} header={sideMenuHeader} />
|
|
26
|
+
</StyledLeftNavContainer>
|
|
27
|
+
)}
|
|
28
|
+
<StyledMainContentContainer
|
|
29
|
+
style={{
|
|
30
|
+
width: permissions.isHomePageEnabled
|
|
31
|
+
? 'inherit'
|
|
32
|
+
: 'calc(100% - 220px)',
|
|
33
|
+
position: permissions.isHomePageEnabled ? 'unset' : 'fixed',
|
|
34
|
+
marginTop: permissions.isHomePageEnabled ? '10px' : '0px',
|
|
35
|
+
borderRadius: permissions.isHomePageEnabled ? '10px' : '0px',
|
|
36
|
+
border: permissions.isHomePageEnabled ? '1px solid #1212' : 'none',
|
|
37
|
+
height: permissions.isHomePageEnabled
|
|
38
|
+
? 'calc(100vh - 74px)'
|
|
39
|
+
: 'calc(100vh - 64px)',
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
24
42
|
<ErrorBoundary>{children}</ErrorBoundary>
|
|
25
43
|
</StyledMainContentContainer>
|
|
26
44
|
</ErrorBoundary>
|
|
@@ -59,9 +59,18 @@ const ExamGroupSelector = (props: ExamGroupSelectorProps) => {
|
|
|
59
59
|
}
|
|
60
60
|
} else if (options.length === 0) {
|
|
61
61
|
axios
|
|
62
|
-
.get(api
|
|
62
|
+
.get(api, {
|
|
63
|
+
params: {
|
|
64
|
+
isArchived: 'false',
|
|
65
|
+
isExamPublished: 'true',
|
|
66
|
+
},
|
|
67
|
+
})
|
|
63
68
|
.then((response) => {
|
|
64
|
-
setOptions(
|
|
69
|
+
setOptions(
|
|
70
|
+
filters?.examType !== 'internal'
|
|
71
|
+
? response.data?.examGroups
|
|
72
|
+
: response.data?.exams,
|
|
73
|
+
)
|
|
65
74
|
})
|
|
66
75
|
.catch((error) => {
|
|
67
76
|
console.error('Error fetching data from the API:', error)
|
package/src/hooks/useAuth.ts
CHANGED
|
@@ -26,6 +26,7 @@ type AuthResponse = {
|
|
|
26
26
|
logo: string
|
|
27
27
|
logo_square: string
|
|
28
28
|
}
|
|
29
|
+
isHomePageEnabled?: boolean
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -235,6 +236,7 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
|
|
|
235
236
|
s.isMasterInstitutionUser = res.data?.institutions
|
|
236
237
|
?.map((institution) => institution?.id)
|
|
237
238
|
?.includes(res?.data?.masterInstitutionUniqueId)
|
|
239
|
+
s.isHomePageEnabled = res.data?.isHomePageEnabled
|
|
238
240
|
})
|
|
239
241
|
AssetsStore.update((s) => {
|
|
240
242
|
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'
|
|
@@ -59,16 +59,29 @@ export const StyledMainContentContainer = muiStyled('main')(() => ({
|
|
|
59
59
|
overflowY: 'auto',
|
|
60
60
|
|
|
61
61
|
'&::-webkit-scrollbar': {
|
|
62
|
-
width: '0.
|
|
63
|
-
height: '0.
|
|
62
|
+
width: '0.4em',
|
|
63
|
+
height: '0.4em',
|
|
64
64
|
},
|
|
65
65
|
|
|
66
66
|
'&::-webkit-scrollbar-thumb': {
|
|
67
|
-
backgroundColor: 'rgba(0,0,0, 0.
|
|
67
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
68
68
|
borderRadius: '3px',
|
|
69
|
-
|
|
70
69
|
'&:hover': {
|
|
71
70
|
background: 'rgba(0,0,0, 0.4)',
|
|
72
71
|
},
|
|
73
72
|
},
|
|
73
|
+
|
|
74
|
+
// '&::-webkit-scrollbar': {
|
|
75
|
+
// width: '0.6em',
|
|
76
|
+
// height: '0.6em',
|
|
77
|
+
// },
|
|
78
|
+
|
|
79
|
+
// '&::-webkit-scrollbar-thumb': {
|
|
80
|
+
// backgroundColor: 'rgba(0,0,0, 0.3)',
|
|
81
|
+
// borderRadius: '3px',
|
|
82
|
+
|
|
83
|
+
// '&:hover': {
|
|
84
|
+
// background: 'rgba(0,0,0, 0.4)',
|
|
85
|
+
// },
|
|
86
|
+
// },
|
|
74
87
|
}))
|
|
@@ -1305,6 +1305,11 @@ export enum Permission {
|
|
|
1305
1305
|
CAN_REJECT_LEAVE_REQUESTS = 'can_reject_leave_requests',
|
|
1306
1306
|
CAN_CANCEL_LEAVE_REQUESTS = 'can_cancel_leave_requests',
|
|
1307
1307
|
|
|
1308
|
+
//All Leave Requests
|
|
1309
|
+
VIEW_ALL_LEAVES_REQUESTS = 'can_view_all_leaves_requests',
|
|
1310
|
+
CANCEL_ALL_LEAVE_REQUESTS = 'can_cancel_all_leave_requests',
|
|
1311
|
+
EXPORT_ALL_LEAVE_REQUESTS = 'can_export_all_leave_requests',
|
|
1312
|
+
|
|
1308
1313
|
//Departments
|
|
1309
1314
|
CAN_VIEW_DEPARTMENTS = 'can_view_departments',
|
|
1310
1315
|
CAN_ADD_DEPARTMENTS = 'can_add_departments',
|
|
@@ -2047,6 +2052,7 @@ interface IPermissionsStore {
|
|
|
2047
2052
|
masterInstitutionId?: string
|
|
2048
2053
|
isMasterInstitution: boolean
|
|
2049
2054
|
isMasterInstitutionUser?: boolean
|
|
2055
|
+
isHomePageEnabled?: boolean
|
|
2050
2056
|
}
|
|
2051
2057
|
|
|
2052
2058
|
export const PermissionsStore = new Store<IPermissionsStore>({
|
|
@@ -2057,4 +2063,5 @@ export const PermissionsStore = new Store<IPermissionsStore>({
|
|
|
2057
2063
|
masterInstitutionId: null,
|
|
2058
2064
|
isMasterInstitution: false,
|
|
2059
2065
|
isMasterInstitutionUser: false,
|
|
2066
|
+
isHomePageEnabled: false,
|
|
2060
2067
|
})
|