@campxdev/shared 1.10.81 → 1.10.83

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": "1.10.81",
3
+ "version": "1.10.83",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
@@ -9,11 +9,13 @@ interface SearchBarProps {
9
9
  onSearch: (v: string) => void
10
10
  label?: ReactNode
11
11
  textFieldProps?: ITextFieldProps
12
+ placeholder?: string
12
13
  }
13
14
 
14
15
  export default function SearchBar({
15
16
  onSearch,
16
17
  label,
18
+ placeholder = 'Search',
17
19
  ...restProps
18
20
  }: SearchBarProps) {
19
21
  const [, setSearch] = useState('')
@@ -30,7 +32,7 @@ export default function SearchBar({
30
32
  return (
31
33
  <TextField
32
34
  label={label}
33
- placeholder="Search"
35
+ placeholder={placeholder}
34
36
  onChange={debouncedChangeHandler}
35
37
  InputProps={{
36
38
  endAdornment: (
@@ -1,18 +1,29 @@
1
- import { Box, Typography, styled } from '@mui/material'
1
+ import { Box, TextField, Typography, styled } from '@mui/material'
2
+ import { useState } from 'react'
2
3
  import { InsititutionsStore } from '../../shared-state/InstitutionsStore'
3
4
  import Image from '../Image/Image'
4
5
 
5
6
  export default function InsititutionsDialog({ close }) {
7
+ const [searchText, setSearchText] = useState('')
6
8
  const { institutions } = InsititutionsStore.useState((s) => s)
9
+ const filteredInstitutions = institutions.filter((item) =>
10
+ item.name.toLowerCase().includes(searchText.toLowerCase()),
11
+ )
7
12
 
8
13
  return (
9
14
  <Box sx={{ padding: '20px' }}>
10
15
  <Typography variant="h3" textAlign={'center'}>
11
- Select an Instituition
16
+ Select an Institution
12
17
  </Typography>
13
-
18
+ <TextField
19
+ label="Search Institution"
20
+ variant="outlined"
21
+ margin="normal"
22
+ value={searchText}
23
+ onChange={(e) => setSearchText(e.target.value)}
24
+ />
14
25
  <StyledInstitutionContainer>
15
- {institutions?.map((item, index) => (
26
+ {filteredInstitutions?.map((item, index) => (
16
27
  <InstitutionCard institution={item} key={index} />
17
28
  ))}
18
29
  </StyledInstitutionContainer>
@@ -42,7 +42,7 @@ const checkIsAdmin = (user) => {
42
42
  let subDomain = window.location.host.split('.')?.slice(-3)[0]
43
43
  const localSubDomain = process.env.REACT_APP_SUBDOMAIN
44
44
 
45
- if (user?.isSuperuser) return 1
45
+ if (user?.isSuperUser) return 1
46
46
 
47
47
  if (process.env.NODE_ENV === 'development') {
48
48
  subDomain = localSubDomain
@@ -235,6 +235,9 @@ function useAuth({ permissionsEndpoint, loginUrl }: AuthParams): AuthResponse {
235
235
  can_challan_registrations_view:
236
236
  isMasterSlave &&
237
237
  res.data?.permissions.can_challan_registrations_view,
238
+ can_my_mentees_view:
239
+ res.data?.user?.isMentor &&
240
+ res.data?.permissions.can_my_mentees_view,
238
241
  } as any
239
242
  s.applications = res.data?.applications ?? []
240
243
  })