Skip to content

Commit

Permalink
Merge pull request #674 from codeforpdx/Development
Browse files Browse the repository at this point in the history
Final Update from 0.13.0 to 1.0.0-alpha
  • Loading branch information
leekahung committed Sep 4, 2024
2 parents 27165c3 + 9396c90 commit 89e0a4f
Show file tree
Hide file tree
Showing 131 changed files with 4,540 additions and 1,593 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Bug report
about: Create a bug report
title: '[Bug Report] - Your Title Here'
labels: 'bug'
projects: 'PASS'
assignees: ''

---
Expand Down Expand Up @@ -35,4 +36,4 @@ Steps to reproduce the behavior:
If you have a suggestion for how to fix the bug, please provide details here.

### Additional context:
Add any other context about the problem here.
Add any other context about the problem here.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/enhancement_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Enhancement request
about: Suggest an enhancement for this project
title: '[Enhancement] - Your Title Here'
labels: enhancement
projects: 'PASS'
assignees: ''
---

Expand Down Expand Up @@ -31,4 +32,4 @@ Discuss any potential drawbacks or negative impacts this enhancement might have,
Mention any alternative solutions or enhancements you've considered. Why were they not chosen or why are they less desirable than your proposal?

### Additional Context:
Add any other context or screenshots about the enhancement request here.
Add any other context or screenshots about the enhancement request here.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Feature request
about: Suggest an idea for this project
title: '[Feature Request] - Your Title Here '
labels: 'new feature'
projects: 'PASS'
assignees: ''

---
Expand All @@ -20,4 +21,4 @@ If you have a specific solution in mind, outline it here. Include as many detail
A clear and concise description of any alternative solutions or features you've considered and why they could or could not work.

### Additional Context:
Add any other context or screenshots about the feature request here. If you have mock-ups, prototypes, or any visual aids that could help illustrate the feature, please include them.
Add any other context or screenshots about the feature request here. If you have mock-ups, prototypes, or any visual aids that could help illustrate the feature, please include them.
15 changes: 0 additions & 15 deletions .github/workflows/add_project_to_issue.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Code for PDX
Copyright (c) 2022 CODE PDX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions env.template
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"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "pass",
"homepage": ".",
"version": "0.12.0",
"version": "1.0.0-alpha",
"description": "",
"scripts": {
"start": "concurrently --kill-others \"npm run dev\" \"npm run podserver\"",
"start": "concurrently --kill-others \"npm run podserver\" \"npm run dev\"",
"dev": "vite --host",
"build": "vite build",
"test": "vitest",
Expand Down
Binary file added public/assets/app-blue.webp
Binary file not shown.
Binary file removed public/assets/app-green.png
Binary file not shown.
Binary file added public/assets/key-features-blue.webp
Binary file not shown.
Binary file removed public/assets/key-features-green.png
Binary file not shown.
Binary file added public/assets/web-security-blue.webp
Binary file not shown.
Binary file removed public/assets/web-security-green.png
Binary file not shown.
6 changes: 3 additions & 3 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { SessionProvider } from '@contexts';
// Material UI Imports
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { ThemeProvider } from '@mui/material/styles';
// Context Imports
import { SessionProvider } from '@contexts';
import UserDataContextProvider from './contexts/UserDataContext';
import { NotificationContextProvider } from './contexts/NotificationContext';
// Theme Imports
Expand All @@ -18,7 +18,7 @@ import Layout from './layouts/Layout';
const queryClientConfig = {
defaultOptions: {
queries: {
staleTime: 1000 * 60 // one minute
staleTime: 1000 * 60 // One minute
}
}
};
Expand Down
9 changes: 8 additions & 1 deletion src/AppRoutes.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// React Imports
import React from 'react';
import { Routes, Route, Navigate, Outlet } from 'react-router-dom';
import { Routes, Route, Navigate, Outlet, useLocation } from 'react-router-dom';
// Inrupt Imports
import { useSession } from '@hooks';
// Component Imports
Expand All @@ -23,6 +23,11 @@ const AppRoutes = () => {
const restorePath = localStorage.getItem('restorePath');
const loggedIn = session.info.isLoggedIn;
const path = loggedIn ? restorePath || '/contacts' : '/';
const location = useLocation();

if (location.pathname === '/civic-profile') {
return <Navigate to="/civic-profile/basic-info" replace />;
}

return (
<Routes>
Expand Down Expand Up @@ -53,9 +58,11 @@ const AppRoutes = () => {
))}
</Route>
<Route path="/profile" element={<Profile />} />
{/* TODO: Remove blank Civic Profile page, ensure it directs Basic Information instead */}
<Route path="/civic-profile" element={<CivicProfile />}>
{CIVIC_FORM_LIST.map((formProps) => (
<Route
key={formProps.path}
{...formProps}
element={
<FormLayout>
Expand Down
186 changes: 182 additions & 4 deletions src/components/CivicProfileForms/BasicInfo.jsx
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&apos;t identify as male, female or transgender</MenuItem>
<MenuItem value={8}>Don&apos;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;
17 changes: 11 additions & 6 deletions src/components/CivicProfileForms/FinancialInfo.jsx
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;
Loading

0 comments on commit 89e0a4f

Please sign in to comment.