@campxdev/shared 1.10.10 → 1.10.12

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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/assets/images/BackgroundImage.jpg +0 -0
  3. package/src/assets/images/BackgroundImg.png +0 -0
  4. package/src/assets/images/CoverBg.png +0 -0
  5. package/src/assets/images/PaperPublicationBg.png +0 -0
  6. package/src/components/IconButtons/Icons.tsx +33 -2
  7. package/src/components/Layout/Header/HeaderActions/UserBox.tsx +8 -1
  8. package/src/components/MyProfile/Education/Education.tsx +47 -0
  9. package/src/components/MyProfile/Education/EducationCard.tsx +62 -0
  10. package/src/components/MyProfile/Education/EducationForm.tsx +97 -0
  11. package/src/components/MyProfile/Education/Styles.tsx +27 -0
  12. package/src/components/MyProfile/Experience/Experience.tsx +47 -0
  13. package/src/components/MyProfile/Experience/ExperienceCard.tsx +63 -0
  14. package/src/components/MyProfile/Experience/ExperienceForm.tsx +107 -0
  15. package/src/components/MyProfile/Experience/Styles.tsx +27 -0
  16. package/src/components/MyProfile/FileUpload.tsx +69 -0
  17. package/src/components/MyProfile/MyProfile.tsx +166 -0
  18. package/src/components/MyProfile/NoDataSection.tsx +27 -0
  19. package/src/components/MyProfile/PaperPublication/Authors.tsx +88 -0
  20. package/src/components/MyProfile/PaperPublication/PaperPublications.tsx +52 -0
  21. package/src/components/MyProfile/PaperPublication/PublicationCard.tsx +80 -0
  22. package/src/components/MyProfile/PaperPublication/PublicationsForm.tsx +285 -0
  23. package/src/components/MyProfile/PaperPublication/Styles.tsx +51 -0
  24. package/src/components/MyProfile/StyledTabsContainer.tsx +53 -0
  25. package/src/components/MyProfile/Styles.tsx +115 -0
  26. package/src/components/MyProfile/Workshop/Styles.tsx +38 -0
  27. package/src/components/MyProfile/Workshop/Workshop.tsx +49 -0
  28. package/src/components/MyProfile/Workshop/WorkshopCard.tsx +64 -0
  29. package/src/components/MyProfile/Workshop/WorkshopData.tsx +36 -0
  30. package/src/components/MyProfile/Workshop/WorkshopForm.tsx +202 -0
  31. package/src/components/MyProfile/index.ts +1 -0
  32. package/src/components/MyProfile/service.ts +58 -0
  33. package/src/shared-state/PermissionsStore.ts +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/shared",
3
- "version": "1.10.10",
3
+ "version": "1.10.12",
4
4
  "main": "./exports.ts",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
Binary file
@@ -1,5 +1,3 @@
1
- import React from 'react'
2
-
3
1
  export const ViewIcon = () => {
4
2
  return (
5
3
  <svg
@@ -266,3 +264,36 @@ export const DateRangeIcon = () => {
266
264
  </svg>
267
265
  )
268
266
  }
267
+
268
+ export const EducationIcon = () => {
269
+ return (
270
+ <svg
271
+ xmlns="http://www.w3.org/2000/svg"
272
+ width="15.835"
273
+ height="20"
274
+ viewBox="0 0 15.835 20"
275
+ >
276
+ <path
277
+ id="diploma"
278
+ d="M9.667,10a.833.833,0,1,1,0,1.667h-2.5a.833.833,0,1,1,0-1.667Zm5-2.5a.833.833,0,0,0-.833-.833H7.167a.833.833,0,1,0,0,1.667h6.667A.833.833,0,0,0,14.667,7.5ZM7.167,5h6.667a.833.833,0,1,0,0-1.667H7.167A.833.833,0,1,0,7.167,5Zm10,11.2V19.4a.6.6,0,0,1-1.026.425l-.641-.64-.641.64a.6.6,0,0,1-1.026-.425V16.2A3.323,3.323,0,0,1,15.5,10a3.283,3.283,0,0,1,.833.118V4.167a2.5,2.5,0,0,0-2.5-2.5H7.167a2.5,2.5,0,0,0-2.5,2.5v10a2.5,2.5,0,0,0,2.5,2.5h4.167a.833.833,0,1,1,0,1.667H7.167A4.172,4.172,0,0,1,3,14.168v-10A4.172,4.172,0,0,1,7.167,0h6.667A4.172,4.172,0,0,1,18,4.167v6.985a3.292,3.292,0,0,1-.833,5.052Zm0-2.87A1.667,1.667,0,1,0,15.5,15,1.667,1.667,0,0,0,17.168,13.334Z"
279
+ transform="translate(-3)"
280
+ />
281
+ </svg>
282
+ )
283
+ }
284
+
285
+ export const ExperienceIcon = () => {
286
+ return (
287
+ <svg
288
+ xmlns="http://www.w3.org/2000/svg"
289
+ width="18"
290
+ height="18"
291
+ viewBox="0 0 18 18"
292
+ >
293
+ <path
294
+ id="briefcase"
295
+ d="M14.25,3h-.825A3.757,3.757,0,0,0,9.75,0H8.25A3.757,3.757,0,0,0,4.575,3H3.75A3.754,3.754,0,0,0,0,6.75v7.5A3.755,3.755,0,0,0,3.75,18h10.5A3.755,3.755,0,0,0,18,14.25V6.75A3.755,3.755,0,0,0,14.25,3Zm-6-1.5h1.5A2.25,2.25,0,0,1,11.862,3H6.138A2.25,2.25,0,0,1,8.25,1.5Zm-4.5,3h10.5A2.25,2.25,0,0,1,16.5,6.75V9H1.5V6.75A2.25,2.25,0,0,1,3.75,4.5Zm10.5,12H3.75A2.25,2.25,0,0,1,1.5,14.25V10.5H8.25v.75a.75.75,0,1,0,1.5,0V10.5H16.5v3.75A2.25,2.25,0,0,1,14.25,16.5Z"
296
+ />
297
+ </svg>
298
+ )
299
+ }
@@ -1,4 +1,5 @@
1
- import { ExitToAppOutlined, HttpsOutlined } from '@mui/icons-material'
1
+ import { ExitToAppOutlined, HttpsOutlined, Person } from '@mui/icons-material'
2
+ import { useNavigate } from 'react-router-dom'
2
3
  import logout from '../../../../utils/logout'
3
4
  import ChangePassword from '../../../ChangePassword'
4
5
  import DropDownButton from '../../../DropDownButton/DropDownButton'
@@ -22,6 +23,7 @@ export default function UserBox({
22
23
  actions: IMenuItemProps[] | []
23
24
  customActions?: IMenuItemProps[] | []
24
25
  }) {
26
+ const navigate = useNavigate()
25
27
  return (
26
28
  <DropDownButton
27
29
  anchor={({ open }) => (
@@ -34,6 +36,11 @@ export default function UserBox({
34
36
  ? customActions
35
37
  : [
36
38
  ...actions,
39
+ {
40
+ label: 'My Profile',
41
+ icon: <Person />,
42
+ onClick: () => navigate('/han'),
43
+ },
37
44
  {
38
45
  label: 'Change Password',
39
46
  actionType: 'dialog',
@@ -0,0 +1,47 @@
1
+ /* eslint-disable no-console */
2
+ /* eslint-disable react/jsx-key */
3
+ import { Typography } from '@mui/material'
4
+ import ActionButton from '../../ActionButton'
5
+ import { DrawerButton } from '../../ModalButtons'
6
+ import NoDataSection from '../NoDataSection'
7
+ import EducationCard from './EducationCard'
8
+ import { EducationForm } from './EducationForm'
9
+ import { StyledBoxCard, StyledBoxContainer } from './Styles'
10
+
11
+ const Education = ({ educations }) => {
12
+ const isEducation = educations && educations?.length > 0
13
+ return isEducation ? (
14
+ <>
15
+ <StyledBoxContainer>
16
+ <Typography variant="h3">Education</Typography>
17
+ <DrawerButton
18
+ anchor={({ open }) => (
19
+ <ActionButton onClick={open} variant="text">
20
+ +Add Education
21
+ </ActionButton>
22
+ )}
23
+ content={({ close }) => (
24
+ <EducationForm data={null} hideDialog={close} />
25
+ )}
26
+ title="Add Education"
27
+ />
28
+ </StyledBoxContainer>
29
+ <StyledBoxCard>
30
+ {educations.map((data) => (
31
+ <EducationCard data={data} />
32
+ ))}
33
+ </StyledBoxCard>
34
+ </>
35
+ ) : (
36
+ <NoDataSection
37
+ title="Education"
38
+ subtitle="Add your Education"
39
+ addButtonTitle="Add Education"
40
+ addButtonContent={({ close }) => (
41
+ <EducationForm data={null} hideDialog={close} />
42
+ )}
43
+ />
44
+ )
45
+ }
46
+
47
+ export default Education
@@ -0,0 +1,62 @@
1
+ import { Box, Card, Typography } from '@mui/material'
2
+ import moment from 'moment'
3
+ import { EditButton } from '../../IconButtons'
4
+ import { EducationIcon } from '../../IconButtons/Icons'
5
+ import { DrawerButton } from '../../ModalButtons'
6
+ import { EducationForm } from './EducationForm'
7
+ import { AvatarStyled, StyledBox } from './Styles'
8
+
9
+ const EducationCard = ({ data }) => {
10
+ return (
11
+ <div>
12
+ <Card
13
+ sx={{
14
+ padding: '20px ',
15
+ }}
16
+ >
17
+ <StyledBox>
18
+ <Box
19
+ sx={{
20
+ display: 'flex',
21
+ }}
22
+ >
23
+ <AvatarStyled>
24
+ <EducationIcon />
25
+ </AvatarStyled>
26
+
27
+ <Box sx={{ marginTop: '8px', marginRight: '5px' }}>
28
+ <Typography variant="body2">{data?.institution}</Typography>
29
+ <Typography variant="subtitle2">
30
+ {moment(data?.startDate).format('DD MMMM, YYYY')} -
31
+ {moment(data?.endDate).format('DD MMMM, YYYY')}
32
+ </Typography>
33
+ </Box>
34
+ </Box>
35
+ <Box
36
+ sx={{
37
+ display: 'flex',
38
+ }}
39
+ >
40
+ <DrawerButton
41
+ title={'Edit Education'}
42
+ anchor={({ open }) => <EditButton onClick={open} />}
43
+ content={({ close }) => (
44
+ <EducationForm data={data} hideDialog={close} />
45
+ )}
46
+ />
47
+ </Box>
48
+ </StyledBox>
49
+ <Box
50
+ sx={{
51
+ paddingTop: '10px',
52
+ }}
53
+ >
54
+ <Typography variant="h5">{data?.name}</Typography>
55
+ <Typography variant="subtitle2">{data?.description}</Typography>
56
+ </Box>
57
+ </Card>
58
+ </div>
59
+ )
60
+ }
61
+
62
+ export default EducationCard
@@ -0,0 +1,97 @@
1
+ /* eslint-disable no-console */
2
+ import { yupResolver } from '@hookform/resolvers/yup'
3
+ import { Stack } from '@mui/material'
4
+ import moment from 'moment'
5
+ import { useForm } from 'react-hook-form'
6
+ import { useMutation, useQueryClient } from 'react-query'
7
+ import { toast } from 'react-toastify'
8
+ import * as yup from 'yup'
9
+ import { axiosErrorToast } from '../../../config/axios'
10
+ import ActionButton from '../../ActionButton'
11
+ import { FormDatePicker, FormTextField } from '../../HookForm'
12
+ import { createUpdateEducation } from '../service'
13
+
14
+ const schema = yup.object().shape({
15
+ name: yup.string().required('Name is required'),
16
+ institution: yup.string().required('Institution is required'),
17
+ startDate: yup.string().required('From Date is required'),
18
+ description: yup.string().required('Description is required'),
19
+ })
20
+
21
+ export const EducationForm = ({ data, hideDialog }) => {
22
+ const queryClient = useQueryClient()
23
+ const { mutate, isLoading } = useMutation(createUpdateEducation, {
24
+ onSuccess: () => {
25
+ toast.success(data ? 'Education Updated' : 'Education Added')
26
+ queryClient.invalidateQueries('dashboard')
27
+ hideDialog()
28
+ },
29
+ onError: (err) => {
30
+ console.log(err)
31
+ axiosErrorToast(err)
32
+ },
33
+ })
34
+ const { control, handleSubmit } = useForm({
35
+ resolver: yupResolver(schema),
36
+ defaultValues: {
37
+ ...data,
38
+ startDate: data ? moment(data.startDate).toISOString() : '',
39
+ endDate: data ? moment(data.endDate).toISOString() : '',
40
+ },
41
+ })
42
+ const onSubmit = (formData) => {
43
+ const postBody = {
44
+ ...formData,
45
+ startDate: moment(formData?.startDate).format('YYYY-MM-DD'),
46
+ endDate: moment(formData.endDate).format('YYYY-MM-DD'),
47
+ }
48
+ mutate(postBody)
49
+ }
50
+ const onError = (error) => {
51
+ console.log(error)
52
+ }
53
+
54
+ return (
55
+ <form onSubmit={handleSubmit(onSubmit, onError)}>
56
+ <Stack gap={2.5}>
57
+ <>
58
+ <FormTextField
59
+ control={control}
60
+ name="name"
61
+ label="Name of the education"
62
+ required
63
+ />
64
+ <FormTextField
65
+ control={control}
66
+ name="institution"
67
+ label="Institution"
68
+ required
69
+ />
70
+ <FormDatePicker
71
+ control={control}
72
+ name="startDate"
73
+ label="From Date"
74
+ required
75
+ />
76
+ <FormDatePicker control={control} name="endDate" label="To Date" />
77
+ <FormTextField
78
+ control={control}
79
+ multiline
80
+ rows={4}
81
+ name="description"
82
+ label="Description"
83
+ required
84
+ />
85
+ </>
86
+ </Stack>
87
+ <Stack direction="row" gap={2} mt={3}>
88
+ <ActionButton type="submit" fullWidth loading={isLoading}>
89
+ Submit
90
+ </ActionButton>
91
+ <ActionButton variant="outlined" fullWidth onClick={() => hideDialog()}>
92
+ Cancel
93
+ </ActionButton>
94
+ </Stack>
95
+ </form>
96
+ )
97
+ }
@@ -0,0 +1,27 @@
1
+ import { Avatar, Box, styled } from '@mui/material'
2
+
3
+ export const StyledBox = styled(Box)({
4
+ display: 'flex',
5
+ alignItems: 'center',
6
+ justifyContent: 'space-between',
7
+ })
8
+
9
+ export const StyledBoxContainer = styled(Box)({
10
+ display: 'flex',
11
+ justifyContent: 'space-between',
12
+ alignItems: 'center',
13
+ margin: '10px 5px',
14
+ })
15
+
16
+ export const StyledBoxCard = styled(Box)({
17
+ display: 'grid',
18
+ gridTemplateColumns: 'repeat(auto-fill, minmax(500px, 1fr))',
19
+ gap: '1rem',
20
+ })
21
+
22
+ export const AvatarStyled = styled(Avatar)({
23
+ height: '50px',
24
+ width: '50px',
25
+ backgroundColor: '#F4F4F4',
26
+ marginRight: '10px',
27
+ })
@@ -0,0 +1,47 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import { Typography } from '@mui/material'
3
+ import ActionButton from '../../ActionButton'
4
+ import { DrawerButton } from '../../ModalButtons'
5
+ import NoDataSection from '../NoDataSection'
6
+ import ExperienceCard from './ExperienceCard'
7
+ import { ExperienceForm } from './ExperienceForm'
8
+ import { StyledBoxCard, StyledBoxContainer } from './Styles'
9
+
10
+ const Experience = ({ experiences }) => {
11
+ const isExperience = experiences && experiences.length > 0
12
+
13
+ return isExperience ? (
14
+ <>
15
+ <StyledBoxContainer>
16
+ <Typography variant="h3">Experience</Typography>
17
+ <DrawerButton
18
+ anchor={({ open }) => (
19
+ <ActionButton onClick={open} variant="text">
20
+ +Add Experience
21
+ </ActionButton>
22
+ )}
23
+ content={({ close }) => (
24
+ <ExperienceForm data={null} hideDialog={close} />
25
+ )}
26
+ title="Add Experience"
27
+ />
28
+ </StyledBoxContainer>
29
+ <StyledBoxCard>
30
+ {experiences.map((data) => (
31
+ <ExperienceCard data={data} />
32
+ ))}
33
+ </StyledBoxCard>
34
+ </>
35
+ ) : (
36
+ <NoDataSection
37
+ title="Experience"
38
+ subtitle="Add Experience"
39
+ addButtonTitle="Add Experience"
40
+ addButtonContent={({ close }) => (
41
+ <ExperienceForm data={null} hideDialog={close} />
42
+ )}
43
+ />
44
+ )
45
+ }
46
+
47
+ export default Experience
@@ -0,0 +1,63 @@
1
+ import { Box, Card, Typography } from '@mui/material'
2
+ import moment from 'moment'
3
+ import { EditButton } from '../../IconButtons'
4
+ import { ExperienceIcon } from '../../IconButtons/Icons'
5
+ import { DrawerButton } from '../../ModalButtons'
6
+ import { ExperienceForm } from './ExperienceForm'
7
+ import { AvatarStyled, StyledBox } from './Styles'
8
+
9
+ const ExperienceCard = ({ data }) => {
10
+ return (
11
+ <div>
12
+ <Card
13
+ sx={{
14
+ padding: '20px ',
15
+ }}
16
+ >
17
+ <StyledBox>
18
+ <Box
19
+ sx={{
20
+ display: 'flex',
21
+ }}
22
+ >
23
+ <AvatarStyled>
24
+ <ExperienceIcon />
25
+ </AvatarStyled>
26
+
27
+ <Box sx={{ marginTop: '8px', marginRight: '5px' }}>
28
+ <Typography variant="body2">{data?.title}</Typography>
29
+ <Typography variant="subtitle2">
30
+ {moment(data?.fromDate).format('DD MMMM, YYYY')} -
31
+ {moment(data?.toDate).format('DD MMMM, YYYY')}
32
+ </Typography>
33
+ </Box>
34
+ </Box>
35
+ <Box
36
+ sx={{
37
+ display: 'flex',
38
+ }}
39
+ >
40
+ <DrawerButton
41
+ key={data?.id}
42
+ title={'Edit Experience'}
43
+ anchor={({ open }) => <EditButton onClick={open} />}
44
+ content={({ close }) => (
45
+ <ExperienceForm data={data} hideDialog={close} />
46
+ )}
47
+ />
48
+ </Box>
49
+ </StyledBox>
50
+ <Box
51
+ sx={{
52
+ paddingTop: '10px',
53
+ }}
54
+ >
55
+ <Typography variant="h5">{data?.organizationName}</Typography>
56
+ <Typography variant="subtitle2">{data?.description}</Typography>
57
+ </Box>
58
+ </Card>
59
+ </div>
60
+ )
61
+ }
62
+
63
+ export default ExperienceCard
@@ -0,0 +1,107 @@
1
+ /* eslint-disable no-console */
2
+ import { Stack } from '@mui/material'
3
+ import moment from 'moment'
4
+ import { useForm } from 'react-hook-form'
5
+ import { useMutation, useQuery, useQueryClient } from 'react-query'
6
+ import { toast } from 'react-toastify'
7
+ import * as yup from 'yup'
8
+ import axios, { axiosErrorToast } from '../../../config/axios'
9
+ import ActionButton from '../../ActionButton'
10
+ import { FormDatePicker, FormSingleSelect, FormTextField } from '../../HookForm'
11
+ import { createUpdateExperience } from '../service'
12
+ import { yupResolver } from '@hookform/resolvers/yup'
13
+
14
+ const schema = yup.object().shape({
15
+ experienceType: yup.string().required('Experience Type is required'),
16
+ title: yup.string().required('Title is required'),
17
+ organizationName: yup.string().required('Organization Name is required'),
18
+ })
19
+
20
+ export const ExperienceForm = ({ data, hideDialog }) => {
21
+ const queryClient = useQueryClient()
22
+
23
+ const { data: types } = useQuery('experience-type', () =>
24
+ axios.get('/square/experience/types').then((res) => res.data),
25
+ )
26
+ const { mutate, isLoading } = useMutation(createUpdateExperience, {
27
+ onSuccess: () => {
28
+ toast.success(data ? 'Experience Updated' : 'Experience Added')
29
+ queryClient.invalidateQueries('dashboard')
30
+ hideDialog()
31
+ },
32
+ onError: (err) => {
33
+ console.log(err)
34
+ axiosErrorToast(err)
35
+ },
36
+ })
37
+ const { control, handleSubmit, watch } = useForm({
38
+ resolver: yupResolver(schema),
39
+ defaultValues: {
40
+ ...data,
41
+ fromDate: data ? moment(data.fromDate).toISOString() : '',
42
+ toDate: data ? moment(data.toDate).toISOString() : '',
43
+ },
44
+ })
45
+ const onSubmit = (formData) => {
46
+ const postBody = {
47
+ ...formData,
48
+ fromDate: moment(formData?.fromDate).format('YYYY-MM-DD'),
49
+ toDate: moment(formData.toDate).format('YYYY-MM-DD'),
50
+ }
51
+ mutate(postBody)
52
+ }
53
+ const onError = (error) => {
54
+ console.log(error)
55
+ }
56
+ const selectedType = watch('experienceType')
57
+
58
+ return (
59
+ <form onSubmit={handleSubmit(onSubmit, onError)}>
60
+ <Stack gap={2.5}>
61
+ <FormSingleSelect
62
+ name="experienceType"
63
+ label={'Experience Type'}
64
+ control={control}
65
+ required
66
+ options={types?.map((item) => ({
67
+ value: item,
68
+ label: item,
69
+ }))}
70
+ />
71
+ {selectedType && (
72
+ <>
73
+ <FormTextField
74
+ control={control}
75
+ name="title"
76
+ label="Title"
77
+ required
78
+ />
79
+ <FormTextField
80
+ control={control}
81
+ name="organizationName"
82
+ label="Organisation Name"
83
+ required
84
+ />
85
+ <FormDatePicker control={control} name="fromDate" label="From" />
86
+ <FormDatePicker control={control} name="toDate" label="To" />
87
+ <FormTextField
88
+ control={control}
89
+ name="description"
90
+ label="Description"
91
+ multiline
92
+ rows={4}
93
+ />
94
+ </>
95
+ )}
96
+ </Stack>
97
+ <Stack direction="row" gap={2} mt={3}>
98
+ <ActionButton type="submit" fullWidth loading={isLoading}>
99
+ {data ? 'Edit Experience' : 'Add Experience'}
100
+ </ActionButton>
101
+ <ActionButton variant="outlined" fullWidth onClick={() => hideDialog()}>
102
+ Cancel
103
+ </ActionButton>
104
+ </Stack>
105
+ </form>
106
+ )
107
+ }
@@ -0,0 +1,27 @@
1
+ import { Avatar, Box, styled } from '@mui/material'
2
+
3
+ export const StyledBox = styled(Box)({
4
+ display: 'flex',
5
+ alignItems: 'center',
6
+ justifyContent: 'space-between',
7
+ })
8
+
9
+ export const StyledBoxContainer = styled(Box)({
10
+ display: 'flex',
11
+ justifyContent: 'space-between',
12
+ alignItems: 'center',
13
+ margin: '10px 5px',
14
+ })
15
+
16
+ export const StyledBoxCard = styled(Box)({
17
+ display: 'grid',
18
+ gridTemplateColumns: 'repeat(auto-fill, minmax(500px, 1fr))',
19
+ gap: '1rem',
20
+ })
21
+
22
+ export const AvatarStyled = styled(Avatar)({
23
+ height: '50px',
24
+ width: '50px',
25
+ backgroundColor: '#F4F4F4',
26
+ marginRight: '10px',
27
+ })
@@ -0,0 +1,69 @@
1
+ import FileUploadIcon from '@mui/icons-material/FileUpload'
2
+ import { Box, Typography } from '@mui/material'
3
+ import { DeleteButton } from '../IconButtons'
4
+ import { StyledUploadContainer, StyledUploadedFileContainer } from './Styles'
5
+
6
+ const FileUpload = ({ resource, handleFileInput, onDelete }) => {
7
+ return (
8
+ <Box>
9
+ <Typography sx={{ opacity: '0.5', margin: '10px 0px' }}>
10
+ Attachments
11
+ </Typography>
12
+ {resource ? (
13
+ <FileRender resource={resource} handleDelete={onDelete} />
14
+ ) : (
15
+ <Box></Box>
16
+ )}
17
+ <StyledUploadContainer htmlFor="file">
18
+ <FileUploadIcon />
19
+ <Typography variant="subtitle2" sx={{ margin: '0px 10px' }}>
20
+ Upload Files
21
+ </Typography>
22
+ </StyledUploadContainer>
23
+ <input id="file" type="file" hidden multiple onChange={handleFileInput} />
24
+ </Box>
25
+ )
26
+ }
27
+
28
+ export default FileUpload
29
+
30
+ const FileRender = ({ resource, handleDelete }) => {
31
+ return (
32
+ <>
33
+ {resource.length !== 0 &&
34
+ resource.map((file) => {
35
+ let extension = file?.name?.split('.')[1]
36
+ return (
37
+ <StyledUploadedFileContainer key={file.key}>
38
+ <Box sx={{ display: 'flex', alignItems: 'center' }}>
39
+ {extension === 'pdf' ? (
40
+ <span>
41
+ <img src={'/images/pdf.png'} />
42
+ </span>
43
+ ) : extension === 'pptx' ? (
44
+ <span>
45
+ <img src={'/images/ppt.png'} />
46
+ </span>
47
+ ) : extension === 'txt' ? (
48
+ <span>
49
+ <img src={'/images/doc.png'} />
50
+ </span>
51
+ ) : (
52
+ <span>
53
+ <img src={'/images/jpg.png'} />
54
+ </span>
55
+ )}
56
+
57
+ <Typography sx={{ margin: '0px 10px' }}>
58
+ {file.originalFileName}
59
+ </Typography>
60
+ </Box>
61
+ {handleDelete && (
62
+ <DeleteButton onClick={() => handleDelete(file.key)} />
63
+ )}
64
+ </StyledUploadedFileContainer>
65
+ )
66
+ })}
67
+ </>
68
+ )
69
+ }