-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #674 from codeforpdx/Development
Final Update from 0.13.0 to 1.0.0-alpha
- Loading branch information
Showing
131 changed files
with
4,540 additions
and
1,593 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
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.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
VITE_SOLID_IDENTITY_PROVIDER="http://localhost:3000/" | ||
VITE_SOLID_POD_SERVER="http://localhost:3000/" | ||
VITE_SUGGESTED_OIDC_OPTIONS="http://localhost:3000/, https://opencommons.net/, https://solidcommunity.net/, https://login.inrupt.com/, https://inrupt.net/" | ||
VITE_OIDC_WEBIDS = '{"http://localhost:3000/": "http://localhost:3000/user/profile/card#me", "https://opencommons.net/": "http://opencommons.net/user/profile/card#me", "https://solidcommunity.net/": "https://user.solidcommunity.net/profile/card#me", "https://login.inrupt.com/": "https://id.inrupt.com/user", "https://inrupt.net/": "https://id.inrupt.com/user"}' | ||
VITE_CLIENT_ID_DOC="http://localhost:3000/clientAppId.json" |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,8 +1,186 @@ | ||
// React Imports | ||
import React from 'react'; | ||
// MUI Imports | ||
import Typography from '@mui/material/Typography'; | ||
import React, { useEffect, useState } from 'react'; | ||
// Material UI Imports | ||
import Button from '@mui/material/Button'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
import ClearIcon from '@mui/icons-material/Clear'; | ||
import FormControl from '@mui/material/FormControl'; | ||
import FormHelperText from '@mui/material/FormHelperText'; | ||
import Grid from '@mui/material/Grid'; | ||
import InputLabel from '@mui/material/InputLabel'; | ||
import MenuItem from '@mui/material/MenuItem'; | ||
import Select from '@mui/material/Select'; | ||
import TextField from '@mui/material/TextField'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
// Dependency Imports | ||
import dayjs from 'dayjs'; | ||
// Custom Hooks Imports | ||
import { useCivicProfile, useNotification } from '@hooks'; | ||
// Component Imports | ||
import { FormSection } from '../Form'; | ||
|
||
const BasicInfo = () => <Typography>Basic Info</Typography>; | ||
/** | ||
* BasicInfo - A form to fill out basic user info | ||
* | ||
* @memberof CivicProfileForms | ||
* @name BasicInfo | ||
* @returns {React.JSX.Element} The BasicInfo Component | ||
*/ | ||
const BasicInfo = () => { | ||
const { data, add, isSuccess, storedDataset, refetch } = useCivicProfile(); | ||
const { addNotification } = useNotification(); | ||
const [formData, setFormData] = useState({ | ||
firstName: '', | ||
lastName: '', | ||
dateOfBirth: null, | ||
gender: 9 | ||
}); | ||
|
||
useEffect(() => { | ||
if (isSuccess) { | ||
setFormData((prevFormData) => ({ ...prevFormData, ...data })); | ||
} | ||
}, [isSuccess, data]); | ||
useEffect(() => { | ||
if (!storedDataset) { | ||
refetch(); | ||
} | ||
}, [storedDataset]); | ||
const handleChange = (e) => { | ||
if (e.$isDayjsObject) { | ||
setFormData((prevFormData) => ({ | ||
...prevFormData, | ||
dateOfBirth: e.toDate() | ||
})); | ||
} else if (e.target) { | ||
const { name, value } = e.target; | ||
setFormData((prevFormData) => ({ ...prevFormData, [name]: value })); | ||
} | ||
}; | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
if (!isSuccess || !storedDataset) { | ||
return; | ||
} | ||
add(formData); | ||
addNotification('success', `Form submitted!`); | ||
}; | ||
|
||
const handleClear = () => { | ||
setFormData((prevFormData) => ({ | ||
...prevFormData, | ||
firstName: '', | ||
lastName: '', | ||
dateOfBirth: null, | ||
gender: 9 | ||
})); | ||
|
||
addNotification('success', `Form cleared!`); | ||
}; | ||
|
||
return ( | ||
<FormSection title="Basic Information"> | ||
<form aria-labelledby="hmis-basic-info-form" onSubmit={handleSubmit} autoComplete="off"> | ||
<Grid container spacing={2} mt={0} mb={2}> | ||
<Grid item xs={12} md={6}> | ||
<TextField | ||
id="hmis-basic-info-first-name" | ||
name="firstName" | ||
label="Legal first name" | ||
onChange={handleChange} | ||
value={formData.firstName} | ||
fullWidth | ||
autoFocus | ||
/> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<TextField | ||
id="hmis-basic-info-last-name" | ||
name="lastName" | ||
label="Legal last name" | ||
onChange={handleChange} | ||
value={formData.lastName} | ||
fullWidth | ||
/> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<FormControl fullWidth> | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DatePicker | ||
id="hmis-basic-info-date-of-birth" | ||
name="dateOfBirth" | ||
label="Date of birth" | ||
onChange={handleChange} | ||
value={formData.dateOfBirth ? dayjs(formData.dateOfBirth) : null} | ||
format="YYYY-MM-DD" | ||
type="date" | ||
disableFuture | ||
openTo="year" | ||
views={['year', 'month', 'day']} | ||
/> | ||
</LocalizationProvider> | ||
<FormHelperText>YYYY-MM-DD</FormHelperText> | ||
</FormControl> | ||
</Grid> | ||
<Grid item xs={12} md={6}> | ||
<FormControl fullWidth> | ||
<InputLabel id="hmis-basic-info-gender">Gender</InputLabel> | ||
<Select | ||
id="hmis-basic-info-gender-select" | ||
name="gender" | ||
label="Gender" | ||
onChange={handleChange} | ||
value={formData.gender} | ||
labelId="hmis-basic-info-gender" | ||
defaultValue={9} | ||
> | ||
<MenuItem value={0}>Female</MenuItem> | ||
<MenuItem value={1}>Male</MenuItem> | ||
<MenuItem value={2}>Transgender male to female</MenuItem> | ||
<MenuItem value={3}>Transgender female to male</MenuItem> | ||
<MenuItem value={4}>Don't identify as male, female or transgender</MenuItem> | ||
<MenuItem value={8}>Don't know</MenuItem> | ||
<MenuItem value={9}>Decline to answer</MenuItem> | ||
</Select> | ||
</FormControl> | ||
</Grid> | ||
</Grid> | ||
<Grid container spacing={1}> | ||
<Grid item xs={12} sm={6}> | ||
<Button | ||
variant="outlined" | ||
type="button" | ||
label="Clear button" | ||
color="error" | ||
startIcon={<ClearIcon />} | ||
fullWidth | ||
onClick={handleClear} | ||
aria-label="Clear button" | ||
> | ||
Clear | ||
</Button> | ||
</Grid> | ||
<Grid item xs={12} sm={6}> | ||
<Button | ||
variant="contained" | ||
type="submit" | ||
label="Submit button" | ||
color="primary" | ||
startIcon={<CheckIcon />} | ||
fullWidth | ||
disabled={!isSuccess} | ||
aria-label="Submit button" | ||
> | ||
Submit | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
</form> | ||
</FormSection> | ||
); | ||
}; | ||
|
||
export default BasicInfo; |
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,8 +1,13 @@ | ||
// React Imports | ||
import React from 'react'; | ||
// MUI Imports | ||
import Typography from '@mui/material/Typography'; | ||
// // React Imports | ||
// import React from 'react'; | ||
// // Material UI Imports | ||
// import Typography from '@mui/material/Typography'; | ||
// import { FormSection } from '../Form'; | ||
|
||
const FinancialInfo = () => <Typography>Financial Info</Typography>; | ||
// const FinancialInfo = () => ( | ||
// <FormSection title="Financial Information"> | ||
// <Typography>To be completed</Typography> | ||
// </FormSection> | ||
// ); | ||
|
||
export default FinancialInfo; | ||
// export default FinancialInfo; |
Oops, something went wrong.