-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Event API integration complete (#145)
* Got a lot of event api integration done, but not all. Still event edit page left, probably the trickiest one of them all. Other than that not sure if there is anything else that uses event services (if there are then we can refactor with the new event api functions). Just set up the user api functions file, have not done any integration for user api. * Added autocompletion component * Finished with integration for event edit page. * Added changes to address review of PR #145. * Removed duplicate config to turn off import/prefer-default-export. * Just for deploy preview.
- Loading branch information
1 parent
8c6e5f5
commit 1818d7a
Showing
43 changed files
with
1,312 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"import/order": [ | ||
|
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
|
||
# These owners will be the default owners for everything in the repo. | ||
@HKN-UCSD/SoftwareDevs | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
frontend/src/components/autocomplete/OfficerNameAutocomplete/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
import { BaseAutocomplete } from '../base'; | ||
|
||
import { getMultipleUsers, getUserNames } from '@Services/UserService'; | ||
|
||
type OfficerNameData = { | ||
id: number; | ||
firstName: string; | ||
lastName: string; | ||
}; | ||
|
||
type OfficerAutocompleteProp = { | ||
name: string; | ||
label: string; | ||
fullWidth: boolean; | ||
}; | ||
|
||
export const OfficerNameAutocomplete = (props: OfficerAutocompleteProp) => { | ||
const { name, label, fullWidth } = props; | ||
const [officerNames, setOfficerNames] = useState<OfficerNameData[]>([]); | ||
|
||
useEffect(() => { | ||
getMultipleUsers({ | ||
officers: true, | ||
names: true, | ||
}).then(officerNameArr => { | ||
setOfficerNames(getUserNames(officerNameArr)); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<BaseAutocomplete | ||
name={name} | ||
label={label} | ||
multiple | ||
filterSelectedOptions | ||
options={officerNames} | ||
getOptionLabel={option => `${option.firstName} ${option.lastName}`} | ||
getOptionSelected={(option, value) => | ||
option.id === value.id && | ||
option.firstName === value.firstName && | ||
option.lastName === value.lastName | ||
} | ||
fullWidth={fullWidth} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import { Field } from 'formik'; | ||
import { Autocomplete } from 'formik-material-ui-lab'; | ||
import { TextField } from '@material-ui/core'; | ||
import { AutocompleteRenderInputParams } from '@material-ui/lab/Autocomplete'; | ||
|
||
type BaseAutoCompleteProp = { | ||
name: string; | ||
label: string; | ||
options: Array<any>; | ||
getOptionSelected?: (option: any, value?: any) => any; | ||
getOptionLabel?: (option: any) => any; | ||
multiple?: boolean; | ||
filterSelectedOptions?: boolean; | ||
fullWidth?: boolean; | ||
}; | ||
|
||
export const BaseAutocomplete = ({ | ||
name, | ||
label, | ||
options, | ||
getOptionSelected, | ||
getOptionLabel, | ||
multiple = false, | ||
filterSelectedOptions = false, | ||
fullWidth = false, | ||
}: BaseAutoCompleteProp) => { | ||
return ( | ||
<Field | ||
name={name} | ||
options={options} | ||
getOptionLabel={getOptionLabel} | ||
getOptionSelected={getOptionSelected} | ||
component={Autocomplete} | ||
multiple={multiple} | ||
filterSelectedOptions={filterSelectedOptions} | ||
fullWidth={fullWidth} | ||
renderInput={(params: AutocompleteRenderInputParams) => ( | ||
<TextField {...params} label={label} variant='outlined' /> | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
BaseAutocomplete.defaultProps = { | ||
multiple: false, | ||
filterSelectedOptions: false, | ||
fullWidth: false, | ||
getOptionLabel: () => { | ||
return null; | ||
}, | ||
getOptionSelected: () => { | ||
return null; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { OfficerNameAutocomplete } from './OfficerNameAutocomplete'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
frontend/src/components/dropdowns/AffiliateDropdownField/styles.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const EVENT_STATUS = { | ||
PENDING: 'pending', | ||
READY: 'ready', | ||
COMPLETE: 'complete', | ||
}; | ||
|
||
export default EVENT_STATUS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
const EVENT_TAGS = { | ||
PROFESSIONAL: 'Professional', | ||
TECHNICAL: 'Technical', | ||
SOCIAL: 'Social', | ||
PROFESSIONAL: 'professional', | ||
TECHNICAL: 'technical', | ||
SOCIAL: 'social', | ||
MENTORSHIP: 'mentorship', | ||
}; | ||
|
||
export default EVENT_TAGS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.