generated from hack4impact-uiuc/mern-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create basic endpoint skeleton * get endpoint 500 error * Fix routing * Get member endpoint to work * Return more fields from endpoint * Return object id from endpoint * Add filterSensitiveInfo util * Give all non-required Member fields a default of null * Move passport-setup to utils * Remove console.log * Add members endpoints * Fix filterSensitiveInfo util * Use passport-setup.js in utils * Use auth endpoint * Move /api/auth/user to /api/members/current * Add omit fields to GET /:memberId * Change current user endpoint in frontend * Add more auth utils * Use isDirector from module in members routes * Change level default in model back to TBD * Add level priority explanation * Add detailed permission checking in members endpoint * Fix difference function * Fix typos in user-utils * Add _id as neverEditable field * Fix allFields not being checked correctly * Filter viewable fields when returning from PUT * Pull enum options from backend * Add status options to endpoint * Disable dropdowns * Add labels to fields * Create wrapper for getting member by ID * Add boolean selector * Add number fields * Add fields for basic string attributes * Retrieve schema type from DB * Move preprocessing to backend * Fix enum type detection * Remove duplicated code * Fix attribute change error * Run formatter * Remove warnings * Format client * Populate edit fields from DB * Add types to props * Run formatter * Remove alert * Run formatter * Get permissions from backend * Disable input boxes if missing permissions * Add enum dropdowns * Format client * Remove user ID override * Change to ES6 defaults * Remove unused package * Change var to let * Concisen member options endpoint * Delete env file * Unexport schema * Use concise property iteration * Make /options endpoint concise * Remove unneeded exports * Capitalize constant * Shorten attribute change callback * Run formatter * Turn off default-props in linter * Fix var name typo * Change member page routing * Run formatter * Use useParams hook * Change object syntax * Run formatter * Link "View Profile" to current logged-in user * Fix lint, ignore _id * Run format * Don't show mongo ID * Rename Member.js to Profile.js * Run formatter * Store fields in value instead of placeholder Co-authored-by: ishaansharma <[email protected]> Co-authored-by: Jeffrey Tang <[email protected]>
- Loading branch information
1 parent
c74feb5
commit 27ed934
Showing
17 changed files
with
1,397 additions
and
48 deletions.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
client/src/components/EditableAttribute/BooleanAttribute.js
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,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import EnumAttribute from './EnumAttribute'; | ||
|
||
const BooleanAttribute = ({ | ||
value = '', | ||
attributeLabel = '', | ||
isDisabled = false, | ||
onChange, | ||
}) => { | ||
const VALUE_OPTIONS = [ | ||
{ label: 'Yes', value: 'true' }, | ||
{ label: 'No', value: 'false' }, | ||
]; | ||
|
||
return ( | ||
<EnumAttribute | ||
value={value} | ||
attributeLabel={attributeLabel} | ||
valueOptions={VALUE_OPTIONS} | ||
isDisabled={isDisabled} | ||
onChange={onChange} | ||
/> | ||
); | ||
}; | ||
|
||
BooleanAttribute.propTypes = { | ||
value: PropTypes.string, | ||
attributeLabel: PropTypes.string, | ||
isDisabled: PropTypes.bool, | ||
onChange: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default BooleanAttribute; |
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,35 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import DatePicker from 'react-datepicker'; | ||
import 'react-datepicker/dist/react-datepicker.css'; | ||
|
||
const DateAttribute = ({ | ||
value = '', | ||
attributeLabel = '', | ||
isDisabled = false, | ||
onChange, | ||
}) => { | ||
const onValueChange = date => { | ||
onChange(date, attributeLabel); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<p>{attributeLabel}</p> | ||
<DatePicker | ||
onChange={onValueChange} | ||
selected={value} | ||
disabled={isDisabled} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
DateAttribute.propTypes = { | ||
value: PropTypes.string, | ||
attributeLabel: PropTypes.string, | ||
isDisabled: PropTypes.bool, | ||
onChange: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default DateAttribute; |
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,40 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Select from 'react-select'; | ||
|
||
const EnumAttribute = ({ | ||
value = '', | ||
valueOptions = [], | ||
attributeLabel = '', | ||
isDisabled = false, | ||
onChange, | ||
}) => { | ||
const onValueChange = option => { | ||
onChange(option, attributeLabel); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<p>{attributeLabel}</p> | ||
<Select | ||
defaultValue={value} | ||
value={value} | ||
placeholder={value} | ||
isDisabled={isDisabled} | ||
name={attributeLabel} | ||
options={valueOptions} | ||
onChange={onValueChange} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
EnumAttribute.propTypes = { | ||
value: PropTypes.string, | ||
valueOptions: PropTypes.arrayOf(PropTypes.string), | ||
attributeLabel: PropTypes.string, | ||
isDisabled: PropTypes.bool, | ||
onChange: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default EnumAttribute; |
37 changes: 37 additions & 0 deletions
37
client/src/components/EditableAttribute/StringAttribute.js
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,37 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { TextField } from '@hack4impact-uiuc/bridge'; | ||
|
||
const StringAttribute = ({ | ||
type = 'text', | ||
value = '', | ||
attributeLabel = '', | ||
isDisabled = false, | ||
onChange, | ||
}) => { | ||
const onValueChange = e => { | ||
onChange(e.target.value, attributeLabel); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<p>{attributeLabel}</p> | ||
<TextField | ||
type={type} | ||
value={value} | ||
onChange={onValueChange} | ||
disabled={isDisabled} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
StringAttribute.propTypes = { | ||
type: PropTypes.string, | ||
value: PropTypes.string, | ||
attributeLabel: PropTypes.string, | ||
isDisabled: PropTypes.bool, | ||
onChange: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default StringAttribute; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.
27ed934
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: