Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pantheredeye committed Nov 24, 2024
1 parent 4def705 commit 57761a4
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 104 deletions.
2 changes: 1 addition & 1 deletion deploy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
[[production.servers]]
host = "swppp.top"
username = "devops"
privateKeyPath = "C:/Users/39P3QC2/.ssh/id_ed25519"
privateKeyPath = "C:/Users/bburnworth/.ssh/id_ed25519"
sides = ["api","web"]
packageManagerCommand = "yarn"
monitorCommand = "pm2"
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/SitesListCell/SitesListCell.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Define your own mock data here:
export const standard = (/* vars, { ctx, req } */) => ({
sitesList: {
__typename: "sitesList" as const,
__typename: 'sitesList' as const,
id: 42,
},
});
})
30 changes: 15 additions & 15 deletions web/src/components/SitesListCell/SitesListCell.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import type { Meta, StoryObj } from "@storybook/react";
import type { Meta, StoryObj } from '@storybook/react'

import { Loading, Empty, Failure, Success } from "./SitesListCell";
import { standard } from "./SitesListCell.mock";
import { Loading, Empty, Failure, Success } from './SitesListCell'
import { standard } from './SitesListCell.mock'

const meta: Meta = {
title: "Cells/SitesListCell",
tags: ["autodocs"],
};
title: 'Cells/SitesListCell',
tags: ['autodocs'],
}

export default meta;
export default meta

export const loading: StoryObj<typeof Loading> = {
render: () => {
return Loading ? <Loading /> : <></>;
return Loading ? <Loading /> : <></>
},
};
}

export const empty: StoryObj<typeof Empty> = {
render: () => {
return Empty ? <Empty /> : <></>;
return Empty ? <Empty /> : <></>
},
};
}

export const failure: StoryObj<typeof Failure> = {
render: (args) => {
return Failure ? <Failure error={new Error("Oh no")} {...args} /> : <></>;
return Failure ? <Failure error={new Error('Oh no')} {...args} /> : <></>
},
};
}

export const success: StoryObj<typeof Success> = {
render: (args) => {
return Success ? <Success {...standard()} {...args} /> : <></>;
return Success ? <Success {...standard()} {...args} /> : <></>
},
};
}
42 changes: 21 additions & 21 deletions web/src/components/SitesListCell/SitesListCell.test.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
import { render } from "@redwoodjs/testing/web";
import { render } from '@redwoodjs/testing/web'

import { Loading, Empty, Failure, Success } from "./SitesListCell";
import { standard } from "./SitesListCell.mock";
import { Loading, Empty, Failure, Success } from './SitesListCell'
import { standard } from './SitesListCell.mock'

// Generated boilerplate tests do not account for all circumstances
// and can fail without adjustments, e.g. Float and DateTime types.
// Please refer to the RedwoodJS Testing Docs:
// https://redwoodjs.com/docs/testing#testing-cells
// https://redwoodjs.com/docs/testing#jest-expect-type-considerations

describe("SitesListCell", () => {
it("renders Loading successfully", () => {
describe('SitesListCell', () => {
it('renders Loading successfully', () => {
expect(() => {
render(<Loading />);
}).not.toThrow();
});
render(<Loading />)
}).not.toThrow()
})

it("renders Empty successfully", async () => {
it('renders Empty successfully', async () => {
expect(() => {
render(<Empty />);
}).not.toThrow();
});
render(<Empty />)
}).not.toThrow()
})

it("renders Failure successfully", async () => {
it('renders Failure successfully', async () => {
expect(() => {
render(<Failure error={new Error("Oh no")} />);
}).not.toThrow();
});
render(<Failure error={new Error('Oh no')} />)
}).not.toThrow()
})

// When you're ready to test the actual output of your component render
// you could test that, for example, certain text is present:
//
// 1. import { screen } from '@redwoodjs/testing/web'
// 2. Add test: expect(screen.getByText('Hello, world')).toBeInTheDocument()

it("renders Success successfully", async () => {
it('renders Success successfully', async () => {
expect(() => {
render(<Success sitesList={standard().sitesList} />);
}).not.toThrow();
});
});
render(<Success sitesList={standard().sitesList} />)
}).not.toThrow()
})
})
20 changes: 8 additions & 12 deletions web/src/components/SitesListCell/SitesListCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {
FindSitesListQueryVariables,
} from 'types/graphql'

import { Link, routes } from '@redwoodjs/router'
import type {
CellSuccessProps,
CellFailureProps,
Expand All @@ -11,7 +12,6 @@ import type {

import { columns } from 'src/components/SitesTable/columns'
import DataTable from 'src/components/SitesTable/SitesTable'
import { Link, routes } from '@redwoodjs/router'

export const QUERY: TypedDocumentNode<
FindSitesListQuery,
Expand Down Expand Up @@ -39,19 +39,15 @@ export const Failure = ({

export const Success = ({
sites,
}: CellSuccessProps<
FindSitesListQuery,
FindSitesListQueryVariables
>) => {
}: CellSuccessProps<FindSitesListQuery, FindSitesListQueryVariables>) => {
return (
<div className="container mx-auto py-10">

<Link
to={routes.newSite()}
className="flex w-full items-center justify-center rounded-xl bg-indigo-600 px-4 py-2 font-medium text-white shadow-lg hover:bg-indigo-500 focus:outline-none"
>
Add Site
</Link>
<Link
to={routes.newSite()}
className="flex w-full items-center justify-center rounded-xl bg-indigo-600 px-4 py-2 font-medium text-white shadow-lg hover:bg-indigo-500 focus:outline-none"
>
Add Site
</Link>
<DataTable columns={columns} data={sites} />
</div>
)
Expand Down
2 changes: 0 additions & 2 deletions web/src/components/SitesTable/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
DropdownMenuTrigger,
} from 'src/components/ui/DropdownMenu'

import ExportPDFButton from '../ExportPDFButton/ExportPDFButton'

export type Site = {
id: number
name: string
Expand Down
56 changes: 19 additions & 37 deletions web/src/pages/NewSitePage/NewSitePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
TextField,
TextAreaField,
Submit,
CheckboxField,
DateField,
TimeField,
DatetimeLocalField,
} from '@redwoodjs/forms'
import { navigate, routes } from '@redwoodjs/router'
import { useMutation, useQuery } from '@redwoodjs/web'
Expand Down Expand Up @@ -126,9 +122,7 @@ const NewSitePage = () => {
<div className="space-y-12">
<div className="grid grid-cols-1 gap-x-8 gap-y-10 border-b border-gray-900/10 pb-12 md:grid-cols-3">
<div className="px-4 sm:px-0">
<h2 className="text-3xl font-bold text-gray-100">
Site Details
</h2>
<h2 className="text-3xl font-bold text-gray-100">Site Details</h2>
<p className="mt-2 text-sm text-gray-400">
Please fill out the details for the new site.
</p>
Expand All @@ -145,15 +139,15 @@ const NewSitePage = () => {
Site Name*
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="name"
id="name"
value={name}
onChange={(e) => setName(e.target.value)}
className="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 required:border-red-500 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
required
/>
<FieldError name="name" className="mt-1 text-red-500" />
</div>
</div>
<div className="col-span-full">
Expand All @@ -164,8 +158,7 @@ const NewSitePage = () => {
Address Line 1*
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="addressLine1"
id="addressLine1"
value={addressLine1}
Expand All @@ -182,8 +175,7 @@ const NewSitePage = () => {
Address Line 2
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="addressLine2"
id="addressLine2"
value={addressLine2}
Expand All @@ -200,8 +192,7 @@ const NewSitePage = () => {
City
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="city"
id="city"
value={city}
Expand All @@ -218,8 +209,7 @@ const NewSitePage = () => {
State / Province
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="state"
id="state"
value={state}
Expand All @@ -236,8 +226,7 @@ const NewSitePage = () => {
Postal Code
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="postalCode"
id="postalCode"
value={postalCode}
Expand All @@ -254,8 +243,7 @@ const NewSitePage = () => {
Country
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="country"
id="country"
value={country}
Expand All @@ -272,8 +260,7 @@ const NewSitePage = () => {
NPDES Tracking No
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="npdesTrackingNo"
id="npdesTrackingNo"
value={npdesTrackingNo}
Expand All @@ -290,7 +277,7 @@ const NewSitePage = () => {
Site Type*
</Label>
<div className="mt-2">
<select
<SelectField
id="siteTypeId"
name="siteTypeId"
value={siteTypeId}
Expand All @@ -304,7 +291,7 @@ const NewSitePage = () => {
</option>
)
)}
</select>
</SelectField>
</div>
</div>
<div className="col-span-full">
Expand All @@ -315,8 +302,7 @@ const NewSitePage = () => {
Site Inspector
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="siteInspector"
id="siteInspector"
value={siteInspector}
Expand Down Expand Up @@ -352,8 +338,7 @@ const NewSitePage = () => {
Owner Name*
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="ownerName"
id="ownerName"
value={ownerName}
Expand All @@ -368,9 +353,7 @@ const NewSitePage = () => {
{siteTypeId !== 2 && (
<div className="grid grid-cols-1 gap-x-8 gap-y-10 border-b border-gray-900/10 pb-12 md:grid-cols-3">
<div>
<h2 className="text-3xl font-bold text-gray-100">
BMPs
</h2>
<h2 className="text-3xl font-bold text-gray-100">BMPs</h2>
<p className="mt-2 text-sm text-gray-400">
Add any custom BMPs for the site. Standard BMPs will show on
the inspection form automatically.
Expand Down Expand Up @@ -413,12 +396,11 @@ const NewSitePage = () => {
<Label
name="newBmpName"
className="block text-sm font-medium text-gray-200"
>
>
BMP Name*
</Label>
<div className="mt-2">
<input
type="text"
<TextField
name="newBmpName"
id="newBmpName"
value={newBmpName}
Expand All @@ -431,11 +413,11 @@ const NewSitePage = () => {
<Label
name="newBmpDescription"
className="block text-sm font-medium text-gray-200"
>
>
Description*
</Label>
<div className="mt-2">
<textarea
<TextAreaField
name="newBmpDescription"
id="newBmpDescription"
value={newBmpDescription}
Expand Down
12 changes: 6 additions & 6 deletions web/src/pages/SitesPage/SitesPage.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { Meta, StoryObj } from "@storybook/react";
import type { Meta, StoryObj } from '@storybook/react'

import SitesPage from "./SitesPage";
import SitesPage from './SitesPage'

const meta: Meta<typeof SitesPage> = {
component: SitesPage,
};
}

export default meta;
export default meta

type Story = StoryObj<typeof SitesPage>;
type Story = StoryObj<typeof SitesPage>

export const Primary: Story = {};
export const Primary: Story = {}
Loading

0 comments on commit 57761a4

Please sign in to comment.