@campxdev/shared 0.1.0
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/.eslintrc.js +34 -0
- package/.prettierrc +10 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +9 -0
- package/antd.customize.less +73 -0
- package/exports.ts +20 -0
- package/package.json +78 -0
- package/public/dean.JPG +0 -0
- package/public/download.png +0 -0
- package/public/illustrations/bookmark.svg +19 -0
- package/public/illustrations/girl-writing.png +0 -0
- package/public/illustrations/whiteboard.svg +24 -0
- package/public/images/AnimatedUploadFile.gif +0 -0
- package/public/images/doc@2x.png +0 -0
- package/public/images/greenTick.png +0 -0
- package/public/images/jpg.png +0 -0
- package/public/images/paperclip@2x.png +0 -0
- package/public/images/pdf.png +0 -0
- package/public/images/ppt.png +0 -0
- package/public/images/profileImage.jpg +0 -0
- package/public/images/profileImage.png +0 -0
- package/public/index.html +50 -0
- package/public/logo.png +0 -0
- package/public/logo_campx_full.png +0 -0
- package/public/logo_square.svg +21 -0
- package/public/omr_sign.jpg +0 -0
- package/src/App.tsx +35 -0
- package/src/assets/fonts/avenir/Avenir.ttc +0 -0
- package/src/assets/fonts/avenir/index.ts +2 -0
- package/src/assets/fonts/poppins/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/poppins/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/poppins/index.ts +7 -0
- package/src/assets/images/File bundle-bro.svg +122 -0
- package/src/assets/images/Filebundle.png +0 -0
- package/src/assets/images/NoPart.png +0 -0
- package/src/assets/images/ResultProcess.png +0 -0
- package/src/assets/images/ResultProcess.svg +99 -0
- package/src/assets/images/attachment.svg +1 -0
- package/src/assets/images/avatar.png +0 -0
- package/src/assets/images/index.ts +19 -0
- package/src/assets/images/pdf.png +0 -0
- package/src/assets/images/taskAttachment.png +0 -0
- package/src/assets/images/welcomeimage.jpg +0 -0
- package/src/assets/static_files/External_Marks_Import .xlsx +0 -0
- package/src/assets/static_files/Leads_Sample.xlsx +0 -0
- package/src/assets/static_files/Subject_Topic_Import_Sheet.xlsx +0 -0
- package/src/assets/static_files/admissions_Sample.xlsx +0 -0
- package/src/assets/static_files/barcodes_template.xlsx +0 -0
- package/src/assets/static_files/hostel_rooms_import.xlsx +0 -0
- package/src/assets/static_files/index.ts +24 -0
- package/src/assets/static_files/sample_admissions.xlsx +0 -0
- package/src/assets/static_files/sample_admissions_report.xlsx +0 -0
- package/src/assets/static_files/sample_curriculum_subjects_template.xlsx +0 -0
- package/src/assets/static_files/sample_import_students_new.xlsx +0 -0
- package/src/assets/static_files/sample_internal_marks.xlsx +0 -0
- package/src/assets/static_files/sample_student_subjects_template.xlsx +0 -0
- package/src/components/ActionButton.tsx +28 -0
- package/src/components/Attachment.tsx +26 -0
- package/src/components/AutocompleteSearch/AutocompleteSearch.tsx +57 -0
- package/src/components/AutocompleteSearch/index.tsx +1 -0
- package/src/components/Breadcrumbs.tsx +73 -0
- package/src/components/Card.tsx +97 -0
- package/src/components/CardsGrid.tsx +28 -0
- package/src/components/Chips.tsx +77 -0
- package/src/components/Detail.tsx +15 -0
- package/src/components/DetailsGrid.tsx +52 -0
- package/src/components/DividerHeading.tsx +40 -0
- package/src/components/DrawerWrapper/DialogWrapper.tsx +63 -0
- package/src/components/DrawerWrapper/DrawerTemplate.tsx +53 -0
- package/src/components/DrawerWrapper/DrawerWrapper.tsx +53 -0
- package/src/components/DropDownButton.tsx +184 -0
- package/src/components/ErrorBoundary.js +45 -0
- package/src/components/ErrorBox.tsx +42 -0
- package/src/components/FloatingContainer.tsx +26 -0
- package/src/components/FullCalendar/Actions.tsx +162 -0
- package/src/components/FullCalendar/FullCalendarWrapper.tsx +54 -0
- package/src/components/HookForm/AutoCompleteSearch.tsx +143 -0
- package/src/components/HookForm/DatePicker.tsx +65 -0
- package/src/components/HookForm/DateTimePicker.tsx +70 -0
- package/src/components/HookForm/FormLabel.tsx +14 -0
- package/src/components/HookForm/MultiCheckbox.tsx +82 -0
- package/src/components/HookForm/MultiSelect.tsx +100 -0
- package/src/components/HookForm/RadioGroup.tsx +113 -0
- package/src/components/HookForm/SingleCheckbox.tsx +46 -0
- package/src/components/HookForm/SingleSelect.tsx +93 -0
- package/src/components/HookForm/TextField.tsx +74 -0
- package/src/components/HookForm/TimePicker.tsx +82 -0
- package/src/components/HookForm/index.ts +23 -0
- package/src/components/IconButtons/IconButtons.tsx +137 -0
- package/src/components/IconButtons/Icons.tsx +269 -0
- package/src/components/IconButtons/assets/edit.svg +4 -0
- package/src/components/IconButtons/assets/eye.svg +6 -0
- package/src/components/IconButtons/assets/trash.svg +7 -0
- package/src/components/IconButtons/index.tsx +8 -0
- package/src/components/IconLabel.tsx +37 -0
- package/src/components/Image/Image.tsx +43 -0
- package/src/components/Image/broken-image.png +0 -0
- package/src/components/Image/index.tsx +1 -0
- package/src/components/ImageUpload.tsx +98 -0
- package/src/components/Input/AutoCompleteSearch.tsx +143 -0
- package/src/components/Input/DatePicker.tsx +60 -0
- package/src/components/Input/DateRangePicker.tsx +131 -0
- package/src/components/Input/DateTimePicker.tsx +70 -0
- package/src/components/Input/FormLabel.tsx +14 -0
- package/src/components/Input/MultiCheckbox.tsx +79 -0
- package/src/components/Input/MultiSelect.tsx +52 -0
- package/src/components/Input/RadioGroup.tsx +55 -0
- package/src/components/Input/SingleCheckbox.tsx +23 -0
- package/src/components/Input/SingleSelect.tsx +139 -0
- package/src/components/Input/TextField.tsx +50 -0
- package/src/components/Input/TimePicker.tsx +82 -0
- package/src/components/Input/index.ts +26 -0
- package/src/components/JsonPreview/JsonPreview.tsx +7 -0
- package/src/components/JsonPreview/index.tsx +1 -0
- package/src/components/LabelValue/LabelValue.tsx +21 -0
- package/src/components/LabelValue/index.tsx +1 -0
- package/src/components/Layout/ChangePassword.tsx +49 -0
- package/src/components/Layout/Header/AppHeader.tsx +150 -0
- package/src/components/Layout/Header/CogWheelMenu.tsx +35 -0
- package/src/components/Layout/Header/FreshDeskHelpButton.tsx +19 -0
- package/src/components/Layout/Header/MainAppHeader.tsx +6 -0
- package/src/components/Layout/Header/Notification.tsx +13 -0
- package/src/components/Layout/Header/UserBox.tsx +51 -0
- package/src/components/Layout/Header/applications.tsx +39 -0
- package/src/components/Layout/Header/icons.tsx +57 -0
- package/src/components/Layout/Header/index.tsx +1 -0
- package/src/components/Layout/Header/styles.tsx +48 -0
- package/src/components/LinearProgress/LinearProgress.tsx +27 -0
- package/src/components/LinearProgress/index.tsx +1 -0
- package/src/components/MediaRow/MediaRow.tsx +69 -0
- package/src/components/MediaRow/index.tsx +1 -0
- package/src/components/MenuButton.tsx +105 -0
- package/src/components/ModalButtons/DialogButton.tsx +84 -0
- package/src/components/ModalButtons/DrawerButton.tsx +89 -0
- package/src/components/ModalButtons/index.tsx +4 -0
- package/src/components/NoDataIllustration/NoDataIllustration.tsx +32 -0
- package/src/components/NoDataIllustration/index.tsx +1 -0
- package/src/components/PageContent.tsx +14 -0
- package/src/components/PageHeader.tsx +52 -0
- package/src/components/PopupConfirm/ConfirmContextProvider.tsx +22 -0
- package/src/components/PopupConfirm/PopupConfirm.tsx +33 -0
- package/src/components/PopupConfirm/index.tsx +1 -0
- package/src/components/PopupConfirm/useConfirm.ts +47 -0
- package/src/components/Row/Row.tsx +24 -0
- package/src/components/Row/index.tsx +1 -0
- package/src/components/SearchBar/SearchBar.tsx +53 -0
- package/src/components/SearchBar/index.tsx +1 -0
- package/src/components/Spinner.tsx +18 -0
- package/src/components/StepsHeader/StepsHeader.tsx +115 -0
- package/src/components/StepsHeader/index.tsx +1 -0
- package/src/components/Styled/OutlinedIconButton.tsx +7 -0
- package/src/components/Styled/index.tsx +1 -0
- package/src/components/StyledTableContainer.tsx +33 -0
- package/src/components/Swiper/Swiper.tsx +39 -0
- package/src/components/Swiper/index.tsx +1 -0
- package/src/components/SwitchButton/SwitchButton.tsx +41 -0
- package/src/components/SwitchButton/index.tsx +1 -0
- package/src/components/TableComponent/BatchActionsHeader.tsx +58 -0
- package/src/components/TableComponent/Icons/index.tsx +50 -0
- package/src/components/TableComponent/ReactTable.tsx +293 -0
- package/src/components/TableComponent/RenderTableBody.tsx +65 -0
- package/src/components/TableComponent/TableFooter/TableFooter.tsx +102 -0
- package/src/components/TableComponent/TableFooter/index.tsx +1 -0
- package/src/components/TableComponent/TableFooter/styles.tsx +28 -0
- package/src/components/TableComponent/index.tsx +219 -0
- package/src/components/TableComponent/no-data-illu.svg +1 -0
- package/src/components/TableComponent/react-table-config.d.ts +129 -0
- package/src/components/TableComponent/styles.tsx +173 -0
- package/src/components/TableComponent/types.ts +57 -0
- package/src/components/Tabs/Tabs.tsx +52 -0
- package/src/components/Tabs/TabsContainer.tsx +50 -0
- package/src/components/Tabs/index.tsx +1 -0
- package/src/components/Tabs/styles.tsx +55 -0
- package/src/components/ToastContainer/ToastContainer.tsx +42 -0
- package/src/components/ToastContainer/index.tsx +1 -0
- package/src/components/UploadButton/UploadButton.tsx +98 -0
- package/src/components/UploadButton/index.tsx +1 -0
- package/src/components/UploadButton/types.ts +14 -0
- package/src/components/UploadDocument/UploadDocument.tsx +108 -0
- package/src/components/UploadDocument/index.tsx +1 -0
- package/src/components/UploadFileDialog/UploadFileDialog.tsx +240 -0
- package/src/components/UploadFileDialog/index.tsx +1 -0
- package/src/components/index.ts +59 -0
- package/src/config/axios.ts +138 -0
- package/src/constants/UIConstants.ts +97 -0
- package/src/constants/formValidations.ts +6 -0
- package/src/constants/index.ts +4 -0
- package/src/constants/permissions.ts +67 -0
- package/src/constants/validateMessages.ts +12 -0
- package/src/contexts/Providers.tsx +24 -0
- package/src/contexts/QueryClientProvider.tsx +22 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useFetch.ts +53 -0
- package/src/hooks/useRouter.ts +31 -0
- package/src/index.tsx +9 -0
- package/src/layouts/ComponentsLayout.tsx +3 -0
- package/src/pages/LoginPage/LoginPage.tsx +166 -0
- package/src/pages/LoginPage/index.ts +1 -0
- package/src/pages/LoginPage/styles.tsx +121 -0
- package/src/pages/index.ts +4 -0
- package/src/permissions/PageWithPermission.tsx +58 -0
- package/src/permissions/PermissionDeniedPage.tsx +23 -0
- package/src/permissions/PermissionsStore.ts +289 -0
- package/src/permissions/ValidateAccess.tsx +18 -0
- package/src/permissions/index.ts +3 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/shared-state/AssetsStore.ts +15 -0
- package/src/shared-state/UserStore.ts +13 -0
- package/src/shared-state/index.ts +3 -0
- package/src/stories/Button.stories.tsx +41 -0
- package/src/stories/Button.tsx +48 -0
- package/src/stories/Header.stories.tsx +25 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Page.stories.tsx +26 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/TextField.stories.tsx +18 -0
- package/src/stories/TextField.tsx +49 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +69 -0
- package/src/theme/App.less +3 -0
- package/src/theme/MuiThemeProvider.tsx +11 -0
- package/src/theme/customCssBaseline.ts +78 -0
- package/src/theme/index.css +75 -0
- package/src/theme/muiTheme.ts +516 -0
- package/src/theme/theme.d.ts +75 -0
- package/src/utils/alphabet.ts +23 -0
- package/src/utils/arrayPadEnd.ts +3 -0
- package/src/utils/formatCurrency.ts +9 -0
- package/src/utils/getUrlParams.ts +5 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/ordinalSuffixOf.ts +14 -0
- package/src/utils/romanize.ts +40 -0
- package/src/utils/withRouteWrapper.tsx +25 -0
- package/src/utils/withSuspense.tsx +6 -0
- package/styled-components.tsx +60 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import FormTextField from '../../components/HookForm/TextField'
|
|
2
|
+
import { Box, Button, Link, styled } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
export const StyledMain = styled(Box)(({ theme }) => ({
|
|
5
|
+
minHeight: '100vh',
|
|
6
|
+
display: 'grid',
|
|
7
|
+
gridTemplateColumns: '1fr 1fr',
|
|
8
|
+
'@media(max-width: 1024px)': {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
width: '100%',
|
|
11
|
+
},
|
|
12
|
+
}))
|
|
13
|
+
|
|
14
|
+
export const StyledBanner = styled(Box)(({ theme }) => ({
|
|
15
|
+
position: 'relative',
|
|
16
|
+
backgroundColor: '#eef8fe',
|
|
17
|
+
'@media(max-width: 1024px)': {
|
|
18
|
+
display: 'none',
|
|
19
|
+
},
|
|
20
|
+
}))
|
|
21
|
+
export const StyledFormSection = styled(Box)(({ theme }) => ({
|
|
22
|
+
width: '100%',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
}))
|
|
28
|
+
|
|
29
|
+
export const StyledBannerImage = styled(Box)(() => ({
|
|
30
|
+
height: 'calc(100vh - 90px - 56px)',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
'& img': {
|
|
35
|
+
width: '100%',
|
|
36
|
+
height: 'auto',
|
|
37
|
+
objectfit: 'contain',
|
|
38
|
+
},
|
|
39
|
+
}))
|
|
40
|
+
export const StyledBannerFooter = styled(Box)(() => ({
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
bottom: 0,
|
|
43
|
+
left: 0,
|
|
44
|
+
width: '100%',
|
|
45
|
+
'& .logo': {
|
|
46
|
+
backgroundColor: '#e5f4fd',
|
|
47
|
+
height: '90px',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
justifyContent: 'center',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
gap: '6px',
|
|
53
|
+
'& img': {
|
|
54
|
+
display: 'block',
|
|
55
|
+
width: '100px',
|
|
56
|
+
height: 'auto',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
'& .copyright': {
|
|
60
|
+
height: '56px',
|
|
61
|
+
display: 'flex',
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
},
|
|
65
|
+
}))
|
|
66
|
+
|
|
67
|
+
export const StyledLink = styled(Link)(({ theme }) => ({
|
|
68
|
+
display: 'inline',
|
|
69
|
+
textDecoration: 'none',
|
|
70
|
+
fontWeight: 600,
|
|
71
|
+
color: theme.palette.text.primary,
|
|
72
|
+
'&:hover': {
|
|
73
|
+
textDecoration: 'underline',
|
|
74
|
+
color: theme.palette.text.primary,
|
|
75
|
+
},
|
|
76
|
+
}))
|
|
77
|
+
|
|
78
|
+
export const StyledButton = styled(Button)(({ theme }) => ({
|
|
79
|
+
borderRadius: '10px',
|
|
80
|
+
height: '60px',
|
|
81
|
+
fontSize: '18px',
|
|
82
|
+
}))
|
|
83
|
+
|
|
84
|
+
export const StyledTextField = styled(FormTextField)(({ theme }) => ({
|
|
85
|
+
'& .MuiInputBase-root': {
|
|
86
|
+
minHeight: '60px',
|
|
87
|
+
},
|
|
88
|
+
'& .MuiOutlinedInput-input': {
|
|
89
|
+
padding: '18.5px 14px',
|
|
90
|
+
},
|
|
91
|
+
}))
|
|
92
|
+
|
|
93
|
+
// export const StyledBannerFooter = styled.div`
|
|
94
|
+
// position: absolute;
|
|
95
|
+
// bottom: 0;
|
|
96
|
+
// left: 0;
|
|
97
|
+
// width: 100%;
|
|
98
|
+
// & .logo {
|
|
99
|
+
// height: 90px;
|
|
100
|
+
// background-color: #e5f4fd;
|
|
101
|
+
// display: flex;
|
|
102
|
+
// justify-content: center;
|
|
103
|
+
// align-items: center;
|
|
104
|
+
// flex-direction: column;
|
|
105
|
+
// gap: 10px;
|
|
106
|
+
// & img {
|
|
107
|
+
// display: block;
|
|
108
|
+
// width: 100px;
|
|
109
|
+
// height: auto;
|
|
110
|
+
// }
|
|
111
|
+
// }
|
|
112
|
+
// & .copyright {
|
|
113
|
+
// height: 56px;
|
|
114
|
+
// display: flex;
|
|
115
|
+
// justify-content: center;
|
|
116
|
+
// align-items: center;
|
|
117
|
+
// & .ant-typography {
|
|
118
|
+
// font-size: 12px;
|
|
119
|
+
// }
|
|
120
|
+
// }
|
|
121
|
+
// `
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import PermissionDeniedPage from './PermissionDeniedPage'
|
|
2
|
+
import { PermissionsStore } from './PermissionsStore'
|
|
3
|
+
import React, { ReactNode, useEffect } from 'react'
|
|
4
|
+
import { globalStore } from '../App'
|
|
5
|
+
import { Box, Typography } from '@mui/material'
|
|
6
|
+
import { useHistory } from '../hooks/useRouter'
|
|
7
|
+
|
|
8
|
+
const accessIfNoKey = process.env.NODE_ENV === 'development' ? true : false
|
|
9
|
+
|
|
10
|
+
export default function PageWithPermission({
|
|
11
|
+
permissionKey,
|
|
12
|
+
component: Component,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}: {
|
|
16
|
+
permissionKey: string
|
|
17
|
+
component?: any
|
|
18
|
+
children?: any
|
|
19
|
+
}) {
|
|
20
|
+
const history = useHistory()
|
|
21
|
+
const errorState = globalStore.useState((s) => s.error)
|
|
22
|
+
|
|
23
|
+
const permissions = PermissionsStore.useState((s) => s).permissions
|
|
24
|
+
const hasAccess = permissionKey ? permissions[permissionKey] : accessIfNoKey
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
globalStore.update((s) => {
|
|
28
|
+
s.error = {
|
|
29
|
+
message: '',
|
|
30
|
+
statusCode: null,
|
|
31
|
+
description: '',
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}, [history])
|
|
35
|
+
|
|
36
|
+
if (errorState.statusCode) return <ErrorPage />
|
|
37
|
+
|
|
38
|
+
// if (hasAccess) return Component
|
|
39
|
+
if (hasAccess) return children
|
|
40
|
+
return <PermissionDeniedPage />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const ErrorPage = () => {
|
|
44
|
+
const globalState = globalStore.useState((s) => s).error
|
|
45
|
+
return (
|
|
46
|
+
<Box
|
|
47
|
+
sx={{
|
|
48
|
+
display: 'flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<Typography variant="h1" marginTop={'100px'}>
|
|
54
|
+
{globalState.description}
|
|
55
|
+
</Typography>
|
|
56
|
+
</Box>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Link } from 'react-router-dom'
|
|
4
|
+
import styled from 'styled-components'
|
|
5
|
+
export default function PermissionDeniedPage() {
|
|
6
|
+
return (
|
|
7
|
+
<StyledPageContainer>
|
|
8
|
+
<div>
|
|
9
|
+
<Typography>Permission Denied</Typography>
|
|
10
|
+
{/* <Link to={'/'}>Go Back</Link> */}
|
|
11
|
+
</div>
|
|
12
|
+
</StyledPageContainer>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const StyledPageContainer = styled.div`
|
|
17
|
+
height: 100vh;
|
|
18
|
+
width: 100%;
|
|
19
|
+
center: #233659;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
`
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { Store } from 'pullstate'
|
|
2
|
+
|
|
3
|
+
export enum Permission {
|
|
4
|
+
VIEW_AUDIT_LOGS = 'can_view_audit_logs',
|
|
5
|
+
STUDENTS_VIEW = 'can_students_view',
|
|
6
|
+
ADMISSIONS_VIEW = 'can_admissions_view',
|
|
7
|
+
USERS_VIEW = 'can_users_view',
|
|
8
|
+
SUBJECTS_VIEW = 'can_subjects_view',
|
|
9
|
+
COURSE_REGISTRATION_VIEW = 'can_course_registration_view',
|
|
10
|
+
END_SEMESTER_EXAMINATIONS_VIEW = 'can_end_semester_examinations_view',
|
|
11
|
+
INTERNAL_EXAMINATIONS_VIEW = 'can_internal_examinations_view',
|
|
12
|
+
VIEW_ANSWER_SHEET_REPORT = 'can_view_answer_sheet_report',
|
|
13
|
+
SEATING_PLAN = 'can_examinations_seating_plan',
|
|
14
|
+
VIEW_REPORTS = 'can_results_processing_view_reports',
|
|
15
|
+
CAN_ADD_FEED = 'can_feed_add',
|
|
16
|
+
MARKS_DIVISION = 'can_examinations_manage_marks_division',
|
|
17
|
+
|
|
18
|
+
//classroom
|
|
19
|
+
|
|
20
|
+
CLASSROOM_VIEW = 'can_classroom_view',
|
|
21
|
+
CLASSROOM_EDIT = 'can_classroom_edit',
|
|
22
|
+
CLASSROOM_DELETE = 'can_classroom_delete',
|
|
23
|
+
CLASSROOM_ADD = 'can_classroom_add',
|
|
24
|
+
|
|
25
|
+
// Tasks
|
|
26
|
+
|
|
27
|
+
CAN_TASKS_ADD = 'can_tasks_add',
|
|
28
|
+
CAN_TASKS_DELETE = 'can_tasks_delete',
|
|
29
|
+
CAN_TASKS_EDIT = 'can_tasks_edit',
|
|
30
|
+
CAN_TASKS_VIEW = 'can_tasks_view',
|
|
31
|
+
CAN_TASKS_CHANGE_STATUS = 'can_tasks_change_status',
|
|
32
|
+
|
|
33
|
+
// Academic Calendar
|
|
34
|
+
|
|
35
|
+
ACADEMIC_CALENDAR_VIEW = 'can_academic_calendar_view',
|
|
36
|
+
ACADEMIC_CALENDAR_EVENT_ADD = 'can_academic_calendar_event_add',
|
|
37
|
+
ACADEMIC_CALENDAR_EVENT_EDIT = 'can_academic_calendar_event_edit',
|
|
38
|
+
ACADEMIC_CALENDAR_EVENT_DELETE = 'can_academic_calendar_event_delete',
|
|
39
|
+
|
|
40
|
+
//Designations
|
|
41
|
+
DESIGNATIONS_ADD = 'can_designations_add',
|
|
42
|
+
DESIGNATIONS_DELETE = 'can_designations_delete',
|
|
43
|
+
DESIGNATIONS_EDIT = 'can_designations_edit',
|
|
44
|
+
DESIGNATIONS_VIEW = 'can_designations_view',
|
|
45
|
+
|
|
46
|
+
//bundling
|
|
47
|
+
|
|
48
|
+
BUNDLING_VIEW = 'can_bundling_view',
|
|
49
|
+
BUNDLING_ADD = 'can_bundling_add',
|
|
50
|
+
BUNDLING_EDIT = 'can_bundling_edit',
|
|
51
|
+
BUNDLING_DELETE = 'can_bundling_delete',
|
|
52
|
+
|
|
53
|
+
// manage
|
|
54
|
+
MANAGE_ROLES_AND_PROFILES = 'can_manage_roles_and_profiles',
|
|
55
|
+
|
|
56
|
+
MANAGE_USER_GROUPS = 'can_manage_user_groups',
|
|
57
|
+
MANAGE_ASSESSMENTS = 'can_manage_assessments',
|
|
58
|
+
USERS_ADD = 'can_users_add',
|
|
59
|
+
USERS_EDIT = 'can_users_edit',
|
|
60
|
+
USERS_DELETE = 'can_users_delete',
|
|
61
|
+
USERS_REORDER = 'can_users_reorder',
|
|
62
|
+
USERS_UPLOAD_PHOTOS = 'can_user_upload_photos',
|
|
63
|
+
USERS_EXPORT = 'can_users_export',
|
|
64
|
+
ADMISSIONS_ADD = 'can_admissions_add',
|
|
65
|
+
ADMISSIONS_EDIT = 'can_admissions_edit',
|
|
66
|
+
ADMISSIONS_DELETE = 'can_admissions_delete',
|
|
67
|
+
ADMISSIONS_CHANGE_STATUS = 'can_admissions_change_status',
|
|
68
|
+
ADMISSIONS_IMPORT = 'can_admissions_import',
|
|
69
|
+
ADMISSIONS_EXPORT = 'can_admissions_export',
|
|
70
|
+
ADMISSIONS_CONFIRM = 'can_admissions_confirm',
|
|
71
|
+
STUDENTS_ADD = 'can_students_add',
|
|
72
|
+
STUDENTS_EDIT = 'can_students_edit',
|
|
73
|
+
STUDENTS_DELETE = 'can_students_delete',
|
|
74
|
+
STUDENTS_DETAIN = 'can_students_detain',
|
|
75
|
+
STUDENTS_IMPORT = 'can_students_import',
|
|
76
|
+
STUDENTS_EXPORT = 'can_students_export',
|
|
77
|
+
STUDENTS_RESULTS = 'can_students_results',
|
|
78
|
+
STUDENTS_UPLOAD_PHOTOS = 'can_students_upload_photos',
|
|
79
|
+
STUDENTS_TRANSFER = 'can_students_transfer',
|
|
80
|
+
STUDENTS_ALLOTMENT = 'can_students_allotment',
|
|
81
|
+
SUBJECTS_ADD = 'can_subjects_add',
|
|
82
|
+
SUBJECTS_EDIT = 'can_subjects_edit',
|
|
83
|
+
SUBJECTS_DELETE = 'can_subjects_delete',
|
|
84
|
+
SUBJECTS_EDIT_SUBJECT_INFO = 'can_subjects_edit_subject_info',
|
|
85
|
+
COURSE_REGISTRATION_ADD = 'can_course_registration_add',
|
|
86
|
+
COURSE_REGISTRATION_EDIT = 'can_course_registration_edit',
|
|
87
|
+
COURSE_REGISTRATION_DELETE = 'can_course_registration_delete',
|
|
88
|
+
END_SEMESTER_EXAMINATIONS_ADD = 'can_end_semester_examinations_add',
|
|
89
|
+
END_SEMESTER_EXAMINATIONS_EDIT = 'can_end_semester_examinations_edit',
|
|
90
|
+
END_SEMESTER_EXAMINATIONS_DELETE = 'can_end_semester_examinations_delete',
|
|
91
|
+
END_SEMESTER_EXAMINATIONS_SEATING_PLAN = 'can_end_semester_examinations_seating_plan',
|
|
92
|
+
END_SEMESTER_EXAMINATIONS_MANAGE_EXAM_FEE = 'can_end_semester_examinations_manage_exam_fee',
|
|
93
|
+
END_SEMESTER_EXAMINATIONS_D_FORMS = 'can_end_semester_examinations_d_forms',
|
|
94
|
+
END_SEMESTER_EXAMINATIONS_BUNDLING = 'can_end_semester_examinations_bundling',
|
|
95
|
+
END_SEMESTER_EXAMINATIONS_MARKS_ENTRY = 'can_end_semester_examinations_marks_entry',
|
|
96
|
+
END_SEMESTER_EXAMINATIONS_INVIGILATIONS = 'can_end_semester_examinations_invigilations',
|
|
97
|
+
INTERNAL_EXAMINATIONS_ADD = 'can_internal_examinations_add',
|
|
98
|
+
INTERNAL_EXAMINATIONS_EDIT = 'can_internal_examinations_edit',
|
|
99
|
+
INTERNAL_EXAMINATIONS_DELETE = 'can_internal_examinations_delete',
|
|
100
|
+
INTERNAL_EXAMINATIONS_MANAGE_EXAM_FEE = 'can_internal_examinations_manage_exam_fee',
|
|
101
|
+
INTERNAL_EXAMINATIONS_MANAGE_HALLTICKETS = 'can_internal_examinations_manage_halltickets',
|
|
102
|
+
INTERNAL_EXAMINATIONS_SEATING_PLAN = 'can_internal_examinations_seating_plan',
|
|
103
|
+
INTERNAL_EXAMINATIONS_INVIGILATIONS = 'can_internal_examinations_invigilations',
|
|
104
|
+
EXTRA_CURRICULAR_ACTIVITIES_NEWS_FEED = 'can_extra_curricular_activities_news_feed',
|
|
105
|
+
EXTRA_CURRICULAR_ACTIVITIES_CLUBS = 'can_extra_curricular_activities_clubs',
|
|
106
|
+
EXTRA_CURRICULAR_ACTIVITIES_EVENTS = 'can_extra_curricular_activities_events',
|
|
107
|
+
EDIT_ANSWER_SHEET_MARKS = 'can_edit_answer_sheet_marks',
|
|
108
|
+
EDIT_EXTERNAL_MARKS = 'can_edit_external_marks',
|
|
109
|
+
EXAM_COLLATERALS = 'can_exam_collaterals',
|
|
110
|
+
REVALUTION = 'can_revaluation',
|
|
111
|
+
EDIT_INTERNAL_MARKS = 'can_edit_internal_marks',
|
|
112
|
+
PROCESS_RESULTS = 'can_process_results',
|
|
113
|
+
CAN_PROGRAMS_ADD = 'can_programs_add',
|
|
114
|
+
CAN_PROGRAMS_DELETE = 'can_programs_delete',
|
|
115
|
+
CAN_PROGRAMS_EDIT = 'can_programs_edit',
|
|
116
|
+
CAN_PROGRAMS_VIEW = 'can_programs_view',
|
|
117
|
+
CAN_DEGRESS_ADD = 'can_degrees_add',
|
|
118
|
+
CAN_DEGRESS_DELETE = 'can_degrees_delete',
|
|
119
|
+
CAN_DEGRESS_EDIT = 'can_degrees_edit',
|
|
120
|
+
CAN_SETTINGS_VIEW = 'can_settings_view',
|
|
121
|
+
CAN_DASHBOARD_VIEW = 'can_dashboard_view',
|
|
122
|
+
CAN_DEGRESS_VIEW = 'can_degrees_view',
|
|
123
|
+
CAN_SEMESTERS_ADD = 'can_semesters_add',
|
|
124
|
+
CAN_SEMESTERS_DELETE = 'can_semesters_delete',
|
|
125
|
+
CAN_SEMESTERS_EDIT = 'can_semesters_edit',
|
|
126
|
+
CAN_SEMESTERS_VIEW = 'can_semesters_view',
|
|
127
|
+
CAN_CURRICULUMS_ADD = 'can_curriculums_add',
|
|
128
|
+
CAN_CURRICULUMS_DELETE = 'can_curriculums_delete',
|
|
129
|
+
CAN_CURRICULUMS_EDIT = 'can_curriculums_edit',
|
|
130
|
+
CAN_CURRICULUMS_VIEW = 'can_curriculums_view',
|
|
131
|
+
CAN_ASSESSMENT_RULES_ADD = 'can_assessment_rules_add',
|
|
132
|
+
CAN_ASSESSMENT_RULES_DELETE = 'can_assessment_rules_delete',
|
|
133
|
+
CAN_ASSESSMENT_RULES_EDIT = 'can_assessment_rules_edit',
|
|
134
|
+
CAN_ASSESSMENT_RULES_VIEW = 'can_assessment_rules_view',
|
|
135
|
+
CAN_RESULTS_PROCESSING_GENERATE_MEMOS = 'can_results_processing_generate_memos',
|
|
136
|
+
CAN_RESULTS_PROCESSING_MODERATION_AND_GRAFTING = 'can_results_processing_moderation_and_grafting',
|
|
137
|
+
CAN_RESULTS_PROCESSING_PUBLISH_RESULTS = 'can_results_processing_publish_results',
|
|
138
|
+
CAN_RESULTS_PROCESSING_UPDATE_INTERNAL_MARKS = 'can_results_processing_update_internal_marks',
|
|
139
|
+
CAN_RESULTS_PROCESSING_VIEW = 'can_results_processing_view',
|
|
140
|
+
|
|
141
|
+
//newly added permissions
|
|
142
|
+
|
|
143
|
+
CAN_PHD_FORM_VIEW = 'can_admissions_view_phd_applications',
|
|
144
|
+
CAN_PHD_FORM_DOWNLOAD = 'can_admissions_download_phd_applications',
|
|
145
|
+
CAN_CET_VIEW = 'can_admissions_view_cet',
|
|
146
|
+
CAN_CET_DOWNLOAD = 'can_admissions_download_cet',
|
|
147
|
+
CAN_HOSTELER_DASHBOARD_VIEW = 'can_hosteler_dashboard_view',
|
|
148
|
+
CAN_HOSTELER_VIEW = 'can_hosteler_view',
|
|
149
|
+
CAN_HOSTELER_ADD = 'can_hosteler_add',
|
|
150
|
+
CAN_HOSTELER_EDIT = 'can_hosteler_edit',
|
|
151
|
+
CAN_HOSTELER_CHANGE_STATUS = 'can_hosteler_change_status',
|
|
152
|
+
CAN_HOSTELER_FACE_DATA_RESET = 'can_hosteler_face_data_reset',
|
|
153
|
+
CAN_HOSTELER_FEE_PAYMENT_VIEW = 'can_hosteler_fee_payments_view',
|
|
154
|
+
CAN_HOSTELER_REPORTS_VIEW = 'can_hosteler_reports_view',
|
|
155
|
+
CAN_HOSTELER_SETTINGS_VIEW_CONFIGURATION = 'can_hosteler_settings_view_configuration',
|
|
156
|
+
CAN_HOSTELER_SETTINGS_EDIT_CONFIGURATION = 'can_hosteler_settings_edit_configuration',
|
|
157
|
+
CAN_HOSTELER_SETTINGS_ADD_FEE_TYPES = 'can_hosteler_settings_add_fee_types',
|
|
158
|
+
CAN_HOSTELER_SETTINGS_VIEW_FEE_TYPES = 'can_hosteler_settings_view_fee_types',
|
|
159
|
+
CAN_HOSTELER_SETTINGS_EDIT_FEE_TYPES = 'can_hosteler_settings_edit_fee_types',
|
|
160
|
+
CAN_HOSTELER_SETTINGS_DELETE_FEE_TYPES = 'can_hosteler_settings_delete_fee_types',
|
|
161
|
+
CAN_HOSTELERS_SETTINGS_BLOCK_VIEW = 'can_hosteler_settings_blocks_view',
|
|
162
|
+
CAN_HOSTELERS_SETTINGS_BLOCK_ADD = 'can_hosteler_settings_blocks_add',
|
|
163
|
+
CAN_HOSTELERS_SETTINGS_BLOCK_EDIT = 'can_hosteler_settings_blocks_edit',
|
|
164
|
+
CAN_HOSTELERS_SETTINGS_BLOCK_DELETE = 'can_hosteler_settings_blocks_delete',
|
|
165
|
+
CAN_HOSTELERS_SETTINGS_ROOMS_VIEW = 'can_hosteler_settings_rooms_view',
|
|
166
|
+
CAN_HOSTELERS_SETTINGS_ROOMS_ADD = 'can_hosteler_settings_rooms_add',
|
|
167
|
+
CAN_HOSTELERS_SETTINGS_ROOMS_EDIT = 'can_hosteler_settings_rooms_edit',
|
|
168
|
+
CAN_HOSTELERS_SETTINGS_ROOMS_DELETE = 'can_hosteler_settings_rooms_delete',
|
|
169
|
+
CAN_HOSTELERS_SETTINGS_ROOMS_IMPORT = 'can_hosteler_settings_import_hostel_rooms',
|
|
170
|
+
CAN_HOSTELERS_SETTINGS_AMENITIES_VIEW = 'can_hosteler_settings_amenities_view',
|
|
171
|
+
CAN_HOSTELERS_SETTINGS_AMENITIES_ADD = 'can_hosteler_settings_amenities_add',
|
|
172
|
+
CAN_HOSTELERS_SETTINGS_AMENITIES_EDIT = 'can_hosteler_settings_amenities_edit',
|
|
173
|
+
CAN_HOSTELERS_SETTINGS_AMENITIES_DELETE = 'can_hosteler_settings_amenities_delete',
|
|
174
|
+
CAN_ADMISSIONS_DASHBOARD_VIEW = 'can_admission_dashboard_view',
|
|
175
|
+
CAN_LEAD_STATUS_VIEW = 'can_lead_status_view',
|
|
176
|
+
CAN_LEAD_STATUS_EDIT = 'can_lead_status_edit',
|
|
177
|
+
CAN_LEAD_STATUS_ADD = 'can_lead_status_add',
|
|
178
|
+
CAN_LEAD_STATUS_DELETE = 'can_lead_status_delete',
|
|
179
|
+
SCHOOLS_VIEW = 'can_schools_view',
|
|
180
|
+
SCHOOLS_ADD = 'can_schools_add',
|
|
181
|
+
SCHOOLS_EDIT = 'can_schools_edit',
|
|
182
|
+
SCHOOLS_DELETE = 'can_schools_delete',
|
|
183
|
+
SUBJECT_TYPE_VIEW = 'can_subject_types_view',
|
|
184
|
+
SUBJECT_TYPE_ADD = 'can_subject_types_add',
|
|
185
|
+
SUBJECT_TYPE_EDIT = 'can_subject_types_edit',
|
|
186
|
+
SUBJECT_TYPE_DELETE = 'can_subject_types_delete',
|
|
187
|
+
ASSESSMENT_TYPE_VIEW = 'can_assessment_types_view',
|
|
188
|
+
ASSESSMENT_TYPE_ADD = 'can_assessment_types_add',
|
|
189
|
+
ASSESSMENT_TYPE_EDIT = 'can_assessment_types_edit',
|
|
190
|
+
ASSESSMENT_TYPE_DELETE = 'can_assessment_types_delete',
|
|
191
|
+
CLASSROOM_REPORTS = 'can_classroom_reports',
|
|
192
|
+
CLASSROOM_REASSIGN_FACULTY = 'can_classroom_re_assign_faculty',
|
|
193
|
+
CAN_INDIVIDUAL_PAGES_VIEW = 'can_individual_pages_view',
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface IPermissions {
|
|
197
|
+
// view
|
|
198
|
+
can_view_audit_logs: boolean
|
|
199
|
+
can_students_view: boolean
|
|
200
|
+
can_admissions_view: boolean
|
|
201
|
+
can_users_view: boolean
|
|
202
|
+
can_subjects_view: boolean
|
|
203
|
+
can_course_registration_view: boolean
|
|
204
|
+
can_end_semester_examinations_view: boolean
|
|
205
|
+
can_internal_examinations_view: boolean
|
|
206
|
+
can_view_answer_sheet_report: boolean
|
|
207
|
+
can_feed_add: boolean
|
|
208
|
+
can_classroom_view: boolean
|
|
209
|
+
can_classroom_edit: boolean
|
|
210
|
+
can_classroom_delete: boolean
|
|
211
|
+
can_classroom_add: boolean
|
|
212
|
+
can_tasks_view: boolean
|
|
213
|
+
// manage
|
|
214
|
+
can_manage_roles_and_profiles: boolean
|
|
215
|
+
can_manage_user_groups: boolean
|
|
216
|
+
can_manage_programs: boolean
|
|
217
|
+
can_manage_courses: boolean
|
|
218
|
+
can_manage_semesters: boolean
|
|
219
|
+
can_manage_curriculums: boolean
|
|
220
|
+
can_manage_assessments: boolean
|
|
221
|
+
can_users_add: boolean
|
|
222
|
+
can_users_edit: boolean
|
|
223
|
+
can_users_delete: boolean
|
|
224
|
+
can_users_reorder: boolean
|
|
225
|
+
can_admissions_add: boolean
|
|
226
|
+
can_admissions_edit: boolean
|
|
227
|
+
can_admissions_delete: boolean
|
|
228
|
+
can_admissions_change_status: boolean
|
|
229
|
+
can_admissions_import: boolean
|
|
230
|
+
can_admissions_export: boolean
|
|
231
|
+
can_admissions_confirm: boolean
|
|
232
|
+
can_students_add: boolean
|
|
233
|
+
can_students_edit: boolean
|
|
234
|
+
can_students_delete: boolean
|
|
235
|
+
can_students_detain: boolean
|
|
236
|
+
can_students_import: boolean
|
|
237
|
+
can_students_export: boolean
|
|
238
|
+
can_students_results: boolean
|
|
239
|
+
can_students_upload_photos: boolean
|
|
240
|
+
can_students_transfer: boolean
|
|
241
|
+
can_students_allotment: boolean
|
|
242
|
+
can_subjects_add: boolean
|
|
243
|
+
can_subjects_edit: boolean
|
|
244
|
+
can_subjects_delete: boolean
|
|
245
|
+
can_subjects_edit_subject_info: boolean
|
|
246
|
+
can_course_registration_add: boolean
|
|
247
|
+
can_course_registration_edit: boolean
|
|
248
|
+
can_course_registration_delete: boolean
|
|
249
|
+
can_end_semester_examinations_add: boolean
|
|
250
|
+
can_end_semester_examinations_edit: boolean
|
|
251
|
+
can_end_semester_examinations_delete: boolean
|
|
252
|
+
can_end_semester_examinations_seating_plan: boolean
|
|
253
|
+
can_end_semester_examinations_manage_exam_fee: boolean
|
|
254
|
+
can_end_semester_examinations_d_forms: boolean
|
|
255
|
+
can_end_semester_examinations_bundling: boolean
|
|
256
|
+
can_end_semester_examinations_marks_entry: boolean
|
|
257
|
+
can_end_semester_examinations_invigilations: boolean
|
|
258
|
+
can_examinations_seating_plan: boolean
|
|
259
|
+
can_internal_examinations_add: boolean
|
|
260
|
+
can_internal_examinations_edit: boolean
|
|
261
|
+
can_internal_examinations_delete: boolean
|
|
262
|
+
can_internal_examinations_manage_exam_fee: boolean
|
|
263
|
+
can_internal_examinations_manage_halltickets: boolean
|
|
264
|
+
can_internal_examinations_seating_plan: boolean
|
|
265
|
+
can_internal_examinations_invigilations: boolean
|
|
266
|
+
can_extra_curricular_activities_news_feed: boolean
|
|
267
|
+
can_extra_curricular_activities_clubs: boolean
|
|
268
|
+
can_extra_curricular_activities_events: boolean
|
|
269
|
+
can_edit_answer_sheet_marks: boolean
|
|
270
|
+
can_edit_external_marks: boolean
|
|
271
|
+
can_exam_collaterals: boolean
|
|
272
|
+
can_revalution: boolean
|
|
273
|
+
can_edit_internal_marks: boolean
|
|
274
|
+
can_process_results: boolean
|
|
275
|
+
can_generate_memos: boolean
|
|
276
|
+
can_individual_pages_view: boolean
|
|
277
|
+
can_tasks_add: boolean
|
|
278
|
+
can_tasks_edit: boolean
|
|
279
|
+
can_tasks_change_status: boolean
|
|
280
|
+
can_tasks_delete: boolean
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface IPermissionsStore {
|
|
284
|
+
permissions: IPermissions
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export const PermissionsStore = new Store<IPermissionsStore>({
|
|
288
|
+
permissions: null,
|
|
289
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Permission, PermissionsStore } from './PermissionsStore'
|
|
3
|
+
|
|
4
|
+
export default function ValidateAccess({
|
|
5
|
+
accessKey,
|
|
6
|
+
children,
|
|
7
|
+
}: {
|
|
8
|
+
accessKey: Permission
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}) {
|
|
11
|
+
const permissions = PermissionsStore.useState((s) => s).permissions
|
|
12
|
+
const hasAccess = accessKey ? permissions[accessKey] : true
|
|
13
|
+
|
|
14
|
+
if (hasAccess) {
|
|
15
|
+
return <>{children}</>
|
|
16
|
+
}
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Store } from 'pullstate'
|
|
2
|
+
|
|
3
|
+
export interface IAssetsStore {
|
|
4
|
+
logo: string
|
|
5
|
+
logo_square: string
|
|
6
|
+
school_name: string
|
|
7
|
+
address: string | any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AssetsStore = new Store({
|
|
11
|
+
logo: null,
|
|
12
|
+
logo_square: null,
|
|
13
|
+
school_name: null,
|
|
14
|
+
address: '',
|
|
15
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
|
|
6
|
+
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Example/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
11
|
+
argTypes: {
|
|
12
|
+
backgroundColor: { control: 'color' },
|
|
13
|
+
},
|
|
14
|
+
} as ComponentMeta<typeof Button>;
|
|
15
|
+
|
|
16
|
+
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
17
|
+
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />;
|
|
18
|
+
|
|
19
|
+
export const Primary = Template.bind({});
|
|
20
|
+
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
21
|
+
Primary.args = {
|
|
22
|
+
primary: true,
|
|
23
|
+
label: 'Button',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Secondary = Template.bind({});
|
|
27
|
+
Secondary.args = {
|
|
28
|
+
label: 'Button',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Large = Template.bind({});
|
|
32
|
+
Large.args = {
|
|
33
|
+
size: 'large',
|
|
34
|
+
label: 'Button',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Small = Template.bind({});
|
|
38
|
+
Small.args = {
|
|
39
|
+
size: 'small',
|
|
40
|
+
label: 'Button',
|
|
41
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './button.css';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Is this the principal call to action on the page?
|
|
7
|
+
*/
|
|
8
|
+
primary?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* What background color to use
|
|
11
|
+
*/
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
/**
|
|
14
|
+
* How large should the button be?
|
|
15
|
+
*/
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
/**
|
|
18
|
+
* Button contents
|
|
19
|
+
*/
|
|
20
|
+
label: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional click handler
|
|
23
|
+
*/
|
|
24
|
+
onClick?: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Primary UI component for user interaction
|
|
29
|
+
*/
|
|
30
|
+
export const Button = ({
|
|
31
|
+
primary = false,
|
|
32
|
+
size = 'medium',
|
|
33
|
+
backgroundColor,
|
|
34
|
+
label,
|
|
35
|
+
...props
|
|
36
|
+
}: ButtonProps) => {
|
|
37
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
38
|
+
return (
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
42
|
+
style={{ backgroundColor }}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
{label}
|
|
46
|
+
</button>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Header } from './Header';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Example/Header',
|
|
8
|
+
component: Header,
|
|
9
|
+
parameters: {
|
|
10
|
+
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout
|
|
11
|
+
layout: 'fullscreen',
|
|
12
|
+
},
|
|
13
|
+
} as ComponentMeta<typeof Header>;
|
|
14
|
+
|
|
15
|
+
const Template: ComponentStory<typeof Header> = (args) => <Header {...args} />;
|
|
16
|
+
|
|
17
|
+
export const LoggedIn = Template.bind({});
|
|
18
|
+
LoggedIn.args = {
|
|
19
|
+
user: {
|
|
20
|
+
name: 'Jane Doe',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const LoggedOut = Template.bind({});
|
|
25
|
+
LoggedOut.args = {};
|