generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add root page with structure in place. Added playwright tests to ensure behavior Updated dev docker image to support playwright which required moving to a Debian based base image (Alpine linux base image is smaller but doesn't work well with Chrome runner because Chrome doesn't publish a precompiled package for it in Alpine) * Remove inline styles Remove commented out code * Update Playwright tests to work in CI Parameterize baseURL so we can just work with internal routes
- Loading branch information
Showing
13 changed files
with
163 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
FROM node:20.17.0-alpine3.20 | ||
|
||
RUN apk add --update nodejs npm | ||
|
||
|
||
FROM node:20.17.0 | ||
COPY . /app | ||
|
||
WORKDIR /app | ||
RUN npm install | ||
RUN npx playwright install --with-deps | ||
|
||
EXPOSE 5173 | ||
EXPOSE 5173 8080 | ||
CMD npm run dev -- --host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import {Simulate} from "react-dom/test-utils"; | ||
import click = Simulate.click; | ||
|
||
test('has STLT Name', async ({ page }) => { | ||
await page.goto('/'); | ||
|
||
await expect(page.getByText('Demo STLT')).toBeVisible() | ||
}); | ||
|
||
test('has new template button', async ({ page , baseURL}) => { | ||
await page.goto('/'); | ||
await expect(page.getByRole('button', { name: '+ New Template' })).toBeVisible() | ||
await page.getByRole('button', { name: '+ New Template' }).click() | ||
expect(page.url()).toEqual(`${baseURL}/new-template/upload`) | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,52 @@ | ||
import { useState } from 'react' | ||
import reactLogo from './assets/react.svg' | ||
import viteLogo from '/vite.svg' | ||
import {useState} from 'react' | ||
import './App.scss' | ||
import { Button } from '@trussworks/react-uswds' | ||
import {Button, Link, SideNav} from "@trussworks/react-uswds"; | ||
import {useLocation, useNavigate, useNavigation} from "react-router-dom"; | ||
|
||
import {AppHeader} from "./components/AppHeader/AppHeader.tsx"; | ||
import dataLinkLogo from "./assets/datalink_placeholder_logo.svg"; | ||
import extractImage from "./assets/extract_image.svg" | ||
function App() { | ||
const [count, setCount] = useState(0) | ||
const {pathname} = useLocation() | ||
const navigate = useNavigate() | ||
const navLinks = [ | ||
{text: "Annotate and Extract", url: "/annotate"}, | ||
{text: "Label Management", url: "/labels"}, | ||
{text: "Dashboard", url: "/"} | ||
] | ||
|
||
return ( | ||
<> | ||
<div> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src={viteLogo} className="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://react.dev" target="_blank"> | ||
<img src={reactLogo} className="logo react" alt="React logo" /> | ||
</a> | ||
</div> | ||
<h1>Vite + React</h1> | ||
<div className="card"> | ||
<button onClick={() => setCount((count) => count + 1)}> | ||
count is {count} | ||
</button> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to test HMR | ||
</p> | ||
</div> | ||
<p className="read-the-docs"> | ||
Click on the Vite and React logos to learn more | ||
</p> | ||
<Button type="button">Click Me</Button> | ||
</> | ||
) | ||
|
||
return ( | ||
<> | ||
<div className='display-flex flex-column width-full height-full'> | ||
<AppHeader jurisdiction={`Demo STLT`}/> | ||
<div className="display-flex flex-row height-full"> | ||
<div | ||
className="flex-3 padding-top-1 padding-left-1 padding-right-4 minw-15 usa-dark-background bg-primary-dark text-base-lightest display-flex flex-column flex-gap-1 maxw-30" | ||
> | ||
<div className='display-flex flex-column flex-align-start padding-top-2'> | ||
{navLinks.map((i, idx) => { | ||
return <Link key={idx} href={i.url} | ||
className={`border-left-2px padding-left-1 padding-top-2 padding-bottom-2 ${i.url === pathname ? 'text-bold' : 'border-primary-dark'}`}>{i.text}</Link> | ||
})} | ||
</div> | ||
</div> | ||
<div className="flex-10 display-flex flex-column"> | ||
<h2 className="padding-left-2">Annotate and Extract</h2> | ||
<div className=" flex-1 padding-left-2 padding-right-2 bg-idwa-light" > | ||
<p><span className="text-bold">Welcome Blake, </span></p> | ||
<p>Extract data from any PDFs, or images to send to your surveillance systems using data from your saved templates or create new segmentations.</p> | ||
<img className="display-block margin-left-auto margin-right-auto padding-top-8" src={extractImage} alt="Extract From Documents"/> | ||
<p className="text-bold text-center">You have no segmentation templates set up yet. The templates will be used to extract data for your lab forms.</p> | ||
<Button type="button" className="usa-button display-flex flex-align-center margin-left-auto margin-right-auto" onClick={() => navigate("/new-template/upload")}>+ New Template</Button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</> | ||
) | ||
} | ||
|
||
export default App |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
.flex-gap-half { | ||
gap: 0.5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {FC} from "react"; | ||
import {Button, Icon, Header} from "@trussworks/react-uswds"; | ||
|
||
import './AppHeader.scss' | ||
import dataLinkLogo from '../../assets/datalink_placeholder_logo.svg'; | ||
import {useNavigate} from "react-router-dom"; | ||
|
||
interface IndexHeaderProps { | ||
jurisdiction: string | ||
} | ||
|
||
export const AppHeader: FC<IndexHeaderProps> = ({jurisdiction}: IndexHeaderProps) => { | ||
const navigate = useNavigate() | ||
return ( | ||
<> | ||
<Header basic={true} role={`banner`} | ||
className='header width-full display-flex flex-row flex-justify-start bg-primary-darker padding-1 padding-left-4 padding-right-4 text-base-lightest flex-gap-half' | ||
> | ||
<div className="display-flex flex-justify-center"> | ||
<Button unstyled type="button" onClick={() => navigate("/")}> | ||
<img | ||
className='width-3' | ||
src={dataLinkLogo} | ||
alt={`IDWA`} | ||
/> | ||
</Button> | ||
</div> | ||
<div className='text-bold font-ui-md display-flex flex-align-center'> | ||
Datalink | ||
</div> | ||
<div className='padding-left-1 display-flex flex-align-center'>{jurisdiction}</div> | ||
<div className='flex-align-end flex-justify-end flex-1'></div> | ||
<div className=" display-flex flex-justify-center"> | ||
<a> | ||
Log Out | ||
</a> | ||
</div> | ||
<div className="display-flex flex-justify-center"> | ||
<a> | ||
<Icon.Person className={`text-base-lightest usa-icon--size-3`}/> | ||
</a> | ||
</div> | ||
<div className="display-flex flex-justify-center"> | ||
<a> | ||
<Icon.Settings className={`text-base-lightest usa-icon--size-3`}/> | ||
</a> | ||
</div> | ||
|
||
</Header> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters