-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
520 frontend implement profile editing (#526)
* working edit popups * fix undefined errors and lazy load * remove unused file * make reusable component for handling the modal submission logic * refactor panel opening logic * fix builds * fix phone bug * move all into submit handler instead
- Loading branch information
1 parent
f5ae030
commit ffe5305
Showing
13 changed files
with
384 additions
and
92 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
31 changes: 0 additions & 31 deletions
31
client/src/components/composite/Profile/ProfileCalendarCard/ProfileCalendarCard.tsx
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,36 @@ | ||
import { ReducedUserAdditionalInfo } from "models/User" | ||
import { useSelfDataQuery } from "services/User/UserQueries" | ||
import WrappedProfileEdit, { IGeneralProfileEdit } from "./WrappedProfileEdit" | ||
|
||
type EditAdditionalFields = Pick< | ||
Partial<ReducedUserAdditionalInfo>, | ||
"does_snowboarding" | "does_ski" | "dietary_requirements" | ||
> | ||
|
||
/** | ||
* Allows the user to edit the miscellaneous information. | ||
*/ | ||
const EditAdditionalPanel = ({ isOpen, handleClose }: IGeneralProfileEdit) => { | ||
const { data: currentUserData } = useSelfDataQuery() | ||
return ( | ||
<WrappedProfileEdit<EditAdditionalFields> | ||
isOpen={isOpen} | ||
handleClose={handleClose} | ||
fields={[ | ||
{ | ||
fieldName: "dietary_requirements", | ||
defaultFieldValue: currentUserData?.dietary_requirements | ||
}, | ||
{ | ||
fieldName: "does_ski", | ||
defaultFieldValue: currentUserData?.does_ski | ||
}, | ||
{ | ||
fieldName: "does_snowboarding", | ||
defaultFieldValue: currentUserData?.does_snowboarding | ||
} | ||
]} | ||
></WrappedProfileEdit> | ||
) | ||
} | ||
export default EditAdditionalPanel |
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,61 @@ | ||
import { ReducedUserAdditionalInfo } from "models/User" | ||
import { useSelfDataQuery } from "services/User/UserQueries" | ||
import WrappedProfileEdit, { IGeneralProfileEdit } from "./WrappedProfileEdit" | ||
|
||
type EditPersonalFields = Pick< | ||
Partial<ReducedUserAdditionalInfo>, | ||
| "first_name" | ||
| "last_name" | ||
| "gender" | ||
| "student_id" | ||
| "date_of_birth" | ||
| "phone_number" | ||
| "emergency_contact" | ||
> | ||
|
||
/** | ||
* Displays the fields required to edit the personal section | ||
* | ||
* TODO: extend to include editing auth details (email etc) | ||
*/ | ||
const EditPersonalPanel = ({ isOpen, handleClose }: IGeneralProfileEdit) => { | ||
const { data: currentUserData } = useSelfDataQuery() | ||
return ( | ||
<WrappedProfileEdit<EditPersonalFields> | ||
isOpen={isOpen} | ||
handleClose={handleClose} | ||
fields={[ | ||
{ | ||
fieldName: "first_name", | ||
defaultFieldValue: currentUserData?.first_name | ||
}, | ||
{ | ||
fieldName: "last_name", | ||
defaultFieldValue: currentUserData?.last_name | ||
}, | ||
|
||
{ | ||
fieldName: "gender", | ||
defaultFieldValue: currentUserData?.gender | ||
}, | ||
{ | ||
fieldName: "date_of_birth", | ||
defaultFieldValue: currentUserData?.date_of_birth | ||
}, | ||
{ | ||
fieldName: "phone_number", | ||
defaultFieldValue: currentUserData?.phone_number | ||
}, | ||
{ | ||
fieldName: "emergency_contact", | ||
defaultFieldValue: currentUserData?.emergency_contact | ||
}, | ||
{ | ||
fieldName: "student_id", | ||
defaultFieldValue: currentUserData?.student_id | ||
} | ||
]} | ||
></WrappedProfileEdit> | ||
) | ||
} | ||
export default EditPersonalPanel |
Oops, something went wrong.