@campxdev/campx-web-utils 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 CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@campxdev/campx-web-utils",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "peerDependencies": {
7
- "@campxdev/react-blueprint": ">=1.9.0",
7
+ "@campxdev/react-blueprint": ">=1.9.3",
8
8
  "@emotion/react": ">=^11.13.3",
9
9
  "@emotion/styled": ">=^11.13.0",
10
10
  "@mui/icons-material": ">=6.1.5",
@@ -14,8 +14,8 @@
14
14
  "react-redux": "=>9.1.2"
15
15
  },
16
16
  "dependencies": {
17
- "@campxdev/react-blueprint": "1.9.0",
18
- "@hookform/resolvers": "^3.9.0",
17
+ "@campxdev/react-blueprint": "1.9.3",
18
+ "@hookform/resolvers": "2.9.10",
19
19
  "@mui/x-date-pickers": "^7.22.1",
20
20
  "axios": "^1.7.2",
21
21
  "cookie-js": "^0.0.1",
@@ -8,7 +8,6 @@ import { ChangePasswordDialog } from '../../components/ChangePassword';
8
8
  import { axios } from '../../config/axios';
9
9
  import { ErrorBoundary } from '../../context/export';
10
10
  import HelpDocs from './components/HelpDocs';
11
- import { helpDocsConfig } from './components/helpDocsConfig';
12
11
 
13
12
  type Props = {
14
13
  actions?: ReactNode[];
@@ -21,6 +20,11 @@ type Props = {
21
20
  designation?: string;
22
21
  clientName?: string;
23
22
  institutionData?: any[];
23
+ defaultCollapsed?: boolean;
24
+ helpDocsConfig?: Record<
25
+ string,
26
+ { actions: { name: string; onClick: () => void }[] }
27
+ >;
24
28
  };
25
29
 
26
30
  export const AppLayout: React.FC<Props> = ({
@@ -34,8 +38,10 @@ export const AppLayout: React.FC<Props> = ({
34
38
  userName = '',
35
39
  designation = '',
36
40
  clientName = '',
41
+ defaultCollapsed = true,
42
+ helpDocsConfig,
37
43
  }) => {
38
- const [collapsed, setCollapsed] = useState(true);
44
+ const [collapsed, setCollapsed] = useState(defaultCollapsed);
39
45
  const theme = useTheme();
40
46
  const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
41
47
 
@@ -57,7 +63,7 @@ export const AppLayout: React.FC<Props> = ({
57
63
  const pathSegments = fullPath.split('/').filter(Boolean);
58
64
  const actualPath = pathSegments.slice(1).join('/');
59
65
  const normalizedPath = actualPath.replace(/\/\d+/g, '/:id');
60
- const helpDocsActions = helpDocsConfig[`/${normalizedPath}`]?.actions || [];
66
+ const helpDocsActions = helpDocsConfig?.[`/${normalizedPath}`]?.actions || [];
61
67
 
62
68
  return (
63
69
  <AppLayoutContainer>
@@ -87,8 +93,11 @@ export const AppLayout: React.FC<Props> = ({
87
93
  profileSx: { width: 32, height: 32, fontSize: '12px' },
88
94
  })}
89
95
  />
90
- {helpDocsActions.length > 0 && <HelpDocs actions={helpDocsActions} />}
91
- <OuletContainer
96
+ {helpDocsConfig && helpDocsActions.length > 0 && (
97
+ <HelpDocs actions={helpDocsActions} />
98
+ )}
99
+
100
+ <OutletContainer
92
101
  sx={{
93
102
  margin: '12px 0px 0px 0px',
94
103
  backgroundColor: theme.palette.surface.paperBackground,
@@ -101,7 +110,7 @@ export const AppLayout: React.FC<Props> = ({
101
110
  <Suspense fallback={<Spinner />}>
102
111
  <ErrorBoundary>{children}</ErrorBoundary>
103
112
  </Suspense>
104
- </OuletContainer>
113
+ </OutletContainer>
105
114
  </motion.div>
106
115
  </AppLayoutContainer>
107
116
  );
@@ -114,13 +123,17 @@ const AppLayoutContainer = styled(Stack)(({ theme }: { theme?: any }) => ({
114
123
  [theme.breakpoints.down('md')]: { flexWrap: 'wrap' },
115
124
  }));
116
125
 
117
- const OuletContainer = styled(Box)(({ theme }: { theme?: any }) => ({
126
+ const OutletContainer = styled(Box)(({ theme }: { theme?: any }) => ({
118
127
  borderRadius: '8px',
119
128
  height: 'calc(100vh - 96px)',
120
129
  overflowY: 'scroll',
121
130
  width: '100%',
122
131
 
123
- '&::-webkit-scrollbar': { width: '0.5em', height: '0.2em' },
132
+ '&::-webkit-scrollbar': {
133
+ width: '0.5em',
134
+ height: '0.2em',
135
+ backgroundColor: theme.palette.surface.defaultBackground,
136
+ },
124
137
 
125
138
  '&::-webkit-scrollbar-thumb': {
126
139
  backgroundColor: theme.palette.primary.light,
@@ -1,89 +0,0 @@
1
- export const helpDocsConfig: Record<
2
- string,
3
- { actions: { name: string; onClick: () => void }[] }
4
- > = {
5
- '/payments/exam-fees': {
6
- actions: [
7
- {
8
- name: 'Know how to collect exam fee',
9
- onClick: () =>
10
- window.open('https://docs.campx.in/Workflows/collect_fee/', '_blank'),
11
- },
12
- ],
13
- },
14
- '/payments/student-permissions': {
15
- actions: [
16
- {
17
- name: 'Know how to manage permissions',
18
- onClick: () =>
19
- window.open('https://docs.campx.in/Workflows/collect_fee/', '_blank'),
20
- },
21
- ],
22
- },
23
- '/exams/blocked-students': {
24
- actions: [
25
- {
26
- name: 'Know how to block students',
27
- onClick: () =>
28
- window.open('https://docs.campx.in/Workflows/collect_fee/', '_blank'),
29
- },
30
- ],
31
- },
32
- '/ums/settings/assessments/assessment-types': {
33
- actions: [
34
- {
35
- name: 'Know how to setup Assessment rules',
36
- onClick: () =>
37
- window.open(
38
- 'https://docs.campx.in/Workflows/assessment_rules/',
39
- '_blank',
40
- ),
41
- },
42
- ],
43
- },
44
- '/ums/settings/assessments/assessment-templates': {
45
- actions: [
46
- {
47
- name: 'Know how to setup Assessment rules',
48
- onClick: () =>
49
- window.open(
50
- 'https://docs.campx.in/Workflows/assessment_rules/',
51
- '_blank',
52
- ),
53
- },
54
- ],
55
- },
56
- '/ums/classrooms/:id/timetable': {
57
- actions: [
58
- {
59
- name: 'Know how to suspend a class',
60
- onClick: () =>
61
- window.open(
62
- 'https://docs.campx.in/Workflows/suspending-a-class/',
63
- '_blank',
64
- ),
65
- },
66
- ],
67
- },
68
-
69
- '/exams/examinations/:id/bundle-subjects': {
70
- actions: [
71
- {
72
- name: 'Learn about Scanning & Bundling',
73
- onClick: () =>
74
- window.open(
75
- 'https://docs.campx.in/Workflows/scanningbundling_booklets/',
76
- '_blank',
77
- ),
78
- },
79
- {
80
- name: 'Know how to upload digital booklets',
81
- onClick: () =>
82
- window.open(
83
- 'https://docs.campx.in/Workflows/digital_booklets/',
84
- '_blank',
85
- ),
86
- },
87
- ],
88
- },
89
- };