diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47338b3da..77f211f19 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,15 +3,15 @@ ci: autofix_commit_msg: | [pre-commit.ci] auto fixes from pre-commit.com hooks - autoupdate_branch: 'pre-commit' - autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_branch: "pre-commit" + autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" autoupdate_schedule: quarterly skip: [] submodules: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v4.5.0' + rev: "v4.5.0" hooks: - id: trailing-whitespace - id: check-json @@ -24,7 +24,7 @@ repos: \.vscode\/.*| )$ - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.1.11' + rev: "v0.1.11" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -38,17 +38,18 @@ repos: - python pass_filenames: false - repo: https://github.com/pre-commit/mirrors-eslint - rev: 'v9.8.0' + rev: "v9.8.0" hooks: - id: eslint files: ^client/.*\.[jt]sx?$ args: [-c=client/eslint.config.js] types: [file] - repo: https://github.com/pre-commit/mirrors-prettier - rev: 'v3.1.0' + rev: "v3.1.0" hooks: - id: prettier exclude: infra/haztrak/ + files: ^(client/.*\.[jt]sx?|.*\.md|.*\.yaml)$ - repo: https://github.com/asottile/pyupgrade rev: v3.15.0 hooks: diff --git a/.prettierignore b/client/.prettierignore similarity index 100% rename from .prettierignore rename to client/.prettierignore diff --git a/.prettierrc.json b/client/.prettierrc.json similarity index 100% rename from .prettierrc.json rename to client/.prettierrc.json diff --git a/client/Dockerfile b/client/Dockerfile index cc4fc7978..04ae785fc 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,6 +1,6 @@ # Mutlistage dockerize dpgraham.com react.js front end # Build stage -FROM node:20-alpine as builder +FROM node:20-alpine AS builder LABEL maintainer="graham.david@epa.gov" WORKDIR /app COPY . . @@ -9,20 +9,20 @@ RUN npm run build # test -FROM builder as test +FROM builder AS test WORKDIR /app CMD ["npm", "run", "test"] # local development -FROM builder as dev +FROM builder AS dev WORKDIR /app EXPOSE 3000 CMD ["npm", "start"] # Production -FROM nginx:1.24.0-alpine as production +FROM nginx:1.24.0-alpine AS production WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # copy build from builder stage COPY --from=builder /app/build /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/client/src/App.scss b/client/app/App.scss similarity index 100% rename from client/src/App.scss rename to client/app/App.scss diff --git a/client/src/App.tsx b/client/app/App.tsx similarity index 81% rename from client/src/App.tsx rename to client/app/App.tsx index b880ed2e2..298114dcb 100644 --- a/client/src/App.tsx +++ b/client/app/App.tsx @@ -1,12 +1,12 @@ -import { ErrorBoundary } from 'components/Error'; -import { Notifications } from 'components/Notifications/Notifications'; -import { HtSpinner } from 'components/UI'; +import { ErrorBoundary } from '~/components/Error'; +import { Notifications } from '~/components/Notifications/Notifications'; +import { HtSpinner } from '~/components/UI'; import React, { ReactElement, Suspense } from 'react'; import { Container } from 'react-bootstrap'; import { RouterProvider } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; -import { router } from 'routes'; +import { router } from '~/routes'; import './App.scss'; const GlobalSpinner = () => ( diff --git a/client/src/components/Auth/LoginForm.tsx b/client/app/components/Auth/LoginForm.tsx similarity index 97% rename from client/src/components/Auth/LoginForm.tsx rename to client/app/components/Auth/LoginForm.tsx index 83546daae..72e4c0bf5 100644 --- a/client/src/components/Auth/LoginForm.tsx +++ b/client/app/components/Auth/LoginForm.tsx @@ -1,5 +1,5 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { HtForm, HtSpinner } from 'components/UI'; +import { HtForm, HtSpinner } from '~/components/UI'; import React, { useEffect, useState } from 'react'; import { FloatingLabel, Form } from 'react-bootstrap'; import { useForm } from 'react-hook-form'; @@ -10,7 +10,7 @@ import { useAppDispatch, useAppSelector, useLoginMutation, -} from 'store'; +} from '~/store'; import { z } from 'zod'; const loginSchema = z.object({ diff --git a/client/src/components/Auth/index.ts b/client/app/components/Auth/index.ts similarity index 100% rename from client/src/components/Auth/index.ts rename to client/app/components/Auth/index.ts diff --git a/client/src/components/Charts/GeneratorStatusAreaChart/GeneratorStatusAreaChart.tsx b/client/app/components/Charts/GeneratorStatusAreaChart/GeneratorStatusAreaChart.tsx similarity index 100% rename from client/src/components/Charts/GeneratorStatusAreaChart/GeneratorStatusAreaChart.tsx rename to client/app/components/Charts/GeneratorStatusAreaChart/GeneratorStatusAreaChart.tsx diff --git a/client/src/components/Charts/ManifestCountBarChart/ManifestCountBarChart.tsx b/client/app/components/Charts/ManifestCountBarChart/ManifestCountBarChart.tsx similarity index 100% rename from client/src/components/Charts/ManifestCountBarChart/ManifestCountBarChart.tsx rename to client/app/components/Charts/ManifestCountBarChart/ManifestCountBarChart.tsx diff --git a/client/src/components/Charts/ManifestStatusPieChart/ManifestStatusPieChart.tsx b/client/app/components/Charts/ManifestStatusPieChart/ManifestStatusPieChart.tsx similarity index 100% rename from client/src/components/Charts/ManifestStatusPieChart/ManifestStatusPieChart.tsx rename to client/app/components/Charts/ManifestStatusPieChart/ManifestStatusPieChart.tsx diff --git a/client/src/components/Charts/index.ts b/client/app/components/Charts/index.ts similarity index 100% rename from client/src/components/Charts/index.ts rename to client/app/components/Charts/index.ts diff --git a/client/src/components/Error/Error404.tsx b/client/app/components/Error/Error404.tsx similarity index 100% rename from client/src/components/Error/Error404.tsx rename to client/app/components/Error/Error404.tsx diff --git a/client/src/components/Error/ErrorBoundary.tsx b/client/app/components/Error/ErrorBoundary.tsx similarity index 100% rename from client/src/components/Error/ErrorBoundary.tsx rename to client/app/components/Error/ErrorBoundary.tsx diff --git a/client/src/components/Error/index.ts b/client/app/components/Error/index.ts similarity index 100% rename from client/src/components/Error/index.ts rename to client/app/components/Error/index.ts diff --git a/client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx b/client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx similarity index 88% rename from client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx rename to client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx index 3c6118e88..aa5d44cd5 100644 --- a/client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx +++ b/client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.spec.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { screen } from '@testing-library/react'; import React, { useState } from 'react'; -import { cleanup, renderWithProviders } from 'test-utils'; +import { cleanup, renderWithProviders } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; -import { createMockHandler, createMockSite } from 'test-utils/fixtures/mockHandler'; -import { SiteFilterForm } from 'components/HaztrakSite/SiteFilter/SiteFilterForm'; +import { createMockHandler, createMockSite } from '~/mocks/fixtures/mockHandler'; +import { SiteFilterForm } from '~/components/HaztrakSite/SiteFilter/SiteFilterForm'; import { useSearchParams } from 'react-router-dom'; import userEvent from '@testing-library/user-event'; diff --git a/client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx b/client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx similarity index 96% rename from client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx rename to client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx index becbdc06a..feb38f880 100644 --- a/client/src/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx +++ b/client/app/components/HaztrakSite/SiteFilter/SiteFilterForm.tsx @@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form'; import { FloatingLabel, Form } from 'react-bootstrap'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; -import { HaztrakSite } from 'components/HaztrakSite/haztrakSiteSchema'; +import { HaztrakSite } from '~/components/HaztrakSite/haztrakSiteSchema'; import { useSearchParams } from 'react-router-dom'; interface SiteFilterFormProps { diff --git a/client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx b/client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx similarity index 76% rename from client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx rename to client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx index 1bdf7bf9a..6b6e6642b 100644 --- a/client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx +++ b/client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.spec.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { screen } from '@testing-library/react'; import React from 'react'; -import { cleanup, renderWithProviders } from 'test-utils'; +import { cleanup, renderWithProviders } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; -import { SiteListGroup } from 'components/HaztrakSite/SiteListGroup/SiteListGroup'; -import { createMockHandler, createMockSite } from 'test-utils/fixtures/mockHandler'; +import { SiteListGroup } from '~/components/HaztrakSite/SiteListGroup/SiteListGroup'; +import { createMockHandler, createMockSite } from '~/mocks/fixtures/mockHandler'; afterEach(() => { cleanup(); diff --git a/client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx b/client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx similarity index 84% rename from client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx rename to client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx index 04d6e9f81..4aebed470 100644 --- a/client/src/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx +++ b/client/app/components/HaztrakSite/SiteListGroup/SiteListGroup.tsx @@ -1,7 +1,7 @@ -import { HaztrakSite } from 'components/HaztrakSite/haztrakSiteSchema'; +import { HaztrakSite } from '~/components/HaztrakSite/haztrakSiteSchema'; import { Col, Container, ListGroup, Row } from 'react-bootstrap'; -import { SiteListItem } from 'components/HaztrakSite/SiteListItem/SiteListItem'; -import { SiteFilterForm } from 'components/HaztrakSite/SiteFilter/SiteFilterForm'; +import { SiteListItem } from '~/components/HaztrakSite/SiteListItem/SiteListItem'; +import { SiteFilterForm } from '~/components/HaztrakSite/SiteFilter/SiteFilterForm'; import React, { useState } from 'react'; import winkingRobot from '/assets/img/robot/robot-wink.jpg'; import { useAutoAnimate } from '@formkit/auto-animate/react'; diff --git a/client/src/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx b/client/app/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx similarity index 82% rename from client/src/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx rename to client/app/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx index 4db3eb534..eeb18b6e3 100644 --- a/client/src/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx +++ b/client/app/components/HaztrakSite/SiteListItem/SiteListItem.spec.tsx @@ -1,9 +1,9 @@ import '@testing-library/jest-dom'; import { screen } from '@testing-library/react'; import React from 'react'; -import { cleanup, renderWithProviders } from 'test-utils'; +import { cleanup, renderWithProviders } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; -import { createMockSite } from 'test-utils/fixtures/mockHandler'; +import { createMockSite } from '~/mocks/fixtures/mockHandler'; import { SiteListItem } from './SiteListItem'; afterEach(() => { diff --git a/client/src/components/HaztrakSite/SiteListItem/SiteListItem.tsx b/client/app/components/HaztrakSite/SiteListItem/SiteListItem.tsx similarity index 82% rename from client/src/components/HaztrakSite/SiteListItem/SiteListItem.tsx rename to client/app/components/HaztrakSite/SiteListItem/SiteListItem.tsx index 20ecdf4b3..9840954cf 100644 --- a/client/src/components/HaztrakSite/SiteListItem/SiteListItem.tsx +++ b/client/app/components/HaztrakSite/SiteListItem/SiteListItem.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import { HaztrakSite } from 'components/HaztrakSite/haztrakSiteSchema'; +import { HaztrakSite } from '~/components/HaztrakSite/haztrakSiteSchema'; import { ListGroup } from 'react-bootstrap'; import { Link } from 'react-router-dom'; -import { SiteListItemActions } from 'components/HaztrakSite/SiteListItem/SiteListItemActions'; +import { SiteListItemActions } from '~/components/HaztrakSite/SiteListItem/SiteListItemActions'; interface SiteListItemProps { site: HaztrakSite; diff --git a/client/src/components/HaztrakSite/SiteListItem/SiteListItemActions.tsx b/client/app/components/HaztrakSite/SiteListItem/SiteListItemActions.tsx similarity index 100% rename from client/src/components/HaztrakSite/SiteListItem/SiteListItemActions.tsx rename to client/app/components/HaztrakSite/SiteListItem/SiteListItemActions.tsx diff --git a/client/src/components/HaztrakSite/haztrakSiteSchema.ts b/client/app/components/HaztrakSite/haztrakSiteSchema.ts similarity index 90% rename from client/src/components/HaztrakSite/haztrakSiteSchema.ts rename to client/app/components/HaztrakSite/haztrakSiteSchema.ts index 633f23f59..cd8b21bdb 100644 --- a/client/src/components/HaztrakSite/haztrakSiteSchema.ts +++ b/client/app/components/HaztrakSite/haztrakSiteSchema.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { rcraSite } from 'components/RcraSite'; +import { rcraSite } from '~/components/RcraSite'; const haztrakSiteSchema = z.object({ name: z.string(), diff --git a/client/src/components/HaztrakSite/index.ts b/client/app/components/HaztrakSite/index.ts similarity index 100% rename from client/src/components/HaztrakSite/index.ts rename to client/app/components/HaztrakSite/index.ts diff --git a/client/src/components/Help/HaztrakLicense.tsx b/client/app/components/Help/HaztrakLicense.tsx similarity index 97% rename from client/src/components/Help/HaztrakLicense.tsx rename to client/app/components/Help/HaztrakLicense.tsx index 00c9021ef..bb49ac7da 100644 --- a/client/src/components/Help/HaztrakLicense.tsx +++ b/client/app/components/Help/HaztrakLicense.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { HtCard } from 'components/UI'; +import { HtCard } from '~/components/UI'; export function HaztrakLicense() { return ( diff --git a/client/src/components/Help/SectionTitle.tsx b/client/app/components/Help/SectionTitle.tsx similarity index 100% rename from client/src/components/Help/SectionTitle.tsx rename to client/app/components/Help/SectionTitle.tsx diff --git a/client/app/components/Help/index.ts b/client/app/components/Help/index.ts new file mode 100644 index 000000000..ab4f444ae --- /dev/null +++ b/client/app/components/Help/index.ts @@ -0,0 +1,2 @@ +export { HaztrakLicense } from '~/components/Help/HaztrakLicense'; +export { SectionTitle } from '~/components/Help/SectionTitle'; diff --git a/client/src/components/Layout/Nav/NavItem.tsx b/client/app/components/Layout/Nav/NavItem.tsx similarity index 89% rename from client/src/components/Layout/Nav/NavItem.tsx rename to client/app/components/Layout/Nav/NavItem.tsx index ed1cd9af7..0cc79895a 100644 --- a/client/src/components/Layout/Nav/NavItem.tsx +++ b/client/app/components/Layout/Nav/NavItem.tsx @@ -1,7 +1,7 @@ import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { NavContext, NavContextProps } from 'components/Layout/Root'; -import { Route } from 'components/Layout/Sidebar/SidebarRoutes'; +import { NavContext, NavContextProps } from '~/components/Layout/Root'; +import { Route } from '~/components/Layout/Sidebar/SidebarRoutes'; import React, { useContext } from 'react'; import { Link } from 'react-router-dom'; import { NavLink } from 'react-bootstrap'; diff --git a/client/src/components/Layout/Nav/NavSection.tsx b/client/app/components/Layout/Nav/NavSection.tsx similarity index 76% rename from client/src/components/Layout/Nav/NavSection.tsx rename to client/app/components/Layout/Nav/NavSection.tsx index 21ce40a17..5c9fb5e5f 100644 --- a/client/src/components/Layout/Nav/NavSection.tsx +++ b/client/app/components/Layout/Nav/NavSection.tsx @@ -1,5 +1,5 @@ -import { NavItem } from 'components/Layout/Nav/NavItem'; -import { RoutesSection } from 'components/Layout/Sidebar/SidebarRoutes'; +import { NavItem } from '~/components/Layout/Nav/NavItem'; +import { RoutesSection } from '~/components/Layout/Sidebar/SidebarRoutes'; import React from 'react'; interface SidebarSectionProps { diff --git a/client/src/components/Layout/PrivateRoute.tsx b/client/app/components/Layout/PrivateRoute.tsx similarity index 86% rename from client/src/components/Layout/PrivateRoute.tsx rename to client/app/components/Layout/PrivateRoute.tsx index a1d286756..bbe845d7c 100644 --- a/client/src/components/Layout/PrivateRoute.tsx +++ b/client/app/components/Layout/PrivateRoute.tsx @@ -1,6 +1,6 @@ import React, { ReactElement } from 'react'; import { Navigate } from 'react-router-dom'; -import { selectAuthenticated, useAppSelector } from 'store'; +import { selectAuthenticated, useAppSelector } from '~/store'; interface Props { children: ReactElement; diff --git a/client/src/components/Layout/Root.tsx b/client/app/components/Layout/Root.tsx similarity index 92% rename from client/src/components/Layout/Root.tsx rename to client/app/components/Layout/Root.tsx index 78f688d01..d84da102f 100644 --- a/client/src/components/Layout/Root.tsx +++ b/client/app/components/Layout/Root.tsx @@ -1,5 +1,5 @@ -import { ErrorBoundary } from 'components/Error'; -import { HtSpinner } from 'components/UI'; +import { ErrorBoundary } from '~/components/Error'; +import { HtSpinner } from '~/components/UI'; import React, { createContext, Dispatch, SetStateAction, Suspense, useState } from 'react'; import { Container } from 'react-bootstrap'; import { Outlet } from 'react-router-dom'; diff --git a/client/src/components/Layout/Sidebar/Sidebar.spec.tsx b/client/app/components/Layout/Sidebar/Sidebar.spec.tsx similarity index 75% rename from client/src/components/Layout/Sidebar/Sidebar.spec.tsx rename to client/app/components/Layout/Sidebar/Sidebar.spec.tsx index 083854b10..19d464dcd 100644 --- a/client/src/components/Layout/Sidebar/Sidebar.spec.tsx +++ b/client/app/components/Layout/Sidebar/Sidebar.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { Sidebar } from 'components/Layout/Sidebar/Sidebar'; +import { Sidebar } from '~/components/Layout/Sidebar/Sidebar'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Layout/Sidebar/Sidebar.tsx b/client/app/components/Layout/Sidebar/Sidebar.tsx similarity index 87% rename from client/src/components/Layout/Sidebar/Sidebar.tsx rename to client/app/components/Layout/Sidebar/Sidebar.tsx index e598647cd..0f9ccb261 100644 --- a/client/src/components/Layout/Sidebar/Sidebar.tsx +++ b/client/app/components/Layout/Sidebar/Sidebar.tsx @@ -1,12 +1,12 @@ import logo from '/assets/img/haztrak-logos/haztrak-logo-zip-file/png/logo-black-crop.png'; -import { NavSection } from 'components/Layout/Nav/NavSection'; -import { NavItem } from 'components/Layout/Nav/NavItem'; -import { NavContext, NavContextProps } from 'components/Layout/Root'; +import { NavSection } from '~/components/Layout/Nav/NavSection'; +import { NavItem } from '~/components/Layout/Nav/NavItem'; +import { NavContext, NavContextProps } from '~/components/Layout/Root'; import React, { ReactElement, useContext } from 'react'; import { Nav, Offcanvas } from 'react-bootstrap'; import { useSelector } from 'react-redux'; import { Link } from 'react-router-dom'; -import { RootState } from 'store'; +import { RootState } from '~/store'; import { routes } from './SidebarRoutes'; /** Vertical sidebar for navigation that disappears when the viewport is small*/ diff --git a/client/src/components/Layout/Sidebar/SidebarRoutes.tsx b/client/app/components/Layout/Sidebar/SidebarRoutes.tsx similarity index 100% rename from client/src/components/Layout/Sidebar/SidebarRoutes.tsx rename to client/app/components/Layout/Sidebar/SidebarRoutes.tsx diff --git a/client/src/components/Layout/TopNav/TopNav.spec.tsx b/client/app/components/Layout/TopNav/TopNav.spec.tsx similarity index 85% rename from client/src/components/Layout/TopNav/TopNav.spec.tsx rename to client/app/components/Layout/TopNav/TopNav.spec.tsx index bc9753cfc..2f008b62d 100644 --- a/client/src/components/Layout/TopNav/TopNav.spec.tsx +++ b/client/app/components/Layout/TopNav/TopNav.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { TopNav } from 'components/Layout/TopNav/TopNav'; +import { TopNav } from '~/components/Layout/TopNav/TopNav'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Layout/TopNav/TopNav.tsx b/client/app/components/Layout/TopNav/TopNav.tsx similarity index 97% rename from client/src/components/Layout/TopNav/TopNav.tsx rename to client/app/components/Layout/TopNav/TopNav.tsx index 18817b0e0..1eba8e4d4 100644 --- a/client/src/components/Layout/TopNav/TopNav.tsx +++ b/client/app/components/Layout/TopNav/TopNav.tsx @@ -1,12 +1,12 @@ import logo from '/assets/img/haztrak-logos/haztrak-logo-zip-file/svg/logo-no-background.svg'; import { faArrowRightFromBracket, faBars, faGear, faUser } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { NavContext, NavContextProps } from 'components/Layout/Root'; +import { NavContext, NavContextProps } from '~/components/Layout/Root'; import React, { useContext } from 'react'; import { Button, Dropdown } from 'react-bootstrap'; import { useDispatch, useSelector } from 'react-redux'; import { Link, useNavigate } from 'react-router-dom'; -import { removeCredentials, selectAuthenticated, useLogoutMutation } from 'store'; +import { removeCredentials, selectAuthenticated, useLogoutMutation } from '~/store'; export function TopNav() { const { showSidebar, setShowSidebar } = useContext(NavContext); diff --git a/client/src/components/Layout/index.ts b/client/app/components/Layout/index.ts similarity index 100% rename from client/src/components/Layout/index.ts rename to client/app/components/Layout/index.ts diff --git a/client/src/components/Manifest/Actions/ManifestCancelBtn.tsx b/client/app/components/Manifest/Actions/ManifestCancelBtn.tsx similarity index 80% rename from client/src/components/Manifest/Actions/ManifestCancelBtn.tsx rename to client/app/components/Manifest/Actions/ManifestCancelBtn.tsx index 2a41eed0d..523d4d3c3 100644 --- a/client/src/components/Manifest/Actions/ManifestCancelBtn.tsx +++ b/client/app/components/Manifest/Actions/ManifestCancelBtn.tsx @@ -1,9 +1,9 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { HtButton } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { HtButton } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React, { useContext } from 'react'; import { useFormContext } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; diff --git a/client/src/components/Manifest/Actions/ManifestEditBtn.tsx b/client/app/components/Manifest/Actions/ManifestEditBtn.tsx similarity index 85% rename from client/src/components/Manifest/Actions/ManifestEditBtn.tsx rename to client/app/components/Manifest/Actions/ManifestEditBtn.tsx index a4ef114f9..663142744 100644 --- a/client/src/components/Manifest/Actions/ManifestEditBtn.tsx +++ b/client/app/components/Manifest/Actions/ManifestEditBtn.tsx @@ -1,8 +1,8 @@ import { faPenToSquare } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { HtButton } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { HtButton } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React, { useContext } from 'react'; import { ButtonProps } from 'react-bootstrap'; import { useNavigate } from 'react-router-dom'; diff --git a/client/src/components/Manifest/Actions/ManifestFABs.spec.tsx b/client/app/components/Manifest/Actions/ManifestFABs.spec.tsx similarity index 85% rename from client/src/components/Manifest/Actions/ManifestFABs.spec.tsx rename to client/app/components/Manifest/Actions/ManifestFABs.spec.tsx index 395d64133..9a4f9376f 100644 --- a/client/src/components/Manifest/Actions/ManifestFABs.spec.tsx +++ b/client/app/components/Manifest/Actions/ManifestFABs.spec.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; -import { ManifestFABs } from 'components/Manifest/Actions/ManifestFABs'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { ManifestStatus } from 'components/Manifest/manifestSchema'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestFABs } from '~/components/Manifest/Actions/ManifestFABs'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { ManifestStatus } from '~/components/Manifest/manifestSchema'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; const TestComponent = ({ diff --git a/client/src/components/Manifest/Actions/ManifestFABs.tsx b/client/app/components/Manifest/Actions/ManifestFABs.tsx similarity index 62% rename from client/src/components/Manifest/Actions/ManifestFABs.tsx rename to client/app/components/Manifest/Actions/ManifestFABs.tsx index 69797f631..c98d341d5 100644 --- a/client/src/components/Manifest/Actions/ManifestFABs.tsx +++ b/client/app/components/Manifest/Actions/ManifestFABs.tsx @@ -1,9 +1,9 @@ -import { ManifestEditBtn } from 'components/Manifest/Actions/ManifestEditBtn'; -import { ManifestSaveBtn } from 'components/Manifest/Actions/ManifestSaveBtn'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { QuickSignBtn } from 'components/Manifest/QuickerSign'; -import { FloatingActionBtn } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestEditBtn } from '~/components/Manifest/Actions/ManifestEditBtn'; +import { ManifestSaveBtn } from '~/components/Manifest/Actions/ManifestSaveBtn'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign'; +import { FloatingActionBtn } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React, { ReactElement, useContext } from 'react'; interface ManifestActionBtnsProps { diff --git a/client/src/components/Manifest/Actions/ManifestSaveBtn.tsx b/client/app/components/Manifest/Actions/ManifestSaveBtn.tsx similarity index 86% rename from client/src/components/Manifest/Actions/ManifestSaveBtn.tsx rename to client/app/components/Manifest/Actions/ManifestSaveBtn.tsx index 7f8bae0f7..b601c7ed0 100644 --- a/client/src/components/Manifest/Actions/ManifestSaveBtn.tsx +++ b/client/app/components/Manifest/Actions/ManifestSaveBtn.tsx @@ -1,7 +1,7 @@ import { faFloppyDisk } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { HtButton } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { HtButton } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { ButtonProps } from 'react-bootstrap'; diff --git a/client/src/components/Manifest/Actions/index.ts b/client/app/components/Manifest/Actions/index.ts similarity index 100% rename from client/src/components/Manifest/Actions/index.ts rename to client/app/components/Manifest/Actions/index.ts diff --git a/client/src/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx b/client/app/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx similarity index 95% rename from client/src/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx rename to client/app/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx index fffa1f6d5..59884bce9 100644 --- a/client/src/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx +++ b/client/app/components/Manifest/AdditionalInfo/AdditionalInfoForm.tsx @@ -1,9 +1,9 @@ import { faTimesCircle } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Manifest } from 'components/Manifest'; -import { WasteLine } from 'components/Manifest/WasteLine'; -import { HtForm } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest } from '~/components/Manifest'; +import { WasteLine } from '~/components/Manifest/WasteLine'; +import { HtForm } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { Button, Col, Form, Row } from 'react-bootstrap'; import { useFieldArray, useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx b/client/app/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx similarity index 88% rename from client/src/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx rename to client/app/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx index df7fea8c3..a50fef40d 100644 --- a/client/src/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx +++ b/client/app/components/Manifest/AdditionalInfo/AdditionalinfoForm.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; import { fireEvent } from '@testing-library/react'; -import { AdditionalInfoForm } from 'components/Manifest/AdditionalInfo'; +import { AdditionalInfoForm } from '~/components/Manifest/AdditionalInfo'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Manifest/AdditionalInfo/additionalInfoSchema.ts b/client/app/components/Manifest/AdditionalInfo/additionalInfoSchema.ts similarity index 100% rename from client/src/components/Manifest/AdditionalInfo/additionalInfoSchema.ts rename to client/app/components/Manifest/AdditionalInfo/additionalInfoSchema.ts diff --git a/client/src/components/Manifest/AdditionalInfo/index.ts b/client/app/components/Manifest/AdditionalInfo/index.ts similarity index 100% rename from client/src/components/Manifest/AdditionalInfo/index.ts rename to client/app/components/Manifest/AdditionalInfo/index.ts diff --git a/client/src/components/Manifest/Address/AddressForm.spec.tsx b/client/app/components/Manifest/Address/AddressForm.spec.tsx similarity index 90% rename from client/src/components/Manifest/Address/AddressForm.spec.tsx rename to client/app/components/Manifest/Address/AddressForm.spec.tsx index b3d504bc3..0d95c94b9 100644 --- a/client/src/components/Manifest/Address/AddressForm.spec.tsx +++ b/client/app/components/Manifest/Address/AddressForm.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { AddressForm } from './AddressForm'; import { afterEach, describe, test, expect } from 'vitest'; diff --git a/client/src/components/Manifest/Address/AddressForm.tsx b/client/app/components/Manifest/Address/AddressForm.tsx similarity index 85% rename from client/src/components/Manifest/Address/AddressForm.tsx rename to client/app/components/Manifest/Address/AddressForm.tsx index 9f8d75316..f143ebf5f 100644 --- a/client/src/components/Manifest/Address/AddressForm.tsx +++ b/client/app/components/Manifest/Address/AddressForm.tsx @@ -1,4 +1,4 @@ -import { GeneratorAddress } from 'components/Manifest/Address/GeneratorAddress'; +import { GeneratorAddress } from '~/components/Manifest/Address/GeneratorAddress'; import React from 'react'; interface Props { diff --git a/client/src/components/Manifest/Address/GeneratorAddress.tsx b/client/app/components/Manifest/Address/GeneratorAddress.tsx similarity index 95% rename from client/src/components/Manifest/Address/GeneratorAddress.tsx rename to client/app/components/Manifest/Address/GeneratorAddress.tsx index 1d17ac583..9311d8a94 100644 --- a/client/src/components/Manifest/Address/GeneratorAddress.tsx +++ b/client/app/components/Manifest/Address/GeneratorAddress.tsx @@ -1,9 +1,9 @@ import { ErrorMessage } from '@hookform/error-message'; -import { CountryCode, StateCode } from 'components/Manifest/Address/StateSelect'; -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { RcraAddress } from 'components/RcraSite'; -import { HtForm } from 'components/UI'; +import { CountryCode, StateCode } from '~/components/Manifest/Address/StateSelect'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { RcraAddress } from '~/components/RcraSite'; +import { HtForm } from '~/components/UI'; import React, { useContext } from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { Controller, FieldError, FieldErrorsImpl, Merge, useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Address/StateSelect.tsx b/client/app/components/Manifest/Address/StateSelect.tsx similarity index 100% rename from client/src/components/Manifest/Address/StateSelect.tsx rename to client/app/components/Manifest/Address/StateSelect.tsx diff --git a/client/src/components/Manifest/Address/index.ts b/client/app/components/Manifest/Address/index.ts similarity index 100% rename from client/src/components/Manifest/Address/index.ts rename to client/app/components/Manifest/Address/index.ts diff --git a/client/src/components/Manifest/Contact/ContactForm.spec.tsx b/client/app/components/Manifest/Contact/ContactForm.spec.tsx similarity index 88% rename from client/src/components/Manifest/Contact/ContactForm.spec.tsx rename to client/app/components/Manifest/Contact/ContactForm.spec.tsx index 010e35abc..833dba052 100644 --- a/client/src/components/Manifest/Contact/ContactForm.spec.tsx +++ b/client/app/components/Manifest/Contact/ContactForm.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { ContactForm } from './ContactForm'; import { afterEach, describe, test, expect } from 'vitest'; diff --git a/client/src/components/Manifest/Contact/ContactForm.tsx b/client/app/components/Manifest/Contact/ContactForm.tsx similarity index 93% rename from client/src/components/Manifest/Contact/ContactForm.tsx rename to client/app/components/Manifest/Contact/ContactForm.tsx index 5dd80c4a0..1fe50e50b 100644 --- a/client/src/components/Manifest/Contact/ContactForm.tsx +++ b/client/app/components/Manifest/Contact/ContactForm.tsx @@ -1,7 +1,7 @@ -import { Manifest } from 'components/Manifest'; -import { PhoneForm } from 'components/Manifest/Contact/PhoneForm'; -import { HtForm } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest } from '~/components/Manifest'; +import { PhoneForm } from '~/components/Manifest/Contact/PhoneForm'; +import { HtForm } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Contact/PhoneForm.spec.tsx b/client/app/components/Manifest/Contact/PhoneForm.spec.tsx similarity index 77% rename from client/src/components/Manifest/Contact/PhoneForm.spec.tsx rename to client/app/components/Manifest/Contact/PhoneForm.spec.tsx index b224d361a..e7b128156 100644 --- a/client/src/components/Manifest/Contact/PhoneForm.spec.tsx +++ b/client/app/components/Manifest/Contact/PhoneForm.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { PhoneForm } from 'components/Manifest/Contact'; +import { PhoneForm } from '~/components/Manifest/Contact'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Manifest/Contact/PhoneForm.tsx b/client/app/components/Manifest/Contact/PhoneForm.tsx similarity index 96% rename from client/src/components/Manifest/Contact/PhoneForm.tsx rename to client/app/components/Manifest/Contact/PhoneForm.tsx index 08a269f6e..371cd57d5 100644 --- a/client/src/components/Manifest/Contact/PhoneForm.tsx +++ b/client/app/components/Manifest/Contact/PhoneForm.tsx @@ -1,5 +1,5 @@ -import { Manifest } from 'components/Manifest'; -import { HtForm } from 'components/UI'; +import { Manifest } from '~/components/Manifest'; +import { HtForm } from '~/components/UI'; import React, { useState } from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Contact/index.ts b/client/app/components/Manifest/Contact/index.ts similarity index 100% rename from client/src/components/Manifest/Contact/index.ts rename to client/app/components/Manifest/Contact/index.ts diff --git a/client/src/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx b/client/app/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx similarity index 90% rename from client/src/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx rename to client/app/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx index 8247fbc36..dd3448186 100644 --- a/client/src/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx +++ b/client/app/components/Manifest/GeneralInfo/GeneralInfoForm.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; import { GeneralInfoForm } from './GeneralInfoForm'; diff --git a/client/src/components/Manifest/GeneralInfo/GeneralInfoForm.tsx b/client/app/components/Manifest/GeneralInfo/GeneralInfoForm.tsx similarity index 93% rename from client/src/components/Manifest/GeneralInfo/GeneralInfoForm.tsx rename to client/app/components/Manifest/GeneralInfo/GeneralInfoForm.tsx index df38f00ac..7c2fc999c 100644 --- a/client/src/components/Manifest/GeneralInfo/GeneralInfoForm.tsx +++ b/client/app/components/Manifest/GeneralInfo/GeneralInfoForm.tsx @@ -1,8 +1,8 @@ -import { ManifestStatusSelect } from 'components/Manifest/GeneralInfo/ManifestStatusSelect'; -import { ManifestTypeSelect } from 'components/Manifest/GeneralInfo/ManifestTypeSelect'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { HtForm, InfoIconTooltip } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestStatusSelect } from '~/components/Manifest/GeneralInfo/ManifestStatusSelect'; +import { ManifestTypeSelect } from '~/components/Manifest/GeneralInfo/ManifestTypeSelect'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { HtForm, InfoIconTooltip } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx b/client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx similarity index 92% rename from client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx rename to client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx index 4c2bb8be3..0c94b7ced 100644 --- a/client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx +++ b/client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.spec.tsx @@ -1,14 +1,14 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { ManifestStatusSelect } from 'components/Manifest/GeneralInfo/ManifestStatusSelect'; +import { ManifestStatusSelect } from '~/components/Manifest/GeneralInfo/ManifestStatusSelect'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockHandler, createMockSite } from 'test-utils/fixtures'; -import { createMockProfileResponse } from 'test-utils/fixtures/mockUser'; -import { mockUserEndpoints } from 'test-utils/mock'; -import { API_BASE_URL } from 'test-utils/mock/mockSiteEndpoints'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler, createMockSite } from '~/mocks/fixtures'; +import { createMockProfileResponse } from '~/mocks/fixtures/mockUser'; +import { mockUserEndpoints } from 'app/mocks/handlers'; +import { API_BASE_URL } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; const server = setupServer(...mockUserEndpoints); diff --git a/client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx b/client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx similarity index 92% rename from client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx rename to client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx index 8800f96af..040993a2e 100644 --- a/client/src/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx +++ b/client/app/components/Manifest/GeneralInfo/ManifestStatusSelect.tsx @@ -1,11 +1,11 @@ -import { Manifest, ManifestStatus } from 'components/Manifest/manifestSchema'; -import { HtForm, InfoIconTooltip } from 'components/UI'; -import { useManifestStatus } from 'hooks/manifest'; +import { Manifest, ManifestStatus } from '~/components/Manifest/manifestSchema'; +import { HtForm, InfoIconTooltip } from '~/components/UI'; +import { useManifestStatus } from '~/hooks/manifest'; import React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import Select, { SingleValue } from 'react-select'; -import { manifest } from 'services'; -import { useGetProfileQuery } from 'store'; +import { manifest } from '~/services'; +import { useGetProfileQuery } from '~/store'; interface StatusOption { value: ManifestStatus; diff --git a/client/src/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx b/client/app/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx similarity index 90% rename from client/src/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx rename to client/app/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx index 15ca31b5d..04a17a06c 100644 --- a/client/src/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx +++ b/client/app/components/Manifest/GeneralInfo/ManifestTypeField.spec.tsx @@ -1,11 +1,11 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { ManifestTypeSelect } from 'components/Manifest/GeneralInfo/ManifestTypeSelect'; +import { ManifestTypeSelect } from '~/components/Manifest/GeneralInfo/ManifestTypeSelect'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockHandler } from 'test-utils/fixtures'; -import { mockUserEndpoints } from 'test-utils/mock'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler } from '~/mocks/fixtures'; +import { mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; const server = setupServer(...mockUserEndpoints); diff --git a/client/src/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx b/client/app/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx similarity index 93% rename from client/src/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx rename to client/app/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx index b40a3458f..1318724ce 100644 --- a/client/src/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx +++ b/client/app/components/Manifest/GeneralInfo/ManifestTypeSelect.tsx @@ -1,6 +1,6 @@ -import { Manifest, ManifestStatus, SubmissionType } from 'components/Manifest/manifestSchema'; -import { HtForm } from 'components/UI'; -import { useManifestStatus } from 'hooks/manifest'; +import { Manifest, ManifestStatus, SubmissionType } from '~/components/Manifest/manifestSchema'; +import { HtForm } from '~/components/UI'; +import { useManifestStatus } from '~/hooks/manifest'; import React, { useState } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import Select, { SingleValue } from 'react-select'; diff --git a/client/src/components/Manifest/GeneralInfo/index.ts b/client/app/components/Manifest/GeneralInfo/index.ts similarity index 100% rename from client/src/components/Manifest/GeneralInfo/index.ts rename to client/app/components/Manifest/GeneralInfo/index.ts diff --git a/client/src/components/Manifest/Generator/GeneratorForm.spec.tsx b/client/app/components/Manifest/Generator/GeneratorForm.spec.tsx similarity index 89% rename from client/src/components/Manifest/Generator/GeneratorForm.spec.tsx rename to client/app/components/Manifest/Generator/GeneratorForm.spec.tsx index 1bfa33bdf..c8004e459 100644 --- a/client/src/components/Manifest/Generator/GeneratorForm.spec.tsx +++ b/client/app/components/Manifest/Generator/GeneratorForm.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; import { fireEvent } from '@testing-library/react'; -import { siteType } from 'components/Manifest/manifestSchema'; +import { siteType } from '~/components/Manifest/manifestSchema'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; import { GeneratorForm } from './GeneratorForm'; diff --git a/client/src/components/Manifest/Generator/GeneratorForm.tsx b/client/app/components/Manifest/Generator/GeneratorForm.tsx similarity index 94% rename from client/src/components/Manifest/Generator/GeneratorForm.tsx rename to client/app/components/Manifest/Generator/GeneratorForm.tsx index c71df9af4..d503c55da 100644 --- a/client/src/components/Manifest/Generator/GeneratorForm.tsx +++ b/client/app/components/Manifest/Generator/GeneratorForm.tsx @@ -1,7 +1,7 @@ -import { Manifest } from 'components/Manifest'; -import { AddressForm } from 'components/Manifest/Address'; -import { HtForm } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest } from '~/components/Manifest'; +import { AddressForm } from '~/components/Manifest/Address'; +import { HtForm } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import { ReactElement, useEffect, useState } from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Generator/GeneratorSection.spec.tsx b/client/app/components/Manifest/Generator/GeneratorSection.spec.tsx similarity index 83% rename from client/src/components/Manifest/Generator/GeneratorSection.spec.tsx rename to client/app/components/Manifest/Generator/GeneratorSection.spec.tsx index cdfa61757..e5a265a8f 100644 --- a/client/src/components/Manifest/Generator/GeneratorSection.spec.tsx +++ b/client/app/components/Manifest/Generator/GeneratorSection.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockHandler } from 'test-utils/fixtures'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler } from '~/mocks/fixtures'; import { afterEach, describe, expect, test } from 'vitest'; import { GeneratorSection } from './GeneratorSection'; diff --git a/client/src/components/Manifest/Generator/GeneratorSection.tsx b/client/app/components/Manifest/Generator/GeneratorSection.tsx similarity index 87% rename from client/src/components/Manifest/Generator/GeneratorSection.tsx rename to client/app/components/Manifest/Generator/GeneratorSection.tsx index 0e00b99c7..d52e41df5 100644 --- a/client/src/components/Manifest/Generator/GeneratorSection.tsx +++ b/client/app/components/Manifest/Generator/GeneratorSection.tsx @@ -1,16 +1,16 @@ import { ErrorMessage } from '@hookform/error-message'; -import { ContactForm, PhoneForm } from 'components/Manifest/Contact'; -import { Handler, Manifest } from 'components/Manifest/manifestSchema'; -import { QuickSignBtn } from 'components/Manifest/QuickerSign'; -import { RcraSiteDetails } from 'components/RcraSite'; -import { HtButton, HtSpinner } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; -import { useHandlerSearchConfig } from 'hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; +import { ContactForm, PhoneForm } from '~/components/Manifest/Contact'; +import { Handler, Manifest } from '~/components/Manifest/manifestSchema'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign'; +import { RcraSiteDetails } from '~/components/RcraSite'; +import { HtButton, HtSpinner } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; +import { useHandlerSearchConfig } from '~/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; import React, { useEffect, useState } from 'react'; import { Alert, Button, Col, Stack } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; import { useSearchParams } from 'react-router-dom'; -import { useGetRcrainfoSiteQuery } from 'store'; +import { useGetRcrainfoSiteQuery } from '~/store'; import { GeneratorForm } from './GeneratorForm'; interface GeneratorSectionProps { diff --git a/client/src/components/Manifest/Generator/index.ts b/client/app/components/Manifest/Generator/index.ts similarity index 100% rename from client/src/components/Manifest/Generator/index.ts rename to client/app/components/Manifest/Generator/index.ts diff --git a/client/src/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx b/client/app/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx similarity index 92% rename from client/src/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx rename to client/app/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx index 85f5704a9..84b9716af 100644 --- a/client/src/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx +++ b/client/app/components/Manifest/Handler/Search/HandlerSearchForm.spec.tsx @@ -3,11 +3,11 @@ import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; import '@testing-library/jest-dom'; -import { HaztrakProfileResponse } from 'store/userSlice/user.slice'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockRcrainfoSite } from 'test-utils/fixtures'; -import { mockUserEndpoints } from 'test-utils/mock'; -import { API_BASE_URL } from 'test-utils/mock/mockSiteEndpoints'; +import { HaztrakProfileResponse } from '~/store/userSlice/user.slice'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockRcrainfoSite } from '~/mocks/fixtures'; +import { mockUserEndpoints } from 'app/mocks/handlers'; +import { API_BASE_URL } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; import { HandlerSearchForm } from './HandlerSearchForm'; diff --git a/client/src/components/Manifest/Handler/Search/HandlerSearchForm.tsx b/client/app/components/Manifest/Handler/Search/HandlerSearchForm.tsx similarity index 92% rename from client/src/components/Manifest/Handler/Search/HandlerSearchForm.tsx rename to client/app/components/Manifest/Handler/Search/HandlerSearchForm.tsx index 2b8c2da6f..2a4479695 100644 --- a/client/src/components/Manifest/Handler/Search/HandlerSearchForm.tsx +++ b/client/app/components/Manifest/Handler/Search/HandlerSearchForm.tsx @@ -1,8 +1,8 @@ -import { RcrainfoSiteSearchBadge } from 'components/Manifest/Handler/Search/RcrainfoSiteSearchBadge'; -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { Manifest, SiteType, Transporter } from 'components/Manifest/manifestSchema'; -import { RcraSite } from 'components/RcraSite'; -import { HtForm } from 'components/UI'; +import { RcrainfoSiteSearchBadge } from '~/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { Manifest, SiteType, Transporter } from '~/components/Manifest/manifestSchema'; +import { RcraSite } from '~/components/RcraSite'; +import { HtForm } from '~/components/UI'; import React, { useContext, useEffect, useState } from 'react'; import { Button, Col, Row } from 'react-bootstrap'; import { @@ -14,8 +14,8 @@ import { } from 'react-hook-form'; import { useSearchParams } from 'react-router-dom'; import Select from 'react-select'; -import { useGetProfileQuery, useSearchRcrainfoSitesQuery, useSearchRcraSitesQuery } from 'store'; -import { useDebounce } from 'hooks'; +import { useGetProfileQuery, useSearchRcrainfoSitesQuery, useSearchRcraSitesQuery } from '~/store'; +import { useDebounce } from '~/hooks'; interface Props { handleClose: () => void; diff --git a/client/src/components/Manifest/Handler/Search/HandlerSearchModal.tsx b/client/app/components/Manifest/Handler/Search/HandlerSearchModal.tsx similarity index 87% rename from client/src/components/Manifest/Handler/Search/HandlerSearchModal.tsx rename to client/app/components/Manifest/Handler/Search/HandlerSearchModal.tsx index 754b3a8fe..683186d1e 100644 --- a/client/src/components/Manifest/Handler/Search/HandlerSearchModal.tsx +++ b/client/app/components/Manifest/Handler/Search/HandlerSearchModal.tsx @@ -1,7 +1,7 @@ -import { HandlerSearchForm } from 'components/Manifest/Handler'; -import { Manifest, Transporter } from 'components/Manifest/manifestSchema'; -import { HtModal } from 'components/UI'; -import { useHandlerSearchConfig } from 'hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; +import { HandlerSearchForm } from '~/components/Manifest/Handler'; +import { Manifest, Transporter } from '~/components/Manifest/manifestSchema'; +import { HtModal } from '~/components/UI'; +import { useHandlerSearchConfig } from '~/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; import React from 'react'; import { Col, Row } from 'react-bootstrap'; import { useFieldArray, useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx b/client/app/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx similarity index 96% rename from client/src/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx rename to client/app/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx index 228858390..61b1d039e 100644 --- a/client/src/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx +++ b/client/app/components/Manifest/Handler/Search/RcrainfoSiteSearchBadge.tsx @@ -1,6 +1,6 @@ import { faCheck, faXmark } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { HtSpinner } from 'components/UI'; +import { HtSpinner } from '~/components/UI'; import React from 'react'; import { Badge } from 'react-bootstrap'; diff --git a/client/src/components/Manifest/Handler/index.ts b/client/app/components/Manifest/Handler/index.ts similarity index 72% rename from client/src/components/Manifest/Handler/index.ts rename to client/app/components/Manifest/Handler/index.ts index 76c4baa98..b62357dc3 100644 --- a/client/src/components/Manifest/Handler/index.ts +++ b/client/app/components/Manifest/Handler/index.ts @@ -1,4 +1,4 @@ -import { Handler, handlerSchema, Signer } from 'components/Manifest/manifestSchema'; +import { Handler, handlerSchema, Signer } from '~/components/Manifest/manifestSchema'; import { HandlerSearchForm } from './Search/HandlerSearchForm'; import { HandlerSearchModal } from './Search/HandlerSearchModal'; diff --git a/client/src/components/Manifest/ManifestForm.spec.tsx b/client/app/components/Manifest/ManifestForm.spec.tsx similarity index 94% rename from client/src/components/Manifest/ManifestForm.spec.tsx rename to client/app/components/Manifest/ManifestForm.spec.tsx index b78366863..841e54391 100644 --- a/client/src/components/Manifest/ManifestForm.spec.tsx +++ b/client/app/components/Manifest/ManifestForm.spec.tsx @@ -1,11 +1,11 @@ import '@testing-library/jest-dom'; import { fireEvent, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { ManifestForm } from 'components/Manifest'; +import { ManifestForm } from '~/components/Manifest'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders } from 'test-utils'; -import { mockUserEndpoints, mockWasteEndpoints } from 'test-utils/mock'; +import { cleanup, renderWithProviders } from 'app/mocks'; +import { mockUserEndpoints, mockWasteEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; const server = setupServer(...mockUserEndpoints, ...mockWasteEndpoints); diff --git a/client/src/components/Manifest/ManifestForm.tsx b/client/app/components/Manifest/ManifestForm.tsx similarity index 92% rename from client/src/components/Manifest/ManifestForm.tsx rename to client/app/components/Manifest/ManifestForm.tsx index f6199a5e2..bc05f886b 100644 --- a/client/src/components/Manifest/ManifestForm.tsx +++ b/client/app/components/Manifest/ManifestForm.tsx @@ -4,24 +4,24 @@ import { ManifestEditBtn, ManifestFABs, ManifestSaveBtn, -} from 'components/Manifest/Actions'; -import { AdditionalInfoForm } from 'components/Manifest/AdditionalInfo'; -import { GeneralInfoForm } from 'components/Manifest/GeneralInfo'; -import { GeneratorSection } from 'components/Manifest/Generator'; -import { TransporterSection } from 'components/Manifest/Transporter/TransporterSection'; -import { TsdfSection } from 'components/Manifest/Tsdf'; -import { UpdateRcra } from 'components/Manifest/UpdateRcra/UpdateRcra'; -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { WasteLineSection } from 'components/Manifest/WasteLine/WasteLineSection'; -import { HtCard, HtForm } from 'components/UI'; -import { useUserSiteIds } from 'hooks'; -import { useManifestStatus, useReadOnly, useSaveManifest } from 'hooks/manifest'; +} from '~/components/Manifest/Actions'; +import { AdditionalInfoForm } from '~/components/Manifest/AdditionalInfo'; +import { GeneralInfoForm } from '~/components/Manifest/GeneralInfo'; +import { GeneratorSection } from '~/components/Manifest/Generator'; +import { TransporterSection } from '~/components/Manifest/Transporter/TransporterSection'; +import { TsdfSection } from '~/components/Manifest/Tsdf'; +import { UpdateRcra } from '~/components/Manifest/UpdateRcra/UpdateRcra'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { WasteLineSection } from '~/components/Manifest/WasteLine/WasteLineSection'; +import { HtCard, HtForm } from '~/components/UI'; +import { useUserSiteIds } from '~/hooks'; +import { useManifestStatus, useReadOnly, useSaveManifest } from '~/hooks/manifest'; import React, { createContext, useEffect, useState } from 'react'; import { Container, Stack } from 'react-bootstrap'; import { FormProvider, SubmitHandler, useFieldArray, useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; import { toast } from 'react-toastify'; -import { manifest } from 'services'; +import { manifest } from '~/services'; import { HandlerSearchModal } from './Handler'; import { Manifest, manifestSchema, SiteType } from './manifestSchema'; import { QuickerSignData, QuickerSignModal } from './QuickerSign'; diff --git a/client/src/components/Manifest/NewManifestBtn.tsx b/client/app/components/Manifest/NewManifestBtn.tsx similarity index 100% rename from client/src/components/Manifest/NewManifestBtn.tsx rename to client/app/components/Manifest/NewManifestBtn.tsx diff --git a/client/src/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx b/client/app/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx similarity index 83% rename from client/src/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx rename to client/app/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx index 120395ea4..9537d2351 100644 --- a/client/src/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx +++ b/client/app/components/Manifest/QuickerSign/QuickerSignForm.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; -import { QuickerSignForm } from 'components/Manifest/QuickerSign'; +import { QuickerSignForm } from '~/components/Manifest/QuickerSign'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockMTNHandler } from 'test-utils/fixtures'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockMTNHandler } from '~/mocks/fixtures'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Manifest/QuickerSign/QuickerSignForm.tsx b/client/app/components/Manifest/QuickerSign/QuickerSignForm.tsx similarity index 95% rename from client/src/components/Manifest/QuickerSign/QuickerSignForm.tsx rename to client/app/components/Manifest/QuickerSign/QuickerSignForm.tsx index 42e7a9a88..682b27846 100644 --- a/client/src/components/Manifest/QuickerSign/QuickerSignForm.tsx +++ b/client/app/components/Manifest/QuickerSign/QuickerSignForm.tsx @@ -1,9 +1,9 @@ import { faFileSignature, faPen } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Handler, RcraSiteType } from 'components/Manifest/manifestSchema'; -import { Transporter } from 'components/Manifest/Transporter'; -import { HtForm } from 'components/UI'; -import { useProgressTracker } from 'hooks'; +import { Handler, RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { Transporter } from '~/components/Manifest/Transporter'; +import { HtForm } from '~/components/UI'; +import { useProgressTracker } from '~/hooks'; import React, { useEffect, useState } from 'react'; import { Button, Col, Container, Form, ListGroup, Row, Stack } from 'react-bootstrap'; import { SubmitHandler, useForm } from 'react-hook-form'; @@ -15,7 +15,7 @@ import { useAppDispatch, useAppSelector, useSignEManifestMutation, -} from 'store'; +} from '~/store'; import { z } from 'zod'; const siteType = z.enum(['Transporter', 'Generator', 'Tsdf', 'Broker']); diff --git a/client/src/components/Manifest/QuickerSign/QuickerSignModal.tsx b/client/app/components/Manifest/QuickerSign/QuickerSignModal.tsx similarity index 87% rename from client/src/components/Manifest/QuickerSign/QuickerSignModal.tsx rename to client/app/components/Manifest/QuickerSign/QuickerSignModal.tsx index 53a2fe943..e36b0fd8c 100644 --- a/client/src/components/Manifest/QuickerSign/QuickerSignModal.tsx +++ b/client/app/components/Manifest/QuickerSign/QuickerSignModal.tsx @@ -1,5 +1,5 @@ -import { Handler, RcraSiteType } from 'components/Manifest/manifestSchema'; -import { HtModal } from 'components/UI'; +import { Handler, RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { HtModal } from '~/components/UI'; import React from 'react'; import { QuickerSignForm } from './QuickerSignForm'; diff --git a/client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx b/client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx similarity index 83% rename from client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx rename to client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx index 212f651bb..36052b850 100644 --- a/client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx +++ b/client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.spec.tsx @@ -1,12 +1,12 @@ import '@testing-library/jest-dom'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { Handler, RcraSiteType } from 'components/Manifest/manifestSchema'; -import { QuickSignBtn } from 'components/Manifest/QuickerSign/index'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { Handler, RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign/index'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockMTNHandler } from 'test-utils/fixtures'; -import { mockUserEndpoints } from 'test-utils/mock'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockMTNHandler } from '~/mocks/fixtures'; +import { mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vitest'; import { undefined } from 'zod'; diff --git a/client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx b/client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx similarity index 85% rename from client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx rename to client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx index 859358ee9..c49414bd1 100644 --- a/client/src/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx +++ b/client/app/components/Manifest/QuickerSign/SignBtn/QuickSignBtn.tsx @@ -1,12 +1,12 @@ import { faFeather } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { createSelector } from '@reduxjs/toolkit'; -import { ManifestContext } from 'components/Manifest/ManifestForm'; -import { Handler } from 'components/Manifest/manifestSchema'; -import { RcraApiUserBtn } from 'components/Rcrainfo'; +import { ManifestContext } from '~/components/Manifest/ManifestForm'; +import { Handler } from '~/components/Manifest/manifestSchema'; +import { RcraApiUserBtn } from '~/components/Rcrainfo'; import React, { useContext, useMemo } from 'react'; import { ButtonProps } from 'react-bootstrap'; -import { ProfileSlice, useGetProfileQuery } from 'store'; +import { ProfileSlice, useGetProfileQuery } from '~/store'; interface QuickSignBtnProps extends ButtonProps { mtnHandler?: Handler; diff --git a/client/src/components/Manifest/QuickerSign/index.ts b/client/app/components/Manifest/QuickerSign/index.ts similarity index 74% rename from client/src/components/Manifest/QuickerSign/index.ts rename to client/app/components/Manifest/QuickerSign/index.ts index 3ce4b25a8..b86c95fbc 100644 --- a/client/src/components/Manifest/QuickerSign/index.ts +++ b/client/app/components/Manifest/QuickerSign/index.ts @@ -1,4 +1,4 @@ -import { QuickSignBtn } from 'components/Manifest/QuickerSign/SignBtn/QuickSignBtn'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign/SignBtn/QuickSignBtn'; import { QuickerSignature, QuickerSignData, QuickerSignForm } from './QuickerSignForm'; import { QuickerSignModal } from './QuickerSignModal'; diff --git a/client/src/components/Manifest/SiteSelect/SiteSelect.spec.tsx b/client/app/components/Manifest/SiteSelect/SiteSelect.spec.tsx similarity index 82% rename from client/src/components/Manifest/SiteSelect/SiteSelect.spec.tsx rename to client/app/components/Manifest/SiteSelect/SiteSelect.spec.tsx index 5b2b9be54..ecb20f61e 100644 --- a/client/src/components/Manifest/SiteSelect/SiteSelect.spec.tsx +++ b/client/app/components/Manifest/SiteSelect/SiteSelect.spec.tsx @@ -1,8 +1,8 @@ import { screen } from '@testing-library/react'; -import { SiteSelect } from 'components/Manifest/SiteSelect/SiteSelect'; +import { SiteSelect } from '~/components/Manifest/SiteSelect/SiteSelect'; import React, { useState } from 'react'; import { useForm } from 'react-hook-form'; -import { renderWithProviders } from 'test-utils'; +import { renderWithProviders } from 'app/mocks'; import { describe, expect, test } from 'vitest'; function TestComponent() { diff --git a/client/src/components/Manifest/SiteSelect/SiteSelect.tsx b/client/app/components/Manifest/SiteSelect/SiteSelect.tsx similarity index 89% rename from client/src/components/Manifest/SiteSelect/SiteSelect.tsx rename to client/app/components/Manifest/SiteSelect/SiteSelect.tsx index 9aeecbd40..f94e4225a 100644 --- a/client/src/components/Manifest/SiteSelect/SiteSelect.tsx +++ b/client/app/components/Manifest/SiteSelect/SiteSelect.tsx @@ -1,11 +1,11 @@ import { createSelector } from '@reduxjs/toolkit'; -import { RcraSite } from 'components/RcraSite'; -import { HtForm } from 'components/UI'; +import { RcraSite } from '~/components/RcraSite'; +import { HtForm } from '~/components/UI'; import React, { useMemo } from 'react'; import { Control, Controller } from 'react-hook-form'; import Select from 'react-select'; -import { useGetUserHaztrakSitesQuery } from 'store'; -import { HaztrakSite } from 'components/HaztrakSite'; +import { useGetUserHaztrakSitesQuery } from '~/store'; +import { HaztrakSite } from '~/components/HaztrakSite'; interface SiteSelectProps { control: Control; diff --git a/client/src/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx b/client/app/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx similarity index 91% rename from client/src/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx rename to client/app/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx index 266e29597..c2688523f 100644 --- a/client/src/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx +++ b/client/app/components/Manifest/SiteSelect/SiteTypeSelect.spec.tsx @@ -1,9 +1,9 @@ import { screen } from '@testing-library/react'; -import { RcraSiteType } from 'components/Manifest/manifestSchema'; -import { SiteTypeSelect } from 'components/Manifest/SiteSelect/SiteTypeSelect'; +import { RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { SiteTypeSelect } from '~/components/Manifest/SiteSelect/SiteTypeSelect'; import React, { useState } from 'react'; import { useForm } from 'react-hook-form'; -import { renderWithProviders } from 'test-utils'; +import { renderWithProviders } from 'app/mocks'; import { describe, expect, test } from 'vitest'; function TestComponent({ siteType }: { siteType?: RcraSiteType }) { diff --git a/client/src/components/Manifest/SiteSelect/SiteTypeSelect.tsx b/client/app/components/Manifest/SiteSelect/SiteTypeSelect.tsx similarity index 94% rename from client/src/components/Manifest/SiteSelect/SiteTypeSelect.tsx rename to client/app/components/Manifest/SiteSelect/SiteTypeSelect.tsx index 536a503a0..468959b14 100644 --- a/client/src/components/Manifest/SiteSelect/SiteTypeSelect.tsx +++ b/client/app/components/Manifest/SiteSelect/SiteTypeSelect.tsx @@ -1,5 +1,5 @@ -import { RcraSiteType } from 'components/Manifest/manifestSchema'; -import { HtForm } from 'components/UI'; +import { RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { HtForm } from '~/components/UI'; import React from 'react'; import { Form } from 'react-bootstrap'; import { Control, Controller } from 'react-hook-form'; diff --git a/client/src/components/Manifest/SiteSelect/index.ts b/client/app/components/Manifest/SiteSelect/index.ts similarity index 100% rename from client/src/components/Manifest/SiteSelect/index.ts rename to client/app/components/Manifest/SiteSelect/index.ts diff --git a/client/src/components/Manifest/Transporter/TransporterRowActions.tsx b/client/app/components/Manifest/Transporter/TransporterRowActions.tsx similarity index 100% rename from client/src/components/Manifest/Transporter/TransporterRowActions.tsx rename to client/app/components/Manifest/Transporter/TransporterRowActions.tsx diff --git a/client/src/components/Manifest/Transporter/TransporterSection.tsx b/client/app/components/Manifest/Transporter/TransporterSection.tsx similarity index 82% rename from client/src/components/Manifest/Transporter/TransporterSection.tsx rename to client/app/components/Manifest/Transporter/TransporterSection.tsx index 7aff9dcdc..04f10ba9e 100644 --- a/client/src/components/Manifest/Transporter/TransporterSection.tsx +++ b/client/app/components/Manifest/Transporter/TransporterSection.tsx @@ -1,9 +1,9 @@ import { ErrorMessage } from '@hookform/error-message'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { TransporterTable } from 'components/Manifest/Transporter/TransporterTable'; -import { HtButton } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; -import { useHandlerSearchConfig } from 'hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { TransporterTable } from '~/components/Manifest/Transporter/TransporterTable'; +import { HtButton } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; +import { useHandlerSearchConfig } from '~/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; import { Alert } from 'react-bootstrap'; import { useFieldArray, useFormContext } from 'react-hook-form'; import { v4 as uuidv4 } from 'uuid'; diff --git a/client/src/components/Manifest/Transporter/TransporterTable.spec.tsx b/client/app/components/Manifest/Transporter/TransporterTable.spec.tsx similarity index 95% rename from client/src/components/Manifest/Transporter/TransporterTable.spec.tsx rename to client/app/components/Manifest/Transporter/TransporterTable.spec.tsx index 12880f549..d519d8b18 100644 --- a/client/src/components/Manifest/Transporter/TransporterTable.spec.tsx +++ b/client/app/components/Manifest/Transporter/TransporterTable.spec.tsx @@ -1,11 +1,11 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { Transporter } from 'components/Manifest'; +import { Transporter } from '~/components/Manifest'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockTransporter } from 'test-utils/fixtures'; -import { mockUserEndpoints } from 'test-utils/mock'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockTransporter } from '~/mocks/fixtures'; +import { mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; import { TransporterTable } from './index'; diff --git a/client/src/components/Manifest/Transporter/TransporterTable.tsx b/client/app/components/Manifest/Transporter/TransporterTable.tsx similarity index 94% rename from client/src/components/Manifest/Transporter/TransporterTable.tsx rename to client/app/components/Manifest/Transporter/TransporterTable.tsx index 5206ddd6f..a4a5b1dfe 100644 --- a/client/src/components/Manifest/Transporter/TransporterTable.tsx +++ b/client/app/components/Manifest/Transporter/TransporterTable.tsx @@ -1,10 +1,10 @@ import { useAutoAnimate } from '@formkit/auto-animate/react'; import { faAngleRight, faCheck, faSignature } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Transporter } from 'components/Manifest'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { QuickSignBtn } from 'components/Manifest/QuickerSign'; -import { useReadOnly } from 'hooks/manifest'; +import { Transporter } from '~/components/Manifest'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign'; +import { useReadOnly } from '~/hooks/manifest'; import React, { useState } from 'react'; import { Accordion, Button, Card, Col, Row, Table, useAccordionButton } from 'react-bootstrap'; import { UseFieldArrayReturn } from 'react-hook-form'; diff --git a/client/src/components/Manifest/Transporter/index.ts b/client/app/components/Manifest/Transporter/index.ts similarity index 68% rename from client/src/components/Manifest/Transporter/index.ts rename to client/app/components/Manifest/Transporter/index.ts index d22fbef0d..47276038c 100644 --- a/client/src/components/Manifest/Transporter/index.ts +++ b/client/app/components/Manifest/Transporter/index.ts @@ -1,5 +1,5 @@ import { TransporterTable } from './TransporterTable'; -import { Transporter } from 'components/Manifest'; +import { Transporter } from '~/components/Manifest'; export { TransporterTable }; export type { Transporter }; diff --git a/client/src/components/Manifest/Tsdf/TsdfSection.spec.tsx b/client/app/components/Manifest/Tsdf/TsdfSection.spec.tsx similarity index 83% rename from client/src/components/Manifest/Tsdf/TsdfSection.spec.tsx rename to client/app/components/Manifest/Tsdf/TsdfSection.spec.tsx index a2f3818e5..53f10f0a9 100644 --- a/client/src/components/Manifest/Tsdf/TsdfSection.spec.tsx +++ b/client/app/components/Manifest/Tsdf/TsdfSection.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockHandler } from 'test-utils/fixtures'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler } from '~/mocks/fixtures'; import { afterEach, describe, expect, test } from 'vitest'; import { TsdfSection } from './TsdfSection'; diff --git a/client/src/components/Manifest/Tsdf/TsdfSection.tsx b/client/app/components/Manifest/Tsdf/TsdfSection.tsx similarity index 87% rename from client/src/components/Manifest/Tsdf/TsdfSection.tsx rename to client/app/components/Manifest/Tsdf/TsdfSection.tsx index 8a6d47f14..65908d9a2 100644 --- a/client/src/components/Manifest/Tsdf/TsdfSection.tsx +++ b/client/app/components/Manifest/Tsdf/TsdfSection.tsx @@ -1,15 +1,15 @@ import { ErrorMessage } from '@hookform/error-message'; -import { Handler, Manifest } from 'components/Manifest/manifestSchema'; -import { QuickSignBtn } from 'components/Manifest/QuickerSign'; -import { RcraSiteDetails } from 'components/RcraSite'; -import { HtButton, HtSpinner } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; -import { useHandlerSearchConfig } from 'hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; +import { Handler, Manifest } from '~/components/Manifest/manifestSchema'; +import { QuickSignBtn } from '~/components/Manifest/QuickerSign'; +import { RcraSiteDetails } from '~/components/RcraSite'; +import { HtButton, HtSpinner } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; +import { useHandlerSearchConfig } from '~/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; import React, { useEffect } from 'react'; import { Alert, Col } from 'react-bootstrap'; import { useFormContext } from 'react-hook-form'; import { useSearchParams } from 'react-router-dom'; -import { useGetRcrainfoSiteQuery } from 'store'; +import { useGetRcrainfoSiteQuery } from '~/store'; interface TsdfSectionProps { setupSign: () => void; diff --git a/client/src/components/Manifest/Tsdf/index.ts b/client/app/components/Manifest/Tsdf/index.ts similarity index 100% rename from client/src/components/Manifest/Tsdf/index.ts rename to client/app/components/Manifest/Tsdf/index.ts diff --git a/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx b/client/app/components/Manifest/UpdateRcra/UpdateRcra.tsx similarity index 96% rename from client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx rename to client/app/components/Manifest/UpdateRcra/UpdateRcra.tsx index 587199a12..a0529ee61 100644 --- a/client/src/components/Manifest/UpdateRcra/UpdateRcra.tsx +++ b/client/app/components/Manifest/UpdateRcra/UpdateRcra.tsx @@ -1,7 +1,7 @@ -import { HtSpinner } from 'components/UI'; +import { HtSpinner } from '~/components/UI'; import React, { useEffect } from 'react'; import { Navigate } from 'react-router-dom'; -import { addAlert, useAppDispatch, useGetTaskStatusQuery } from 'store'; +import { addAlert, useAppDispatch, useGetTaskStatusQuery } from '~/store'; interface UpdateRcraProps { taskId: string; diff --git a/client/src/components/Manifest/WasteLine/DotIdSelect.tsx b/client/app/components/Manifest/WasteLine/DotIdSelect.tsx similarity index 93% rename from client/src/components/Manifest/WasteLine/DotIdSelect.tsx rename to client/app/components/Manifest/WasteLine/DotIdSelect.tsx index fdc238199..a1cea29a2 100644 --- a/client/src/components/Manifest/WasteLine/DotIdSelect.tsx +++ b/client/app/components/Manifest/WasteLine/DotIdSelect.tsx @@ -1,7 +1,7 @@ -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; import React, { useEffect, useState } from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import { useLazyGetDotIdNumbersQuery } from 'store'; +import { useLazyGetDotIdNumbersQuery } from '~/store'; import Select from 'react-select'; interface DotIdOption { diff --git a/client/src/components/Manifest/WasteLine/EditWasteModal.tsx b/client/app/components/Manifest/WasteLine/EditWasteModal.tsx similarity index 86% rename from client/src/components/Manifest/WasteLine/EditWasteModal.tsx rename to client/app/components/Manifest/WasteLine/EditWasteModal.tsx index d2dc86f9f..863c46e0c 100644 --- a/client/src/components/Manifest/WasteLine/EditWasteModal.tsx +++ b/client/app/components/Manifest/WasteLine/EditWasteModal.tsx @@ -1,7 +1,7 @@ -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { HtModal } from 'components/UI'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { HtModal } from '~/components/UI'; import React, { useContext } from 'react'; import { Col, Row } from 'react-bootstrap'; import { UseFieldArrayReturn } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx b/client/app/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx similarity index 92% rename from client/src/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx rename to client/app/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx index d8f4948e1..940071892 100644 --- a/client/src/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx +++ b/client/app/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm.tsx @@ -1,13 +1,13 @@ import { ErrorMessage } from '@hookform/error-message'; -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { StateWasteCodeSelect } from 'components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect'; -import { Code, WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { HtForm } from 'components/UI'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { StateWasteCodeSelect } from '~/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect'; +import { Code, WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { HtForm } from '~/components/UI'; import React, { useContext } from 'react'; import { Col, Row } from 'react-bootstrap'; import { Controller, useFormContext } from 'react-hook-form'; import Select, { components, StylesConfig } from 'react-select'; -import { useGetFedWasteCodesQuery } from 'store'; +import { useGetFedWasteCodesQuery } from '~/store'; interface HazardousWasteFormProps { epaWaste: boolean; diff --git a/client/src/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx b/client/app/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx similarity index 97% rename from client/src/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx rename to client/app/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx index 91472f3bd..b29a9d825 100644 --- a/client/src/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx +++ b/client/app/components/Manifest/WasteLine/HazardousWasteForm/StateWasteCodeSelect.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import Select, { components } from 'react-select'; -import { useGetStateWasteCodesQuery } from 'store'; +import { useGetStateWasteCodesQuery } from '~/store'; interface StateWasteCodeSelectProps { stateId?: string; diff --git a/client/app/components/Manifest/WasteLine/HazardousWasteForm/index.ts b/client/app/components/Manifest/WasteLine/HazardousWasteForm/index.ts new file mode 100644 index 000000000..11d9af341 --- /dev/null +++ b/client/app/components/Manifest/WasteLine/HazardousWasteForm/index.ts @@ -0,0 +1,3 @@ +import { HazardousWasteForm } from '~/components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm'; + +export { HazardousWasteForm }; diff --git a/client/src/components/Manifest/WasteLine/QuantityForm.spec.tsx b/client/app/components/Manifest/WasteLine/QuantityForm.spec.tsx similarity index 69% rename from client/src/components/Manifest/WasteLine/QuantityForm.spec.tsx rename to client/app/components/Manifest/WasteLine/QuantityForm.spec.tsx index 3312a11dc..9a69270ff 100644 --- a/client/src/components/Manifest/WasteLine/QuantityForm.spec.tsx +++ b/client/app/components/Manifest/WasteLine/QuantityForm.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { QuantityForm } from 'components/Manifest/WasteLine/QuantityForm'; +import { QuantityForm } from '~/components/Manifest/WasteLine/QuantityForm'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => cleanup()); diff --git a/client/src/components/Manifest/WasteLine/QuantityForm.tsx b/client/app/components/Manifest/WasteLine/QuantityForm.tsx similarity index 98% rename from client/src/components/Manifest/WasteLine/QuantityForm.tsx rename to client/app/components/Manifest/WasteLine/QuantityForm.tsx index ee28510db..e29cf2bbb 100644 --- a/client/src/components/Manifest/WasteLine/QuantityForm.tsx +++ b/client/app/components/Manifest/WasteLine/QuantityForm.tsx @@ -3,8 +3,8 @@ import { ContainerType, QuantityUOM, WasteLine, -} from 'components/Manifest/WasteLine/wasteLineSchema'; -import { HtForm } from 'components/UI'; +} from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { HtForm } from '~/components/UI'; import React from 'react'; import { Col, Form, Row } from 'react-bootstrap'; import { Controller, useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineForm.spec.tsx b/client/app/components/Manifest/WasteLine/WasteLineForm.spec.tsx similarity index 96% rename from client/src/components/Manifest/WasteLine/WasteLineForm.spec.tsx rename to client/app/components/Manifest/WasteLine/WasteLineForm.spec.tsx index 84e0a0516..4eeb19a0f 100644 --- a/client/src/components/Manifest/WasteLine/WasteLineForm.spec.tsx +++ b/client/app/components/Manifest/WasteLine/WasteLineForm.spec.tsx @@ -2,8 +2,8 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { mockUserEndpoints, mockWasteEndpoints } from 'test-utils/mock'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { mockUserEndpoints, mockWasteEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; import { WasteLineForm } from './WasteLineForm'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineForm.tsx b/client/app/components/Manifest/WasteLine/WasteLineForm.tsx similarity index 93% rename from client/src/components/Manifest/WasteLine/WasteLineForm.tsx rename to client/app/components/Manifest/WasteLine/WasteLineForm.tsx index a15911e95..8d8f630b7 100644 --- a/client/src/components/Manifest/WasteLine/WasteLineForm.tsx +++ b/client/app/components/Manifest/WasteLine/WasteLineForm.tsx @@ -1,11 +1,11 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { AdditionalInfoForm } from 'components/Manifest/AdditionalInfo'; -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { DotIdSelect } from 'components/Manifest/WasteLine/DotIdSelect'; -import { HazardousWasteForm } from 'components/Manifest/WasteLine/HazardousWasteForm'; -import { WasteLine, wasteLineSchema } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { HtCard, HtForm } from 'components/UI'; +import { AdditionalInfoForm } from '~/components/Manifest/AdditionalInfo'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { DotIdSelect } from '~/components/Manifest/WasteLine/DotIdSelect'; +import { HazardousWasteForm } from '~/components/Manifest/WasteLine/HazardousWasteForm'; +import { WasteLine, wasteLineSchema } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { HtCard, HtForm } from '~/components/UI'; import React, { useContext, useState } from 'react'; import { Button, Col, Container, Form, Row, Stack } from 'react-bootstrap'; import { Controller, FormProvider, UseFieldArrayReturn, useForm } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineSection.tsx b/client/app/components/Manifest/WasteLine/WasteLineSection.tsx similarity index 79% rename from client/src/components/Manifest/WasteLine/WasteLineSection.tsx rename to client/app/components/Manifest/WasteLine/WasteLineSection.tsx index 8a26a5a12..47ce8ffb8 100644 --- a/client/src/components/Manifest/WasteLine/WasteLineSection.tsx +++ b/client/app/components/Manifest/WasteLine/WasteLineSection.tsx @@ -1,9 +1,9 @@ import { ErrorMessage } from '@hookform/error-message'; -import { Manifest } from 'components/Manifest/manifestSchema'; -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { WasteLineTable } from 'components/Manifest/WasteLine/WasteLineTable'; -import { HtButton } from 'components/UI'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { WasteLineTable } from '~/components/Manifest/WasteLine/WasteLineTable'; +import { HtButton } from '~/components/UI'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { Alert } from 'react-bootstrap'; import { useFieldArray, useFormContext } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx b/client/app/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx similarity index 94% rename from client/src/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx rename to client/app/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx index d2a4a9980..58360a864 100644 --- a/client/src/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx +++ b/client/app/components/Manifest/WasteLine/WasteLineTable/WasteLineTable.tsx @@ -1,11 +1,11 @@ import { useAutoAnimate } from '@formkit/auto-animate/react'; import { faAngleRight, faCheckCircle, faCircleXmark } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Manifest } from 'components/Manifest'; -import { ManifestContext, ManifestContextType } from 'components/Manifest/ManifestForm'; -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { WasteRowActions } from 'components/Manifest/WasteLine/WasteLineTable/WasteRowActions'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest } from '~/components/Manifest'; +import { ManifestContext, ManifestContextType } from '~/components/Manifest/ManifestForm'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { WasteRowActions } from '~/components/Manifest/WasteLine/WasteLineTable/WasteRowActions'; +import { useReadOnly } from '~/hooks/manifest'; import React, { useContext, useState } from 'react'; import { Accordion, Button, Card, Col, Row, useAccordionButton } from 'react-bootstrap'; import { UseFieldArrayReturn } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx b/client/app/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx similarity index 98% rename from client/src/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx rename to client/app/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx index e8fa6c60e..e8c1c26f8 100644 --- a/client/src/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx +++ b/client/app/components/Manifest/WasteLine/WasteLineTable/WasteRowActions.tsx @@ -6,7 +6,7 @@ import { faTrash, } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Manifest } from 'components/Manifest'; +import { Manifest } from '~/components/Manifest'; import React, { MouseEventHandler, ReactElement, useState } from 'react'; import { Col, Dropdown, Row, useAccordionButton } from 'react-bootstrap'; import { UseFieldArrayReturn } from 'react-hook-form'; diff --git a/client/src/components/Manifest/WasteLine/WasteLineTable/index.ts b/client/app/components/Manifest/WasteLine/WasteLineTable/index.ts similarity index 100% rename from client/src/components/Manifest/WasteLine/WasteLineTable/index.ts rename to client/app/components/Manifest/WasteLine/WasteLineTable/index.ts diff --git a/client/app/components/Manifest/WasteLine/index.ts b/client/app/components/Manifest/WasteLine/index.ts new file mode 100644 index 000000000..254cd5ede --- /dev/null +++ b/client/app/components/Manifest/WasteLine/index.ts @@ -0,0 +1,6 @@ +import { EditWasteModal } from '~/components/Manifest/WasteLine/EditWasteModal'; +import { WasteLineTable } from './WasteLineTable'; +import { WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; + +export { WasteLineTable, EditWasteModal }; +export type { WasteLine }; diff --git a/client/src/components/Manifest/WasteLine/wasteLineSchema.ts b/client/app/components/Manifest/WasteLine/wasteLineSchema.ts similarity index 100% rename from client/src/components/Manifest/WasteLine/wasteLineSchema.ts rename to client/app/components/Manifest/WasteLine/wasteLineSchema.ts diff --git a/client/src/components/Manifest/index.ts b/client/app/components/Manifest/index.ts similarity index 100% rename from client/src/components/Manifest/index.ts rename to client/app/components/Manifest/index.ts diff --git a/client/src/components/Manifest/manifestSchema.ts b/client/app/components/Manifest/manifestSchema.ts similarity index 97% rename from client/src/components/Manifest/manifestSchema.ts rename to client/app/components/Manifest/manifestSchema.ts index 575a6ae01..5efc9b8e6 100644 --- a/client/src/components/Manifest/manifestSchema.ts +++ b/client/app/components/Manifest/manifestSchema.ts @@ -1,5 +1,5 @@ -import { additionalInfoSchema } from 'components/Manifest/AdditionalInfo/additionalInfoSchema'; -import { rcraPhoneSchema, rcraSite } from 'components/RcraSite'; +import { additionalInfoSchema } from '~/components/Manifest/AdditionalInfo/additionalInfoSchema'; +import { rcraPhoneSchema, rcraSite } from '~/components/RcraSite'; import { z } from 'zod'; export const siteType = z.enum(['generator', 'designatedFacility', 'transporter']); diff --git a/client/src/components/Mtn/MtnRowActions.tsx b/client/app/components/Mtn/MtnRowActions.tsx similarity index 100% rename from client/src/components/Mtn/MtnRowActions.tsx rename to client/app/components/Mtn/MtnRowActions.tsx diff --git a/client/src/components/Mtn/MtnSearchField/MtnSearchField.tsx b/client/app/components/Mtn/MtnSearchField/MtnSearchField.tsx similarity index 100% rename from client/src/components/Mtn/MtnSearchField/MtnSearchField.tsx rename to client/app/components/Mtn/MtnSearchField/MtnSearchField.tsx diff --git a/client/src/components/Mtn/MtnStatusField/MtnStatusField.tsx b/client/app/components/Mtn/MtnStatusField/MtnStatusField.tsx similarity index 100% rename from client/src/components/Mtn/MtnStatusField/MtnStatusField.tsx rename to client/app/components/Mtn/MtnStatusField/MtnStatusField.tsx diff --git a/client/src/components/Mtn/MtnTable.spec.tsx b/client/app/components/Mtn/MtnTable.spec.tsx similarity index 92% rename from client/src/components/Mtn/MtnTable.spec.tsx rename to client/app/components/Mtn/MtnTable.spec.tsx index ae882bf73..2ab22b162 100644 --- a/client/src/components/Mtn/MtnTable.spec.tsx +++ b/client/app/components/Mtn/MtnTable.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; import { fireEvent } from '@testing-library/react'; -import { MtnDetails, MtnTable } from 'components/Mtn'; +import { MtnDetails, MtnTable } from '~/components/Mtn'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; +import { renderWithProviders, screen } from 'app/mocks'; import { describe, expect, test } from 'vitest'; const DEFAULT_MTN_DETAILS: MtnDetails = { diff --git a/client/src/components/Mtn/MtnTable.tsx b/client/app/components/Mtn/MtnTable.tsx similarity index 96% rename from client/src/components/Mtn/MtnTable.tsx rename to client/app/components/Mtn/MtnTable.tsx index 72f4c71e5..67ceefc0f 100644 --- a/client/src/components/Mtn/MtnTable.tsx +++ b/client/app/components/Mtn/MtnTable.tsx @@ -16,10 +16,10 @@ import { getSortedRowModel, useReactTable, } from '@tanstack/react-table'; -import { MtnRowActions } from 'components/Mtn/MtnRowActions'; -import { MtnSearchField } from 'components/Mtn/MtnSearchField/MtnSearchField'; -import { MtnStatusField, StatusOption } from 'components/Mtn/MtnStatusField/MtnStatusField'; -import { HtPageBtns, HtPageControls } from 'components/UI'; +import { MtnRowActions } from '~/components/Mtn/MtnRowActions'; +import { MtnSearchField } from '~/components/Mtn/MtnSearchField/MtnSearchField'; +import { MtnStatusField, StatusOption } from '~/components/Mtn/MtnStatusField/MtnStatusField'; +import { HtPageBtns, HtPageControls } from '~/components/UI'; import React, { ChangeEvent, useState } from 'react'; import { Button, Col, Table } from 'react-bootstrap'; import { Link, useSearchParams } from 'react-router-dom'; diff --git a/client/src/components/Mtn/index.ts b/client/app/components/Mtn/index.ts similarity index 100% rename from client/src/components/Mtn/index.ts rename to client/app/components/Mtn/index.ts diff --git a/client/src/components/Notifications/Notifications.tsx b/client/app/components/Notifications/Notifications.tsx similarity index 76% rename from client/src/components/Notifications/Notifications.tsx rename to client/app/components/Notifications/Notifications.tsx index 7e5031df1..b782f6ada 100644 --- a/client/src/components/Notifications/Notifications.tsx +++ b/client/app/components/Notifications/Notifications.tsx @@ -1,5 +1,5 @@ -import { ProgressTracker } from 'components/Notifications/ProgressTracker'; -import { LongRunningTask, selectAllTasks, useAppSelector } from 'store'; +import { ProgressTracker } from '~/components/Notifications/ProgressTracker'; +import { LongRunningTask, selectAllTasks, useAppSelector } from '~/store'; export function Notifications() { const tasks: LongRunningTask[] = useAppSelector(selectAllTasks); diff --git a/client/src/components/Notifications/ProgressTracker.tsx b/client/app/components/Notifications/ProgressTracker.tsx similarity index 91% rename from client/src/components/Notifications/ProgressTracker.tsx rename to client/app/components/Notifications/ProgressTracker.tsx index d602cde7d..7c3a75eef 100644 --- a/client/src/components/Notifications/ProgressTracker.tsx +++ b/client/app/components/Notifications/ProgressTracker.tsx @@ -1,7 +1,7 @@ -import { useProgressTracker } from 'hooks'; +import { useProgressTracker } from '~/hooks'; import { useEffect } from 'react'; import { toast } from 'react-toastify'; -import { LongRunningTask } from 'store'; +import { LongRunningTask } from '~/store'; export interface NotificationProps { task: LongRunningTask; diff --git a/client/src/components/Org/OrgSitesTable.tsx b/client/app/components/Org/OrgSitesTable.tsx similarity index 87% rename from client/src/components/Org/OrgSitesTable.tsx rename to client/app/components/Org/OrgSitesTable.tsx index cc76cd4c0..dcf38d50f 100644 --- a/client/src/components/Org/OrgSitesTable.tsx +++ b/client/app/components/Org/OrgSitesTable.tsx @@ -1,7 +1,7 @@ -import { HaztrakSite } from 'components/HaztrakSite'; +import { HaztrakSite } from '~/components/HaztrakSite'; import React from 'react'; import { Row, Table } from 'react-bootstrap'; -import { HaztrakProfileOrg, useGetOrgSitesQuery } from 'store'; +import { HaztrakProfileOrg, useGetOrgSitesQuery } from '~/store'; interface OrgSitesProps { org: HaztrakProfileOrg; diff --git a/client/src/components/Org/UserOrg.tsx b/client/app/components/Org/UserOrg.tsx similarity index 93% rename from client/src/components/Org/UserOrg.tsx rename to client/app/components/Org/UserOrg.tsx index 628cbdd79..28e85f8c4 100644 --- a/client/src/components/Org/UserOrg.tsx +++ b/client/app/components/Org/UserOrg.tsx @@ -1,9 +1,9 @@ import { faCheck, faX } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { SiteAccess } from 'components/User/SiteAccess'; +import { SiteAccess } from '~/components/User/SiteAccess'; import React from 'react'; import { Col, Row, Tab, Tabs } from 'react-bootstrap'; -import { ProfileSlice } from 'store'; +import { ProfileSlice } from '~/store'; import { OrgSitesTable } from './OrgSitesTable'; interface UserOrgProps { diff --git a/client/src/components/Org/index.ts b/client/app/components/Org/index.ts similarity index 100% rename from client/src/components/Org/index.ts rename to client/app/components/Org/index.ts diff --git a/client/src/components/RcraProfile/RcraProfile.tsx b/client/app/components/RcraProfile/RcraProfile.tsx similarity index 95% rename from client/src/components/RcraProfile/RcraProfile.tsx rename to client/app/components/RcraProfile/RcraProfile.tsx index b17a1e452..3ca4ca616 100644 --- a/client/src/components/RcraProfile/RcraProfile.tsx +++ b/client/app/components/RcraProfile/RcraProfile.tsx @@ -1,12 +1,12 @@ import { zodResolver } from '@hookform/resolvers/zod'; -import { SyncRcrainfoProfileBtn } from 'components/RcraProfile/SyncRcrainfoProfileBtn'; -import { HtForm, HtSpinner } from 'components/UI'; -import { useProgressTracker } from 'hooks'; +import { SyncRcrainfoProfileBtn } from '~/components/RcraProfile/SyncRcrainfoProfileBtn'; +import { HtForm, HtSpinner } from '~/components/UI'; +import { useProgressTracker } from '~/hooks'; import React, { useEffect, useState } from 'react'; import { Button, Col, Container, Form, Row, Table } from 'react-bootstrap'; import { useForm } from 'react-hook-form'; -import { RcrainfoProfileState, useAppDispatch, useUpdateRcrainfoProfileMutation } from 'store'; -import { userApi } from 'store/userSlice/user.slice'; +import { RcrainfoProfileState, useAppDispatch, useUpdateRcrainfoProfileMutation } from '~/store'; +import { userApi } from '~/store/userSlice/user.slice'; import { z } from 'zod'; interface ProfileViewProps { diff --git a/client/src/components/RcraProfile/SyncRcrainfoProfileBtn.tsx b/client/app/components/RcraProfile/SyncRcrainfoProfileBtn.tsx similarity index 92% rename from client/src/components/RcraProfile/SyncRcrainfoProfileBtn.tsx rename to client/app/components/RcraProfile/SyncRcrainfoProfileBtn.tsx index bf92226a6..a3c3ada01 100644 --- a/client/src/components/RcraProfile/SyncRcrainfoProfileBtn.tsx +++ b/client/app/components/RcraProfile/SyncRcrainfoProfileBtn.tsx @@ -1,6 +1,6 @@ -import { RcraApiUserBtn } from 'components/Rcrainfo'; +import { RcraApiUserBtn } from '~/components/Rcrainfo'; import React, { useEffect } from 'react'; -import { addTask, updateTask, useAppDispatch, useSyncRcrainfoProfileMutation } from 'store'; +import { addTask, updateTask, useAppDispatch, useSyncRcrainfoProfileMutation } from '~/store'; interface SyncRcrainfoProfileBtnProps { taskId?: string; diff --git a/client/app/components/RcraProfile/index.ts b/client/app/components/RcraProfile/index.ts new file mode 100644 index 000000000..ec2ab2d0e --- /dev/null +++ b/client/app/components/RcraProfile/index.ts @@ -0,0 +1,3 @@ +import { RcraProfile } from '~/components/RcraProfile/RcraProfile'; + +export { RcraProfile }; diff --git a/client/src/components/RcraSite/AddressListGroup.tsx b/client/app/components/RcraSite/AddressListGroup.tsx similarity index 92% rename from client/src/components/RcraSite/AddressListGroup.tsx rename to client/app/components/RcraSite/AddressListGroup.tsx index babf9a0ff..8ccdfe87d 100644 --- a/client/src/components/RcraSite/AddressListGroup.tsx +++ b/client/app/components/RcraSite/AddressListGroup.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { ListGroup } from 'react-bootstrap'; -import { RcraAddress } from 'components/RcraSite'; +import { RcraAddress } from '~/components/RcraSite'; interface AddressListGroupProps { title: string; diff --git a/client/src/components/RcraSite/RcraSiteDetails.spec.tsx b/client/app/components/RcraSite/RcraSiteDetails.spec.tsx similarity index 83% rename from client/src/components/RcraSite/RcraSiteDetails.spec.tsx rename to client/app/components/RcraSite/RcraSiteDetails.spec.tsx index 21e3c0f5d..259512c1a 100644 --- a/client/src/components/RcraSite/RcraSiteDetails.spec.tsx +++ b/client/app/components/RcraSite/RcraSiteDetails.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; -import { RcraSiteDetails } from 'components/RcraSite'; +import { RcraSiteDetails } from '~/components/RcraSite'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockMTNHandler } from 'test-utils/fixtures'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockMTNHandler } from '~/mocks/fixtures'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/RcraSite/RcraSiteDetails.tsx b/client/app/components/RcraSite/RcraSiteDetails.tsx similarity index 95% rename from client/src/components/RcraSite/RcraSiteDetails.tsx rename to client/app/components/RcraSite/RcraSiteDetails.tsx index f227ade43..7d2f6c3a3 100644 --- a/client/src/components/RcraSite/RcraSiteDetails.tsx +++ b/client/app/components/RcraSite/RcraSiteDetails.tsx @@ -1,7 +1,7 @@ import { faCircleCheck, faCircleXmark, faSignature } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { Handler } from 'components/Manifest'; -import { AddressListGroup, RcraSite } from 'components/RcraSite'; +import { Handler } from '~/components/Manifest'; +import { AddressListGroup, RcraSite } from '~/components/RcraSite'; import React from 'react'; import { Col, Row } from 'react-bootstrap'; diff --git a/client/src/components/RcraSite/index.ts b/client/app/components/RcraSite/index.ts similarity index 100% rename from client/src/components/RcraSite/index.ts rename to client/app/components/RcraSite/index.ts diff --git a/client/src/components/RcraSite/rcraSiteSchema.ts b/client/app/components/RcraSite/rcraSiteSchema.ts similarity index 100% rename from client/src/components/RcraSite/rcraSiteSchema.ts rename to client/app/components/RcraSite/rcraSiteSchema.ts diff --git a/client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx b/client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx similarity index 85% rename from client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx rename to client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx index f1d9bd0a6..be2164cdf 100644 --- a/client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx +++ b/client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { RcraApiUserBtn } from 'components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn'; +import { RcraApiUserBtn } from '~/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test, vi } from 'vitest'; afterEach(() => { diff --git a/client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx b/client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx similarity index 93% rename from client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx rename to client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx index e8cc292d5..d3231cbc2 100644 --- a/client/src/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx +++ b/client/app/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn.tsx @@ -1,5 +1,5 @@ import { Button, ButtonProps } from 'react-bootstrap'; -import { useGetProfileQuery } from 'store'; +import { useGetProfileQuery } from '~/store'; interface HtApiUserBtnProps extends ButtonProps {} diff --git a/client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx b/client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx similarity index 80% rename from client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx rename to client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx index 8b501990b..02c251a41 100644 --- a/client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx +++ b/client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.spec.tsx @@ -1,11 +1,11 @@ import '@testing-library/jest-dom'; -import { SyncManifestBtn } from 'components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn'; +import { SyncManifestBtn } from '~/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { mockUserEndpoints } from 'test-utils/mock'; -import { API_BASE_URL } from 'test-utils/mock/mockSiteEndpoints'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { mockUserEndpoints } from 'app/mocks/handlers'; +import { API_BASE_URL } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vitest'; const testTaskID = 'testTaskId'; diff --git a/client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx b/client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx similarity index 91% rename from client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx rename to client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx index a11a1b5e7..23bbc86fa 100644 --- a/client/src/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx +++ b/client/app/components/Rcrainfo/buttons/SyncManifestBtn/SyncManifestBtn.tsx @@ -1,9 +1,9 @@ import { faSync } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { RcraApiUserBtn } from 'components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn'; -import { useProgressTracker } from 'hooks'; +import { RcraApiUserBtn } from '~/components/Rcrainfo/buttons/RcraApiUserBtn/RcraApiUserBtn'; +import { useProgressTracker } from '~/hooks'; import React, { useEffect, useState } from 'react'; -import { addTask, updateTask, useAppDispatch, useSyncEManifestMutation } from 'store'; +import { addTask, updateTask, useAppDispatch, useSyncEManifestMutation } from '~/store'; interface SyncManifestProps { siteId?: string; diff --git a/client/src/components/Rcrainfo/index.ts b/client/app/components/Rcrainfo/index.ts similarity index 100% rename from client/src/components/Rcrainfo/index.ts rename to client/app/components/Rcrainfo/index.ts diff --git a/client/src/components/UI/FeatureDescription.tsx b/client/app/components/UI/FeatureDescription.tsx similarity index 100% rename from client/src/components/UI/FeatureDescription.tsx rename to client/app/components/UI/FeatureDescription.tsx diff --git a/client/src/components/UI/FloatingActionBtn.tsx b/client/app/components/UI/FloatingActionBtn.tsx similarity index 100% rename from client/src/components/UI/FloatingActionBtn.tsx rename to client/app/components/UI/FloatingActionBtn.tsx diff --git a/client/src/components/UI/HtButton.tsx b/client/app/components/UI/HtButton.tsx similarity index 100% rename from client/src/components/UI/HtButton.tsx rename to client/app/components/UI/HtButton.tsx diff --git a/client/src/components/UI/HtCard/HtCard.spec.tsx b/client/app/components/UI/HtCard/HtCard.spec.tsx similarity index 84% rename from client/src/components/UI/HtCard/HtCard.spec.tsx rename to client/app/components/UI/HtCard/HtCard.spec.tsx index f1df03e1d..78ddba717 100644 --- a/client/src/components/UI/HtCard/HtCard.spec.tsx +++ b/client/app/components/UI/HtCard/HtCard.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { HtCard } from 'components/UI'; +import { HtCard } from '~/components/UI'; import React from 'react'; -import { cleanup, render, screen } from 'test-utils'; +import { cleanup, render, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/UI/HtCard/HtCard.tsx b/client/app/components/UI/HtCard/HtCard.tsx similarity index 98% rename from client/src/components/UI/HtCard/HtCard.tsx rename to client/app/components/UI/HtCard/HtCard.tsx index d99f44722..a3cf227bf 100644 --- a/client/src/components/UI/HtCard/HtCard.tsx +++ b/client/app/components/UI/HtCard/HtCard.tsx @@ -1,4 +1,4 @@ -import { ErrorBoundary } from 'components/Error'; +import { ErrorBoundary } from '~/components/Error'; import React, { ReactElement } from 'react'; import { Card, CardHeaderProps, CardProps, Container } from 'react-bootstrap'; diff --git a/client/src/components/UI/HtForm.tsx b/client/app/components/UI/HtForm.tsx similarity index 100% rename from client/src/components/UI/HtForm.tsx rename to client/app/components/UI/HtForm.tsx diff --git a/client/src/components/UI/HtModal/HtModal.spec.tsx b/client/app/components/UI/HtModal/HtModal.spec.tsx similarity index 86% rename from client/src/components/UI/HtModal/HtModal.spec.tsx rename to client/app/components/UI/HtModal/HtModal.spec.tsx index f3b9bcebb..8e339658f 100644 --- a/client/src/components/UI/HtModal/HtModal.spec.tsx +++ b/client/app/components/UI/HtModal/HtModal.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { HtModal } from 'components/UI'; +import { HtModal } from '~/components/UI'; import React from 'react'; -import { cleanup, render, screen } from 'test-utils'; +import { cleanup, render, screen } from 'app/mocks'; import { afterEach, describe, expect, test, vi } from 'vitest'; afterEach(() => { diff --git a/client/src/components/UI/HtModal/HtModal.tsx b/client/app/components/UI/HtModal/HtModal.tsx similarity index 100% rename from client/src/components/UI/HtModal/HtModal.tsx rename to client/app/components/UI/HtModal/HtModal.tsx diff --git a/client/src/components/UI/HtPaginate/HtPageBtns.tsx b/client/app/components/UI/HtPaginate/HtPageBtns.tsx similarity index 98% rename from client/src/components/UI/HtPaginate/HtPageBtns.tsx rename to client/app/components/UI/HtPaginate/HtPageBtns.tsx index d604decda..d8cd30b53 100644 --- a/client/src/components/UI/HtPaginate/HtPageBtns.tsx +++ b/client/app/components/UI/HtPaginate/HtPageBtns.tsx @@ -6,7 +6,7 @@ import { } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Table } from '@tanstack/react-table'; -import { usePagination } from 'hooks'; +import { usePagination } from '~/hooks'; import React from 'react'; import { Pagination } from 'react-bootstrap'; diff --git a/client/src/components/UI/HtPaginate/HtPageControls.tsx b/client/app/components/UI/HtPaginate/HtPageControls.tsx similarity index 100% rename from client/src/components/UI/HtPaginate/HtPageControls.tsx rename to client/app/components/UI/HtPaginate/HtPageControls.tsx diff --git a/client/src/components/UI/HtPaginate/HtPaginate.spec.tsx b/client/app/components/UI/HtPaginate/HtPaginate.spec.tsx similarity index 93% rename from client/src/components/UI/HtPaginate/HtPaginate.spec.tsx rename to client/app/components/UI/HtPaginate/HtPaginate.spec.tsx index 2abda4fa7..7fa87cf59 100644 --- a/client/src/components/UI/HtPaginate/HtPaginate.spec.tsx +++ b/client/app/components/UI/HtPaginate/HtPaginate.spec.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; -import { HtPaginate } from 'components/UI'; +import { HtPaginate } from '~/components/UI'; import React from 'react'; -import { cleanup, render, screen } from 'test-utils'; +import { cleanup, render, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; afterEach(() => { diff --git a/client/src/components/UI/HtPaginate/HtPaginate.tsx b/client/app/components/UI/HtPaginate/HtPaginate.tsx similarity index 98% rename from client/src/components/UI/HtPaginate/HtPaginate.tsx rename to client/app/components/UI/HtPaginate/HtPaginate.tsx index 053e5c89d..6c38ac081 100644 --- a/client/src/components/UI/HtPaginate/HtPaginate.tsx +++ b/client/app/components/UI/HtPaginate/HtPaginate.tsx @@ -1,4 +1,4 @@ -import { usePagination } from 'hooks'; +import { usePagination } from '~/hooks'; import React from 'react'; import { Pagination } from 'react-bootstrap'; diff --git a/client/src/components/UI/HtSpinner.tsx b/client/app/components/UI/HtSpinner.tsx similarity index 100% rename from client/src/components/UI/HtSpinner.tsx rename to client/app/components/UI/HtSpinner.tsx diff --git a/client/src/components/UI/HtTooltip/HtTooltip.spec.tsx b/client/app/components/UI/HtTooltip/HtTooltip.spec.tsx similarity index 93% rename from client/src/components/UI/HtTooltip/HtTooltip.spec.tsx rename to client/app/components/UI/HtTooltip/HtTooltip.spec.tsx index c6f4dc2fc..ceef707fc 100644 --- a/client/src/components/UI/HtTooltip/HtTooltip.spec.tsx +++ b/client/app/components/UI/HtTooltip/HtTooltip.spec.tsx @@ -1,6 +1,6 @@ import '@testing-library/jest-dom'; import { cleanup, fireEvent, render, screen } from '@testing-library/react'; -import { HtTooltip } from 'components/UI'; +import { HtTooltip } from '~/components/UI'; import React from 'react'; import { afterEach, describe, expect, test } from 'vitest'; diff --git a/client/src/components/UI/HtTooltip/HtTooltip.tsx b/client/app/components/UI/HtTooltip/HtTooltip.tsx similarity index 100% rename from client/src/components/UI/HtTooltip/HtTooltip.tsx rename to client/app/components/UI/HtTooltip/HtTooltip.tsx diff --git a/client/src/components/UI/HtTooltip/index.ts b/client/app/components/UI/HtTooltip/index.ts similarity index 100% rename from client/src/components/UI/HtTooltip/index.ts rename to client/app/components/UI/HtTooltip/index.ts diff --git a/client/src/components/UI/README.md b/client/app/components/UI/README.md similarity index 100% rename from client/src/components/UI/README.md rename to client/app/components/UI/README.md diff --git a/client/app/components/UI/index.ts b/client/app/components/UI/index.ts new file mode 100644 index 000000000..d16d0b364 --- /dev/null +++ b/client/app/components/UI/index.ts @@ -0,0 +1,11 @@ +export { HtButton } from '~/components/UI/HtButton'; +export { HtForm } from '~/components/UI/HtForm'; +export { HtPageBtns } from '~/components/UI/HtPaginate/HtPageBtns'; +export { HtPageControls } from '~/components/UI/HtPaginate/HtPageControls'; +export { HtPaginate } from '~/components/UI/HtPaginate/HtPaginate'; +export { HtCard } from './HtCard/HtCard'; +export { HtModal } from './HtModal/HtModal'; +export { HtSpinner } from './HtSpinner'; +export { HtTooltip, InfoIconTooltip } from './HtTooltip'; +export { FeatureDescription } from './FeatureDescription'; +export { FloatingActionBtn } from './FloatingActionBtn'; diff --git a/client/src/components/User/SiteAccess.tsx b/client/app/components/User/SiteAccess.tsx similarity index 95% rename from client/src/components/User/SiteAccess.tsx rename to client/app/components/User/SiteAccess.tsx index 2056b4694..a9a8ab421 100644 --- a/client/src/components/User/SiteAccess.tsx +++ b/client/app/components/User/SiteAccess.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Row, Table } from 'react-bootstrap'; import { Link } from 'react-router-dom'; -import { HaztrakProfileSite } from 'store'; +import { HaztrakProfileSite } from '~/store'; interface SiteAccessProps { sites?: Record; diff --git a/client/src/components/User/UserInfoForm.spec.tsx b/client/app/components/User/UserInfoForm.spec.tsx similarity index 86% rename from client/src/components/User/UserInfoForm.spec.tsx rename to client/app/components/User/UserInfoForm.spec.tsx index 41a831b87..c4c0a1e3d 100644 --- a/client/src/components/User/UserInfoForm.spec.tsx +++ b/client/app/components/User/UserInfoForm.spec.tsx @@ -1,13 +1,13 @@ import '@testing-library/jest-dom'; import { cleanup } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { UserInfoForm } from 'components/User/UserInfoForm'; +import { UserInfoForm } from '~/components/User/UserInfoForm'; import { setupServer } from 'msw/node'; import React from 'react'; -import { HaztrakUser, ProfileSlice } from 'store'; -import { renderWithProviders, screen } from 'test-utils'; -import { createMockHaztrakUser } from 'test-utils/fixtures'; -import { mockUserEndpoints } from 'test-utils/mock'; +import { HaztrakUser, ProfileSlice } from '~/store'; +import { renderWithProviders, screen } from 'app/mocks'; +import { createMockHaztrakUser } from '~/mocks/fixtures'; +import { mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vitest'; const server = setupServer(...mockUserEndpoints); diff --git a/client/src/components/User/UserInfoForm.tsx b/client/app/components/User/UserInfoForm.tsx similarity index 98% rename from client/src/components/User/UserInfoForm.tsx rename to client/app/components/User/UserInfoForm.tsx index 115b139a5..5d28d039e 100644 --- a/client/src/components/User/UserInfoForm.tsx +++ b/client/app/components/User/UserInfoForm.tsx @@ -1,11 +1,11 @@ import { faUser } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { zodResolver } from '@hookform/resolvers/zod'; -import { HtForm, HtSpinner } from 'components/UI'; +import { HtForm, HtSpinner } from '~/components/UI'; import React, { createRef, useState } from 'react'; import { Button, Col, Form, Row } from 'react-bootstrap'; import { useForm } from 'react-hook-form'; -import { HaztrakUser, ProfileSlice, useUpdateUserMutation } from 'store'; +import { HaztrakUser, ProfileSlice, useUpdateUserMutation } from '~/store'; import { z } from 'zod'; interface UserProfileProps { diff --git a/client/app/components/User/index.ts b/client/app/components/User/index.ts new file mode 100644 index 000000000..42ae563fd --- /dev/null +++ b/client/app/components/User/index.ts @@ -0,0 +1 @@ +export { UserInfoForm } from '~/components/User/UserInfoForm'; diff --git a/client/src/env.d.ts b/client/app/env.d.ts similarity index 100% rename from client/src/env.d.ts rename to client/app/env.d.ts diff --git a/client/src/hooks/index.ts b/client/app/hooks/index.ts similarity index 100% rename from client/src/hooks/index.ts rename to client/app/hooks/index.ts diff --git a/client/src/hooks/manifest/index.ts b/client/app/hooks/manifest/index.ts similarity index 100% rename from client/src/hooks/manifest/index.ts rename to client/app/hooks/manifest/index.ts diff --git a/client/src/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx b/client/app/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx similarity index 95% rename from client/src/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx rename to client/app/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx index 99e8c6fb3..7d2d4ba29 100644 --- a/client/src/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx +++ b/client/app/hooks/manifest/useManifestStatus/useManifestStatus.spec.tsx @@ -2,10 +2,10 @@ import '@testing-library/jest-dom'; import { afterEach, describe, expect, it } from 'vitest'; import { cleanup } from '@testing-library/react'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; +import { renderWithProviders, screen } from 'app/mocks'; import { useManifestStatus } from './useManifestStatus'; import userEvent from '@testing-library/user-event'; -import { ManifestStatus } from 'components/Manifest/manifestSchema'; +import { ManifestStatus } from '~/components/Manifest/manifestSchema'; const TestChildComponent = () => { const [status] = useManifestStatus(); diff --git a/client/src/hooks/manifest/useManifestStatus/useManifestStatus.tsx b/client/app/hooks/manifest/useManifestStatus/useManifestStatus.tsx similarity index 79% rename from client/src/hooks/manifest/useManifestStatus/useManifestStatus.tsx rename to client/app/hooks/manifest/useManifestStatus/useManifestStatus.tsx index 9a5246882..4f05bfb55 100644 --- a/client/src/hooks/manifest/useManifestStatus/useManifestStatus.tsx +++ b/client/app/hooks/manifest/useManifestStatus/useManifestStatus.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; -import { ManifestStatus } from 'components/Manifest/manifestSchema'; -import { useAppDispatch, useAppSelector } from 'store'; -import { selectManifestStatus, setManifestStatus } from 'store/manifestSlice/manifest.slice'; +import { ManifestStatus } from '~/components/Manifest/manifestSchema'; +import { useAppDispatch, useAppSelector } from '~/store'; +import { selectManifestStatus, setManifestStatus } from '~/store/manifestSlice/manifest.slice'; /** State management for the e-Manifest status (e.g., 'NotAssigned', 'Scheduled') * @example const [status, setStatus] = useManifestStatus(optionalDefault); diff --git a/client/src/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx b/client/app/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx similarity index 89% rename from client/src/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx rename to client/app/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx index d4a1aa556..e1f2467f3 100644 --- a/client/src/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx +++ b/client/app/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig.tsx @@ -1,10 +1,10 @@ import { useEffect, useState } from 'react'; -import { useAppDispatch, useAppSelector } from 'store'; +import { useAppDispatch, useAppSelector } from '~/store'; import { HandlerSearchConfig, selectHandlerSearchConfigs, setHandlerSearchConfigs, -} from 'store/manifestSlice/manifest.slice'; +} from '~/store/manifestSlice/manifest.slice'; /** hook used to control the handler Search Form modal * @example const [open, setOpen] = useOpenHandlerSearch(); diff --git a/client/src/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx b/client/app/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx similarity index 87% rename from client/src/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx rename to client/app/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx index 32e4028e0..16989f6ce 100644 --- a/client/src/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx +++ b/client/app/hooks/manifest/useOpenHandlerSearch/useOpenHandlerSearch.spec.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { cleanup } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { SiteType } from 'components/Manifest/manifestSchema'; -import { useHandlerSearchConfig } from 'hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; +import { SiteType } from '~/components/Manifest/manifestSchema'; +import { useHandlerSearchConfig } from '~/hooks/manifest/useOpenHandlerSearch/useHandlerSearchConfig'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; +import { renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, it } from 'vitest'; const TestChildComponent = () => { diff --git a/client/src/hooks/manifest/useReadOnly/useReadOnly.spec.tsx b/client/app/hooks/manifest/useReadOnly/useReadOnly.spec.tsx similarity index 97% rename from client/src/hooks/manifest/useReadOnly/useReadOnly.spec.tsx rename to client/app/hooks/manifest/useReadOnly/useReadOnly.spec.tsx index 18c59d7b2..d83ef34fe 100644 --- a/client/src/hooks/manifest/useReadOnly/useReadOnly.spec.tsx +++ b/client/app/hooks/manifest/useReadOnly/useReadOnly.spec.tsx @@ -2,7 +2,7 @@ import '@testing-library/jest-dom'; import { cleanup } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; +import { renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, it } from 'vitest'; import { useReadOnly } from './useReadOnly'; diff --git a/client/src/hooks/manifest/useReadOnly/useReadOnly.tsx b/client/app/hooks/manifest/useReadOnly/useReadOnly.tsx similarity index 87% rename from client/src/hooks/manifest/useReadOnly/useReadOnly.tsx rename to client/app/hooks/manifest/useReadOnly/useReadOnly.tsx index 6cec6b25f..423b3ae93 100644 --- a/client/src/hooks/manifest/useReadOnly/useReadOnly.tsx +++ b/client/app/hooks/manifest/useReadOnly/useReadOnly.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; -import { useAppDispatch, useAppSelector } from 'store'; -import { selectManifestReadOnly, setManifestReadOnly } from 'store/manifestSlice/manifest.slice'; +import { useAppDispatch, useAppSelector } from '~/store'; +import { selectManifestReadOnly, setManifestReadOnly } from '~/store/manifestSlice/manifest.slice'; /** State management for whether a manifest is editable/read only * @example const [status, setStatus] = useReadOnly(); diff --git a/client/src/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx b/client/app/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx similarity index 92% rename from client/src/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx rename to client/app/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx index 665ad941f..774693114 100644 --- a/client/src/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx +++ b/client/app/hooks/manifest/useSaveManifest/useSaveManifest.spec.tsx @@ -1,12 +1,12 @@ import '@testing-library/jest-dom'; import { cleanup, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { Manifest } from 'components/Manifest'; +import { Manifest } from '~/components/Manifest'; import { setupServer } from 'msw/node'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; -import { createMockManifest } from 'test-utils/fixtures'; -import { mockManifestEndpoints } from 'test-utils/mock'; +import { renderWithProviders, screen } from 'app/mocks'; +import { createMockManifest } from '~/mocks/fixtures'; +import { mockManifestEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; import { useSaveManifest } from './useSaveManifest'; diff --git a/client/src/hooks/manifest/useSaveManifest/useSaveManifest.tsx b/client/app/hooks/manifest/useSaveManifest/useSaveManifest.tsx similarity index 97% rename from client/src/hooks/manifest/useSaveManifest/useSaveManifest.tsx rename to client/app/hooks/manifest/useSaveManifest/useSaveManifest.tsx index 2f73e3539..2ccfdae18 100644 --- a/client/src/hooks/manifest/useSaveManifest/useSaveManifest.tsx +++ b/client/app/hooks/manifest/useSaveManifest/useSaveManifest.tsx @@ -1,10 +1,10 @@ -import { Manifest } from 'components/Manifest'; +import { Manifest } from '~/components/Manifest'; import { useEffect, useState } from 'react'; import { useCreateManifestMutation, useSaveEManifestMutation, useUpdateManifestMutation, -} from 'store'; +} from '~/store'; /** * encapsulates the logic for making requests to the back end to save a manifest (create, update, or save to e-Manifest) diff --git a/client/src/hooks/useDebounce/useDebounce.spec.tsx b/client/app/hooks/useDebounce/useDebounce.spec.tsx similarity index 100% rename from client/src/hooks/useDebounce/useDebounce.spec.tsx rename to client/app/hooks/useDebounce/useDebounce.spec.tsx diff --git a/client/src/hooks/useDebounce/useDebounce.tsx b/client/app/hooks/useDebounce/useDebounce.tsx similarity index 100% rename from client/src/hooks/useDebounce/useDebounce.tsx rename to client/app/hooks/useDebounce/useDebounce.tsx diff --git a/client/src/hooks/usePagination/usePagination.spec.tsx b/client/app/hooks/usePagination/usePagination.spec.tsx similarity index 98% rename from client/src/hooks/usePagination/usePagination.spec.tsx rename to client/app/hooks/usePagination/usePagination.spec.tsx index dd3d65a69..7f96c4fb3 100644 --- a/client/src/hooks/usePagination/usePagination.spec.tsx +++ b/client/app/hooks/usePagination/usePagination.spec.tsx @@ -1,6 +1,6 @@ import { cleanup, fireEvent, waitFor } from '@testing-library/react'; import React, { useState } from 'react'; -import { render, screen } from 'test-utils'; +import { render, screen } from 'app/mocks'; import { afterEach, describe, expect, test } from 'vitest'; import { usePagination } from './usePagination'; diff --git a/client/src/hooks/usePagination/usePagination.tsx b/client/app/hooks/usePagination/usePagination.tsx similarity index 100% rename from client/src/hooks/usePagination/usePagination.tsx rename to client/app/hooks/usePagination/usePagination.tsx diff --git a/client/src/hooks/useProgressTracker/useProgressTracker.spec.tsx b/client/app/hooks/useProgressTracker/useProgressTracker.spec.tsx similarity index 94% rename from client/src/hooks/useProgressTracker/useProgressTracker.spec.tsx rename to client/app/hooks/useProgressTracker/useProgressTracker.spec.tsx index fa14b2cbc..4f843eb3f 100644 --- a/client/src/hooks/useProgressTracker/useProgressTracker.spec.tsx +++ b/client/app/hooks/useProgressTracker/useProgressTracker.spec.tsx @@ -2,11 +2,11 @@ import '@testing-library/jest-dom'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React, { useState } from 'react'; -import { renderWithProviders, screen, waitFor, cleanup } from 'test-utils'; +import { renderWithProviders, screen, waitFor, cleanup } from 'app/mocks'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; -import { useProgressTracker } from 'hooks/useProgressTracker/useProgressTracker'; +import { useProgressTracker } from '~/hooks/useProgressTracker/useProgressTracker'; import userEvent from '@testing-library/user-event'; -import { addTask, useAppDispatch } from 'store'; +import { addTask, useAppDispatch } from '~/store'; function TestComponent({ taskUUID }: { taskUUID: string }) { const dispatch = useAppDispatch(); diff --git a/client/src/hooks/useProgressTracker/useProgressTracker.tsx b/client/app/hooks/useProgressTracker/useProgressTracker.tsx similarity index 99% rename from client/src/hooks/useProgressTracker/useProgressTracker.tsx rename to client/app/hooks/useProgressTracker/useProgressTracker.tsx index 200a5386c..06ce92e83 100644 --- a/client/src/hooks/useProgressTracker/useProgressTracker.tsx +++ b/client/app/hooks/useProgressTracker/useProgressTracker.tsx @@ -8,7 +8,7 @@ import { useAppDispatch, useAppSelector, useGetTaskStatusQuery, -} from 'store'; +} from '~/store'; interface UseProgressTrackerConfig { taskId: string | undefined; diff --git a/client/src/hooks/useTitle/useTitle.spec.tsx b/client/app/hooks/useTitle/useTitle.spec.tsx similarity index 95% rename from client/src/hooks/useTitle/useTitle.spec.tsx rename to client/app/hooks/useTitle/useTitle.spec.tsx index d207c2be0..bfbc7bfff 100644 --- a/client/src/hooks/useTitle/useTitle.spec.tsx +++ b/client/app/hooks/useTitle/useTitle.spec.tsx @@ -2,8 +2,8 @@ import '@testing-library/jest-dom'; import { describe, expect, afterEach, it } from 'vitest'; import { cleanup, fireEvent } from '@testing-library/react'; import React from 'react'; -import { render, screen } from 'test-utils'; -import { useTitle } from 'hooks'; +import { render, screen } from 'app/mocks'; +import { useTitle } from '~/hooks'; const originalPageTitle = 'originalPageTitle'; const newPageTitle = 'newPageTitle'; diff --git a/client/src/hooks/useTitle/useTitle.tsx b/client/app/hooks/useTitle/useTitle.tsx similarity index 100% rename from client/src/hooks/useTitle/useTitle.tsx rename to client/app/hooks/useTitle/useTitle.tsx diff --git a/client/src/hooks/useUserSiteIds/useUserSiteIds.spec.tsx b/client/app/hooks/useUserSiteIds/useUserSiteIds.spec.tsx similarity index 83% rename from client/src/hooks/useUserSiteIds/useUserSiteIds.spec.tsx rename to client/app/hooks/useUserSiteIds/useUserSiteIds.spec.tsx index 6717d0d4a..bc8a0c102 100644 --- a/client/src/hooks/useUserSiteIds/useUserSiteIds.spec.tsx +++ b/client/app/hooks/useUserSiteIds/useUserSiteIds.spec.tsx @@ -1,14 +1,14 @@ import '@testing-library/jest-dom'; import { cleanup, waitFor } from '@testing-library/react'; -import { useUserSiteIds } from 'hooks'; +import { useUserSiteIds } from '~/hooks'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; -import { createMockHandler, createMockSite } from 'test-utils/fixtures'; -import { createMockProfileResponse } from 'test-utils/fixtures/mockUser'; -import { mockUserEndpoints, mockWasteEndpoints } from 'test-utils/mock'; -import { API_BASE_URL } from 'test-utils/mock/mockSiteEndpoints'; +import { renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler, createMockSite } from '~/mocks/fixtures'; +import { createMockProfileResponse } from '~/mocks/fixtures/mockUser'; +import { mockUserEndpoints, mockWasteEndpoints } from 'app/mocks/handlers'; +import { API_BASE_URL } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest'; function TestComponent() { diff --git a/client/src/hooks/useUserSiteIds/useUserSiteIds.tsx b/client/app/hooks/useUserSiteIds/useUserSiteIds.tsx similarity index 92% rename from client/src/hooks/useUserSiteIds/useUserSiteIds.tsx rename to client/app/hooks/useUserSiteIds/useUserSiteIds.tsx index eec70cc1d..1309b5742 100644 --- a/client/src/hooks/useUserSiteIds/useUserSiteIds.tsx +++ b/client/app/hooks/useUserSiteIds/useUserSiteIds.tsx @@ -1,6 +1,6 @@ import { createSelector } from '@reduxjs/toolkit'; import { useMemo } from 'react'; -import { ProfileSlice, useGetProfileQuery } from 'store'; +import { ProfileSlice, useGetProfileQuery } from '~/store'; /** * Get select details for sites that the user has access to diff --git a/client/app/index.tsx b/client/app/index.tsx new file mode 100644 index 000000000..ff2930b25 --- /dev/null +++ b/client/app/index.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { Provider } from 'react-redux'; +import { rootStore } from '~/store'; +import App from './App'; + +// Start mock service worker in development mode +async function enableMocking() { + if (process.env.NODE_ENV !== 'test') { + return; + } + const { worker } = await import('./mocks/browser'); + return worker.start(); +} + +const container = document.getElementById('root') as HTMLElement; +const root = createRoot(container); + +enableMocking().then(() => { + root.render( + + + + + + ); +}); diff --git a/client/app/mocks/browser.js b/client/app/mocks/browser.js new file mode 100644 index 000000000..957c19cd7 --- /dev/null +++ b/client/app/mocks/browser.js @@ -0,0 +1,5 @@ +// src/mocks/browser.js +import { setupWorker } from 'msw/browser'; +import { handlers } from './handlers'; + +export const worker = setupWorker(...handlers); diff --git a/client/src/test-utils/fixtures/index.ts b/client/app/mocks/fixtures/index.ts similarity index 100% rename from client/src/test-utils/fixtures/index.ts rename to client/app/mocks/fixtures/index.ts diff --git a/client/src/test-utils/fixtures/mockHandler.ts b/client/app/mocks/fixtures/mockHandler.ts similarity index 88% rename from client/src/test-utils/fixtures/mockHandler.ts rename to client/app/mocks/fixtures/mockHandler.ts index 239d7770e..e10e9dae5 100644 --- a/client/src/test-utils/fixtures/mockHandler.ts +++ b/client/app/mocks/fixtures/mockHandler.ts @@ -1,12 +1,12 @@ -import { HaztrakSite } from 'components/HaztrakSite'; -import { Handler } from 'components/Manifest'; -import { Transporter } from 'components/Manifest/Transporter'; -import { RcraAddress, RcraSite } from 'components/RcraSite'; -import { RcrainfoSitePermissions } from 'store'; -import { RcraContact } from 'components/RcraSite/rcraSiteSchema'; +import { HaztrakSite } from '~/components/HaztrakSite'; +import { Handler } from '~/components/Manifest'; +import { Transporter } from '~/components/Manifest/Transporter'; +import { RcraAddress, RcraSite } from '~/components/RcraSite'; +import { RcrainfoSitePermissions } from '~/store'; +import { RcraContact } from '~/components/RcraSite/rcraSiteSchema'; /** - * A mock handler object for tests + * A api handler object for tests */ const DEFAULT_HANDLER: Handler = { epaSiteId: 'testSiteIdNumber', diff --git a/client/src/test-utils/fixtures/mockManifest.ts b/client/app/mocks/fixtures/mockManifest.ts similarity index 78% rename from client/src/test-utils/fixtures/mockManifest.ts rename to client/app/mocks/fixtures/mockManifest.ts index c0b6d50a5..638e1cea1 100644 --- a/client/src/test-utils/fixtures/mockManifest.ts +++ b/client/app/mocks/fixtures/mockManifest.ts @@ -1,6 +1,6 @@ -import { Manifest } from 'components/Manifest/manifestSchema'; -import { createMockMTNHandler, createMockTransporter } from 'test-utils/fixtures/mockHandler'; -import { createMockWaste } from 'test-utils/fixtures/mockWaste'; +import { Manifest } from '~/components/Manifest/manifestSchema'; +import { createMockMTNHandler, createMockTransporter } from '~/mocks/fixtures/mockHandler'; +import { createMockWaste } from '~/mocks/fixtures/mockWaste'; const DEFAULT_MANIFEST: Manifest = { manifestTrackingNumber: '123456789ELC', diff --git a/client/src/test-utils/fixtures/mockUser.ts b/client/app/mocks/fixtures/mockUser.ts similarity index 89% rename from client/src/test-utils/fixtures/mockUser.ts rename to client/app/mocks/fixtures/mockUser.ts index 0471f19dc..fb46c4e9e 100644 --- a/client/src/test-utils/fixtures/mockUser.ts +++ b/client/app/mocks/fixtures/mockUser.ts @@ -1,6 +1,6 @@ -import { HaztrakProfileOrg, HaztrakUser, RcrainfoProfile, RcrainfoProfileSite } from 'store'; -import { HaztrakProfileResponse } from 'store/userSlice/user.slice'; -import { createMockSite } from 'test-utils/fixtures/mockHandler'; +import { HaztrakProfileOrg, HaztrakUser, RcrainfoProfile, RcrainfoProfileSite } from '~/store'; +import { HaztrakProfileResponse } from '~/store/userSlice/user.slice'; +import { createMockSite } from '~/mocks/fixtures/mockHandler'; export const DEFAULT_HAZTRAK_USER: HaztrakUser = { username: 'testuser1', diff --git a/client/src/test-utils/fixtures/mockWaste.ts b/client/app/mocks/fixtures/mockWaste.ts similarity index 91% rename from client/src/test-utils/fixtures/mockWaste.ts rename to client/app/mocks/fixtures/mockWaste.ts index 65a903a0a..1347f4f50 100644 --- a/client/src/test-utils/fixtures/mockWaste.ts +++ b/client/app/mocks/fixtures/mockWaste.ts @@ -1,4 +1,4 @@ -import { Code, WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; +import { Code, WasteLine } from '~/components/Manifest/WasteLine/wasteLineSchema'; const DEFAULT_WASTELINE: WasteLine = { dotHazardous: false, diff --git a/client/app/mocks/handlers/index.ts b/client/app/mocks/handlers/index.ts new file mode 100644 index 000000000..4bf292543 --- /dev/null +++ b/client/app/mocks/handlers/index.ts @@ -0,0 +1,19 @@ +import { mockUserEndpoints } from '~/mocks/handlers/mockUserEndpoints'; +import { mockSiteEndpoints } from '~/mocks/handlers/mockSiteEndpoints'; +import { mockWasteEndpoints } from '~/mocks/handlers/mockWasteEndpoints'; +import { mockManifestEndpoints } from '~/mocks/handlers/mockManifestEndpoints'; + +const handlers = [ + ...mockManifestEndpoints, + ...mockUserEndpoints, + ...mockSiteEndpoints, + ...mockWasteEndpoints, +]; + +export { + mockWasteEndpoints, + mockManifestEndpoints, + mockSiteEndpoints, + mockUserEndpoints, + handlers, +}; diff --git a/client/src/test-utils/mock/mockManifestEndpoints.ts b/client/app/mocks/handlers/mockManifestEndpoints.ts similarity index 97% rename from client/src/test-utils/mock/mockManifestEndpoints.ts rename to client/app/mocks/handlers/mockManifestEndpoints.ts index 19cea77ca..27c263492 100644 --- a/client/src/test-utils/mock/mockManifestEndpoints.ts +++ b/client/app/mocks/handlers/mockManifestEndpoints.ts @@ -1,4 +1,4 @@ -import { Manifest } from 'components/Manifest'; +import { Manifest } from '~/components/Manifest'; import { http, HttpResponse } from 'msw'; import { createMockManifest } from '../fixtures'; diff --git a/client/src/test-utils/mock/mockSiteEndpoints.ts b/client/app/mocks/handlers/mockSiteEndpoints.ts similarity index 100% rename from client/src/test-utils/mock/mockSiteEndpoints.ts rename to client/app/mocks/handlers/mockSiteEndpoints.ts diff --git a/client/src/test-utils/mock/mockUserEndpoints.ts b/client/app/mocks/handlers/mockUserEndpoints.ts similarity index 86% rename from client/src/test-utils/mock/mockUserEndpoints.ts rename to client/app/mocks/handlers/mockUserEndpoints.ts index 1de5858eb..c4b49b444 100644 --- a/client/src/test-utils/mock/mockUserEndpoints.ts +++ b/client/app/mocks/handlers/mockUserEndpoints.ts @@ -1,11 +1,11 @@ import { http, HttpResponse } from 'msw'; -import { HaztrakUser } from 'store/authSlice/auth.slice'; -import { LoginResponse } from 'store/userSlice/user.slice'; -import { createMockHaztrakUser } from 'test-utils/fixtures'; +import { HaztrakUser } from '~/store/authSlice/auth.slice'; +import { LoginResponse } from '~/store/userSlice/user.slice'; +import { createMockHaztrakUser } from '~/mocks/fixtures'; import { createMockProfileResponse, createMockRcrainfoProfileResponse, -} from 'test-utils/fixtures/mockUser'; +} from '~/mocks/fixtures/mockUser'; /** mock Rest API*/ const API_BASE_URL = import.meta.env.VITE_HT_API_URL; diff --git a/client/src/test-utils/mock/mockWasteEndpoints.ts b/client/app/mocks/handlers/mockWasteEndpoints.ts similarity index 88% rename from client/src/test-utils/mock/mockWasteEndpoints.ts rename to client/app/mocks/handlers/mockWasteEndpoints.ts index 8168cf177..936f16c87 100644 --- a/client/src/test-utils/mock/mockWasteEndpoints.ts +++ b/client/app/mocks/handlers/mockWasteEndpoints.ts @@ -1,5 +1,5 @@ import { http, HttpResponse } from 'msw'; -import { mockDotIdNumbers, mockFederalWasteCodes } from 'test-utils/fixtures/mockWaste'; +import { mockDotIdNumbers, mockFederalWasteCodes } from '~/mocks/fixtures/mockWaste'; /** mock Rest API*/ const API_BASE_URL = import.meta.env.VITE_HT_API_URL; diff --git a/client/src/test-utils/index.ts b/client/app/mocks/index.ts similarity index 56% rename from client/src/test-utils/index.ts rename to client/app/mocks/index.ts index 07856dab0..48367d804 100644 --- a/client/src/test-utils/index.ts +++ b/client/app/mocks/index.ts @@ -1,4 +1,4 @@ -import { renderWithProviders } from 'test-utils/render'; +import { renderWithProviders } from '~/mocks/render'; export { renderWithProviders }; export * from '@testing-library/react'; diff --git a/client/src/test-utils/render.tsx b/client/app/mocks/render.tsx similarity index 97% rename from client/src/test-utils/render.tsx rename to client/app/mocks/render.tsx index e2ee00c05..43a240924 100644 --- a/client/src/test-utils/render.tsx +++ b/client/app/mocks/render.tsx @@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactElement } from 'react'; import { FormProvider, useForm, UseFormProps } from 'react-hook-form'; import { Provider } from 'react-redux'; import { BrowserRouter } from 'react-router-dom'; -import { AppStore, RootState, setupStore } from 'store'; +import { AppStore, RootState, setupStore } from '~/store'; interface ExtendedRenderOptions extends Omit { preloadedState?: Partial; diff --git a/client/src/setupTests.ts b/client/app/mocks/setupTests.ts similarity index 100% rename from client/src/setupTests.ts rename to client/app/mocks/setupTests.ts diff --git a/client/src/routes.tsx b/client/app/routes.tsx similarity index 62% rename from client/src/routes.tsx rename to client/app/routes.tsx index c264b0502..6c5fbe4fc 100644 --- a/client/src/routes.tsx +++ b/client/app/routes.tsx @@ -1,13 +1,13 @@ -import { ErrorPage } from 'features/ErrorPage/ErrorPage'; -import { Login } from 'features/Login'; +import { ErrorPage } from '~/routes/ErrorPage/ErrorPage'; +import { Login } from '~/routes/Login'; import React from 'react'; import { createBrowserRouter } from 'react-router-dom'; -const Dashboard = React.lazy(() => import('features/Dashboard')); -const Profile = React.lazy(() => import('features/Profile')); -const SiteList = React.lazy(() => import('features/SiteList')); -const SiteDetails = React.lazy(() => import('features/SiteDetails')); -const Help = React.lazy(() => import('features/About')); +const Dashboard = React.lazy(() => import('~/routes/Dashboard')); +const Profile = React.lazy(() => import('~/routes/Profile')); +const SiteList = React.lazy(() => import('~/routes/SiteList')); +const SiteDetails = React.lazy(() => import('~/routes/SiteDetails')); +const Help = React.lazy(() => import('~/routes/About')); export const router = createBrowserRouter([ { @@ -38,15 +38,15 @@ export const router = createBrowserRouter([ children: [ { path: '', - lazy: () => import('./features/ManifestList'), + lazy: () => import('./routes/ManifestList'), }, { path: 'new', - lazy: () => import('./features/NewManifest'), + lazy: () => import('./routes/NewManifest'), }, { path: ':mtn/:action', - lazy: () => import('./features/ManifestDetails'), + lazy: () => import('./routes/ManifestDetails'), }, ], }, @@ -57,15 +57,15 @@ export const router = createBrowserRouter([ children: [ { path: '', - lazy: () => import('./features/ManifestList'), + lazy: () => import('./routes/ManifestList'), }, { path: 'new', - lazy: () => import('./features/NewManifest'), + lazy: () => import('./routes/NewManifest'), }, { path: ':mtn/:action', - lazy: () => import('./features/ManifestDetails'), + lazy: () => import('./routes/ManifestDetails'), }, ], }, @@ -81,7 +81,7 @@ export const router = createBrowserRouter([ }, { path: '/register', - lazy: () => import('./features/RegisterHero'), + lazy: () => import('./routes/RegisterHero'), }, { path: '*', diff --git a/client/src/features/About/About.tsx b/client/app/routes/About/About.tsx similarity index 95% rename from client/src/features/About/About.tsx rename to client/app/routes/About/About.tsx index 091535079..b90bd091a 100644 --- a/client/src/features/About/About.tsx +++ b/client/app/routes/About/About.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Col, Container, Row } from 'react-bootstrap'; -import { useTitle } from 'hooks'; -import { HaztrakLicense, SectionTitle } from 'components/Help'; +import { useTitle } from '~/hooks'; +import { HaztrakLicense, SectionTitle } from '~/components/Help'; /** * Static page that talks about Haztrak's licensing, maybe versioning in future diff --git a/client/src/features/About/index.ts b/client/app/routes/About/index.ts similarity index 100% rename from client/src/features/About/index.ts rename to client/app/routes/About/index.ts diff --git a/client/src/features/Dashboard/Dashboard.spec.tsx b/client/app/routes/Dashboard/Dashboard.spec.tsx similarity index 82% rename from client/src/features/Dashboard/Dashboard.spec.tsx rename to client/app/routes/Dashboard/Dashboard.spec.tsx index 38fe39285..324574a16 100644 --- a/client/src/features/Dashboard/Dashboard.spec.tsx +++ b/client/app/routes/Dashboard/Dashboard.spec.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; -import { Dashboard } from 'features/Dashboard/Dashboard'; +import { Dashboard } from '~/routes/Dashboard/Dashboard'; import { setupServer } from 'msw/node'; import React, { createElement } from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { mockUserEndpoints } from 'test-utils/mock'; -import { mockSiteEndpoints } from 'test-utils/mock/mockSiteEndpoints'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { mockUserEndpoints } from 'app/mocks/handlers'; +import { mockSiteEndpoints } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vitest'; const USERNAME = 'testuser1'; diff --git a/client/src/features/Dashboard/Dashboard.tsx b/client/app/routes/Dashboard/Dashboard.tsx similarity index 93% rename from client/src/features/Dashboard/Dashboard.tsx rename to client/app/routes/Dashboard/Dashboard.tsx index 86c04fae8..8a4ea3327 100644 --- a/client/src/features/Dashboard/Dashboard.tsx +++ b/client/app/routes/Dashboard/Dashboard.tsx @@ -1,16 +1,16 @@ -import { NewManifestBtn } from 'components/Manifest'; -import { HtButton, HtCard } from 'components/UI'; -import { useTitle } from 'hooks'; +import { NewManifestBtn } from '~/components/Manifest'; +import { HtButton, HtCard } from '~/components/UI'; +import { useTitle } from '~/hooks'; import React, { ReactElement } from 'react'; import { Accordion, Button, Col, Container, Row } from 'react-bootstrap'; import { Link } from 'react-router-dom'; -import { htApi } from 'services'; -import { addAlert, addTask, useAppDispatch } from 'store'; +import { htApi } from '~/services'; +import { addAlert, addTask, useAppDispatch } from '~/store'; import { GeneratorStatusAreaChart, ManifestCountBarChart, ManifestStatusPieChart, -} from 'components/Charts'; +} from '~/components/Charts'; /** Dashboard page for logged-in user*/ export function Dashboard(): ReactElement { diff --git a/client/src/features/Dashboard/index.ts b/client/app/routes/Dashboard/index.ts similarity index 51% rename from client/src/features/Dashboard/index.ts rename to client/app/routes/Dashboard/index.ts index 137191e49..1db2db83c 100644 --- a/client/src/features/Dashboard/index.ts +++ b/client/app/routes/Dashboard/index.ts @@ -1,4 +1,4 @@ -import { Dashboard } from 'features/Dashboard/Dashboard'; +import { Dashboard } from '~/routes/Dashboard/Dashboard'; export { Dashboard as Component }; export default Dashboard; diff --git a/client/src/features/ErrorPage/ErrorPage.tsx b/client/app/routes/ErrorPage/ErrorPage.tsx similarity index 90% rename from client/src/features/ErrorPage/ErrorPage.tsx rename to client/app/routes/ErrorPage/ErrorPage.tsx index d714870ce..7b620e99a 100644 --- a/client/src/features/ErrorPage/ErrorPage.tsx +++ b/client/app/routes/ErrorPage/ErrorPage.tsx @@ -1,5 +1,5 @@ -import { Error404 } from 'components/Error'; -import { HtCard } from 'components/UI'; +import { Error404 } from '~/components/Error'; +import { HtCard } from '~/components/UI'; import React, { ReactElement } from 'react'; import { Button, Container } from 'react-bootstrap'; import { useNavigate } from 'react-router-dom'; diff --git a/client/app/routes/ErrorPage/index.ts b/client/app/routes/ErrorPage/index.ts new file mode 100644 index 000000000..5542a7d1c --- /dev/null +++ b/client/app/routes/ErrorPage/index.ts @@ -0,0 +1 @@ +export { ErrorPage as Component } from '~/routes/ErrorPage/ErrorPage'; diff --git a/client/src/features/Login/Login.tsx b/client/app/routes/Login/Login.tsx similarity index 90% rename from client/src/features/Login/Login.tsx rename to client/app/routes/Login/Login.tsx index efcf6337f..014315d0d 100644 --- a/client/src/features/Login/Login.tsx +++ b/client/app/routes/Login/Login.tsx @@ -1,6 +1,6 @@ import logo from '/assets/img/haztrak-logos/low-resolution/svg/haztrak-low-resolution-logo-black-on-transparent-background.svg'; -import { LoginForm } from 'components/Auth'; -import { useTitle } from 'hooks'; +import { LoginForm } from '~/components/Auth'; +import { useTitle } from '~/hooks'; import React, { ReactElement } from 'react'; import { Container } from 'react-bootstrap'; diff --git a/client/src/features/Login/index.ts b/client/app/routes/Login/index.ts similarity index 100% rename from client/src/features/Login/index.ts rename to client/app/routes/Login/index.ts diff --git a/client/src/features/Login/login.spec.tsx b/client/app/routes/Login/login.spec.tsx similarity index 72% rename from client/src/features/Login/login.spec.tsx rename to client/app/routes/Login/login.spec.tsx index 029e00134..ff8c39ff6 100644 --- a/client/src/features/Login/login.spec.tsx +++ b/client/app/routes/Login/login.spec.tsx @@ -1,8 +1,8 @@ import '@testing-library/jest-dom'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; -import { Login } from 'features/Login'; -import { describe, test, expect } from 'vitest'; +import { renderWithProviders, screen } from 'app/mocks'; +import { Login } from '~/routes/Login'; +import { describe, expect, test } from 'vitest'; describe('Login component', () => { test('renders', () => { diff --git a/client/src/features/ManifestDetails/ManifestDetails.tsx b/client/app/routes/ManifestDetails/ManifestDetails.tsx similarity index 76% rename from client/src/features/ManifestDetails/ManifestDetails.tsx rename to client/app/routes/ManifestDetails/ManifestDetails.tsx index 00e93f16a..5f5887ab3 100644 --- a/client/src/features/ManifestDetails/ManifestDetails.tsx +++ b/client/app/routes/ManifestDetails/ManifestDetails.tsx @@ -1,10 +1,10 @@ -import { ManifestForm } from 'components/Manifest'; -import { HtSpinner } from 'components/UI'; -import { useTitle } from 'hooks'; -import { useReadOnly } from 'hooks/manifest'; +import { ManifestForm } from '~/components/Manifest'; +import { HtSpinner } from '~/components/UI'; +import { useTitle } from '~/hooks'; +import { useReadOnly } from '~/hooks/manifest'; import React from 'react'; import { useParams } from 'react-router-dom'; -import { useGetManifestQuery } from 'store'; +import { useGetManifestQuery } from '~/store'; export function ManifestDetails() { const { mtn, action, siteId } = useParams(); diff --git a/client/src/features/ManifestDetails/index.ts b/client/app/routes/ManifestDetails/index.ts similarity index 100% rename from client/src/features/ManifestDetails/index.ts rename to client/app/routes/ManifestDetails/index.ts diff --git a/client/src/features/ManifestList/ManifestList.tsx b/client/app/routes/ManifestList/ManifestList.tsx similarity index 83% rename from client/src/features/ManifestList/ManifestList.tsx rename to client/app/routes/ManifestList/ManifestList.tsx index dbe0e5310..37ff5da0c 100644 --- a/client/src/features/ManifestList/ManifestList.tsx +++ b/client/app/routes/ManifestList/ManifestList.tsx @@ -1,12 +1,12 @@ -import { NewManifestBtn } from 'components/Manifest'; -import { MtnTable } from 'components/Mtn'; -import { SyncManifestBtn } from 'components/Rcrainfo'; -import { HtCard, HtSpinner } from 'components/UI'; -import { useTitle } from 'hooks'; +import { NewManifestBtn } from '~/components/Manifest'; +import { MtnTable } from '~/components/Mtn'; +import { SyncManifestBtn } from '~/components/Rcrainfo'; +import { HtCard, HtSpinner } from '~/components/UI'; +import { useTitle } from '~/hooks'; import React, { ReactElement, useState } from 'react'; import { Container, Row, Stack } from 'react-bootstrap'; import { useParams } from 'react-router-dom'; -import { useGetMTNQuery } from 'store'; +import { useGetMTNQuery } from '~/store'; /** * Fetch and display all the manifest tracking number (MTN) known by haztrak diff --git a/client/src/features/ManifestList/index.ts b/client/app/routes/ManifestList/index.ts similarity index 100% rename from client/src/features/ManifestList/index.ts rename to client/app/routes/ManifestList/index.ts diff --git a/client/src/features/NewManifest/NewManifest.spec.tsx b/client/app/routes/NewManifest/NewManifest.spec.tsx similarity index 83% rename from client/src/features/NewManifest/NewManifest.spec.tsx rename to client/app/routes/NewManifest/NewManifest.spec.tsx index 79a495bef..2043f816a 100644 --- a/client/src/features/NewManifest/NewManifest.spec.tsx +++ b/client/app/routes/NewManifest/NewManifest.spec.tsx @@ -1,13 +1,13 @@ import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; -import { NewManifest } from 'features/NewManifest/NewManifest'; +import { NewManifest } from '~/routes/NewManifest/NewManifest'; import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { createMockSite } from 'test-utils/fixtures'; -import { mockSiteEndpoints, mockUserEndpoints } from 'test-utils/mock'; -import { API_BASE_URL } from 'test-utils/mock/mockSiteEndpoints'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { createMockSite } from '~/mocks/fixtures'; +import { mockSiteEndpoints, mockUserEndpoints } from 'app/mocks/handlers'; +import { API_BASE_URL } from '~/mocks/handlers/mockSiteEndpoints'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; const mockSites = [createMockSite(), createMockSite()]; diff --git a/client/src/features/NewManifest/NewManifest.tsx b/client/app/routes/NewManifest/NewManifest.tsx similarity index 89% rename from client/src/features/NewManifest/NewManifest.tsx rename to client/app/routes/NewManifest/NewManifest.tsx index e10137e75..9cdd2dcdf 100644 --- a/client/src/features/NewManifest/NewManifest.tsx +++ b/client/app/routes/NewManifest/NewManifest.tsx @@ -1,16 +1,16 @@ import { createSelector } from '@reduxjs/toolkit'; -import { Manifest, ManifestForm } from 'components/Manifest'; -import { RcraSiteType } from 'components/Manifest/manifestSchema'; -import { SiteSelect, SiteTypeSelect } from 'components/Manifest/SiteSelect'; -import { RcraSite } from 'components/RcraSite'; -import { HtCard, HtSpinner } from 'components/UI'; -import { useTitle } from 'hooks'; -import { useReadOnly } from 'hooks/manifest'; +import { Manifest, ManifestForm } from '~/components/Manifest'; +import { RcraSiteType } from '~/components/Manifest/manifestSchema'; +import { SiteSelect, SiteTypeSelect } from '~/components/Manifest/SiteSelect'; +import { RcraSite } from '~/components/RcraSite'; +import { HtCard, HtSpinner } from '~/components/UI'; +import { useTitle } from '~/hooks'; +import { useReadOnly } from '~/hooks/manifest'; import React, { useEffect, useMemo, useState } from 'react'; import { Col, Container, Form } from 'react-bootstrap'; import { useForm } from 'react-hook-form'; import { useParams, useSearchParams } from 'react-router-dom'; -import { useGetProfileQuery } from 'store'; +import { useGetProfileQuery } from '~/store'; /** * NewManifest component allows a user to create a new electronic manifest. diff --git a/client/src/features/NewManifest/index.ts b/client/app/routes/NewManifest/index.ts similarity index 100% rename from client/src/features/NewManifest/index.ts rename to client/app/routes/NewManifest/index.ts diff --git a/client/src/features/Profile/Profile.tsx b/client/app/routes/Profile/Profile.tsx similarity index 86% rename from client/src/features/Profile/Profile.tsx rename to client/app/routes/Profile/Profile.tsx index 4b18e1e71..1b6a4476f 100644 --- a/client/src/features/Profile/Profile.tsx +++ b/client/app/routes/Profile/Profile.tsx @@ -1,11 +1,11 @@ -import { UserOrg } from 'components/Org'; -import { RcraProfile } from 'components/RcraProfile'; -import { HtCard, HtSpinner } from 'components/UI'; -import { UserInfoForm } from 'components/User'; -import { useTitle } from 'hooks'; +import { UserOrg } from '~/components/Org'; +import { RcraProfile } from '~/components/RcraProfile'; +import { HtCard, HtSpinner } from '~/components/UI'; +import { UserInfoForm } from '~/components/User'; +import { useTitle } from '~/hooks'; import React, { ReactElement } from 'react'; import { Col, Container, Row } from 'react-bootstrap'; -import { useGetProfileQuery, useGetRcrainfoProfileQuery, useGetUserQuery } from 'store'; +import { useGetProfileQuery, useGetRcrainfoProfileQuery, useGetUserQuery } from '~/store'; /** * Display user profile, including their Haztrak information, their organization, diff --git a/client/src/features/Profile/index.ts b/client/app/routes/Profile/index.ts similarity index 100% rename from client/src/features/Profile/index.ts rename to client/app/routes/Profile/index.ts diff --git a/client/src/features/RegisterHero/RegisterHero.tsx b/client/app/routes/RegisterHero/RegisterHero.tsx similarity index 97% rename from client/src/features/RegisterHero/RegisterHero.tsx rename to client/app/routes/RegisterHero/RegisterHero.tsx index bbe1fc627..97ae979fb 100644 --- a/client/src/features/RegisterHero/RegisterHero.tsx +++ b/client/app/routes/RegisterHero/RegisterHero.tsx @@ -1,7 +1,7 @@ import React from 'react'; import logo from '/assets/img/haztrak-logos/high-resolution/png/haztrak-high-resolution-logo-black-on-transparent-background.png'; import { Button, Col, Container, Row, Stack } from 'react-bootstrap'; -import { FeatureDescription } from 'components/UI'; +import { FeatureDescription } from '~/components/UI'; import { faFileLines, faPen, faSitemap } from '@fortawesome/free-solid-svg-icons'; import { Link } from 'react-router-dom'; diff --git a/client/src/features/RegisterHero/index.ts b/client/app/routes/RegisterHero/index.ts similarity index 52% rename from client/src/features/RegisterHero/index.ts rename to client/app/routes/RegisterHero/index.ts index d52ac76a3..38dbc2fbf 100644 --- a/client/src/features/RegisterHero/index.ts +++ b/client/app/routes/RegisterHero/index.ts @@ -1,4 +1,4 @@ -import { RegisterHero } from 'features/RegisterHero/RegisterHero'; +import { RegisterHero } from '~/routes/RegisterHero/RegisterHero'; export { RegisterHero as Component }; export default RegisterHero; diff --git a/client/src/features/SiteDetails/SiteDetails.tsx b/client/app/routes/SiteDetails/SiteDetails.tsx similarity index 89% rename from client/src/features/SiteDetails/SiteDetails.tsx rename to client/app/routes/SiteDetails/SiteDetails.tsx index ef4a252ff..811d28036 100644 --- a/client/src/features/SiteDetails/SiteDetails.tsx +++ b/client/app/routes/SiteDetails/SiteDetails.tsx @@ -1,9 +1,9 @@ -import { RcraSiteDetails } from 'components/RcraSite'; -import { HtCard, HtSpinner } from 'components/UI'; +import { RcraSiteDetails } from '~/components/RcraSite'; +import { HtCard, HtSpinner } from '~/components/UI'; import React, { ReactElement } from 'react'; import { Button, Container, Stack } from 'react-bootstrap'; import { useNavigate, useParams } from 'react-router-dom'; -import { useGetUserHaztrakSiteQuery } from 'store'; +import { useGetUserHaztrakSiteQuery } from '~/store'; /** * GET and Display details of the Haztrak site including RCRA site details. diff --git a/client/src/features/SiteDetails/index.ts b/client/app/routes/SiteDetails/index.ts similarity index 50% rename from client/src/features/SiteDetails/index.ts rename to client/app/routes/SiteDetails/index.ts index 2289b1b1c..7e5ee9b3e 100644 --- a/client/src/features/SiteDetails/index.ts +++ b/client/app/routes/SiteDetails/index.ts @@ -1,4 +1,4 @@ -import { SiteDetails } from 'features/SiteDetails/SiteDetails'; +import { SiteDetails } from '~/routes/SiteDetails/SiteDetails'; export { SiteDetails as Component }; export default SiteDetails; diff --git a/client/src/features/SiteList/SiteList.spec.tsx b/client/app/routes/SiteList/SiteList.spec.tsx similarity index 84% rename from client/src/features/SiteList/SiteList.spec.tsx rename to client/app/routes/SiteList/SiteList.spec.tsx index d18d8934a..81d61c69a 100644 --- a/client/src/features/SiteList/SiteList.spec.tsx +++ b/client/app/routes/SiteList/SiteList.spec.tsx @@ -1,9 +1,9 @@ import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import React from 'react'; -import { renderWithProviders, screen } from 'test-utils'; -import { createMockHandler, createMockSite } from 'test-utils/fixtures/mockHandler'; -import { mockSiteEndpoints, mockUserEndpoints } from 'test-utils/mock'; +import { renderWithProviders, screen } from 'app/mocks'; +import { createMockHandler, createMockSite } from '~/mocks/fixtures/mockHandler'; +import { mockSiteEndpoints, mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, beforeAll, describe, expect, test } from 'vitest'; import { SiteList } from './SiteList'; diff --git a/client/src/features/SiteList/SiteList.tsx b/client/app/routes/SiteList/SiteList.tsx similarity index 81% rename from client/src/features/SiteList/SiteList.tsx rename to client/app/routes/SiteList/SiteList.tsx index d63fde6e6..6654e17e1 100644 --- a/client/src/features/SiteList/SiteList.tsx +++ b/client/app/routes/SiteList/SiteList.tsx @@ -1,10 +1,10 @@ -import { SiteListGroup } from 'components/HaztrakSite'; -import { HtCard, HtSpinner } from 'components/UI'; -import { useTitle } from 'hooks'; +import { SiteListGroup } from '~/components/HaztrakSite'; +import { HtCard, HtSpinner } from '~/components/UI'; +import { useTitle } from '~/hooks'; import React from 'react'; import { Container } from 'react-bootstrap'; import { Link } from 'react-router-dom'; -import { useGetUserHaztrakSitesQuery } from 'store'; +import { useGetUserHaztrakSitesQuery } from '~/store'; /** Returns a table displaying the Haztrak sites a user has access to.*/ export function SiteList() { diff --git a/client/src/features/SiteList/index.ts b/client/app/routes/SiteList/index.ts similarity index 52% rename from client/src/features/SiteList/index.ts rename to client/app/routes/SiteList/index.ts index 7680b866f..7a63bfbbe 100644 --- a/client/src/features/SiteList/index.ts +++ b/client/app/routes/SiteList/index.ts @@ -1,4 +1,4 @@ -import { SiteList } from 'features/SiteList/SiteList'; +import { SiteList } from '~/routes/SiteList/SiteList'; export { SiteList as Component }; export default SiteList; diff --git a/client/src/services/APIs/htApi.ts b/client/app/services/APIs/htApi.ts similarity index 95% rename from client/src/services/APIs/htApi.ts rename to client/app/services/APIs/htApi.ts index 43cb5f791..ea104ed72 100644 --- a/client/src/services/APIs/htApi.ts +++ b/client/app/services/APIs/htApi.ts @@ -1,6 +1,6 @@ /**htApi.ts - service for making requests to the Haztrak API*/ import axios, { InternalAxiosRequestConfig } from 'axios'; -import { rootStore } from 'store'; +import { rootStore } from '~/store'; /** An Axios instance with an interceptor to automatically apply authentication headers*/ export const htApi = axios.create({ diff --git a/client/app/services/index.ts b/client/app/services/index.ts new file mode 100644 index 000000000..5fd723ce2 --- /dev/null +++ b/client/app/services/index.ts @@ -0,0 +1,2 @@ +export { htApi } from '~/services/APIs/htApi'; +export { manifest } from '~/services/manifest/manifest'; diff --git a/client/src/services/manifest/manifest.spec.ts b/client/app/services/manifest/manifest.spec.ts similarity index 94% rename from client/src/services/manifest/manifest.spec.ts rename to client/app/services/manifest/manifest.spec.ts index 8c9ed3cda..08c7b956e 100644 --- a/client/src/services/manifest/manifest.spec.ts +++ b/client/app/services/manifest/manifest.spec.ts @@ -1,13 +1,13 @@ -import { manifest } from 'services/manifest/manifest'; +import { manifest } from '~/services/manifest/manifest'; import { createMockManifest, createMockMTNHandler, createMockSite, createMockTransporter, -} from 'test-utils/fixtures'; +} from '~/mocks/fixtures'; import { describe, expect, test } from 'vitest'; -import { ProfileSlice } from 'store'; -import { ManifestStatus } from 'components/Manifest/manifestSchema'; +import { ProfileSlice } from '~/store'; +import { ManifestStatus } from '~/components/Manifest/manifestSchema'; describe('manifest.getNextSigner', () => { test('returns the the generator if scheduled and no generator signature present', () => { diff --git a/client/src/services/manifest/manifest.ts b/client/app/services/manifest/manifest.ts similarity index 92% rename from client/src/services/manifest/manifest.ts rename to client/app/services/manifest/manifest.ts index 128d9e28d..a6ce2a324 100644 --- a/client/src/services/manifest/manifest.ts +++ b/client/app/services/manifest/manifest.ts @@ -1,6 +1,6 @@ -import { Manifest } from 'components/Manifest'; -import { ManifestStatus, RcraSiteType, SiteType } from 'components/Manifest/manifestSchema'; -import { ProfileSlice } from 'store'; +import { Manifest } from '~/components/Manifest'; +import { ManifestStatus, RcraSiteType, SiteType } from '~/components/Manifest/manifestSchema'; +import { ProfileSlice } from '~/store'; export const manifest = { /** Returns EPA ID of the next site that can sign on a manifest or undefined if not applicable. */ diff --git a/client/src/store/authSlice/auth.slice.spec.tsx b/client/app/store/authSlice/auth.slice.spec.tsx similarity index 97% rename from client/src/store/authSlice/auth.slice.spec.tsx rename to client/app/store/authSlice/auth.slice.spec.tsx index 2ee8c01fe..e36c46f86 100644 --- a/client/src/store/authSlice/auth.slice.spec.tsx +++ b/client/app/store/authSlice/auth.slice.spec.tsx @@ -6,8 +6,8 @@ import { setCredentials, useAppDispatch, useAppSelector, -} from 'store'; -import { renderWithProviders, screen } from 'test-utils'; +} from '~/store'; +import { renderWithProviders, screen } from 'app/mocks'; import { afterEach, describe, expect, test, vi } from 'vitest'; const getItemSpy = vi.spyOn(Storage.prototype, 'getItem'); diff --git a/client/src/store/authSlice/auth.slice.ts b/client/app/store/authSlice/auth.slice.ts similarity index 100% rename from client/src/store/authSlice/auth.slice.ts rename to client/app/store/authSlice/auth.slice.ts diff --git a/client/src/store/errorSlice/error.slice.ts b/client/app/store/errorSlice/error.slice.ts similarity index 100% rename from client/src/store/errorSlice/error.slice.ts rename to client/app/store/errorSlice/error.slice.ts diff --git a/client/src/store/htApi.slice.ts b/client/app/store/htApi.slice.ts similarity index 93% rename from client/src/store/htApi.slice.ts rename to client/app/store/htApi.slice.ts index ef721e33d..4f14b2961 100644 --- a/client/src/store/htApi.slice.ts +++ b/client/app/store/htApi.slice.ts @@ -1,12 +1,12 @@ import { BaseQueryFn, createApi } from '@reduxjs/toolkit/query/react'; import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; -import { HaztrakSite } from 'components/HaztrakSite'; -import { Manifest } from 'components/Manifest'; -import { QuickerSignature } from 'components/Manifest/QuickerSign'; -import { Code } from 'components/Manifest/WasteLine/wasteLineSchema'; -import { MtnDetails } from 'components/Mtn'; -import { RcraSite } from 'components/RcraSite'; -import { htApi } from 'services'; +import { HaztrakSite } from '~/components/HaztrakSite'; +import { Manifest } from '~/components/Manifest'; +import { QuickerSignature } from '~/components/Manifest/QuickerSign'; +import { Code } from '~/components/Manifest/WasteLine/wasteLineSchema'; +import { MtnDetails } from '~/components/Mtn'; +import { RcraSite } from '~/components/RcraSite'; +import { htApi } from '~/services'; export interface TaskResponse { taskId: string; diff --git a/client/src/store/index.ts b/client/app/store/index.ts similarity index 87% rename from client/src/store/index.ts rename to client/app/store/index.ts index f2cf06620..a27ff1c14 100644 --- a/client/src/store/index.ts +++ b/client/app/store/index.ts @@ -1,6 +1,6 @@ // Haztrak API - RTK Query -import { haztrakApi } from 'store/htApi.slice'; -import { userApi } from 'store/userSlice/user.slice'; +import { haztrakApi } from '~/store/htApi.slice'; +import { userApi } from '~/store/userSlice/user.slice'; import type { AppDispatch, AppStore, RootState } from './rootStore'; // Root Store @@ -45,8 +45,8 @@ export { setCredentials, selectAuthenticated, removeCredentials, -} from 'store/authSlice/auth.slice'; -export type { HaztrakUser } from 'store/authSlice/auth.slice'; +} from '~/store/authSlice/auth.slice'; +export type { HaztrakUser } from '~/store/authSlice/auth.slice'; // Notification Slice export { @@ -66,7 +66,7 @@ export { addError, selectAllErrors } from './errorSlice/error.slice'; // Types export type { HaztrakError } from './errorSlice/error.slice'; -export type { TaskStatus } from 'store/htApi.slice'; +export type { TaskStatus } from '~/store/htApi.slice'; export type { LongRunningTask, HaztrakAlert } from './notificationSlice/notification.slice'; export type { ProfileSlice, diff --git a/client/src/store/manifestSlice/manifest.slice.spec.tsx b/client/app/store/manifestSlice/manifest.slice.spec.tsx similarity index 91% rename from client/src/store/manifestSlice/manifest.slice.spec.tsx rename to client/app/store/manifestSlice/manifest.slice.spec.tsx index 9b8b332ba..f1702f335 100644 --- a/client/src/store/manifestSlice/manifest.slice.spec.tsx +++ b/client/app/store/manifestSlice/manifest.slice.spec.tsx @@ -1,13 +1,13 @@ import '@testing-library/jest-dom'; -import { useAppSelector } from 'store'; +import { useAppSelector } from '~/store'; import reducer, { ManifestSlice, selectManifestReadOnly, setHandlerSearchConfigs, setManifestReadOnly, setManifestStatus, -} from 'store/manifestSlice/manifest.slice'; -import { renderWithProviders, screen } from 'test-utils'; +} from '~/store/manifestSlice/manifest.slice'; +import { renderWithProviders, screen } from 'app/mocks'; import { describe, expect, test } from 'vitest'; const TestComponent = () => { diff --git a/client/src/store/manifestSlice/manifest.slice.ts b/client/app/store/manifestSlice/manifest.slice.ts similarity index 94% rename from client/src/store/manifestSlice/manifest.slice.ts rename to client/app/store/manifestSlice/manifest.slice.ts index 7dacf27ce..ff2dca82f 100644 --- a/client/src/store/manifestSlice/manifest.slice.ts +++ b/client/app/store/manifestSlice/manifest.slice.ts @@ -1,5 +1,5 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { ManifestStatus, SiteType } from 'components/Manifest/manifestSchema'; +import { ManifestStatus, SiteType } from '~/components/Manifest/manifestSchema'; export interface HandlerSearchConfig { siteType: SiteType; diff --git a/client/src/store/notificationSlice/notification.slice.spec.tsx b/client/app/store/notificationSlice/notification.slice.spec.tsx similarity index 97% rename from client/src/store/notificationSlice/notification.slice.spec.tsx rename to client/app/store/notificationSlice/notification.slice.spec.tsx index 01c53cc49..62f7d1f12 100644 --- a/client/src/store/notificationSlice/notification.slice.spec.tsx +++ b/client/app/store/notificationSlice/notification.slice.spec.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { addAlert, HaztrakAlert, removeAlert, useAppSelector } from 'store'; -import { renderWithProviders, screen } from 'test-utils'; +import { addAlert, HaztrakAlert, removeAlert, useAppSelector } from '~/store'; +import { renderWithProviders, screen } from 'app/mocks'; import { describe, expect, test } from 'vitest'; import reducer, { selectAllAlerts } from './notification.slice'; diff --git a/client/src/store/notificationSlice/notification.slice.ts b/client/app/store/notificationSlice/notification.slice.ts similarity index 98% rename from client/src/store/notificationSlice/notification.slice.ts rename to client/app/store/notificationSlice/notification.slice.ts index 0f0a827df..683dfe7a2 100644 --- a/client/src/store/notificationSlice/notification.slice.ts +++ b/client/app/store/notificationSlice/notification.slice.ts @@ -1,6 +1,6 @@ import { createSelector, createSlice, PayloadAction } from '@reduxjs/toolkit'; import { toast } from 'react-toastify'; -import { RootState } from 'store/rootStore'; +import { RootState } from '~/store/rootStore'; import { v4 as uuidv4 } from 'uuid'; export interface LongRunningTask { diff --git a/client/src/store/rootStore.ts b/client/app/store/rootStore.ts similarity index 92% rename from client/src/store/rootStore.ts rename to client/app/store/rootStore.ts index 7b32bed4f..3c21cbb06 100644 --- a/client/src/store/rootStore.ts +++ b/client/app/store/rootStore.ts @@ -1,7 +1,7 @@ import { combineReducers, configureStore } from '@reduxjs/toolkit'; import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; -import authReducers from 'store/authSlice/auth.slice'; -import { haztrakApi } from 'store/htApi.slice'; +import authReducers from '~/store/authSlice/auth.slice'; +import { haztrakApi } from '~/store/htApi.slice'; import errorReducers from './errorSlice/error.slice'; import notificationReducers from './notificationSlice/notification.slice'; import manifestReducers from './manifestSlice/manifest.slice'; diff --git a/client/src/store/userSlice/user.slice.spec.tsx b/client/app/store/userSlice/user.slice.spec.tsx similarity index 88% rename from client/src/store/userSlice/user.slice.spec.tsx rename to client/app/store/userSlice/user.slice.spec.tsx index 9f3db07a9..1f5f1d22b 100644 --- a/client/src/store/userSlice/user.slice.spec.tsx +++ b/client/app/store/userSlice/user.slice.spec.tsx @@ -2,9 +2,9 @@ import '@testing-library/jest-dom'; import { waitFor } from '@testing-library/react'; import { setupServer } from 'msw/node'; import { useEffect, useState } from 'react'; -import { useGetUserQuery, useUpdateUserMutation } from 'store'; -import { cleanup, renderWithProviders, screen } from 'test-utils'; -import { mockUserEndpoints } from 'test-utils/mock'; +import { useGetUserQuery, useUpdateUserMutation } from '~/store'; +import { cleanup, renderWithProviders, screen } from 'app/mocks'; +import { mockUserEndpoints } from 'app/mocks/handlers'; import { afterAll, afterEach, beforeAll, describe, expect, test } from 'vitest'; const server = setupServer(...mockUserEndpoints); diff --git a/client/src/store/userSlice/user.slice.ts b/client/app/store/userSlice/user.slice.ts similarity index 96% rename from client/src/store/userSlice/user.slice.ts rename to client/app/store/userSlice/user.slice.ts index f410a9fe3..e2d4105c2 100644 --- a/client/src/store/userSlice/user.slice.ts +++ b/client/app/store/userSlice/user.slice.ts @@ -1,6 +1,6 @@ -import { HaztrakSite } from 'components/HaztrakSite'; -import { HaztrakUser } from 'store/authSlice/auth.slice'; -import { haztrakApi, TaskResponse } from 'store/htApi.slice'; +import { HaztrakSite } from '~/components/HaztrakSite'; +import { HaztrakUser } from '~/store/authSlice/auth.slice'; +import { haztrakApi, TaskResponse } from '~/store/htApi.slice'; /**The user's RCRAInfo account data stored in the Redux store*/ export interface ProfileSlice { diff --git a/client/index.html b/client/index.html index 9bf0d86fa..23c284269 100644 --- a/client/index.html +++ b/client/index.html @@ -12,6 +12,6 @@
- + diff --git a/client/src/components/Help/index.ts b/client/src/components/Help/index.ts deleted file mode 100644 index 8c3879d6f..000000000 --- a/client/src/components/Help/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { HaztrakLicense } from 'components/Help/HaztrakLicense'; -export { SectionTitle } from 'components/Help/SectionTitle'; diff --git a/client/src/components/Manifest/WasteLine/HazardousWasteForm/index.ts b/client/src/components/Manifest/WasteLine/HazardousWasteForm/index.ts deleted file mode 100644 index 22d0bf6f6..000000000 --- a/client/src/components/Manifest/WasteLine/HazardousWasteForm/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { HazardousWasteForm } from 'components/Manifest/WasteLine/HazardousWasteForm/HazardousWasteForm'; - -export { HazardousWasteForm }; diff --git a/client/src/components/Manifest/WasteLine/index.ts b/client/src/components/Manifest/WasteLine/index.ts deleted file mode 100644 index 773161257..000000000 --- a/client/src/components/Manifest/WasteLine/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { EditWasteModal } from 'components/Manifest/WasteLine/EditWasteModal'; -import { WasteLineTable } from './WasteLineTable'; -import { WasteLine } from 'components/Manifest/WasteLine/wasteLineSchema'; - -export { WasteLineTable, EditWasteModal }; -export type { WasteLine }; diff --git a/client/src/components/RcraProfile/index.ts b/client/src/components/RcraProfile/index.ts deleted file mode 100644 index 8331f31f0..000000000 --- a/client/src/components/RcraProfile/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { RcraProfile } from 'components/RcraProfile/RcraProfile'; - -export { RcraProfile }; diff --git a/client/src/components/UI/index.ts b/client/src/components/UI/index.ts deleted file mode 100644 index 9193aea01..000000000 --- a/client/src/components/UI/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export { HtButton } from 'components/UI/HtButton'; -export { HtForm } from 'components/UI/HtForm'; -export { HtPageBtns } from 'components/UI/HtPaginate/HtPageBtns'; -export { HtPageControls } from 'components/UI/HtPaginate/HtPageControls'; -export { HtPaginate } from 'components/UI/HtPaginate/HtPaginate'; -export { HtCard } from './HtCard/HtCard'; -export { HtModal } from './HtModal/HtModal'; -export { HtSpinner } from './HtSpinner'; -export { HtTooltip, InfoIconTooltip } from './HtTooltip'; -export { FeatureDescription } from './FeatureDescription'; -export { FloatingActionBtn } from './FloatingActionBtn'; diff --git a/client/src/components/User/index.ts b/client/src/components/User/index.ts deleted file mode 100644 index 53933f2e6..000000000 --- a/client/src/components/User/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { UserInfoForm } from 'components/User/UserInfoForm'; diff --git a/client/src/features/ErrorPage/index.ts b/client/src/features/ErrorPage/index.ts deleted file mode 100644 index 6034fd81e..000000000 --- a/client/src/features/ErrorPage/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ErrorPage as Component } from 'features/ErrorPage/ErrorPage'; diff --git a/client/src/index.tsx b/client/src/index.tsx deleted file mode 100644 index a39040d89..000000000 --- a/client/src/index.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react'; -import { createRoot } from 'react-dom/client'; -import { Provider } from 'react-redux'; -import { rootStore } from 'store'; -import App from './App'; - -const container = document.getElementById('root') as HTMLElement; -const root = createRoot(container); - -// initiate the mock service worker if deployed in TEST environment -// intercepts API calls and returns fake/test responses -if (import.meta.env.VITE_HT_ENV && import.meta.env.VITE_HT_ENV.toUpperCase() === 'TEST') { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { worker } = require('./test-utils/mock/browser'); - worker.start(); -} - -root.render( - - - - - -); diff --git a/client/src/services/index.ts b/client/src/services/index.ts deleted file mode 100644 index 131e298ef..000000000 --- a/client/src/services/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { htApi } from 'services/APIs/htApi'; -export { manifest } from 'services/manifest/manifest'; diff --git a/client/src/test-utils/mock/index.ts b/client/src/test-utils/mock/index.ts deleted file mode 100644 index 79e3b452f..000000000 --- a/client/src/test-utils/mock/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { mockUserEndpoints } from 'test-utils/mock/mockUserEndpoints'; -export { mockSiteEndpoints } from 'test-utils/mock/mockSiteEndpoints'; -export { mockWasteEndpoints } from 'test-utils/mock/mockWasteEndpoints'; -export { mockManifestEndpoints } from 'test-utils/mock/mockManifestEndpoints'; diff --git a/client/tsconfig.json b/client/tsconfig.json index 4648b4277..a09102233 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -1,23 +1,24 @@ { + "include": ["env.d.ts", "**/*.ts", "**/*.tsx"], "compilerOptions": { - "baseUrl": "src", - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, + "lib": ["DOM", "DOM.Iterable", "ES2022"], + "types": ["vite/client"], + "isolatedModules": true, "esModuleInterop": true, - "allowSyntheticDefaultImports": true, + "jsx": "react-jsx", + "module": "ESNext", + "moduleResolution": "Bundler", + "resolveJsonModule": true, + "target": "ES2022", "strict": true, + "allowJs": true, + "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, + "baseUrl": ".", + "paths": { + "~/*": ["./app/*"] + }, "noEmit": true, - "jsx": "react-jsx", "incremental": true - }, - "include": ["src"], - "exclude": ["node_modules", "build"] + } } diff --git a/client/vite.config.ts b/client/vite.config.ts index d4d491d86..d2482e3cf 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -1,16 +1,17 @@ /// -import react from '@vitejs/plugin-react'; +import viteReact from '@vitejs/plugin-react'; import * as path from 'path'; import { defineConfig } from 'vite'; +// @ts-expect-error - error with vite-plugin-eslint import eslint from 'vite-plugin-eslint'; import viteTsconfigPaths from 'vite-tsconfig-paths'; -// @ts-expect-error - we know package.json exists import { dependencies } from './package.json'; function renderChunks(deps: Record) { const chunks = {}; Object.keys(deps).forEach((key) => { if (['react', 'react-router-dom', 'react-dom'].includes(key)) return; + // @ts-expect-error - error with vite-plugin-eslint chunks[key] = [key]; }); return chunks; @@ -36,7 +37,7 @@ export default defineConfig({ }, }, }, - plugins: [react(), viteTsconfigPaths(), eslint()], + plugins: [viteReact(), viteTsconfigPaths(), eslint()], server: { host: true, port: 3000, @@ -54,14 +55,14 @@ export default defineConfig({ '**/build/**', '**/dist/**', '**/coverage/**', - '**/src/setupTests.ts', - '**/src/reportWebVitals.ts', + '**/app/setupTests.ts', + '**/app/reportWebVitals.ts', '**/public/**', '**/*.d.ts', '**/index.ts', ], }, globals: true, - setupFiles: ['src/setupTests.ts'], + setupFiles: ['app/mocks/setupTests.ts'], }, }); diff --git a/compose.yaml b/compose.yaml index f19547a8b..f6f5e7f7d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,4 +1,4 @@ -version: '3.9' +version: "3.9" services: trak: container_name: trak @@ -7,12 +7,12 @@ services: build: context: ./server ports: - - '8000:8000' + - "8000:8000" volumes: - ./server:/app environment: - DJANGO_SETTINGS_MODULE: 'haztrak.settings.dev' - HT_HOST: 'localhost' + DJANGO_SETTINGS_MODULE: "haztrak.settings.dev" + HT_HOST: "localhost" HT_SECRET_KEY: ${HT_SECRET_KEY} HT_DEBUG: ${HT_DEBUG} HT_LOG_LEVEL: ${HT_LOG_LEVEL} @@ -32,17 +32,24 @@ services: sh -c " python manage.py makemigrations && python manage.py migrate && - python manage.py loaddata dev_data.yaml && + python manage.py loaddata dev_data.yaml org_permissions.yaml && python manage.py runserver 0.0.0.0:8000" + healthcheck: + test: + ["CMD", "curl", "-f", "http://localhost:8000/api/health/startup-probe/"] + interval: 30s + timeout: 20s + retries: 5 + start_period: 10s depends_on: db: condition: service_healthy redis: container_name: redis - image: 'redis:alpine' + image: "redis:alpine" ports: - - '6379:6379' + - "6379:6379" volumes: - imdb:/data @@ -65,9 +72,8 @@ services: HT_DB_PORT: ${HT_DB_PORT} command: python manage.py celery_worker depends_on: - - redis - - trak - - db + trak: + condition: service_healthy celery-beat: restart: unless-stopped @@ -88,22 +94,21 @@ services: HT_DB_PORT: ${HT_DB_PORT} command: python manage.py celery_beat depends_on: - - redis - - trak - - db + trak: + condition: service_healthy db: restart: unless-stopped container_name: db - image: 'postgres:16' + image: "postgres:16" environment: POSTGRES_DB: ${HT_DB_NAME} POSTGRES_USER: ${HT_DB_USER} POSTGRES_PASSWORD: ${HT_DB_PASSWORD} ports: - - '5432:5432' + - "5432:5432" healthcheck: - test: ['CMD-SHELL', 'pg_isready -U $HT_DB_USER -d $HT_DB_NAME'] + test: ["CMD-SHELL", "pg_isready -U $HT_DB_USER -d $HT_DB_NAME"] interval: 3s timeout: 3s retries: 5 @@ -116,7 +121,7 @@ services: context: ./client target: dev ports: - - '3000:3000' + - "3000:3000" volumes: - ./client:/app environment: diff --git a/server/Dockerfile b/server/Dockerfile index 09762873c..412f21999 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="graham.david@epa.gov" ENV APP_DIRECTORY=/app/ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -RUN apk add libffi-dev gcc libc-dev +RUN apk add libffi-dev gcc libc-dev curl WORKDIR $APP_DIRECTORY COPY requirements.txt ./ RUN mkdir $APP_DIRECTORY/static diff --git a/server/fixtures/dev_data.yaml b/server/fixtures/dev_data.yaml index 9d1fc3ea9..3688a1e9d 100644 --- a/server/fixtures/dev_data.yaml +++ b/server/fixtures/dev_data.yaml @@ -1,107 +1,3 @@ -- model: auth.group - pk: 1 - fields: - name: Org admin - permissions: - - 161 - - 162 - - 163 - - 164 - - 157 - - 158 - - 159 - - 160 - - 165 - - 166 - - 167 - - 168 - - 126 - - 127 - - 128 - - 129 - - 130 - - 131 - - 132 - - 133 - - 134 - - 135 - - 136 - - 137 - - 138 - - 139 - - 140 - - 141 - - 142 - - 143 - - 144 - - 145 - - 146 - - 147 - - 148 - - 153 - - 154 - - 155 - - 156 - - 149 - - 150 - - 151 - - 152 - - 69 - - 70 - - 71 - - 72 - - 117 - - 118 - - 119 - - 120 - - 73 - - 74 - - 75 - - 76 - - 113 - - 114 - - 115 - - 116 - - 77 - - 78 - - 79 - - 80 - - 109 - - 110 - - 111 - - 112 - - 81 - - 82 - - 83 - - 84 - - 85 - - 86 - - 87 - - 88 - - 89 - - 90 - - 91 - - 92 - - 93 - - 94 - - 95 - - 96 - - 105 - - 106 - - 107 - - 108 - - 121 - - 122 - - 123 - - 124 - - 97 - - 98 - - 99 - - 100 - - 101 - - 102 - - 103 - - 104 - model: core.trakuser pk: 8062d496-15f1-485d-961c-a8e5fa118dde fields: @@ -109,13 +5,13 @@ last_login: 2023-03-19 00:29:46.249589+00:00 is_superuser: false username: orgadmin - first_name: 'org' - last_name: 'admin' + first_name: "org" + last_name: "admin" email: foo@generator.com is_staff: true is_active: true date_joined: 2022-12-17 19:14:17.239000+00:00 - groups: [1] + groups: [1, 2] user_permissions: [] - model: core.trakuser pk: a0ba4966-aa53-44c8-be1a-0a0d2d6b6acd @@ -124,8 +20,8 @@ last_login: 2023-03-19 00:29:46.249589+00:00 is_superuser: true username: admin - first_name: '' - last_name: '' + first_name: "" + last_name: "" email: balh@blah.com is_staff: true is_active: true @@ -139,13 +35,13 @@ last_login: null is_superuser: false username: testuser1 - first_name: 'David' - last_name: 'Graham' - email: 'myemail@proton.me' + first_name: "David" + last_name: "Graham" + email: "myemail@proton.me" is_staff: false is_active: true date_joined: 2022-12-17 19:17:58.260000+00:00 - groups: [] + groups: [2] user_permissions: [] - model: authtoken.token pk: d9609d7764af771ee0def1db08dc7f90dd5e2d6d @@ -161,7 +57,7 @@ city: ARLINGTON state: VA country: US - zip: '22202' + zip: "22202" - model: handler.manifestphone pk: 1 fields: @@ -254,7 +150,7 @@ - model: profile.rcrainfoprofile pk: 1fd27bec-8743-4eb3-a44c-fd063ea62021 fields: - rcra_username: '' + rcra_username: "" phone_number: null email: superadmin@gmail.com - model: profile.rcrainfoprofile @@ -301,3 +197,13 @@ e_manifest: Certifier my_rcra_id: Certifier wiets: Certifier +- model: org.siteuserobjectpermission + pk: 1 + fields: + permission: + - view_site + - org + - site + user: + - testuser1 + content_object: 1 diff --git a/server/haztrak/settings/base.py b/server/haztrak/settings/base.py index 473397835..9bee8f517 100644 --- a/server/haztrak/settings/base.py +++ b/server/haztrak/settings/base.py @@ -232,6 +232,13 @@ GUARDIAN_RAISE_403 = True GUARDIAN_MONKEY_PATCH = False +HEALTH_CHECK = { + "SUBSETS": { + "startup-probe": ["MigrationsHealthCheck", "DatabaseBackend"], + "liveness-probe": ["DatabaseBackend"], + }, +} + TRAK_ORG_MODEL = "org.Org" TRAK_RCRAINFO_SITE_MODEL = "rcrasite.RcraSite" TRAK_MANIFEST_MODEL = "manifest.Manifest" diff --git a/server/org/fixtures/org_permissions.yaml b/server/org/fixtures/org_permissions.yaml new file mode 100644 index 000000000..6eae933d1 --- /dev/null +++ b/server/org/fixtures/org_permissions.yaml @@ -0,0 +1,38 @@ +- model: auth.group + fields: + name: Org admin + permissions: + - - view_org + - org + - org + - - view_orguserobjectpermission + - org + - orguserobjectpermission + - - view_site + - org + - site + - - view_sitegroupobjectpermission + - org + - sitegroupobjectpermission + - - view_siteuserobjectpermission + - org + - siteuserobjectpermission +- model: auth.group + fields: + name: Org viewer + permissions: + - - view_org + - org + - org + - - view_orguserobjectpermission + - org + - orguserobjectpermission + - - view_site + - org + - site + - - view_sitegroupobjectpermission + - org + - sitegroupobjectpermission + - - view_siteuserobjectpermission + - org + - siteuserobjectpermission diff --git a/server/org/migrations/0002_alter_orggroupobjectpermission_content_object_and_more.py b/server/org/migrations/0002_alter_orggroupobjectpermission_content_object_and_more.py new file mode 100644 index 000000000..48e69c9e1 --- /dev/null +++ b/server/org/migrations/0002_alter_orggroupobjectpermission_content_object_and_more.py @@ -0,0 +1,34 @@ +# Generated by Django 5.0.7 on 2024-08-01 14:06 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('org', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='orggroupobjectpermission', + name='content_object', + field=models.ForeignKey(db_column='org_object_id', on_delete=django.db.models.deletion.CASCADE, to='org.org'), + ), + migrations.AlterField( + model_name='orguserobjectpermission', + name='content_object', + field=models.ForeignKey(db_column='org_object_id', on_delete=django.db.models.deletion.CASCADE, to='org.org'), + ), + migrations.AlterField( + model_name='sitegroupobjectpermission', + name='content_object', + field=models.ForeignKey(db_column='site_object_id', on_delete=django.db.models.deletion.CASCADE, to='org.site'), + ), + migrations.AlterField( + model_name='siteuserobjectpermission', + name='content_object', + field=models.ForeignKey(db_column='site_object_id', on_delete=django.db.models.deletion.CASCADE, to='org.site'), + ), + ] diff --git a/server/org/models.py b/server/org/models.py index 87294d37d..476ad5a38 100644 --- a/server/org/models.py +++ b/server/org/models.py @@ -81,7 +81,8 @@ class Meta(UserObjectPermissionBase.Meta): verbose_name = "Org Permission" verbose_name_plural = "Org Permissions" - content_object = models.ForeignKey(Org, on_delete=models.CASCADE) + # Note: class attribute must be named content_object (see django-guardian docs) + content_object = models.ForeignKey(Org, on_delete=models.CASCADE, db_column="org_object_id") class OrgGroupObjectPermission(GroupObjectPermissionBase): @@ -91,7 +92,7 @@ class Meta(GroupObjectPermissionBase.Meta): verbose_name = "Org Role" verbose_name_plural = "Org Roles" - content_object = models.ForeignKey(Org, on_delete=models.CASCADE) + content_object = models.ForeignKey(Org, on_delete=models.CASCADE, db_column="org_object_id") class SiteManager(QuerySet): @@ -188,7 +189,7 @@ class Meta(UserObjectPermissionBase.Meta): verbose_name = "Site Permission" verbose_name_plural = "Site Permissions" - content_object = models.ForeignKey(Site, on_delete=models.CASCADE) + content_object = models.ForeignKey(Site, on_delete=models.CASCADE, db_column="site_object_id") class SiteGroupObjectPermission(GroupObjectPermissionBase): @@ -198,4 +199,4 @@ class Meta(GroupObjectPermissionBase.Meta): verbose_name = "Site Role" verbose_name_plural = "Site Roles" - content_object = models.ForeignKey(Site, on_delete=models.CASCADE) + content_object = models.ForeignKey(Site, on_delete=models.CASCADE, db_column="site_object_id")