diff --git a/backend/README.md b/backend/README.md index 095f2e91..f285d864 100644 --- a/backend/README.md +++ b/backend/README.md @@ -27,11 +27,11 @@ Run `python -V` to check the Python version. #### Configuration -The API configuration must be specified before running the application. Configuration variables are specified as entries within a `.env` file located within the `api-v2` directory. To get started, create a `.env` file within `/api-v2` and copy the values from `.env.example` into the new `.env` file. You may have to contact someone from the development team to get the necessary values. +The API configuration must be specified before running the application. Configuration variables are specified as entries within a `.env` file located within the `backend` directory. To get started, create a `.env` file within `/backend` and copy the values from `.env.example` into the new `.env` file. You may have to contact someone from the development team to get the necessary values. #### Setup and Run -Once the `.env` file has been configured and Poetry is installed, run the following commands in the `api-v2` directory to install the required development dependencies and run the application. +Once the `.env` file has been configured and Poetry is installed, run the following commands in the `backend` directory to install the required development dependencies and run the application. ```shell poetry install # Installs all dependencies diff --git a/frontend/.husky/pre-commit b/frontend/.husky/pre-commit index 24586419..73f95b65 100755 --- a/frontend/.husky/pre-commit +++ b/frontend/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -cd app +cd frontend npm run pre-commit diff --git a/frontend/README.md b/frontend/README.md index 3ee5703e..2f382c18 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -14,11 +14,11 @@ The minimum node version enforced is currently 20+, which is the current LTS ver 1. Clone the repository to a directory on your computer 2. Inside a terminal change directories to the root `HomeUniteUs/` directory -3. Navigate to the the `app/` directory `cd app/` +3. Navigate to the the `frontend/` directory: `cd frontend/` 4. Run the command `npm install` to download all dependencies from the local package.json 5. Create a local `.env` file and copy the contents from `.env.example` 6. Message a team member to obtain values for the .env file -7. From the `app/` directory run `npm run dev` to start a development server at `http://127.0.0.1:4040/` +7. From the `frontend/` directory run `npm run dev` to start a development server at `http://127.0.0.1:4040/` The setup for the front end application is now complete and you should see the website running in your browser at the listed port. @@ -62,11 +62,29 @@ For production builds, vite preforms a string replacement on the `import.meta.en The table below describes the environment variables that are used by this app: -| Variable | Required? | Example | Description | -|----------|-----------|---------|-------------| -| `VITE_HUU_API_BASE_URL` | YES | http://localhost:8080/api/ | The HUU API's base URL. In a development environment (mode is 'development' or 'test'): if this variable is not defined, then `http://localhost:4040/api/` will be used by default. In non-development environment: if this variable is not defined, then the build will throw an error. | -| | | | | +| Variable | Required? | Example | Description | +| ----------------------- | --------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `VITE_HUU_API_BASE_URL` | YES | http://localhost:8080/api/ | The HUU API's base URL. In a development environment (mode is 'development' or 'test'): if this variable is not defined, then `http://localhost:4040/api/` will be used by default. In non-development environment: if this variable is not defined, then the build will throw an error. | +| | | | | ## Production This application is statically compiled using `npm run build`. The files created by the build command are placed in a `dist` directory. Those files are then placed into a directory served by `Nginx`. The configuration environment variables are expected to exist prior to building this application. + +## Folder Structure + +The `frontend/` directory is organized as follows: + +- `src/` - The source code for the frontend application + - `features/` - Contains the components for the application organized by feature as well as a `/ui` for shared components + - `feature/` - Inside the features folder are folders containing components for a specific feature along with any other required files. + - `hooks/` - Hooks related to the feature + - `helpers/` - Helper functions related to the feature + - `__tests__` - Tests for components in the feature + - `index.ts` - A file that exports any components that need to be accessed outside of the feature folder + - `pages/` - Contains all pages that are rendered by the application. These can be organized by features and contain `hooks/`, `helpers/`, and `__tests__` subfolders as well. + - `hooks/` - Hooks that are shared across the application + - `redux/` - Contains the redux store, state slices, and helpers for the application + - `services/` - Code related to interfacing with any external APIs + - `theme/` - Any files related to MUI theming and overrides + - `utils/` - All utility functions used throughout the application diff --git a/frontend/package.json b/frontend/package.json index 53eaef1b..aa022ed6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,7 +21,7 @@ "build-storybook": "build-storybook", "lint": "eslint . --ext ts --ext tsx --max-warnings 0 --fix", "type-check": "npx tsc --noEmit", - "prepare": "cd .. && husky install app/.husky", + "prepare": "cd .. && husky install frontend/.husky", "pre-commit": "lint-staged", "generate": "npx @rtk-query/codegen-openapi openapi-config.ts", "check-node-version": "node check-node-version.mjs", diff --git a/frontend/src/img/admin-icon.svg b/frontend/public/images/admin-icon.svg similarity index 100% rename from frontend/src/img/admin-icon.svg rename to frontend/public/images/admin-icon.svg diff --git a/frontend/src/img/avatar.png b/frontend/public/images/avatar.png similarity index 100% rename from frontend/src/img/avatar.png rename to frontend/public/images/avatar.png diff --git a/frontend/src/img/favicon.png b/frontend/public/images/favicon.png similarity index 100% rename from frontend/src/img/favicon.png rename to frontend/public/images/favicon.png diff --git a/frontend/src/favicon.svg b/frontend/public/images/favicon.svg similarity index 100% rename from frontend/src/favicon.svg rename to frontend/public/images/favicon.svg diff --git a/frontend/src/img/guest-icon.svg b/frontend/public/images/guest-icon.svg similarity index 100% rename from frontend/src/img/guest-icon.svg rename to frontend/public/images/guest-icon.svg diff --git a/frontend/src/img/host-icon.svg b/frontend/public/images/host-icon.svg similarity index 100% rename from frontend/src/img/host-icon.svg rename to frontend/public/images/host-icon.svg diff --git a/frontend/src/img/huu.svg b/frontend/public/images/huu.svg similarity index 100% rename from frontend/src/img/huu.svg rename to frontend/public/images/huu.svg diff --git a/frontend/src/logo.svg b/frontend/public/images/logo.svg similarity index 100% rename from frontend/src/logo.svg rename to frontend/public/images/logo.svg diff --git a/frontend/src/img/spy.png b/frontend/public/images/spy.png similarity index 100% rename from frontend/src/img/spy.png rename to frontend/public/images/spy.png diff --git a/frontend/src/components/authentication/AccountVerificationForm.tsx b/frontend/src/components/authentication/AccountVerificationForm.tsx deleted file mode 100644 index 9c11f88e..00000000 --- a/frontend/src/components/authentication/AccountVerificationForm.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import React from 'react'; -import { - OutlinedInput, - Stack, - InputLabel, - FormHelperText, - Button, -} from '@mui/material'; -import {styled} from '@mui/system'; -import {useFormik} from 'formik'; -import {object, string} from 'yup'; -import {VerificationRequest} from '../../services/auth'; - -interface AccountVerificationFormProps { - onSubmit: ({email, code}: VerificationRequest) => Promise; -} - -const codeValidationSchema = object({ - email: string().email().required('email is required'), - code: string() - .required('code is required') - .length(6, 'code must be 6 characters'), -}); - -export const AccountVerificationForm = ({ - onSubmit, -}: AccountVerificationFormProps) => { - const {handleSubmit, handleChange, values, touched, errors} = useFormik({ - initialValues: { - email: '', - code: '', - }, - validationSchema: codeValidationSchema, - onSubmit: values => { - onSubmit(values); - }, - }); - - return ( -
- - Email address - - {touched.email && errors.email && ( - {errors.email} - )} - - - Verification Code - - {touched.code && errors.code && ( - {errors.code} - )} - - - - - -
- ); -}; - -const Form = styled('form')({ - width: '100%', - display: 'flex', - flexDirection: 'column', - alignItems: 'stretch', - gap: '1rem', -}); diff --git a/frontend/src/components/authentication/index.ts b/frontend/src/components/authentication/index.ts deleted file mode 100644 index 7e42bf1c..00000000 --- a/frontend/src/components/authentication/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {CodeField} from './CodeField'; -export {FormContainer} from './FormContainer'; -export {PasswordField} from './PasswordField'; diff --git a/frontend/src/components/common/AppContainer.tsx b/frontend/src/components/common/AppContainer.tsx deleted file mode 100644 index fd72e63c..00000000 --- a/frontend/src/components/common/AppContainer.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import {Container} from '@mui/material'; -import {styled} from '@mui/system'; -import React from 'react'; - -const MaxWidthContainer = styled(Container)({ - height: '100vh', - maxWidth: '1400px', -}); - -interface AppContainerProps {} - -export const AppContainer = ({ - children, -}: React.PropsWithChildren) => { - return {children}; -}; diff --git a/frontend/src/components/common/Avatar.tsx b/frontend/src/components/common/Avatar.tsx deleted file mode 100644 index 293e7a6a..00000000 --- a/frontend/src/components/common/Avatar.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import {Avatar as MUIAvatar} from '@mui/material'; -import {styled} from '@mui/system'; - -interface AvatarProps { - name: string | undefined; - image: string | undefined; -} - -export const Avatar = ({name = 'No Name', image = ''}: AvatarProps) => { - return ( - - - - ); -}; - -const AvatarContainer = styled('div')(({theme}) => ({ - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - border: `1px solid ${theme.palette.grey[400]}`, - borderRadius: '50%', - height: 50, - width: 50, -})); diff --git a/frontend/src/components/common/HomeLink.tsx b/frontend/src/components/common/HomeLink.tsx deleted file mode 100644 index 0d5c3901..00000000 --- a/frontend/src/components/common/HomeLink.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import {Typography} from '@mui/material'; -import {styled} from '@mui/system'; -import {NavLink} from 'react-router-dom'; - -interface HomeLinkProps { - to: string; - name: string; -} - -export const HomeLink = ({ - to, - name, - children, -}: React.PropsWithChildren) => { - return ( - - {children} - {name} - - ); -}; - -const Link = styled(NavLink)(({theme}) => ({ - height: '11.625rem', - width: '11.625rem', - display: 'flex', - flexDirection: 'column', - justifyContent: 'center', - alignItems: 'center', - border: `1px solid ${theme.palette.grey[300]}`, - borderRadius: 26, - textDecoration: 'none', - transition: 'all 0.2s ease', - color: `${theme.palette.primary.main}`, - '&:hover': { - backgroundColor: `${theme.palette.primary.main}`, - color: '#fff', - }, -})); - -const Text = styled(Typography)({ - fontSize: '1.5rem', - fontWeight: 500, - color: 'currentcolor', -}); diff --git a/frontend/src/components/common/ProgressBar.tsx b/frontend/src/components/common/ProgressBar.tsx deleted file mode 100644 index ffa4b1ff..00000000 --- a/frontend/src/components/common/ProgressBar.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import {styled} from '@mui/material/styles'; -import Box from '@mui/material/Box'; -import LinearProgress, { - linearProgressClasses, -} from '@mui/material/LinearProgress'; - -const BorderLinearProgress = styled(LinearProgress)(({theme}) => ({ - height: 10, - borderRadius: 5, - [`&.${linearProgressClasses.colorPrimary}`]: { - backgroundColor: theme.palette.grey[300], - }, - [`& .${linearProgressClasses.bar}`]: { - borderRadius: 5, - backgroundColor: theme.palette.primary, - }, -})); - -export default function ProgressBar({ - progressBarValue, -}: { - progressBarValue: number; -}) { - return ( - - - - ); -} diff --git a/frontend/src/components/common/UiPlaceholder.tsx b/frontend/src/components/common/UiPlaceholder.tsx deleted file mode 100644 index 943d3133..00000000 --- a/frontend/src/components/common/UiPlaceholder.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from 'react'; -import {Box, Typography} from '@mui/material'; - -export interface UiPlaceholderProps { - name: string; -} - -export function UiPlaceholder(props: UiPlaceholderProps) { - return ( - - {props.name} - - ); -} diff --git a/frontend/src/components/authentication/CodeField.tsx b/frontend/src/features/authentication/CodeField.tsx similarity index 100% rename from frontend/src/components/authentication/CodeField.tsx rename to frontend/src/features/authentication/CodeField.tsx diff --git a/frontend/src/components/authentication/FormContainer.tsx b/frontend/src/features/authentication/FormContainer.tsx similarity index 100% rename from frontend/src/components/authentication/FormContainer.tsx rename to frontend/src/features/authentication/FormContainer.tsx diff --git a/frontend/src/components/authentication/NewPasswordForm.tsx b/frontend/src/features/authentication/NewPasswordForm.tsx similarity index 97% rename from frontend/src/components/authentication/NewPasswordForm.tsx rename to frontend/src/features/authentication/NewPasswordForm.tsx index aa9526f4..8e220191 100644 --- a/frontend/src/components/authentication/NewPasswordForm.tsx +++ b/frontend/src/features/authentication/NewPasswordForm.tsx @@ -4,7 +4,7 @@ import {object, string, ref} from 'yup'; import {NewPasswordRequest} from '../../services/auth'; import {PasswordField} from './PasswordField'; -import {PasswordValidation} from '../common/PasswordValidation'; +import {PasswordValidation} from './PasswordValidation'; interface NewPasswordFormProps { onSubmit: ({password, confirmPassword}: NewPasswordRequest) => Promise; diff --git a/frontend/src/components/authentication/PasswordField.tsx b/frontend/src/features/authentication/PasswordField.tsx similarity index 100% rename from frontend/src/components/authentication/PasswordField.tsx rename to frontend/src/features/authentication/PasswordField.tsx diff --git a/frontend/src/components/common/PasswordValidation.tsx b/frontend/src/features/authentication/PasswordValidation.tsx similarity index 97% rename from frontend/src/components/common/PasswordValidation.tsx rename to frontend/src/features/authentication/PasswordValidation.tsx index 8b65a565..2dfe2fe5 100644 --- a/frontend/src/components/common/PasswordValidation.tsx +++ b/frontend/src/features/authentication/PasswordValidation.tsx @@ -2,7 +2,7 @@ import {List, ListItem, ListSubheader} from '@mui/material'; import RemoveRoundedIcon from '@mui/icons-material/RemoveRounded'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import {useEffect, useState} from 'react'; -import pwValidate from '../../utils/PasswordValidationSchema'; +import pwValidate from '../../utils/validation-schemas'; interface PasswordProps { password: string; diff --git a/frontend/src/components/authentication/ProtectedRoute.tsx b/frontend/src/features/authentication/ProtectedRoute.tsx similarity index 89% rename from frontend/src/components/authentication/ProtectedRoute.tsx rename to frontend/src/features/authentication/ProtectedRoute.tsx index 759acb60..90186da9 100644 --- a/frontend/src/components/authentication/ProtectedRoute.tsx +++ b/frontend/src/features/authentication/ProtectedRoute.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Navigate, useLocation} from 'react-router-dom'; -import {useAuth} from '../../app/hooks/useAuth'; -import {Loading} from '../common'; +import {useAuth} from '../../redux/hooks/useAuth'; +import {Loading} from '../ui'; import {useCurrentUserQuery} from '../../services/user'; export const ProtectedRoute = ({children}: {children: JSX.Element}) => { diff --git a/frontend/src/components/authentication/ResetPasswordContext.tsx b/frontend/src/features/authentication/ResetPasswordContext.tsx similarity index 100% rename from frontend/src/components/authentication/ResetPasswordContext.tsx rename to frontend/src/features/authentication/ResetPasswordContext.tsx diff --git a/frontend/src/components/authentication/SignInForm.tsx b/frontend/src/features/authentication/SignInForm.tsx similarity index 100% rename from frontend/src/components/authentication/SignInForm.tsx rename to frontend/src/features/authentication/SignInForm.tsx diff --git a/frontend/src/components/authentication/SignUpForm.tsx b/frontend/src/features/authentication/SignUpForm.tsx similarity index 96% rename from frontend/src/components/authentication/SignUpForm.tsx rename to frontend/src/features/authentication/SignUpForm.tsx index 14111422..e80b174b 100644 --- a/frontend/src/components/authentication/SignUpForm.tsx +++ b/frontend/src/features/authentication/SignUpForm.tsx @@ -9,8 +9,8 @@ import { // import GoogleIcon from '@mui/icons-material/Google'; import {useFormik} from 'formik'; import {SignUpRequest} from '../../services/auth'; -import {PasswordValidation} from '../common/PasswordValidation'; -import {signUpVaildationSchema} from '../../utils/PasswordValidationSchema'; +import {PasswordValidation} from './PasswordValidation'; +import {signUpVaildationSchema} from '../../utils/validation-schemas'; import {PasswordField} from './PasswordField'; export interface SignUpFormProps { diff --git a/frontend/src/components/authentication/__tests__/CodeField.test.tsx b/frontend/src/features/authentication/__tests__/CodeField.test.tsx similarity index 97% rename from frontend/src/components/authentication/__tests__/CodeField.test.tsx rename to frontend/src/features/authentication/__tests__/CodeField.test.tsx index 1a254b7d..be7227f8 100644 --- a/frontend/src/components/authentication/__tests__/CodeField.test.tsx +++ b/frontend/src/features/authentication/__tests__/CodeField.test.tsx @@ -3,7 +3,7 @@ import { screen, userEvent, fireEvent, -} from '../../../utils/test/test-utils'; +} from '../../../utils/testing/test-utils'; import {CodeField} from '..'; describe('CodeField', () => { diff --git a/frontend/src/components/authentication/__tests__/SignInForm.test.tsx b/frontend/src/features/authentication/__tests__/SignInForm.test.tsx similarity index 93% rename from frontend/src/components/authentication/__tests__/SignInForm.test.tsx rename to frontend/src/features/authentication/__tests__/SignInForm.test.tsx index 2381b514..452e8a53 100644 --- a/frontend/src/components/authentication/__tests__/SignInForm.test.tsx +++ b/frontend/src/features/authentication/__tests__/SignInForm.test.tsx @@ -1,6 +1,6 @@ import {BrowserRouter} from 'react-router-dom'; import {describe, vi} from 'vitest'; -import {fireEvent, render, screen} from '../../../utils/test/test-utils'; +import {fireEvent, render, screen} from '../../../utils/testing/test-utils'; import {SignInForm} from '../SignInForm'; const prepare = () => { diff --git a/frontend/src/components/authentication/__tests__/SignUpForm.test.tsx b/frontend/src/features/authentication/__tests__/SignUpForm.test.tsx similarity index 98% rename from frontend/src/components/authentication/__tests__/SignUpForm.test.tsx rename to frontend/src/features/authentication/__tests__/SignUpForm.test.tsx index 74b03063..19d559be 100644 --- a/frontend/src/components/authentication/__tests__/SignUpForm.test.tsx +++ b/frontend/src/features/authentication/__tests__/SignUpForm.test.tsx @@ -5,7 +5,7 @@ import { screen, userEvent, fireEvent, -} from '../../../utils/test/test-utils'; +} from '../../../utils/testing/test-utils'; import {SignUpForm, SignUpFormProps} from '../SignUpForm'; import {faker} from '@faker-js/faker'; diff --git a/frontend/src/components/authentication/hooks/useAuthenticateWithOAuth.ts b/frontend/src/features/authentication/hooks/useAuthenticateWithOAuth.ts similarity index 90% rename from frontend/src/components/authentication/hooks/useAuthenticateWithOAuth.ts rename to frontend/src/features/authentication/hooks/useAuthenticateWithOAuth.ts index caf3b3cb..893eaf98 100644 --- a/frontend/src/components/authentication/hooks/useAuthenticateWithOAuth.ts +++ b/frontend/src/features/authentication/hooks/useAuthenticateWithOAuth.ts @@ -1,9 +1,12 @@ import React from 'react'; -import {setCredentials} from '../../../app/authSlice'; -import {isFetchBaseQueryError, isErrorWithMessage} from '../../../app/helpers'; +import {setCredentials} from '../../../redux/authSlice'; +import { + isFetchBaseQueryError, + isErrorWithMessage, +} from '../../../redux/helpers'; import {TokenRequest, TokenResponse} from '../../../services/auth'; import {useNavigate} from 'react-router-dom'; -import {useAppDispatch} from '../../../app/hooks/store'; +import {useAppDispatch} from '../../../redux/hooks/store'; import { MutationActionCreatorResult, MutationDefinition, diff --git a/frontend/src/features/authentication/index.ts b/frontend/src/features/authentication/index.ts new file mode 100644 index 00000000..8792d009 --- /dev/null +++ b/frontend/src/features/authentication/index.ts @@ -0,0 +1,9 @@ +export {CodeField} from './CodeField'; +export {FormContainer} from './FormContainer'; +export {PasswordField} from './PasswordField'; +export {NewPasswordForm} from './NewPasswordForm'; +export {PasswordValidation} from './PasswordValidation'; +export {ProtectedRoute} from './ProtectedRoute'; +export {ResetPasswordContext} from './ResetPasswordContext'; +export {SignInForm} from './SignInForm'; +export {SignUpForm} from './SignUpForm'; diff --git a/frontend/src/components/common/GuestInviteButton.tsx b/frontend/src/features/coordinator-dashboard/GuestInviteButton.tsx similarity index 98% rename from frontend/src/components/common/GuestInviteButton.tsx rename to frontend/src/features/coordinator-dashboard/GuestInviteButton.tsx index 9918d6a5..56a5b18b 100644 --- a/frontend/src/components/common/GuestInviteButton.tsx +++ b/frontend/src/features/coordinator-dashboard/GuestInviteButton.tsx @@ -16,7 +16,7 @@ import { } from '@mui/material'; import {useInviteGuestMutation} from '../../services/coordinator'; import {CheckOutlined, EmailOutlined} from '@mui/icons-material'; -import {isFetchBaseQueryError, isErrorWithMessage} from '../../app/helpers'; +import {isFetchBaseQueryError, isErrorWithMessage} from '../../redux/helpers'; export const validationSchema = object({ firstName: string().required('first name is required'), diff --git a/frontend/src/views/LoadingComponent.tsx b/frontend/src/features/coordinator-dashboard/LoadingComponent.tsx similarity index 100% rename from frontend/src/views/LoadingComponent.tsx rename to frontend/src/features/coordinator-dashboard/LoadingComponent.tsx diff --git a/frontend/src/components/common/__tests__/GuestInviteButton.test.tsx b/frontend/src/features/coordinator-dashboard/__tests__/GuestInviteButton.test.tsx similarity index 95% rename from frontend/src/components/common/__tests__/GuestInviteButton.test.tsx rename to frontend/src/features/coordinator-dashboard/__tests__/GuestInviteButton.test.tsx index 63cba846..da534ac9 100644 --- a/frontend/src/components/common/__tests__/GuestInviteButton.test.tsx +++ b/frontend/src/features/coordinator-dashboard/__tests__/GuestInviteButton.test.tsx @@ -6,9 +6,9 @@ import { render, screen, userEvent, -} from '../../../utils/test/test-utils'; -import {GuestInviteButton} from '../GuestInviteButton'; -import {server} from '../../../utils/test/server'; +} from '../../../utils/testing/test-utils'; +import {GuestInviteButton} from '../../coordinator-dashboard/GuestInviteButton'; +import {server} from '../../../utils/testing/server'; import {HttpResponse, http} from 'msw'; function createGuest() { diff --git a/frontend/src/features/coordinator-dashboard/index.ts b/frontend/src/features/coordinator-dashboard/index.ts new file mode 100644 index 00000000..8fe83584 --- /dev/null +++ b/frontend/src/features/coordinator-dashboard/index.ts @@ -0,0 +1,2 @@ +export {GuestInviteButton} from './GuestInviteButton'; +export {LoadingComponent} from './LoadingComponent'; diff --git a/frontend/src/components/dashboard/CoordinatorContact.tsx b/frontend/src/features/guest-dashboard/CoordinatorContact.tsx similarity index 100% rename from frontend/src/components/dashboard/CoordinatorContact.tsx rename to frontend/src/features/guest-dashboard/CoordinatorContact.tsx diff --git a/frontend/src/components/dashboard/DashboardTask.tsx b/frontend/src/features/guest-dashboard/DashboardTask.tsx similarity index 96% rename from frontend/src/components/dashboard/DashboardTask.tsx rename to frontend/src/features/guest-dashboard/DashboardTask.tsx index c08708bb..0fd5359a 100644 --- a/frontend/src/components/dashboard/DashboardTask.tsx +++ b/frontend/src/features/guest-dashboard/DashboardTask.tsx @@ -4,7 +4,7 @@ import LockIcon from '@mui/icons-material/Lock'; import AccessTimeIcon from '@mui/icons-material/AccessTime'; import {Link} from 'react-router-dom'; -import {SubTask} from '../../views/GuestApplicationTracker'; +import {SubTask} from '../../pages/guest-dashboard/GuestDashboard'; export type DashboardTaskProps = Pick< SubTask, diff --git a/frontend/src/components/dashboard/DashboardTaskAccordion.tsx b/frontend/src/features/guest-dashboard/DashboardTaskAccordion.tsx similarity index 98% rename from frontend/src/components/dashboard/DashboardTaskAccordion.tsx rename to frontend/src/features/guest-dashboard/DashboardTaskAccordion.tsx index 84df9541..9293e4d4 100644 --- a/frontend/src/components/dashboard/DashboardTaskAccordion.tsx +++ b/frontend/src/features/guest-dashboard/DashboardTaskAccordion.tsx @@ -13,7 +13,7 @@ import CheckCircleOutlined from '@mui/icons-material/CheckCircleOutlined'; import LockIcon from '@mui/icons-material/Lock'; import {styled} from '@mui/material/styles'; -import {Task} from '../../views/GuestApplicationTracker'; +import {Task} from '../../pages/guest-dashboard/GuestDashboard'; import {DashboardTask} from './DashboardTask'; export interface TaskAccordionProps diff --git a/frontend/src/components/dashboard/__tests__/CoordinatorContact.test.tsx b/frontend/src/features/guest-dashboard/__tests__/CoordinatorContact.test.tsx similarity index 90% rename from frontend/src/components/dashboard/__tests__/CoordinatorContact.test.tsx rename to frontend/src/features/guest-dashboard/__tests__/CoordinatorContact.test.tsx index 8417e51e..bf6dd5ea 100644 --- a/frontend/src/components/dashboard/__tests__/CoordinatorContact.test.tsx +++ b/frontend/src/features/guest-dashboard/__tests__/CoordinatorContact.test.tsx @@ -1,4 +1,4 @@ -import {render, screen} from '../../../utils/test/test-utils'; +import {render, screen} from '../../../utils/testing/test-utils'; import {CoordinatorContact} from '../CoordinatorContact'; const setup = () => { diff --git a/frontend/src/components/dashboard/__tests__/DashboardTask.test.tsx b/frontend/src/features/guest-dashboard/__tests__/DashboardTask.test.tsx similarity index 97% rename from frontend/src/components/dashboard/__tests__/DashboardTask.test.tsx rename to frontend/src/features/guest-dashboard/__tests__/DashboardTask.test.tsx index 56189891..8554470b 100644 --- a/frontend/src/components/dashboard/__tests__/DashboardTask.test.tsx +++ b/frontend/src/features/guest-dashboard/__tests__/DashboardTask.test.tsx @@ -1,5 +1,5 @@ import {BrowserRouter} from 'react-router-dom'; -import {render, screen, userEvent} from '../../../utils/test/test-utils'; +import {render, screen, userEvent} from '../../../utils/testing/test-utils'; import {DashboardTask, DashboardTaskProps} from '../DashboardTask'; const {navigate} = vi.hoisted(() => { diff --git a/frontend/src/components/dashboard/__tests__/DashboardTaskAccordion.test.tsx b/frontend/src/features/guest-dashboard/__tests__/DashboardTaskAccordion.test.tsx similarity index 97% rename from frontend/src/components/dashboard/__tests__/DashboardTaskAccordion.test.tsx rename to frontend/src/features/guest-dashboard/__tests__/DashboardTaskAccordion.test.tsx index 835b69a9..f875189c 100644 --- a/frontend/src/components/dashboard/__tests__/DashboardTaskAccordion.test.tsx +++ b/frontend/src/features/guest-dashboard/__tests__/DashboardTaskAccordion.test.tsx @@ -1,5 +1,5 @@ import {BrowserRouter} from 'react-router-dom'; -import {render, screen, within} from '../../../utils/test/test-utils'; +import {render, screen, within} from '../../../utils/testing/test-utils'; import { DashboardTaskAccordion, TaskAccordionProps, diff --git a/frontend/src/components/dashboard/index.ts b/frontend/src/features/guest-dashboard/index.ts similarity index 100% rename from frontend/src/components/dashboard/index.ts rename to frontend/src/features/guest-dashboard/index.ts diff --git a/frontend/src/components/intake-profile/IntakeProfileGroups.tsx b/frontend/src/features/intake-profile/IntakeProfileGroups.tsx similarity index 98% rename from frontend/src/components/intake-profile/IntakeProfileGroups.tsx rename to frontend/src/features/intake-profile/IntakeProfileGroups.tsx index e2d3a523..ad289012 100644 --- a/frontend/src/components/intake-profile/IntakeProfileGroups.tsx +++ b/frontend/src/features/intake-profile/IntakeProfileGroups.tsx @@ -16,11 +16,11 @@ import { } from '@mui/material'; import {useFormikContext} from 'formik'; import {useOutletContext} from 'react-router-dom'; -import {InitialValues} from 'src/views/IntakeProfile'; +import {InitialValues} from 'src/pages/intake-profile'; import {AdditionalGuestsField} from './fields/AdditionaGuestsField'; import {FieldGroup, Fields, Guest, Pet} from 'src/services/profile'; import {AdditionalPetsField} from './fields/AdditionalPetsField'; -import {phoneRegExp} from '../../views/IntakeProfile/constants/index'; +import {phoneRegExp} from '../../pages/intake-profile/helpers/index'; import {DatePickerField} from './fields/DatePickerField'; export interface OutletContext { diff --git a/frontend/src/components/intake-profile/ProfileReview.tsx b/frontend/src/features/intake-profile/ProfileReview.tsx similarity index 98% rename from frontend/src/components/intake-profile/ProfileReview.tsx rename to frontend/src/features/intake-profile/ProfileReview.tsx index 4536c0a2..1549e2bb 100644 --- a/frontend/src/components/intake-profile/ProfileReview.tsx +++ b/frontend/src/features/intake-profile/ProfileReview.tsx @@ -12,7 +12,7 @@ import {useFormikContext} from 'formik'; import {format, parseISO} from 'date-fns'; import {OutletContext} from './IntakeProfileGroups'; -import {InitialValues} from 'src/views/IntakeProfile'; +import {InitialValues} from '../../pages/intake-profile/IntakeProfile'; import {Response} from 'src/services/profile'; export const ProfileReview = () => { diff --git a/frontend/src/components/intake-profile/ProfileSidebar.tsx b/frontend/src/features/intake-profile/ProfileSidebar.tsx similarity index 100% rename from frontend/src/components/intake-profile/ProfileSidebar.tsx rename to frontend/src/features/intake-profile/ProfileSidebar.tsx diff --git a/frontend/src/components/intake-profile/SidebarButton.tsx b/frontend/src/features/intake-profile/SidebarButton.tsx similarity index 100% rename from frontend/src/components/intake-profile/SidebarButton.tsx rename to frontend/src/features/intake-profile/SidebarButton.tsx diff --git a/frontend/src/components/intake-profile/fields/AdditionaGuestsField.tsx b/frontend/src/features/intake-profile/fields/AdditionaGuestsField.tsx similarity index 98% rename from frontend/src/components/intake-profile/fields/AdditionaGuestsField.tsx rename to frontend/src/features/intake-profile/fields/AdditionaGuestsField.tsx index da72b8fe..0c7b3c3c 100644 --- a/frontend/src/components/intake-profile/fields/AdditionaGuestsField.tsx +++ b/frontend/src/features/intake-profile/fields/AdditionaGuestsField.tsx @@ -6,7 +6,7 @@ import { FieldArray, useFormikContext, } from 'formik'; -import {InitialValues} from 'src/views/IntakeProfile'; +import {InitialValues} from 'src/pages/intake-profile'; import {Guest} from '../../../services/profile'; import {DatePickerField} from './DatePickerField'; diff --git a/frontend/src/components/intake-profile/fields/AdditionalPetsField.tsx b/frontend/src/features/intake-profile/fields/AdditionalPetsField.tsx similarity index 98% rename from frontend/src/components/intake-profile/fields/AdditionalPetsField.tsx rename to frontend/src/features/intake-profile/fields/AdditionalPetsField.tsx index 794735f2..068907f4 100644 --- a/frontend/src/components/intake-profile/fields/AdditionalPetsField.tsx +++ b/frontend/src/features/intake-profile/fields/AdditionalPetsField.tsx @@ -2,7 +2,7 @@ import {Stack, Button, TextField, Typography} from '@mui/material'; import {FormikErrors, FieldArray, useFormikContext} from 'formik'; import {Pet} from '../../../services/profile'; import Autocomplete from '@mui/material/Autocomplete'; -import {InitialValues} from 'src/views/IntakeProfile'; +import {InitialValues} from 'src/pages/intake-profile'; interface Values { pets: Pet[]; diff --git a/frontend/src/components/intake-profile/fields/DatePickerField.tsx b/frontend/src/features/intake-profile/fields/DatePickerField.tsx similarity index 100% rename from frontend/src/components/intake-profile/fields/DatePickerField.tsx rename to frontend/src/features/intake-profile/fields/DatePickerField.tsx diff --git a/frontend/src/components/intake-profile/hooks/useStatusStyling.tsx b/frontend/src/features/intake-profile/hooks/useStatusStyling.tsx similarity index 94% rename from frontend/src/components/intake-profile/hooks/useStatusStyling.tsx rename to frontend/src/features/intake-profile/hooks/useStatusStyling.tsx index 1a2a4564..64c50f9b 100644 --- a/frontend/src/components/intake-profile/hooks/useStatusStyling.tsx +++ b/frontend/src/features/intake-profile/hooks/useStatusStyling.tsx @@ -1,5 +1,5 @@ import {useTheme} from '@mui/material/styles'; -import {InProgressIcon} from '../../Icons/InProgressIcon'; +import {InProgressIcon} from '../../ui/icons/InProgressIcon'; import LockIcon from '@mui/icons-material/Lock'; import {CheckCircleOutlined} from '@mui/icons-material'; diff --git a/frontend/src/features/intake-profile/index.ts b/frontend/src/features/intake-profile/index.ts new file mode 100644 index 00000000..468ac9bf --- /dev/null +++ b/frontend/src/features/intake-profile/index.ts @@ -0,0 +1 @@ +export {ProfileSidebar} from './ProfileSidebar'; diff --git a/frontend/src/components/common/AppLayout.tsx b/frontend/src/features/layouts/AppLayout.tsx similarity index 91% rename from frontend/src/components/common/AppLayout.tsx rename to frontend/src/features/layouts/AppLayout.tsx index a70aef21..e86e908f 100644 --- a/frontend/src/components/common/AppLayout.tsx +++ b/frontend/src/features/layouts/AppLayout.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {Stack, Toolbar, Box} from '@mui/material'; import {Outlet} from 'react-router-dom'; -import {Header} from './Header'; +import {Header} from '../ui/Header'; export const AppLayout = () => { return ( diff --git a/frontend/src/components/layout/CoordinatorDashboardLayout.tsx b/frontend/src/features/layouts/CoordinatorDashboardLayout.tsx similarity index 100% rename from frontend/src/components/layout/CoordinatorDashboardLayout.tsx rename to frontend/src/features/layouts/CoordinatorDashboardLayout.tsx diff --git a/frontend/src/components/layout/DashboardLayout.tsx b/frontend/src/features/layouts/DashboardLayout.tsx similarity index 98% rename from frontend/src/components/layout/DashboardLayout.tsx rename to frontend/src/features/layouts/DashboardLayout.tsx index 4d39afb5..2b7f1407 100644 --- a/frontend/src/components/layout/DashboardLayout.tsx +++ b/frontend/src/features/layouts/DashboardLayout.tsx @@ -12,7 +12,7 @@ import {Link} from '@mui/material'; import {styled} from '@mui/system'; import {Outlet, useLocation} from 'react-router-dom'; -import {AuthenticatedHeader} from '../common'; +import {AuthenticatedHeader} from '../ui'; const DRAWER_WIDTH = 209; const MOBILE_DRAWER_WIDTH = 296; diff --git a/frontend/src/components/layout/GuestDashboardLayout.tsx b/frontend/src/features/layouts/GuestDashboardLayout.tsx similarity index 100% rename from frontend/src/components/layout/GuestDashboardLayout.tsx rename to frontend/src/features/layouts/GuestDashboardLayout.tsx diff --git a/frontend/src/components/layout/index.ts b/frontend/src/features/layouts/index.ts similarity index 82% rename from frontend/src/components/layout/index.ts rename to frontend/src/features/layouts/index.ts index 2826f281..1a90faf7 100644 --- a/frontend/src/components/layout/index.ts +++ b/frontend/src/features/layouts/index.ts @@ -1,3 +1,4 @@ export {DashboardLayout} from './DashboardLayout'; export {CoordinatorDashboardLayout} from './CoordinatorDashboardLayout'; export {GuestDashboardLayout} from './GuestDashboardLayout'; +export {AppLayout} from './AppLayout'; diff --git a/frontend/src/components/common/AuthenticatedHeader.tsx b/frontend/src/features/ui/AuthenticatedHeader.tsx similarity index 88% rename from frontend/src/components/common/AuthenticatedHeader.tsx rename to frontend/src/features/ui/AuthenticatedHeader.tsx index 273b230e..5a13c063 100644 --- a/frontend/src/components/common/AuthenticatedHeader.tsx +++ b/frontend/src/features/ui/AuthenticatedHeader.tsx @@ -1,19 +1,24 @@ import * as React from 'react'; -import AppBar from '@mui/material/AppBar'; -import Box from '@mui/material/Box'; -import IconButton from '@mui/material/IconButton'; import MenuIcon from '@mui/icons-material/Menu'; -import Toolbar from '@mui/material/Toolbar'; -import Typography from '@mui/material/Typography'; -import {Tooltip, Avatar, Menu, MenuItem, Stack} from '@mui/material'; -import logo from '../../img/favicon.png'; -import {useSignOutMutation} from '../../services/auth'; -import {selectCurrentUser} from '../../app/authSlice'; -import {User, UserRole} from '../../services/user'; - +import {styled} from '@mui/system'; +import { + Tooltip, + Avatar, + Menu, + MenuItem, + Stack, + IconButton, + Toolbar, + Typography, + Box, + AppBar, +} from '@mui/material'; import {useSelector} from 'react-redux'; import {Link, useNavigate} from 'react-router-dom'; -import {styled} from '@mui/system'; + +import {useSignOutMutation} from '../../services/auth'; +import {selectCurrentUser} from '../../redux/authSlice'; +import {User, UserRole} from '../../services/user'; function getInitials(user: User): string { const fi = (user.firstName && user.firstName[0]) || '?'; @@ -51,7 +56,7 @@ export const AuthenticatedHeader = ({onClick}: OwnProps) => { ) : (
)} - + diff --git a/frontend/src/components/common/Header.tsx b/frontend/src/features/ui/Header.tsx similarity index 77% rename from frontend/src/components/common/Header.tsx rename to frontend/src/features/ui/Header.tsx index a988596f..8dd90ba5 100644 --- a/frontend/src/components/common/Header.tsx +++ b/frontend/src/features/ui/Header.tsx @@ -1,22 +1,16 @@ import * as React from 'react'; -import AppBar from '@mui/material/AppBar'; -import Box from '@mui/material/Box'; -import Toolbar from '@mui/material/Toolbar'; -import Button from '@mui/material/Button'; import MenuIcon from '@mui/icons-material/Menu'; -import Divider from '@mui/material/Divider'; import { Drawer, IconButton, - List, - ListItem, - ListItemButton, - ListItemText, Stack, + Button, + Toolbar, + Box, + AppBar, styled, - Typography, } from '@mui/material'; -import logo from '../../img/favicon.png'; + const MOBILE_DRAWER_WIDTH = 209; const navItems = [ @@ -31,25 +25,6 @@ export const Header = () => { setMobileOpen(prevState => !prevState); }; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const drawer = ( - - - MUI - - - - {navItems.map(({title, href}) => ( - - - - - - ))} - - - ); - const container = window !== undefined ? () => window.document.body : undefined; @@ -68,7 +43,7 @@ export const Header = () => { Home Unite Us logo diff --git a/frontend/src/components/common/Loading.tsx b/frontend/src/features/ui/Loading.tsx similarity index 100% rename from frontend/src/components/common/Loading.tsx rename to frontend/src/features/ui/Loading.tsx diff --git a/frontend/src/components/Icons/CoordinatorIcon.tsx b/frontend/src/features/ui/icons/CoordinatorIcon.tsx similarity index 100% rename from frontend/src/components/Icons/CoordinatorIcon.tsx rename to frontend/src/features/ui/icons/CoordinatorIcon.tsx diff --git a/frontend/src/components/Icons/GuestIcon.tsx b/frontend/src/features/ui/icons/GuestIcon.tsx similarity index 100% rename from frontend/src/components/Icons/GuestIcon.tsx rename to frontend/src/features/ui/icons/GuestIcon.tsx diff --git a/frontend/src/components/Icons/HostIcon.tsx b/frontend/src/features/ui/icons/HostIcon.tsx similarity index 100% rename from frontend/src/components/Icons/HostIcon.tsx rename to frontend/src/features/ui/icons/HostIcon.tsx diff --git a/frontend/src/components/Icons/InProgressIcon.tsx b/frontend/src/features/ui/icons/InProgressIcon.tsx similarity index 100% rename from frontend/src/components/Icons/InProgressIcon.tsx rename to frontend/src/features/ui/icons/InProgressIcon.tsx diff --git a/frontend/src/components/Icons/index.ts b/frontend/src/features/ui/icons/index.ts similarity index 100% rename from frontend/src/components/Icons/index.ts rename to frontend/src/features/ui/icons/index.ts diff --git a/frontend/src/components/common/index.ts b/frontend/src/features/ui/index.ts similarity index 57% rename from frontend/src/components/common/index.ts rename to frontend/src/features/ui/index.ts index 8a1d621f..83f0b0d3 100644 --- a/frontend/src/components/common/index.ts +++ b/frontend/src/features/ui/index.ts @@ -1,5 +1,3 @@ export {Loading} from './Loading'; export {Header} from './Header'; -export {AppLayout} from './AppLayout'; export {AuthenticatedHeader} from './AuthenticatedHeader'; -export {GuestInviteButton} from './GuestInviteButton'; diff --git a/frontend/src/main.tsx b/frontend/src/main.tsx index 83fa9e7c..859c0ac5 100644 --- a/frontend/src/main.tsx +++ b/frontend/src/main.tsx @@ -7,15 +7,22 @@ import {LocalizationProvider} from '@mui/x-date-pickers'; import {AdapterDateFns} from '@mui/x-date-pickers/AdapterDateFns'; import './index.css'; -import {setupStore} from './app/store'; -import {ProtectedRoute} from './components/authentication/ProtectedRoute'; +import {setupStore} from './redux/store'; import {useSessionMutation} from './services/auth'; import {HomeUniteUsTheme} from './theme'; +import {ProtectedRoute, ResetPasswordContext} from './features/authentication'; +import {Header} from './features/ui'; +import {ProfileReview} from './features/intake-profile/ProfileReview'; +import {FieldGroupList} from './features/intake-profile/IntakeProfileGroups'; +import { + AppLayout, + CoordinatorDashboardLayout, + GuestDashboardLayout, +} from './features/layouts'; import { GuestApplicationTracker, Home, - HostApplicationTracker, - HostsList, + HostDashboard, SignIn, SignUp, ForgotPassword, @@ -34,19 +41,9 @@ import { GuestSettings, CoordinatorDashboard, IntakeProfile, -} from './views'; - -import {AccountVerification} from './views/AccountVerification'; -import {AppLayout, Header} from './components/common'; -import {ResetPasswordContext} from './components/authentication/ResetPasswordContext'; -import { - CoordinatorDashboardLayout, - GuestDashboardLayout, -} from './components/layout'; -import {FieldGroupList} from './components/intake-profile/IntakeProfileGroups'; -import {enableMocking} from './utils/test/browser'; -import {SystemAdminDashboard} from './views/SystemAdminDashboard'; -import {ProfileReview} from './components/intake-profile/ProfileReview'; +} from './pages'; +import {SystemAdminDashboard} from './pages/SystemAdminDashboard'; +import {enableMocking} from './utils/testing/browser'; function HuuApp() { const [session] = useSessionMutation(); @@ -61,7 +58,6 @@ function HuuApp() { }> } /> - } /> } /> } /> } /> @@ -76,7 +72,6 @@ function HuuApp() { path="/forgot-password/success" element={} /> - } /> } /> } /> - - {/* guest routes */} - + } /> diff --git a/frontend/src/views/Home.tsx b/frontend/src/pages/Home.tsx similarity index 100% rename from frontend/src/views/Home.tsx rename to frontend/src/pages/Home.tsx diff --git a/frontend/src/views/Settings.tsx b/frontend/src/pages/Settings.tsx similarity index 100% rename from frontend/src/views/Settings.tsx rename to frontend/src/pages/Settings.tsx diff --git a/frontend/src/views/SystemAdminDashboard.tsx b/frontend/src/pages/SystemAdminDashboard.tsx similarity index 99% rename from frontend/src/views/SystemAdminDashboard.tsx rename to frontend/src/pages/SystemAdminDashboard.tsx index 9bbd7ad1..f4b0f69a 100644 --- a/frontend/src/views/SystemAdminDashboard.tsx +++ b/frontend/src/pages/SystemAdminDashboard.tsx @@ -28,7 +28,7 @@ import DeleteIcon from '@mui/icons-material/Delete'; import PersonIcon from '@mui/icons-material/Person'; import {red} from '@mui/material/colors'; import * as React from 'react'; -import {AuthenticatedHeader} from '../components/common'; +import {AuthenticatedHeader} from '../features/ui'; import { DashboardDataItem, DashboardDataResponse, diff --git a/frontend/src/views/__tests__/ForgotPasswordCode.test.tsx b/frontend/src/pages/__tests__/ForgotPasswordCode.test.tsx similarity index 95% rename from frontend/src/views/__tests__/ForgotPasswordCode.test.tsx rename to frontend/src/pages/__tests__/ForgotPasswordCode.test.tsx index c1174d46..fe41c418 100644 --- a/frontend/src/views/__tests__/ForgotPasswordCode.test.tsx +++ b/frontend/src/pages/__tests__/ForgotPasswordCode.test.tsx @@ -2,17 +2,17 @@ import { ResestPasswordValues, initialValues, validationSchema, -} from '../../components/authentication/ResetPasswordContext'; +} from '../../features/authentication/ResetPasswordContext'; import { render, screen, fireEvent, userEvent, -} from '../../utils/test/test-utils'; +} from '../../utils/testing/test-utils'; import {ForgotPasswordCode} from '../ForgotPasswordCode'; import {BrowserRouter} from 'react-router-dom'; import {Formik} from 'formik'; -import {server} from '../../utils/test/server'; +import {server} from '../../utils/testing/server'; import {HttpResponse, http, delay} from 'msw'; const {navigate} = vi.hoisted(() => { diff --git a/frontend/src/views/__tests__/ResetPassword.test.tsx b/frontend/src/pages/__tests__/ResetPassword.test.tsx similarity index 94% rename from frontend/src/views/__tests__/ResetPassword.test.tsx rename to frontend/src/pages/__tests__/ResetPassword.test.tsx index 50aff8ef..605a9b7f 100644 --- a/frontend/src/views/__tests__/ResetPassword.test.tsx +++ b/frontend/src/pages/__tests__/ResetPassword.test.tsx @@ -4,9 +4,14 @@ import { ResestPasswordValues, initialValues, validationSchema, -} from '../../components/authentication/ResetPasswordContext'; -import {render, screen, waitFor, fireEvent} from '../../utils/test/test-utils'; -import {ResetPassword} from '../ResetPassword'; +} from '../../features/authentication/ResetPasswordContext'; +import { + render, + screen, + waitFor, + fireEvent, +} from '../../utils/testing/test-utils'; +import {ResetPassword} from '../authentication/ResetPassword'; interface Mocks { isError: boolean; diff --git a/frontend/src/views/ConfirmSignUp.tsx b/frontend/src/pages/authentication/ConfirmSignUp.tsx similarity index 92% rename from frontend/src/views/ConfirmSignUp.tsx rename to frontend/src/pages/authentication/ConfirmSignUp.tsx index 9961057a..2c58763e 100644 --- a/frontend/src/views/ConfirmSignUp.tsx +++ b/frontend/src/pages/authentication/ConfirmSignUp.tsx @@ -9,9 +9,9 @@ import { } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; import {useSearchParams} from 'react-router-dom'; -import {useResendConfirmationCodeMutation} from '../services/auth'; -import {FormContainer} from '../components/authentication'; -import {isFetchBaseQueryError, isErrorWithMessage} from '../app/helpers'; +import {useResendConfirmationCodeMutation} from '../../services/auth'; +import {FormContainer} from '../../features/authentication'; +import {isFetchBaseQueryError, isErrorWithMessage} from '../../redux/helpers'; interface Alert { severity: 'success' | 'error'; diff --git a/frontend/src/views/EmailVerificationError.tsx b/frontend/src/pages/authentication/EmailVerificationError.tsx similarity index 92% rename from frontend/src/views/EmailVerificationError.tsx rename to frontend/src/pages/authentication/EmailVerificationError.tsx index e88647ad..3b247a6c 100644 --- a/frontend/src/views/EmailVerificationError.tsx +++ b/frontend/src/pages/authentication/EmailVerificationError.tsx @@ -1,7 +1,7 @@ import {Button, Stack, Typography} from '@mui/material'; import React from 'react'; import CancelOutlined from '@mui/icons-material/CancelOutlined'; -import {FormContainer} from '../components/authentication'; +import {FormContainer} from '../../features/authentication'; export const EmailVerificationError = () => { return ( diff --git a/frontend/src/views/EmailVerificationSuccess.tsx b/frontend/src/pages/authentication/EmailVerificationSuccess.tsx similarity index 92% rename from frontend/src/views/EmailVerificationSuccess.tsx rename to frontend/src/pages/authentication/EmailVerificationSuccess.tsx index 7660dd3b..501aabd5 100644 --- a/frontend/src/views/EmailVerificationSuccess.tsx +++ b/frontend/src/pages/authentication/EmailVerificationSuccess.tsx @@ -1,7 +1,7 @@ import {Button, Stack, Typography} from '@mui/material'; import React from 'react'; import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline'; -import {FormContainer} from '../components/authentication'; +import {FormContainer} from '../../features/authentication'; export const EmailVerificationSuccess = () => { return ( diff --git a/frontend/src/views/ForgotPassword.tsx b/frontend/src/pages/authentication/ForgotPassword.tsx similarity index 91% rename from frontend/src/views/ForgotPassword.tsx rename to frontend/src/pages/authentication/ForgotPassword.tsx index 733d59a3..c38c7d6d 100644 --- a/frontend/src/views/ForgotPassword.tsx +++ b/frontend/src/pages/authentication/ForgotPassword.tsx @@ -11,10 +11,10 @@ import CloseIcon from '@mui/icons-material/Close'; import {useFormikContext} from 'formik'; import React from 'react'; import {useNavigate} from 'react-router-dom'; -import {isErrorWithMessage, isFetchBaseQueryError} from '../app/helpers'; -import {ResestPasswordValues} from '../components/authentication/ResetPasswordContext'; -import {useForgotPasswordMutation} from '../services/auth'; -import {FormContainer} from '../components/authentication'; +import {isErrorWithMessage, isFetchBaseQueryError} from '../../redux/helpers'; +import {ResestPasswordValues} from '../../features/authentication/ResetPasswordContext'; +import {useForgotPasswordMutation} from '../../services/auth'; +import {FormContainer} from '../../features/authentication'; export const ForgotPassword = () => { const [errorMessage, setErrorMessage] = React.useState(''); diff --git a/frontend/src/views/ForgotPasswordCode.tsx b/frontend/src/pages/authentication/ForgotPasswordCode.tsx similarity index 93% rename from frontend/src/views/ForgotPasswordCode.tsx rename to frontend/src/pages/authentication/ForgotPasswordCode.tsx index 57c9c6f8..b4910809 100644 --- a/frontend/src/views/ForgotPasswordCode.tsx +++ b/frontend/src/pages/authentication/ForgotPasswordCode.tsx @@ -13,10 +13,10 @@ import CloseIcon from '@mui/icons-material/Close'; import {useFormikContext} from 'formik'; import React from 'react'; import {useNavigate} from 'react-router-dom'; -import {ResestPasswordValues} from '../components/authentication/ResetPasswordContext'; -import {CodeField, FormContainer} from '../components/authentication'; -import {useForgotPasswordMutation} from '../services/auth'; -import {getErrorMessage} from '../app/helpers'; +import {ResestPasswordValues} from '../../features/authentication/ResetPasswordContext'; +import {CodeField, FormContainer} from '../../features/authentication'; +import {useForgotPasswordMutation} from '../../services/auth'; +import {getErrorMessage} from '../../redux/helpers'; interface Alert { severity: AlertColor; diff --git a/frontend/src/views/ForgotPasswordSuccess.tsx b/frontend/src/pages/authentication/ForgotPasswordSuccess.tsx similarity index 88% rename from frontend/src/views/ForgotPasswordSuccess.tsx rename to frontend/src/pages/authentication/ForgotPasswordSuccess.tsx index 56dfc978..1c1ae8d0 100644 --- a/frontend/src/views/ForgotPasswordSuccess.tsx +++ b/frontend/src/pages/authentication/ForgotPasswordSuccess.tsx @@ -1,6 +1,6 @@ import React from 'react'; import {Typography, Button, Stack} from '@mui/material'; -import {FormContainer} from '../components/authentication'; +import {FormContainer} from '../../features/authentication'; export const ForgotPasswordSuccess = () => { return ( diff --git a/frontend/src/views/NewPassword.tsx b/frontend/src/pages/authentication/NewPassword.tsx similarity index 90% rename from frontend/src/views/NewPassword.tsx rename to frontend/src/pages/authentication/NewPassword.tsx index b1e47860..66be3f6c 100644 --- a/frontend/src/views/NewPassword.tsx +++ b/frontend/src/pages/authentication/NewPassword.tsx @@ -1,12 +1,12 @@ import React from 'react'; -import {NewPasswordForm} from '../components/authentication/NewPasswordForm'; +import {NewPasswordForm} from '../../features/authentication'; import {useSearchParams} from 'react-router-dom'; import {Typography, Stack, Alert, IconButton} from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; -import {NewPasswordRequest, useNewPasswordMutation} from '../services/auth'; +import {NewPasswordRequest, useNewPasswordMutation} from '../../services/auth'; import {useNavigate} from 'react-router-dom'; -import {isFetchBaseQueryError, isErrorWithMessage} from '../app/helpers'; -import {FormContainer} from '../components/authentication'; +import {isFetchBaseQueryError, isErrorWithMessage} from '../../redux/helpers'; +import {FormContainer} from '../../features/authentication'; export const NewPassword = () => { const [errorMessage, setErrorMessage] = React.useState(''); diff --git a/frontend/src/views/ResetPassword.tsx b/frontend/src/pages/authentication/ResetPassword.tsx similarity index 90% rename from frontend/src/views/ResetPassword.tsx rename to frontend/src/pages/authentication/ResetPassword.tsx index 67db2a6c..fcd0582f 100644 --- a/frontend/src/views/ResetPassword.tsx +++ b/frontend/src/pages/authentication/ResetPassword.tsx @@ -7,11 +7,15 @@ import { } from '@mui/material'; import React from 'react'; import {useFormikContext} from 'formik'; -import {ResestPasswordValues} from '../components/authentication/ResetPasswordContext'; -import {useConfirmForgotPasswordMutation} from '../services/auth'; -import {getErrorMessage} from '../app/helpers'; -import {FormContainer, PasswordField} from '../components/authentication'; -import {PasswordValidation} from '../components/common/PasswordValidation'; + +import {useConfirmForgotPasswordMutation} from '../../services/auth'; +import {getErrorMessage} from '../../redux/helpers'; +import { + FormContainer, + PasswordField, + PasswordValidation, +} from '../../features/authentication'; +import {ResestPasswordValues} from '../../features/authentication/ResetPasswordContext'; export const ResetPassword = () => { const { diff --git a/frontend/src/views/SelectAccountType.tsx b/frontend/src/pages/authentication/SelectAccountType.tsx similarity index 97% rename from frontend/src/views/SelectAccountType.tsx rename to frontend/src/pages/authentication/SelectAccountType.tsx index 4c548e57..5a688a73 100644 --- a/frontend/src/views/SelectAccountType.tsx +++ b/frontend/src/pages/authentication/SelectAccountType.tsx @@ -2,7 +2,7 @@ import React, {useState} from 'react'; import {useNavigate} from 'react-router-dom'; import {Typography, Button, Stack, Link, Divider} from '@mui/material'; import {styled} from '@mui/system'; -import {HostIcon, CoordinatorIcon} from '../components/Icons'; +import {HostIcon, CoordinatorIcon} from '../../features/ui/icons'; export const SelectAccountType = () => { const [type, setType] = useState(''); diff --git a/frontend/src/views/SignIn.tsx b/frontend/src/pages/authentication/SignIn.tsx similarity index 88% rename from frontend/src/views/SignIn.tsx rename to frontend/src/pages/authentication/SignIn.tsx index 63df4a07..2a697a54 100644 --- a/frontend/src/views/SignIn.tsx +++ b/frontend/src/pages/authentication/SignIn.tsx @@ -10,20 +10,19 @@ import { } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; -import {setCredentials} from '../app/authSlice'; -import {useAppDispatch} from '../app/hooks/store'; -import {SignInForm} from '../components/authentication/SignInForm'; +import {setCredentials} from '../../redux/authSlice'; +import {useAppDispatch} from '../../redux/hooks/store'; +import {isFetchBaseQueryError, isErrorWithMessage} from '../../redux/helpers'; import { SignInRequest, useGoogleSignInMutation, useSignInMutation, -} from '../services/auth'; -import {isFetchBaseQueryError, isErrorWithMessage} from '../app/helpers'; -import {FormContainer} from '../components/authentication'; +} from '../../services/auth'; +import {SignInForm, FormContainer} from '../../features/authentication'; import { useAuthenticateWithOAuth, redirectsByRole, -} from '../components/authentication/hooks/useAuthenticateWithOAuth'; +} from '../../features/authentication/hooks/useAuthenticateWithOAuth'; export interface LocationState { from: Location; } diff --git a/frontend/src/views/SignUp.tsx b/frontend/src/pages/authentication/SignUp.tsx similarity index 89% rename from frontend/src/views/SignUp.tsx rename to frontend/src/pages/authentication/SignUp.tsx index 91f9712c..d158b478 100644 --- a/frontend/src/views/SignUp.tsx +++ b/frontend/src/pages/authentication/SignUp.tsx @@ -8,17 +8,16 @@ import { Link, } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; - import {useNavigate, useParams} from 'react-router-dom'; -import {SignUpForm} from '../components/authentication/SignUpForm'; + import { useGoogleSignUpMutation, useSignUpMutation, SignUpRequest, -} from '../services/auth'; -import {isErrorWithMessage, isFetchBaseQueryError} from '../app/helpers'; -import {FormContainer} from '../components/authentication'; -import {useAuthenticateWithOAuth} from '../components/authentication/hooks/useAuthenticateWithOAuth'; +} from '../../services/auth'; +import {isErrorWithMessage, isFetchBaseQueryError} from '../../redux/helpers'; +import {useAuthenticateWithOAuth} from '../../features/authentication/hooks/useAuthenticateWithOAuth'; +import {FormContainer, SignUpForm} from '../../features/authentication'; export const SignUp = () => { const [errorMessage, setErrorMessage] = React.useState(''); diff --git a/frontend/src/views/CoordinatorDashboard.tsx b/frontend/src/pages/coordinator-dashboard/CoordinatorDashboard.tsx similarity index 98% rename from frontend/src/views/CoordinatorDashboard.tsx rename to frontend/src/pages/coordinator-dashboard/CoordinatorDashboard.tsx index b7a5363a..fd238523 100644 --- a/frontend/src/views/CoordinatorDashboard.tsx +++ b/frontend/src/pages/coordinator-dashboard/CoordinatorDashboard.tsx @@ -16,9 +16,11 @@ import { DashboardDataItem, DashboardDataResponse, useGetAllDashboardDataMutation, -} from '../services/coordinator'; -import {GuestInviteButton} from '../components/common'; -import {LoadingComponent} from './LoadingComponent'; +} from '../../services/coordinator'; +import { + GuestInviteButton, + LoadingComponent, +} from '../../features/coordinator-dashboard'; const columns: GridColDef[] = [ { diff --git a/frontend/src/views/GuestContacts.tsx b/frontend/src/pages/guest-dashboard/GuestContacts.tsx similarity index 100% rename from frontend/src/views/GuestContacts.tsx rename to frontend/src/pages/guest-dashboard/GuestContacts.tsx diff --git a/frontend/src/views/GuestApplicationTracker.tsx b/frontend/src/pages/guest-dashboard/GuestDashboard.tsx similarity index 99% rename from frontend/src/views/GuestApplicationTracker.tsx rename to frontend/src/pages/guest-dashboard/GuestDashboard.tsx index 5a8db5ae..783a340f 100644 --- a/frontend/src/views/GuestApplicationTracker.tsx +++ b/frontend/src/pages/guest-dashboard/GuestDashboard.tsx @@ -3,7 +3,7 @@ import {styled} from '@mui/system'; import { DashboardTaskAccordion, CoordinatorContact, -} from '../components/dashboard'; +} from '../../features/guest-dashboard'; export type TaskStatus = 'inProgress' | 'complete' | 'locked'; diff --git a/frontend/src/views/GuestDocuments.tsx b/frontend/src/pages/guest-dashboard/GuestDocuments.tsx similarity index 100% rename from frontend/src/views/GuestDocuments.tsx rename to frontend/src/pages/guest-dashboard/GuestDocuments.tsx diff --git a/frontend/src/views/GuestSettings.tsx b/frontend/src/pages/guest-dashboard/GuestSettings.tsx similarity index 100% rename from frontend/src/views/GuestSettings.tsx rename to frontend/src/pages/guest-dashboard/GuestSettings.tsx diff --git a/frontend/src/views/GuestTasks.tsx b/frontend/src/pages/guest-dashboard/GuestTasks.tsx similarity index 100% rename from frontend/src/views/GuestTasks.tsx rename to frontend/src/pages/guest-dashboard/GuestTasks.tsx diff --git a/frontend/src/views/HostApplicationTracker.tsx b/frontend/src/pages/host-dashboard/HostDashboard.tsx similarity index 51% rename from frontend/src/views/HostApplicationTracker.tsx rename to frontend/src/pages/host-dashboard/HostDashboard.tsx index 6f7aef67..d1febf8e 100644 --- a/frontend/src/views/HostApplicationTracker.tsx +++ b/frontend/src/pages/host-dashboard/HostDashboard.tsx @@ -1,32 +1,32 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import {Box, Typography} from '@mui/material'; import * as React from 'react'; -import {AuthenticatedHeader} from '../components/common'; +import {AuthenticatedHeader} from '../../features/ui'; -interface HostApplicationTrackerProps {} +interface HostDashboardProps {} -interface HostApplicationTrackerState {} +interface HostDashboardState {} -enum HostApplicationTrackerActionType {} +enum HostDashboardActionType {} -interface HostApplicationTrackerAction { - type: HostApplicationTrackerActionType; +interface HostDashboardAction { + type: HostDashboardActionType; payload?: string; } -const initialState: HostApplicationTrackerState = {}; +const initialState: HostDashboardState = {}; function reducer( - state: HostApplicationTrackerState, - action: HostApplicationTrackerAction, -): HostApplicationTrackerState { + state: HostDashboardState, + action: HostDashboardAction, +): HostDashboardState { switch (action.type) { default: throw new Error(`Unsupported action: ${JSON.stringify(action)}`); } } -export function HostApplicationTracker(props: HostApplicationTrackerProps) { +export function HostDashboard(props: HostDashboardProps) { const [state, dispatch] = React.useReducer(reducer, initialState); return ( diff --git a/frontend/src/pages/index.ts b/frontend/src/pages/index.ts new file mode 100644 index 00000000..55b823c7 --- /dev/null +++ b/frontend/src/pages/index.ts @@ -0,0 +1,21 @@ +export {CoordinatorDashboard} from './coordinator-dashboard/CoordinatorDashboard'; +export {GuestApplicationTracker} from './guest-dashboard/GuestDashboard'; +export {GuestSettings} from './guest-dashboard/GuestSettings'; +export {GuestContacts} from './guest-dashboard/GuestContacts'; +export {GuestTasks} from './guest-dashboard/GuestTasks'; +export {GuestDocuments} from './guest-dashboard/GuestDocuments'; +export {Home} from './Home'; +export {HostDashboard} from './host-dashboard/HostDashboard'; +export {ForgotPassword} from './authentication/ForgotPassword'; +export {ResetPassword} from './authentication/ResetPassword'; +export {SelectAccountType} from './authentication/SelectAccountType'; +export {SignIn} from './authentication/SignIn'; +export {SignUp} from './authentication/SignUp'; +export {EmailVerificationSuccess} from './authentication/EmailVerificationSuccess'; +export {EmailVerificationError} from './authentication/EmailVerificationError'; +export {NewPassword} from './authentication/NewPassword'; +export {ForgotPasswordCode} from './authentication/ForgotPasswordCode'; +export {ForgotPasswordSuccess} from './authentication/ForgotPasswordSuccess'; +export {Settings} from './Settings'; +export {ConfirmSignUp} from './authentication/ConfirmSignUp'; +export {IntakeProfile} from './intake-profile/IntakeProfile'; diff --git a/frontend/src/views/IntakeProfile/index.tsx b/frontend/src/pages/intake-profile/IntakeProfile.tsx similarity index 97% rename from frontend/src/views/IntakeProfile/index.tsx rename to frontend/src/pages/intake-profile/IntakeProfile.tsx index 3b023eea..6f31774b 100644 --- a/frontend/src/views/IntakeProfile/index.tsx +++ b/frontend/src/pages/intake-profile/IntakeProfile.tsx @@ -1,14 +1,14 @@ import {Button, Stack, useMediaQuery, useTheme} from '@mui/material'; import {Outlet, useLocation, useNavigate, useParams} from 'react-router-dom'; import {Formik} from 'formik'; -import {buildValidationSchema, createInitialValues} from './constants'; +import {buildValidationSchema, createInitialValues} from './helpers'; import { useGetProfileQuery, useGetResponsesQuery, Response, } from '../../services/profile'; import {useState} from 'react'; -import {ProfileSidebar} from '../../components/intake-profile/ProfileSidebar'; +import {ProfileSidebar} from '../../features/intake-profile'; export type Values = { [key: string]: Response['value']; }; diff --git a/frontend/src/views/IntakeProfile/constants/buildValidationSchema.ts b/frontend/src/pages/intake-profile/helpers/buildValidationSchema.ts similarity index 100% rename from frontend/src/views/IntakeProfile/constants/buildValidationSchema.ts rename to frontend/src/pages/intake-profile/helpers/buildValidationSchema.ts diff --git a/frontend/src/views/IntakeProfile/constants/createInitialValues.ts b/frontend/src/pages/intake-profile/helpers/createInitialValues.ts similarity index 96% rename from frontend/src/views/IntakeProfile/constants/createInitialValues.ts rename to frontend/src/pages/intake-profile/helpers/createInitialValues.ts index 7025723c..e8fe2d00 100644 --- a/frontend/src/views/IntakeProfile/constants/createInitialValues.ts +++ b/frontend/src/pages/intake-profile/helpers/createInitialValues.ts @@ -1,5 +1,5 @@ import {FieldGroup, FieldTypes, Response} from '../../../services/profile'; -import {InitialValues} from '..'; +import {InitialValues} from '../IntakeProfile'; /** * Creates an object used for the initial Formik valiues diff --git a/frontend/src/views/IntakeProfile/constants/index.ts b/frontend/src/pages/intake-profile/helpers/index.ts similarity index 98% rename from frontend/src/views/IntakeProfile/constants/index.ts rename to frontend/src/pages/intake-profile/helpers/index.ts index aa7c7304..a093c3d7 100644 --- a/frontend/src/views/IntakeProfile/constants/index.ts +++ b/frontend/src/pages/intake-profile/helpers/index.ts @@ -1,6 +1,6 @@ import {faker} from '@faker-js/faker'; import {array, object, string} from 'yup'; -import {InitialValues} from '..'; +import {InitialValues} from '../IntakeProfile'; import { FieldGroup, Fields, diff --git a/frontend/src/app/authSlice.ts b/frontend/src/redux/authSlice.ts similarity index 100% rename from frontend/src/app/authSlice.ts rename to frontend/src/redux/authSlice.ts diff --git a/frontend/src/app/helpers.ts b/frontend/src/redux/helpers.ts similarity index 100% rename from frontend/src/app/helpers.ts rename to frontend/src/redux/helpers.ts diff --git a/frontend/src/app/hooks/store.ts b/frontend/src/redux/hooks/store.ts similarity index 100% rename from frontend/src/app/hooks/store.ts rename to frontend/src/redux/hooks/store.ts diff --git a/frontend/src/app/hooks/useAuth.ts b/frontend/src/redux/hooks/useAuth.ts similarity index 100% rename from frontend/src/app/hooks/useAuth.ts rename to frontend/src/redux/hooks/useAuth.ts diff --git a/frontend/src/app/store.ts b/frontend/src/redux/store.ts similarity index 100% rename from frontend/src/app/store.ts rename to frontend/src/redux/store.ts diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.ts index 94a1c0dd..30f441cb 100644 --- a/frontend/src/services/api.ts +++ b/frontend/src/services/api.ts @@ -5,8 +5,8 @@ import { FetchBaseQueryError, FetchArgs, } from '@reduxjs/toolkit/query/react'; -import {setCredentials, tokenReceived} from '../app/authSlice'; -import {RootState} from '../app/store'; +import {setCredentials, tokenReceived} from '../redux/authSlice'; +import {RootState} from '../redux/store'; // Create base query const baseQuery = fetchBaseQuery({ diff --git a/frontend/src/services/auth.ts b/frontend/src/services/auth.ts index 82a98665..7920569c 100644 --- a/frontend/src/services/auth.ts +++ b/frontend/src/services/auth.ts @@ -35,11 +35,6 @@ export interface SignOutResponse { message: string; } -export interface VerificationRequest { - email: string; - code: string; -} - export interface ForgotPasswordRequest { email: string; } @@ -109,14 +104,6 @@ const authApi = api.injectEndpoints({ }; }, }), - verification: build.mutation({ - query: credentials => ({ - url: 'auth/verify', - method: 'POST', - withCredentials: true, - body: credentials, - }), - }), forgotPassword: build.mutation({ query: credentials => ({ url: 'auth/forgot-password', @@ -181,7 +168,6 @@ export const { useSignUpMutation, useSignInMutation, useSignOutMutation, - useVerificationMutation, useNewPasswordMutation, useGoogleSignUpMutation, useGoogleSignInMutation, diff --git a/frontend/src/services/host.ts b/frontend/src/services/host.ts deleted file mode 100644 index dd986fb1..00000000 --- a/frontend/src/services/host.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {api} from './api'; -const injectedRtkApi = api.injectEndpoints({ - endpoints: build => ({ - getHosts: build.query({ - query: () => ({url: `/host`}), - providesTags: (result = []) => [ - ...result.map(({id}) => ({type: 'Hosts', id}) as const), - {type: 'Hosts' as const, id: 'LIST'}, - ], - }), - createHost: build.mutation({ - query: queryArg => ({url: `/host`, method: 'POST', body: queryArg.body}), - invalidatesTags: [{type: 'Hosts', id: 'LIST'}], - }), - }), - overrideExisting: false, -}); - -export {injectedRtkApi as hostAPI}; -export type Host = {id: number; name: string}; -export type GetHostsApiResponse = /** status 200 An array of hosts */ Host[]; -export type GetHostsApiArg = void; -export type CreateHostApiResponse = - /** status 200 Succes created host */ ApiResponse; -export type CreateHostApiArg = { - body: { - name: string; - }; -}; -export type ApiResponse = { - id?: number; - name?: string; -}; -export const {useGetHostsQuery, useCreateHostMutation} = injectedRtkApi; diff --git a/frontend/src/utils/test/__mocks__/fileMock.ts b/frontend/src/utils/testing/__mocks__/fileMock.ts similarity index 100% rename from frontend/src/utils/test/__mocks__/fileMock.ts rename to frontend/src/utils/testing/__mocks__/fileMock.ts diff --git a/frontend/src/utils/test/browser.ts b/frontend/src/utils/testing/browser.ts similarity index 100% rename from frontend/src/utils/test/browser.ts rename to frontend/src/utils/testing/browser.ts diff --git a/frontend/src/utils/test/db/profile.ts b/frontend/src/utils/testing/db/profile.ts similarity index 100% rename from frontend/src/utils/test/db/profile.ts rename to frontend/src/utils/testing/db/profile.ts diff --git a/frontend/src/utils/test/handlers/auth.ts b/frontend/src/utils/testing/handlers/auth.ts similarity index 100% rename from frontend/src/utils/test/handlers/auth.ts rename to frontend/src/utils/testing/handlers/auth.ts diff --git a/frontend/src/utils/test/handlers/profile.ts b/frontend/src/utils/testing/handlers/profile.ts similarity index 100% rename from frontend/src/utils/test/handlers/profile.ts rename to frontend/src/utils/testing/handlers/profile.ts diff --git a/frontend/src/utils/test/server.ts b/frontend/src/utils/testing/server.ts similarity index 100% rename from frontend/src/utils/test/server.ts rename to frontend/src/utils/testing/server.ts diff --git a/frontend/src/utils/test/setupTests.ts b/frontend/src/utils/testing/setupTests.ts similarity index 100% rename from frontend/src/utils/test/setupTests.ts rename to frontend/src/utils/testing/setupTests.ts diff --git a/frontend/src/utils/test/test-utils.tsx b/frontend/src/utils/testing/test-utils.tsx similarity index 94% rename from frontend/src/utils/test/test-utils.tsx rename to frontend/src/utils/testing/test-utils.tsx index 76c97d31..9cae4570 100644 --- a/frontend/src/utils/test/test-utils.tsx +++ b/frontend/src/utils/testing/test-utils.tsx @@ -6,7 +6,7 @@ import userEvent from '@testing-library/user-event'; import {HomeUniteUsTheme} from '../../theme'; import {PreloadedState} from '@reduxjs/toolkit'; -import {setupStore, RootState, AppStore} from '../../app/store'; +import {setupStore, RootState, AppStore} from '../../redux/store'; interface ProviderProps { children: ReactNode; diff --git a/frontend/src/utils/PasswordValidationSchema.tsx b/frontend/src/utils/validation-schemas.tsx similarity index 100% rename from frontend/src/utils/PasswordValidationSchema.tsx rename to frontend/src/utils/validation-schemas.tsx diff --git a/frontend/src/views/AccountVerification.tsx b/frontend/src/views/AccountVerification.tsx deleted file mode 100644 index c38a74aa..00000000 --- a/frontend/src/views/AccountVerification.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import {styled} from '@mui/system'; -import {Stack, Typography} from '@mui/material'; - -import {VerificationRequest, useVerificationMutation} from '../services/auth'; -import {AccountVerificationForm} from '../components/authentication/AccountVerificationForm'; - -export const AccountVerification = () => { - const [verify] = useVerificationMutation(); - - const handleVerification = async ({email, code}: VerificationRequest) => { - try { - const response = await verify({ - email, - code, - }).unwrap(); - console.log(response); - } catch (err) { - console.log(err); - } - }; - - return ( - - Verify your account - - - ); -}; - -const FormContainer = styled(Stack)(({theme}) => ({ - maxWidth: '550px', - minWidth: '350px', - alignItems: 'center', - padding: '2rem', - border: '1px solid #e0e0e0', - borderRadius: theme.shape.borderRadius, - backgroundColor: '#fff', - margin: '0 16px', -})); - -const FormHeader = styled(Typography)({ - textAlign: 'center', - marginBottom: '16px', - fontWeight: 600, -}); diff --git a/frontend/src/views/HostsList.tsx b/frontend/src/views/HostsList.tsx deleted file mode 100644 index 7add4726..00000000 --- a/frontend/src/views/HostsList.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - Stack, - InputLabel, - OutlinedInput, - Button, - Container, -} from '@mui/material'; -import React from 'react'; -import {useGetHostsQuery, useCreateHostMutation} from '../services/host'; - -export const HostsList = () => { - const [name, setName] = React.useState(''); - - const {data} = useGetHostsQuery(); - const [createPost, {isLoading}] = useCreateHostMutation(); - - const handleChange = (event: React.ChangeEvent) => { - setName(event.target.value); - }; - - const handleSubmit = () => { - if (name === '') return; - - createPost({body: {name}}); - }; - - return ( - -

Create a host

- - Full name - - - -

Hosts

-
    {data?.map(host =>
  • {host.name}
  • )}
-
- ); -}; diff --git a/frontend/src/views/index.ts b/frontend/src/views/index.ts deleted file mode 100644 index 448093bf..00000000 --- a/frontend/src/views/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -export {AccountVerification} from './AccountVerification'; -export {CoordinatorDashboard} from './CoordinatorDashboard'; -export {GuestApplicationTracker} from './GuestApplicationTracker'; -export {GuestSettings} from './GuestSettings'; -export {GuestContacts} from './GuestContacts'; -export {GuestTasks} from './GuestTasks'; -export {GuestDocuments} from './GuestDocuments'; -export {Home} from './Home'; -export {HostApplicationTracker} from './HostApplicationTracker'; -export {HostsList} from './HostsList'; -export {ForgotPassword} from './ForgotPassword'; -export {ResetPassword} from './ResetPassword'; -export {SelectAccountType} from './SelectAccountType'; -export {SignIn} from './SignIn'; -export {SignUp} from './SignUp'; -export {EmailVerificationSuccess} from './EmailVerificationSuccess'; -export {EmailVerificationError} from './EmailVerificationError'; -export {NewPassword} from './NewPassword'; -export {ForgotPasswordCode} from './ForgotPasswordCode'; -export {ForgotPasswordSuccess} from './ForgotPasswordSuccess'; -export {Settings} from './Settings'; -export {ConfirmSignUp} from './ConfirmSignUp'; -export {IntakeProfile} from './IntakeProfile';