Skip to content

Commit

Permalink
cleanup frontend console errors (#2665)
Browse files Browse the repository at this point in the history
* fix markup errors

* componentize modal

* try to fix modal issue

* upgrade truss

* add keys

* lint

* install peer dependency?

* downgrade uswds

* jk

* make patient results row clickable (#2664)

make entire row clickable

* fix export issues with package bumps

* removed extra prop
  • Loading branch information
fzhao99 authored Oct 7, 2024
1 parent f18687b commit a55c390
Show file tree
Hide file tree
Showing 19 changed files with 271 additions and 153 deletions.
2 changes: 1 addition & 1 deletion containers/tefca-viewer/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test.describe("querying with the TryTEFCA viewer", () => {
await expect(
page.getByText("No records were found for your search"),
).toBeVisible();
await page.getByRole("link", { name: RETURN_TO_STEP_ONE_LABEL }).click();
await page.getByText(RETURN_TO_STEP_ONE_LABEL).click();
await expect(
page.getByRole("heading", { name: "Search for a Patient", exact: true }),
).toBeVisible();
Expand Down
9 changes: 1 addition & 8 deletions containers/tefca-viewer/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ const path = require("path");
const nextConfig = {
sassOptions: {
includePaths: [
path.join(
__dirname,
"../..",
"node_modules",
"@uswds",
"uswds",
"packages",
),
path.join(__dirname, "./", "node_modules", "@uswds", "uswds", "packages"),
],
},
transpilePackages: ["yaml"],
Expand Down
7 changes: 4 additions & 3 deletions containers/tefca-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.515.0",
"@trussworks/react-uswds": "^6.1.0",
"@trussworks/react-uswds": "^9.1.0",
"@types/sinonjs__fake-timers": "^8.1.1",
"@uswds/uswds": "3.7.0",
"@uswds/uswds": "^3.8.2",
"axios": "^1.6.0",
"classnames": "^2.5.1",
"date-fns": "^3.4.0",
Expand Down Expand Up @@ -54,7 +54,7 @@
"@types/node": "^20",
"@types/node-fetch": "^2.6.11",
"@types/pg": "^8.11.8",
"@types/react": "^18.3.3",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.17.0",
Expand All @@ -67,6 +67,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.3",
"eslint-plugin-unused-imports": "^3.1.0",
"focus-trap-react": "^10.3.0",
"jest": "^29.7.0",
"jest-axe": "^8.0.0",
"jest-environment-jsdom": "^29.7.0",
Expand Down
118 changes: 0 additions & 118 deletions containers/tefca-viewer/src/app/header.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion containers/tefca-viewer/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "../styles/styles.scss";
import Header from "./header";
import Header from "./query/components/header/header";
import Footer from "./footer";
import { DataProvider } from "./utils";

Expand Down
1 change: 1 addition & 0 deletions containers/tefca-viewer/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function LandingPage() {
src="/tefca-viewer/tefca-graphic.svg"
width={250}
height={300}
priority
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,11 @@ const CustomizeQuery: React.FC<CustomizeQueryProps> = ({
valueSetOptions={valueSetOptions}
/>
{Object.entries(valueSetOptions[activeTab]).map(([groupIndex, group]) => {
const id = group.author + ":" + group.system + ":" + group.valueSetName;
return (
<Accordion
key={id}
id={id}
title={
<CustomizeQueryAccordionHeader
handleSelectAllChange={handleSelectAllChange}
Expand All @@ -195,7 +198,6 @@ const CustomizeQuery: React.FC<CustomizeQueryProps> = ({
groupIndex={groupIndex}
/>
}
id={group.author + ":" + group.system}
headingLevel="h3"
accordionClassName={`customize-accordion ${styles.customizeQueryAccordion}`}
containerClassName={styles.resultsContainer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Backlink: React.FC<BacklinkProps> = ({ onClick, label }) => {
href="#"
onClick={onClick}
className="back-link unchanged-color-on-visit"
aria-label="Back arrow indicating ability to navigate back a page if clicked"
>
<Icon.ArrowBack /> {label}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ const CustomizeQueryAccordionBody: React.FC<
> = ({ group, toggleInclude, groupIndex }) => {
return (
<Table className={`${styles.customizeQueryGridContainer}`}>
<thead className={`${styles.customizeQueryGridHeader} margin-top-10`}>
<th className={`${styles.accordionTableHeader}`}>Include</th>
<th className={`${styles.accordionTableHeader}`}>Code</th>
<th className={`${styles.accordionTableHeader}`}>Display</th>
<thead className={` margin-top-10`}>
<tr className={styles.customizeQueryGridHeader}>
<th className={`${styles.accordionTableHeader}`}>Include</th>
<th className={`${styles.accordionTableHeader}`}>Code</th>
<th className={`${styles.accordionTableHeader}`}>Display</th>
</tr>
</thead>
<tbody className="display-flex flex-column">
{group.items.map((item, index) => (
Expand All @@ -48,8 +50,12 @@ const CustomizeQueryAccordionBody: React.FC<
/>
)}
</td>
<div>{item.code}</div>
<div>{item.display}</div>
<td className={styles.noBorderNoBackgroundNoPadding}>
{item.code}
</td>
<td className={styles.noBorderNoBackgroundNoPadding}>
{item.display}
</td>
</tr>
))}
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ const CustomizeQueryAccordionHeader: React.FC<CustomizeQueryAccordionProps> = ({
className="usa-icon bg-base-lightest"
size={4}
color="#565C65"
aria-label="Checkmark icon indicating addition"
/>
)}
{selectedCount > 0 && selectedCount < group.items.length && (
<Icon.Remove
className="usa-icon bg-base-lightest"
size={4}
color="#565C65"
aria-label="Minus icon indicating removal"
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
border: none;
}

.noBorderNoBackgroundNoPadding {
border: none !important;
background-color: transparent !important;
padding: 0 !important;
}

.customizeQueryCheckbox {
width: 2.25rem;
height: 2.25rem;
Expand Down Expand Up @@ -144,6 +150,10 @@
gap: var(--column-gap);
}

.customizeQueryGridHeader th {
padding: 0 !important;
}

.accordionTableHeader {
display: flex;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.dataUsagePolicyButton {
cursor: pointer;
background: none !important;
border: none !important;
color: white !important;
padding: 0px !important;
font: inherit !important;
}
71 changes: 71 additions & 0 deletions containers/tefca-viewer/src/app/query/components/header/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"use client";

import { useEffect, useRef, useState } from "react";
import { Modal, ModalButton } from "../../designSystem/Modal";
import { ModalRef } from "@trussworks/react-uswds";
import styles from "./header.module.css";
/**
* Produces the header.
* @returns The HeaderComponent component.
*/
export default function HeaderComponent() {
const modalRef = useRef<ModalRef>(null);
const [isClient, setIsClient] = useState(false);

useEffect(() => {
setIsClient(true);
}, []);

return (
<>
<header className="usa-header usa-header--basic bg-primary-darker">
<div
className="header-footer-content usa-nav-container"
style={{
display: "flex",
alignItems: "center",
justifyContent: "space-between",
}}
>
<div style={{ display: "flex", alignItems: "center" }}>
<div className="usa-logo" style={{ marginLeft: "16px" }}>
<em className="usa-logo__text text-base-lightest">
<a
className="text-base-lightest font-sans-xl text-bold"
href="/tefca-viewer"
title="TEFCA Viewer"
>
TEFCA Viewer
</a>
</em>
</div>
</div>
<div
style={{
whiteSpace: "nowrap",
textAlign: "right",
marginLeft: "auto",
}}
>
{isClient && (
<ModalButton
modalRef={modalRef}
title={"Data Usage Policy"}
className={styles.dataUsagePolicyButton}
/>
)}
</div>
</div>
</header>

{isClient && (
<Modal
modalRef={modalRef}
id="data-usage-policy"
heading="How is my data stored?"
description="It's not! Data inputted into the TEFCA Query Connector is not persisted or stored anywhere."
></Modal>
)}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ResultsViewTable: React.FC<ResultsViewTable> = ({ accordionItems }) => {
const titleId = formatIdForAnchorTag(item.title);
return (
item.content && (
<div className="padding-bottom-2">
<div className="padding-bottom-2" key={item.title}>
<Accordion
title={item.title}
content={
Expand All @@ -34,6 +34,7 @@ const ResultsViewTable: React.FC<ResultsViewTable> = ({ accordionItems }) => {
}
expanded={true}
id={titleId}
key={titleId}
headingLevel={"h3"}
accordionClassName={styles.accordionWrapper}
containerClassName={styles.accordionContainer}
Expand Down
Loading

0 comments on commit a55c390

Please sign in to comment.