@campxdev/shared 0.2.6 → 0.2.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -43,5 +43,8 @@
43
43
  "styled-components": "^5.3.5",
44
44
  "swiper": "^8.1.5",
45
45
  "typescript": "^4.8.4"
46
+ },
47
+ "devDependencies": {
48
+ "react-scripts": "^5.0.1"
46
49
  }
47
50
  }
@@ -1,17 +1,31 @@
1
1
  import {Box, IconButton, Menu, styled, Typography} from '@mui/material'
2
- import {AssetsStore} from '../../../shared-state/AssetsStore'
3
- import CogWheelMenu from './CogWheelMenu'
4
- import FreshDeskHelpButton from './FreshDeskHelpButton'
5
- import {StyledHeader, StyledImageWrapper} from './styles'
6
- import UserBox from './UserBox'
7
- import {Link} from 'react-router-dom'
8
2
  import {useState} from 'react'
3
+ import {Link} from 'react-router-dom'
9
4
  import {applications} from './applications'
5
+ import {collegex, enrollx, examx, payx, peoplex} from './assets'
6
+ import CogWheelMenu from './CogWheelMenu'
7
+ import FreshDeskHelpButton from './FreshDeskHelpButton'
10
8
  import {AppsIcon} from './icons'
11
9
  import Notification from './Notification'
10
+ import {StyledHeader, StyledImageWrapper} from './styles'
11
+ import UserBox from './UserBox'
12
+
13
+ const imageMap = {
14
+ ums: collegex,
15
+ enroll: enrollx,
16
+ exams: examx,
17
+ payments: payx,
18
+ peoplex: peoplex,
19
+ local: collegex,
20
+ }
21
+
22
+ const isDev = process.env.NODE_ENV === 'development'
12
23
 
13
24
  export default function AppHeader({title}: {title?: string}) {
14
- const assetState = AssetsStore.useState((s) => s)
25
+ const originSubdomain = `https://www.exams.ums.in`.split('.')?.slice(-3)[0]
26
+ console.log(originSubdomain)
27
+ const currentApp =
28
+ applications.find((item) => item.key === originSubdomain)?.key ?? 'local'
15
29
 
16
30
  return (
17
31
  <StyledHeader>
@@ -23,7 +37,17 @@ export default function AppHeader({title}: {title?: string}) {
23
37
  <Typography variant='h1'>{title}</Typography>
24
38
  ) : (
25
39
  <StyledImageWrapper>
26
- <img src={assetState.logo} />
40
+ {isDev ? (
41
+ <Typography variant='h6'>CampX</Typography>
42
+ ) : (
43
+ <img
44
+ src={imageMap[currentApp]}
45
+ style={{
46
+ width: '200px',
47
+ height: 'auto',
48
+ }}
49
+ />
50
+ )}
27
51
  </StyledImageWrapper>
28
52
  )}
29
53
  </Link>
@@ -90,6 +114,7 @@ const AppsMenu = () => {
90
114
  <StyledMenuItemContainer
91
115
  key={index}
92
116
  onClick={() => {
117
+ window.location.href = item.path
93
118
  handleClose()
94
119
  }}
95
120
  >
@@ -4,36 +4,57 @@ import AssignmentRoundedIcon from '@mui/icons-material/AssignmentRounded'
4
4
  import AccountBalanceWalletRoundedIcon from '@mui/icons-material/AccountBalanceWalletRounded'
5
5
  import PersonRoundedIcon from '@mui/icons-material/PersonRounded'
6
6
 
7
+ const isDev =
8
+ process.env.NODE_ENV === 'development' ||
9
+ window.location.origin.split('.').slice(-2).join('.') === 'campx.dev'
10
+
11
+ const origins = {
12
+ ums: {
13
+ dev: 'https://ums.campx.dev',
14
+ prod: 'https://ums.campx.in',
15
+ },
16
+ payments: {
17
+ dev: 'https://payments.campx.dev',
18
+ prod: 'https://payments.campx.in',
19
+ },
20
+ exams: {
21
+ dev: 'https://exams.campx.dev',
22
+ prod: 'https://exams.campx.in',
23
+ },
24
+ }
25
+
7
26
  export const applications = [
8
- {
9
- title: 'CollegeX',
10
- path: '/college',
11
- icon: <SchoolRoundedIcon />,
12
- key: 'collegex',
13
- description: 'Pack my box with five dozens liquor jugs',
14
- },
15
- {
16
- title: 'ExamX',
17
- path: '/exams',
18
- icon: <AssignmentRoundedIcon />,
19
- description: 'Pack my box with five dozens liquor jugs',
20
- },
21
- {
22
- title: 'PayX',
23
- path: '/payments',
24
- icon: <AccountBalanceWalletRoundedIcon />,
25
- description: 'Pack my box with five dozens liquor jugs',
26
- },
27
- {
28
- title: 'PeopleX',
29
- path: '/people',
30
- icon: <PersonRoundedIcon />,
31
- description: 'Pack my box with five dozens liquor jugs',
32
- },
33
- {
34
- title: 'HostelX',
35
- path: '/hostel',
36
- icon: <GiteTwoToneIcon />,
37
- description: 'Pack my box with five dozens liquor jugs',
38
- },
27
+ {
28
+ title: 'CollegeX',
29
+ path: isDev ? origins.ums.dev : origins.ums.prod,
30
+ icon: <SchoolRoundedIcon />,
31
+ key: 'ums',
32
+ // description: 'Pack my box with five dozens liquor jugs',
33
+ },
34
+ {
35
+ title: 'ExamX',
36
+ key: 'exams',
37
+ path: isDev ? origins.exams.dev : origins.exams.prod,
38
+ icon: <AssignmentRoundedIcon />,
39
+ // description: 'Pack my box with five dozens liquor jugs',
40
+ },
41
+ {
42
+ title: 'PayX',
43
+ key: 'payments',
44
+ path: isDev ? origins.payments.dev : origins.payments.prod,
45
+ icon: <AccountBalanceWalletRoundedIcon />,
46
+ // description: 'Pack my box with five dozens liquor jugs',
47
+ },
48
+ // {
49
+ // title: 'PeopleX',
50
+ // path: '/people',
51
+ // icon: <PersonRoundedIcon />,
52
+ // // description: 'Pack my box with five dozens liquor jugs',
53
+ // },
54
+ // {
55
+ // title: 'HostelX',
56
+ // path: '/hostel',
57
+ // icon: <GiteTwoToneIcon />,
58
+ // // description: 'Pack my box with five dozens liquor jugs',
59
+ // },
39
60
  ]
@@ -0,0 +1,7 @@
1
+ const collegex = require('./collegex.png')
2
+ const enrollx = require('./enrollx.png')
3
+ const examx = require('./examx.png')
4
+ const payx = require('./payx.png')
5
+ const peoplex = require('./peoplex.png')
6
+
7
+ export {collegex, enrollx, examx, payx, peoplex}
@@ -1,3 +1,4 @@
1
- import { AssetsStore } from './AssetsStore'
2
- import { UserStore } from './UserStore'
3
- export { AssetsStore, UserStore }
1
+ import {AssetsStore} from './AssetsStore'
2
+ import {UserStore} from './UserStore'
3
+ import {globalStore} from './GlobalStore'
4
+ export {AssetsStore, UserStore, globalStore as GlobalStore}
@@ -1,19 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="80.44" height="89.178" viewBox="0 0 80.44 89.178">
2
- <g id="Group_961" data-name="Group 961" transform="translate(-40.43 -166.824)">
3
- <g id="book_10_" data-name="book (10)" transform="translate(40.43 166.824)">
4
- <path id="Path_1473" data-name="Path 1473" d="M67.146,80.588c-17.709,0-29.869,9.173-38.4,9.173S2.29,84.856,2.29,45.6,26.4.583,35.785.583C79.735.583,98.508,80.588,67.146,80.588Z" transform="translate(-2.29 -0.583)" fill="#efefef"/>
5
- <path id="Path_1475" data-name="Path 1475" d="M7.5,8.5a5.119,5.119,0,0,0,5.12,5.12H58.7V62.263H12.62a5.119,5.119,0,0,1-5.12-5.12Z" transform="translate(5.838 11.769)" fill="#f3f3f1"/>
6
- <path id="Path_1476" data-name="Path 1476" d="M14.5,10.5V33.541l7.68-7.68,7.68,7.68V10.5Z" transform="translate(16.76 14.889)" fill="#ffaf20"/>
7
- <path id="Path_1477" data-name="Path 1477" d="M53.583,16.741H12.62a5.12,5.12,0,0,1,0-10.241H53.583Z" transform="translate(5.838 8.648)" fill="#ffaf20"/>
8
- <path id="Path_1478" data-name="Path 1478" d="M12.62,57.143V13.62A5.119,5.119,0,0,1,7.5,8.5V57.143a5.119,5.119,0,0,0,5.12,5.12h5.12A5.119,5.119,0,0,1,12.62,57.143Z" transform="translate(5.838 11.769)" fill="#d5dbe1"/>
9
- <path id="Path_1479" data-name="Path 1479" d="M19.62,10.5H14.5V33.541l5.12-5.12Z" transform="translate(16.76 14.889)" fill="rgba(0,0,0,0.15)"/>
10
- <path id="Path_1480" data-name="Path 1480" d="M12.62,11.62a5.119,5.119,0,0,1,5.12-5.12H12.62a5.12,5.12,0,0,0,0,10.241h5.12A5.119,5.119,0,0,1,12.62,11.62Z" transform="translate(5.838 8.648)" fill="rgba(0,0,0,0.15)"/>
11
- <path id="Path_1481" data-name="Path 1481" d="M59.483,67.444H13.4a6.409,6.409,0,0,1-6.4-6.4V12.4A6.409,6.409,0,0,1,13.4,6H54.363a1.281,1.281,0,0,1,1.28,1.28v8.961h3.84a1.281,1.281,0,0,1,1.28,1.28V66.164A1.281,1.281,0,0,1,59.483,67.444ZM9.56,17.518V61.043a3.845,3.845,0,0,0,3.84,3.84H58.2V18.8H13.4A6.377,6.377,0,0,1,9.56,17.518ZM13.4,8.56a3.84,3.84,0,0,0,0,7.68H53.083V8.56Z" transform="translate(5.058 7.868)" fill="#121212"/>
12
- <path id="Path_1482" data-name="Path 1482" d="M30.641,35.6a1.29,1.29,0,0,1-.906-.374l-6.774-6.777-6.774,6.774a1.282,1.282,0,0,1-2.186-.9V11.28a1.28,1.28,0,1,1,2.56,0V31.231l5.494-5.494a1.281,1.281,0,0,1,1.81,0l5.5,5.494V11.28a1.28,1.28,0,0,1,2.56,0V34.321A1.28,1.28,0,0,1,31.13,35.5,1.262,1.262,0,0,1,30.641,35.6Z" transform="translate(15.979 14.109)" fill="#121212"/>
13
- </g>
14
- <g id="Group_954" data-name="Group 954" transform="translate(95.915 171.496) rotate(-45)">
15
- <path id="Path_1455" data-name="Path 1455" d="M0,0H5.319V2.66H0Z" transform="translate(0 3.761) rotate(-45)" fill="#a4afc1"/>
16
- <path id="Path_1456" data-name="Path 1456" d="M0,0H2.66V5.319H0Z" transform="translate(0.47 12.693) rotate(-45)" fill="#a4afc1"/>
17
- </g>
18
- </g>
19
- </svg>
@@ -1,24 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="361.528" height="340.578" viewBox="0 0 361.528 340.578">
2
- <g id="Group_1286" data-name="Group 1286" transform="translate(-888.795 -405.462)">
3
- <g id="freepik--background-simple--inject-46" transform="translate(857.258 338.404)">
4
- <path id="Path_9419" data-name="Path 9419" d="M32.118,266.079s6.217,54.214,52.288,77.378,91.2.628,132.625-4.8c21.7-2.844,41.822,7.829,63.093,10.061,68.02,7.143,121.407-73.021,111.826-131.988-8.267-51.04-40.9-87.075-100.343-112.776S191.288,57.8,122.243,81.96,27.2,195.86,32.118,266.079Z" transform="translate(0)" fill="#ffaf20"/>
5
- <path id="Path_9420" data-name="Path 9420" d="M32.118,266.079s6.217,54.214,52.288,77.378,91.2.628,132.625-4.8c21.7-2.844,41.822,7.829,63.093,10.061,68.02,7.143,121.407-73.021,111.826-131.988-8.267-51.04-40.9-87.075-100.343-112.776S191.288,57.8,122.243,81.96,27.2,195.86,32.118,266.079Z" transform="translate(0)" fill="#fff" opacity="0.8"/>
6
- </g>
7
- <g id="freepik--Plants--inject-46" transform="translate(839.715 286.17)">
8
- <line id="Line_777" data-name="Line 777" x2="346.558" transform="translate(49.08 413.36)" fill="none" stroke="#263238" stroke-width="1.056"/>
9
- <path id="Path_9421" data-name="Path 9421" d="M462.19,307.42A23,23,0,0,0,451,314.29a48.58,48.58,0,0,0-6.76,9.22c-1.23,2.1-2.35,4.28-3.37,6.49-.67,1.44-1.17,3.25-1.8,4.89-.91,1.47-1.81,3-2.58,4.37,2.73-9.76,11.46-27.73,11.62-32.84.16-5.56-5.16,2.74-8.16,14a157.93,157.93,0,0,0-3.82,19.5c-.31.57-.59,1.13-.83,1.65-.54,1.14-1.47,3.08-2.71,5.6,2.64-8.29,3.7-18.14,2.06-19.37-2.36-1.76-3.22,2.57-3.22,10.55,0,6.28-2,13.84-2.82,16.78-1.49,3-3.16,6.21-4.94,9.63,1.87-6,2.95-14.58,4-21,1.49-9.38.85-12.3-2.19-7.8s-2.5,11-1.78,19c.58,6.35-1.73,12.6-2.71,14.92-2.29,4.34-4.72,8.83-7.17,13.24a45.4,45.4,0,0,0,3.91-14.31c1.05-10.85-.35-20.8-2.85-18s-1,10.37-1.31,19.55A103.54,103.54,0,0,1,411.62,387l-.75,1.32a44.91,44.91,0,0,0,.73-14.13c.5-1.82.33-3-.27-3.53-.09-2,.08-5.11-.79-6.68-2.19-3.91-4.6,1.37-4.62,3.44a34.5,34.5,0,0,0,.33,4.759,12.211,12.211,0,0,0-2.2,2.7c-.33.55-.68,1.18-1,1.85,0-.65.07-1.31.1-2a9.63,9.63,0,0,0-1.08-5.11,31.8,31.8,0,0,0,2.83-8.33,4.6,4.6,0,0,0-.25-2.89,2.36,2.36,0,0,0-3.5-.94c-4.17,2.21-5.29,7.52-5.75,11.78a72.858,72.858,0,0,1-2.17,10.83c-.86,3.21-1.6,6.12-2.09,8.1-.36-2.23-.8-4.4-1.32-6.4-.46-1.76-.92-3.44-1.36-5.08a33.86,33.86,0,0,1,3.36-17.16c4.93-10.12,8.49-14.86,5.08-15.08s-8.38,5.11-9.09,13.46a93.707,93.707,0,0,0-.32,15.24c-1.08-3.89-2.15-7.55-3.27-11.27a24.741,24.741,0,0,1,.62-12.4c2.33-6.88,9.28-19.1,5.62-18.14s-8.05,8.05-8.54,15.55a41.239,41.239,0,0,0,1.29,11.66c-.8-2.62-1.64-5.32-2.54-8.17-.39-1.22-.79-2.52-1.19-3.85a4.136,4.136,0,0,0-.1-.68,19,19,0,0,1,2-11.28c3.49-6.29,10-11.69,6.15-13.13s-9.64,8.79-10,13.91a24.641,24.641,0,0,0,.47,5.8c-.15-.39-.31-.79-.47-1.19-.83-2.93-1.63-5.83-2.33-8.4a23.27,23.27,0,0,1,2.21-11c3.42-7.82,7.76-16.79,3.33-14.51-3.57,1.85-7.44,12.41-6.67,21.33-.31-1.16-.57-2.17-.79-3-.58-5.11-1.68-17.14,0-24.31,1.1-4.79,2.89-9.31,3.45-14.23a3.08,3.08,0,0,0-.08-1.51c-1.19-3-5.06,2.8-5.69,3.75a23,23,0,0,0-3.52,12.69,48.79,48.79,0,0,0,1.35,11.35,69.73,69.73,0,0,0,2,7.05c.49,1.51,1.36,3.17,2,4.8.33,1.69.71,3.41,1.1,4.95-4.67-9-10.55-28.09-13.93-31.93-3.67-4.18-1.89,5.53,3.61,15.81A156.443,156.443,0,0,0,374,329.68c.17.64.35,1.23.52,1.78.39,1.2,1,3.25,1.84,5.94-3.72-7.87-9.67-15.79-11.7-15.56-2.93.32-.61,4.07,4.84,9.9,4.29,4.59,8,11.47,9.39,14.2.92,3.17,1.93,6.69,3,10.41-2.71-5.64-7.79-12.67-11.44-18.08-5.31-7.88-7.77-9.58-6.92-4.21s5.71,9.78,11.7,15.13c4.75,4.25,7.33,10.39,8.2,12.76,1.28,4.73,2.58,9.67,3.79,14.57a44.859,44.859,0,0,0-6.91-13.13c-6.64-8.65-14.45-15-14.35-11.2s6.32,8.28,12.38,15.18a104.773,104.773,0,0,1,9.92,13.39c.11.5.23,1,.35,1.48-2.77-5-7-9-11.24-12.76-1.48-1.32-3.71-4.19-5.61-4.8-4.27-1.37-2.43,4.13-1,5.66,4.56,5,11,8.06,15.19,13.29a48,48,0,0,1,4.26,6.3q.44,2.58.69,4.83c-1.61-1.61-4.86-4.19-5.09-4.35-5.16-3.47-8.14-8.22-12.1-12.79-1.19-1.38-3.22-3.06-5.13-3.14-2.66-.13-3.51,2.72-2.76,4.95,3.12,9.21,14.87,9.61,21.8,14.4a19.861,19.861,0,0,1,3.48,2.82,59.337,59.337,0,0,1,.23,8.55H375.51v6.6h4.71L384,435.3h31.65l3.82-23.5h4.71v-6.6H400.4c1.09-1.31,2.25-2.74,3.42-4.25l5,.15s17.38.76,23.77-2.67.69-6.75-5.41-5-18.11,7.19-20.76,7.11l-2.25-.06c1.24-1.61,2.48-3.3,3.66-5A114,114,0,0,0,422,391c5-2,10.8-3.58,15.1-6.92a4.55,4.55,0,0,0,1.79-2.28,2.36,2.36,0,0,0-1.91-3.08c-4.56-1.23-9,1.89-12.25,4.68a71.269,71.269,0,0,1-9,6.44c-2.82,1.76-5.34,3.38-7.06,4.5,1.26-1.88,2.43-3.76,3.41-5.58.86-1.6,1.68-3.14,2.47-4.64a33.94,33.94,0,0,1,14.17-10.25c10.52-4,16.35-5.07,14-7.56s-9.62-2-15.83,3.64a94.135,94.135,0,0,0-10.64,10.92c1.86-3.58,3.58-7,5.31-10.47a24.54,24.54,0,0,1,8.91-8.64c6.39-3.44,19.81-7.63,16.48-9.42s-11.37.38-16.84,5.54a40.65,40.65,0,0,0-7,9.4c1.2-2.47,2.43-5,3.72-7.71.55-1.16,1.14-2.37,1.76-3.62l.39-.57a18.93,18.93,0,0,1,9.16-6.88c6.84-2.21,15.29-1.71,13.46-5.39s-13.05-.15-16.78,3.36a25,25,0,0,0-3.62,4.56c.16-.39.32-.79.47-1.2,1.39-2.7,2.78-5.36,4-7.72a23.341,23.341,0,0,1,9.12-6.52c7.83-3.39,17.13-7,12.33-8.33-3.87-1.1-13.9,4-19.43,11,.57-1.06,1.06-2,1.46-2.71,3.06-4.14,10.47-13.68,16.57-17.79,4.07-2.75,8.46-4.84,12.23-8a3,3,0,0,0,1-1.17C470.07,305.57,463.3,307.15,462.19,307.42Zm-70.88,82.13c1-1.56,2.83-4.44,4.82-8.15a47.343,47.343,0,0,0,2.1,4.91c-1.85,3.78-3.53,7.06-4.5,7.91L392,395.71c-.15-2.02-.39-4.11-.69-6.16Zm11.53,10.95c-1.45,1.87-2.78,3.41-4,4.7h-6.17c-.1-2.51-.27-5.6-.57-8.9l3.76-3.31s1.65-1.41,3.89-3.53a31.94,31.94,0,0,1,2.47,6.61,20.368,20.368,0,0,1,.62,4.43Zm5.12-13a47.792,47.792,0,0,1-1.19,7.5q-1.44,2.19-2.79,4a65.406,65.406,0,0,0-.76-6.65,29,29,0,0,1-.69-5.61,74,74,0,0,0,5.13-5.73,32.06,32.06,0,0,1,.34,6.47Z" transform="translate(-63.252)" fill="#263238"/>
10
- </g>
11
- <g id="freepik--Canvas--inject-46" transform="translate(776.463 286.17)">
12
- <ellipse id="Ellipse_508" data-name="Ellipse 508" cx="93.85" cy="15.74" rx="93.85" ry="15.74" transform="translate(186.07 428.39)" fill="#ffaf20"/>
13
- <ellipse id="Ellipse_509" data-name="Ellipse 509" cx="93.85" cy="15.74" rx="93.85" ry="15.74" transform="translate(186.07 428.39)" fill="#fff" opacity="0.5"/>
14
- <rect id="Rectangle_2424" data-name="Rectangle 2424" width="9.91" height="315.03" transform="translate(274.97 119.82)" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
15
- <path id="Path_14837" data-name="Path 14837" d="M337.16,380.26H222.68l1.37-10.25H335.11Z" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
16
- <path id="Path_14838" data-name="Path 14838" d="M346.56,442.62h11.61l-53.3-322.03H293.25Z" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
17
- <path id="Path_14839" data-name="Path 14839" d="M213.97,442.62H202.35l52.63-322.03h11.61Z" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
18
- <rect id="Rectangle_2425" data-name="Rectangle 2425" width="47.5" height="7.18" transform="translate(256.17 307.3)" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
19
- <rect id="Rectangle_2426" data-name="Rectangle 2426" width="70.99" height="7.18" transform="translate(244.43 127.09)" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
20
- <rect id="Rectangle_2427" data-name="Rectangle 2427" width="140.1" height="166.55" transform="translate(209.53 133.92)" fill="#fff" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
21
- <rect id="Rectangle_2428" data-name="Rectangle 2428" width="156.5" height="8.2" transform="translate(201.67 299.78)" fill="#263238" stroke="#263238" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.056"/>
22
- </g>
23
- </g>
24
- </svg>
Binary file
Binary file
Binary file