@campxdev/shared 1.11.19 → 1.11.21-alpha.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- "cSpell.words": ["campxdev", "mentee", "mentees"]
2
+ "cSpell.words": ["campxdev", "challan", "mentee", "mentees", "omrs"]
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.11.19",
3
+ "version": "1.11.21-alpha.0",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -38,9 +38,9 @@
38
38
  "axios": "^0.27.2",
39
39
  "date-fns": "^2.28.0",
40
40
  "date-fns-tz": "^2.0.0",
41
+ "device-detector-js": "^3.0.3",
41
42
  "fuse.js": "^6.6.2",
42
43
  "js-cookie": "^3.0.1",
43
- "device-detector-js": "^3.0.3",
44
44
  "moment": "^2.29.4",
45
45
  "pullstate": "^1.24.0",
46
46
  "react": "^18.2.0",
Binary file
@@ -5,6 +5,7 @@ const internalserver = require('./500.png')
5
5
  const unauth = require('./401.png')
6
6
  const nointernet = require('./nointernet.png')
7
7
  const campxLogoPrimary = require('./campx_logo__full_primary.png')
8
+ const campxLogoSquare = require('./X.png')
8
9
  const animatedImage = require('./animation.gif')
9
10
  const activeDevices = require('./active_devices.svg')
10
11
  const changePassword = require('./change_password.svg')
@@ -22,6 +23,8 @@ export {
22
23
  animatedImage,
23
24
  avatarImage,
24
25
  campxLogoPrimary,
26
+ campxLogoSquare,
27
+ careers,
25
28
  changePassword,
26
29
  clogWheel,
27
30
  internalserver,
@@ -36,5 +39,4 @@ export {
36
39
  profile,
37
40
  unauth,
38
41
  web,
39
- careers,
40
42
  }
@@ -31,6 +31,7 @@ interface ApplicationProfileProps {
31
31
  | 'hostels'
32
32
  | 'hrms'
33
33
  | 'commute_x'
34
+ | 'admin'
34
35
  title: string
35
36
  permissions?: {
36
37
  add: string
@@ -8,17 +8,19 @@ import { ITextFieldProps } from '../Input/TextField'
8
8
  interface SearchBarProps {
9
9
  onSearch: (v: string) => void
10
10
  label?: ReactNode
11
- textFieldProps?: ITextFieldProps
12
11
  placeholder?: string
12
+ value?: string
13
+ textFieldProps?: ITextFieldProps
13
14
  }
14
15
 
15
16
  export default function SearchBar({
16
17
  onSearch,
17
18
  label,
18
19
  placeholder = 'Search',
20
+ value,
19
21
  ...restProps
20
22
  }: SearchBarProps) {
21
- const [, setSearch] = useState('')
23
+ const [, setSearch] = useState(value || '')
22
24
 
23
25
  const debouncedChangeHandler = useMemo(
24
26
  () =>
@@ -34,6 +36,7 @@ export default function SearchBar({
34
36
  label={label}
35
37
  placeholder={placeholder}
36
38
  onChange={debouncedChangeHandler}
39
+ defaultValue={value || ''}
37
40
  InputProps={{
38
41
  endAdornment: (
39
42
  <InputAdornment position="end">
@@ -13,6 +13,7 @@ import {
13
13
  peoplex,
14
14
  } from './assets'
15
15
 
16
+ import { campxLogoPrimary } from '../../../assets/images'
16
17
  import HeaderActions from './HeaderActions/HeaderActions'
17
18
  import {
18
19
  StyledHeader,
@@ -30,12 +31,14 @@ const imageMap = {
30
31
  campx: collegex,
31
32
  commute: commutex,
32
33
  hostel: hostelx,
34
+ admin: campxLogoPrimary,
33
35
  }
34
36
 
35
37
  interface AppHeaderProps {
36
38
  clientLogo: string
37
39
  fullName: string
38
40
  profileUrl?: string
41
+ actions?: ReactNode[]
39
42
  userBoxActions: {
40
43
  label: ReactNode
41
44
  icon?: ReactNode
@@ -52,6 +55,7 @@ export default function AppHeader({
52
55
  cogWheelMenu = [],
53
56
  customHeaderActions,
54
57
  profileUrl,
58
+ actions = [],
55
59
  }: AppHeaderProps) {
56
60
  return (
57
61
  <StyledHeader>
@@ -68,6 +72,7 @@ export default function AppHeader({
68
72
  fullName={fullName}
69
73
  userBoxActions={userBoxActions}
70
74
  profileUrl={profileUrl}
75
+ actions={actions}
71
76
  />
72
77
  )}
73
78
  </Box>
@@ -1,3 +1,4 @@
1
+ import { campxLogoSquare } from '../../../assets/images'
1
2
  import { isDevelopment } from '../../../constants'
2
3
  import {
3
4
  campxSquareSmall,
@@ -10,6 +11,10 @@ import {
10
11
  } from './assets'
11
12
 
12
13
  const origins = {
14
+ admin: {
15
+ dev: 'https://admin.campx.dev',
16
+ prod: 'https://admin.campx.in',
17
+ },
13
18
  ums: {
14
19
  dev: 'https://ums.campx.dev',
15
20
  prod: 'https://ums.campx.in',
@@ -41,6 +46,14 @@ const origins = {
41
46
  }
42
47
 
43
48
  export const applications = [
49
+ {
50
+ title: 'Admin',
51
+ path: isDevelopment ? origins.admin.dev : origins.admin.prod,
52
+ icon: campxLogoSquare,
53
+ key: 'admin',
54
+ domainName: 'admin',
55
+ description: 'Manage Complete Campus Root Configuration',
56
+ },
44
57
  {
45
58
  title: 'CollegeX',
46
59
  path: isDevelopment ? origins.ums.dev : origins.ums.prod,
@@ -23,21 +23,23 @@ import {
23
23
  type Order = 'asc' | 'desc' | ''
24
24
  type Sort = {}
25
25
  type DataType = 'currency' | 'string' | 'number'
26
- export interface TableColumn {
26
+
27
+ export interface TableColumn<T> {
27
28
  dataIndex: string
28
29
  key: string
29
30
  title: any
30
- render?: (cellData: any, row: any, index: number) => any
31
+ render?: (cellData: any, row: T, index: number) => any
31
32
  textColor?: string
32
33
  sort?: boolean
33
34
  width?: string //pixels
34
35
  dataType?: DataType
35
36
  }
36
- interface TableProps {
37
+
38
+ interface TableProps<T> {
37
39
  showSerialNumber?: boolean
38
- columns: Array<TableColumn>
40
+ columns: Array<TableColumn<T>>
39
41
  rowKey?: string
40
- dataSource?: any[]
42
+ dataSource?: T[]
41
43
  loading?: boolean
42
44
  onRowClick?: (row: any) => void
43
45
  pagination?: {
@@ -54,7 +56,8 @@ interface TableProps {
54
56
  totalColumns?: number[]
55
57
  showTotalInFirstCellOfTotalRow?: boolean
56
58
  }
57
- export default function Table({
59
+
60
+ export default function Table<T>({
58
61
  showSerialNumber = false,
59
62
  columns,
60
63
  dataSource,
@@ -67,7 +70,7 @@ export default function Table({
67
70
  sx,
68
71
  totalColumns,
69
72
  showTotalInFirstCellOfTotalRow,
70
- }: TableProps) {
73
+ }: TableProps<T>) {
71
74
  const [sort, setSort] = useState<Sort>({})
72
75
  let totalCount = []
73
76
  let totalCols = []
@@ -77,18 +80,18 @@ export default function Table({
77
80
  totalCols = totalColumns ? [...totalColumns] : []
78
81
  }
79
82
 
80
- const handleSortClick = (sortBykey) => {
83
+ const handleSortClick = (sortByKey) => {
81
84
  setSort((prev) => {
82
- if (prev[sortBykey]) {
83
- if (prev[sortBykey] === 'desc') return { ...prev, [sortBykey]: 'asc' }
84
- if (prev[sortBykey] === 'asc') {
85
- delete prev[sortBykey]
85
+ if (prev[sortByKey]) {
86
+ if (prev[sortByKey] === 'desc') return { ...prev, [sortByKey]: 'asc' }
87
+ if (prev[sortByKey] === 'asc') {
88
+ delete prev[sortByKey]
86
89
  return { ...prev }
87
90
  }
88
91
  } else {
89
92
  return {
90
93
  ...prev,
91
- [sortBykey]: 'desc',
94
+ [sortByKey]: 'desc',
92
95
  }
93
96
  }
94
97
  })
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react"
1
+ import { ReactNode } from 'react'
2
2
 
3
3
  export const batchOptions = Array.from({ length: 12 }, (_, i) => {
4
4
  return `${2012 + i} - ${2012 + i + 1}`
@@ -127,6 +127,10 @@ export const ProfileApplicationType = [
127
127
  label: 'PeopleX',
128
128
  value: 'hrms',
129
129
  },
130
+ {
131
+ label: 'AdminX',
132
+ value: 'admin',
133
+ },
130
134
  ]
131
135
 
132
136
  export interface Option {