Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc Repo Chores #758

Merged
merged 12 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -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="[email protected]"
WORKDIR /app
COPY . .
Expand All @@ -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
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions client/src/App.tsx → client/app/App.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => (
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,7 +10,7 @@ import {
useAppDispatch,
useAppSelector,
useLoginMutation,
} from 'store';
} from '~/store';
import { z } from 'zod';

const loginSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { HtCard } from 'components/UI';
import { HtCard } from '~/components/UI';

export function HaztrakLicense() {
return (
Expand Down
2 changes: 2 additions & 0 deletions client/app/components/Help/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { HaztrakLicense } from '~/components/Help/HaztrakLicense';
export { SectionTitle } from '~/components/Help/SectionTitle';
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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*/
Expand Down
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<NavContextProps>(NavContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GeneratorAddress } from 'components/Manifest/Address/GeneratorAddress';
import { GeneratorAddress } from '~/components/Manifest/Address/GeneratorAddress';
import React from 'react';

interface Props {
Expand Down
Loading
Loading