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

setup routing and empty state query building pages #107

Merged
merged 43 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4062f9d
Add Sign In button to header; add /signin page with basic form; redir…
katyasoup Oct 28, 2024
291fa80
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 28, 2024
b9ee4b2
Add gear icon for menu dropdown; go to landing page on Log Out click
katyasoup Oct 29, 2024
b7a5923
prettier formatting
katyasoup Oct 29, 2024
7f30eaf
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 29, 2024
0906224
tweak icon spacing
katyasoup Oct 29, 2024
52db5c9
PR feedback
katyasoup Oct 29, 2024
a7fe7ec
Merge branch 'main' into kcd/77-login-page
katyasoup Oct 29, 2024
853d054
Merge branch 'main' into kcd/77-login-page
katyasoup Oct 31, 2024
4713065
Set back link in header
DanPaseltiner Oct 31, 2024
39fd4bf
Merge branch 'kcd/77-login-page' of https://github.com/CDCgov/dibbs-q…
DanPaseltiner Oct 31, 2024
da1c832
Merge branch 'main' into kcd/77-login-page
katyasoup Oct 31, 2024
59b0865
PR design feedback - error state, some responsive sizing, hide My Que…
katyasoup Oct 31, 2024
d128a1b
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Oct 31, 2024
984b5db
redirect page
fzhao99 Oct 29, 2024
e819b07
import
fzhao99 Oct 29, 2024
b6548bb
import
fzhao99 Oct 29, 2024
20346a4
header styling tweaks
fzhao99 Oct 29, 2024
158edeb
remove log
fzhao99 Oct 31, 2024
488342e
empty state query page
fzhao99 Oct 31, 2024
a7272fb
rehouse files
fzhao99 Oct 31, 2024
9410781
lint
fzhao99 Oct 31, 2024
1027163
lint pt 2
fzhao99 Oct 31, 2024
ed70798
export the thing correctly
fzhao99 Oct 31, 2024
7a8b61a
font styles
fzhao99 Oct 31, 2024
c2cc330
change FC styling
fzhao99 Oct 31, 2024
7dc7ded
don't export
fzhao99 Oct 31, 2024
40c12d9
widen button
fzhao99 Oct 31, 2024
da78d37
remove extra margin
fzhao99 Oct 31, 2024
4f8a027
fix results view styles
fzhao99 Oct 31, 2024
a7264f2
fix header and footer styling
fzhao99 Nov 1, 2024
478baa2
footer
fzhao99 Nov 1, 2024
581104f
footer
fzhao99 Nov 1, 2024
fd49f8f
katie suggestions
fzhao99 Nov 1, 2024
cc07860
merge main
fzhao99 Nov 1, 2024
dacccd9
fix spacing
fzhao99 Nov 1, 2024
9d58fa6
spacing changes
mikang Nov 1, 2024
3b7e7f8
[pre-commit.ci] auto fixes from pre-commit hooks
pre-commit-ci[bot] Nov 1, 2024
f5844ae
fix custom alert height
fzhao99 Nov 4, 2024
840059d
turn off display grid in favor of flex
fzhao99 Nov 4, 2024
6f87cdf
simplify some css
fzhao99 Nov 4, 2024
aa8a43d
start abstracting out some color tokens
fzhao99 Nov 4, 2024
2e26152
font weight
fzhao99 Nov 4, 2024
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
2 changes: 1 addition & 1 deletion query-connector/e2e/alternate_queries.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";
import { PAGE_TITLES } from "@/app/query/components/stepIndicator/StepIndicator";

import { TEST_PATIENT, TEST_PATIENT_NAME } from "./constants";

Expand Down
2 changes: 1 addition & 1 deletion query-connector/e2e/customize_query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";
import { PAGE_TITLES } from "@/app/query/components/stepIndicator/StepIndicator";

import { TEST_PATIENT, TEST_PATIENT_NAME } from "./constants";

Expand Down
2 changes: 1 addition & 1 deletion query-connector/e2e/query_workflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { test, expect } from "@playwright/test";
import { TEST_URL } from "../playwright-setup";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";
import { PAGE_TITLES } from "@/app/query/components/stepIndicator/StepIndicator";
import {
CONTACT_US_DISCLAIMER_EMAIL,
CONTACT_US_DISCLAIMER_TEXT,
Expand Down
4 changes: 2 additions & 2 deletions query-connector/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Image from "next/image";
export default function LandingPage() {
const router = useRouter();

const handleClick = () => {
fzhao99 marked this conversation as resolved.
Show resolved Hide resolved
const handleGoToDemo = () => {
router.push(`/query`);
};

Expand Down Expand Up @@ -97,7 +97,7 @@ export default function LandingPage() {
className="next-button"
type="button"
id="next-button"
onClick={() => handleClick()}
onClick={() => handleGoToDemo()}
>
Go to the demo
</Button>
Expand Down
8 changes: 4 additions & 4 deletions query-connector/src/app/query/components/CustomizeQuery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import CustomizeQueryNav from "./customizeQuery/CustomizeQueryNav";
import {
GroupedValueSet,
mapValueSetsToValueSetTypes,
countDibbsConceptTypeToVsMapItems,
} from "./customizeQuery/customizeQueryUtils";
import Backlink from "./backLink/Backlink";
import { RETURN_LABEL } from "../stepIndicator/StepIndicator";
import { countDibbsConceptTypeToVsMapItems } from "./utils";
import { RETURN_LABEL } from "./stepIndicator/StepIndicator";

interface CustomizeQueryProps {
useCaseQueryResponse: UseCaseQueryResponse;
Expand Down Expand Up @@ -200,9 +200,9 @@ const CustomizeQuery: React.FC<CustomizeQueryProps> = ({
</div>
<LoadingView loading={!useCaseQueryResponse} />
<h1 className="page-title margin-bottom-05-important">Customize query</h1>
<h2 className="page-explainer margin-x-0-important">
<p className="page-explainer margin-x-0-important">
Query: {demoQueryValToLabelMap[queryType]}
</h2>
</p>
<h3 className="margin-x-0-important font-sans-sm text-light padding-bottom-0 padding-top-05">
{countLabs} labs found, {countMedications} medications found,{" "}
{countConditions} conditions found.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Mode } from "@/app/constants";
import Backlink from "./backLink/Backlink";
import PatientSearchResultsTable from "./patientSearchResults/PatientSearchResultsTable";
import NoPatientsFound from "./patientSearchResults/NoPatientsFound";
import { RETURN_LABEL } from "@/app/query/stepIndicator/StepIndicator";
import { RETURN_LABEL } from "@/app/query/components/stepIndicator/StepIndicator";

/**
* The props for the PatientSearchResults component.
Expand Down
6 changes: 3 additions & 3 deletions query-connector/src/app/query/components/ResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { USE_CASES, demoQueryValToLabelMap } from "@/app/constants";
import {
PAGE_TITLES,
RETURN_LABEL,
} from "@/app/query/stepIndicator/StepIndicator";
} from "@/app/query/components/stepIndicator/StepIndicator";

type ResultsViewProps = {
useCaseQueryResponse: UseCaseQueryResponse;
Expand Down Expand Up @@ -75,12 +75,12 @@ const ResultsView: React.FC<ResultsViewProps> = ({
<h1 className="page-title margin-bottom-0-important">
{PAGE_TITLES["results"]}
</h1>
<h2 className="page-explainer margin-bottom-3-important margin-top-0-important">
<p className="page-explainer margin-bottom-3-important margin-top-0-important">
<strong>Query: </strong>
<span className="text-normal display-inline-block">
{demoQueryValToLabelMap[selectedQuery]}
</span>
</h2>
</p>

<div className=" grid-container grid-row grid-gap-md padding-0 ">
<div className="tablet:grid-col-3">
Expand Down
4 changes: 2 additions & 2 deletions query-connector/src/app/query/components/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { UseCaseQueryResponse, UseCaseQuery } from "@/app/query-service";
import { fhirServers } from "@/app/fhir-servers";
import styles from "./searchForm/searchForm.module.scss";
import { FormatPhoneAsDigits } from "@/app/format-service";
import { PAGE_TITLES } from "@/app/query/stepIndicator/StepIndicator";
import { PAGE_TITLES } from "@/app/query/components/stepIndicator/StepIndicator";

interface SearchFormProps {
useCase: USE_CASES;
Expand Down Expand Up @@ -371,7 +371,7 @@ const SearchForm: React.FC<SearchFormProps> = ({
</div>
</div>
</Fieldset>
<button className="usa-button patient-search-button" type="submit">
<button className="usa-button margin-top-between-group" type="submit">
Search for patient
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import {
USE_CASES,
UseCaseToQueryName,
ValueSet,
} from "../constants";
import CustomizeQuery from "./components/CustomizeQuery";
import SelectSavedQuery from "./components/selectQuery/SelectSavedQuery";
} from "../../constants";
import CustomizeQuery from "./CustomizeQuery";
import SelectSavedQuery from "./selectQuery/SelectSavedQuery";

import { QueryResponse } from "@/app/query-service";
import { Patient } from "fhir/r4";
import {
fetchQueryResponse,
fetchUseCaseValueSets,
} from "./components/selectQuery/queryHooks";
import LoadingView from "./components/LoadingView";
} from "./selectQuery/queryHooks";
import LoadingView from "./LoadingView";

interface SelectQueryProps {
goForward: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const CustomizeQueryAccordionBody: React.FC<
> = ({ group, toggleInclude, groupIndex }) => {
return (
<Table className={`${styles.customizeQueryGridContainer}`}>
<thead className={` margin-top-10`}>
<thead>
<tr className={styles.customizeQueryGridHeader}>
<th className={`${styles.accordionTableHeader}`}>Include</th>
<th className={`${styles.accordionTableHeader}`}>Code</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,20 @@ export const mapValueSetsToValueSetType = (valueSets: ValueSet[]) => {

return results;
};

fzhao99 marked this conversation as resolved.
Show resolved Hide resolved
/**
* Utility function to count the number of labs / meds / conditions that we display
* on the customize query page
* @param obj a grouped ValueSet dictionary that we render as an individual accordion
* @returns A count of the number of items in each of the DibbsConceptTypes
*/
export const countDibbsConceptTypeToVsMapItems = (obj: {
[vsNameAuthorSystem: string]: GroupedValueSet;
}) => {
return Object.values(obj).reduce((runningSum, gvs) => {
gvs.items.forEach((vs) => {
runningSum += vs.concepts.length;
});
return runningSum;
}, 0);
};
56 changes: 56 additions & 0 deletions query-connector/src/app/query/components/header/header.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,60 @@
color: white !important;
padding: 0px !important;
font: inherit !important;
margin-right: 1rem !important;
}

.signinButton {
padding: 0.75rem 1.25rem !important;
cursor: pointer;
background: none !important;
border: 2px solid white !important;
border-radius: 4px !important;
color: white !important;
font: inherit !important;
}

.menuButton {
cursor: pointer;
background: none !important;
border: none !important;
color: white !important;
padding: 0px !important;
font: inherit !important;
margin: 0 !important;
height: 1.5rem !important;
width: 1.5rem !important;
}

.menuDropdownContainer {
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: center;
}

.menuDropdown {
border-radius: 4px !important;
padding: 0.5rem !important;
background: #ffffff !important;
margin: 3.5rem 3rem 0rem 0rem !important;
width: 10rem !important;
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.16);
}

.menuItem {
color: black !important;
text-decoration: none !important;
padding: 0.5rem 1rem !important;
cursor: pointer;
}

.menuItem:hover {
text-decoration: none !important;
}

.headerContentContainer {
fzhao99 marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
align-items: center !important;
justify-content: space-between;
}
109 changes: 89 additions & 20 deletions query-connector/src/app/query/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,104 @@

import { useEffect, useRef, useState } from "react";
import { Modal, ModalButton } from "../../designSystem/Modal";
import { ModalRef } from "@trussworks/react-uswds";
import { useRouter, usePathname } from "next/navigation";
import { Button, Icon, ModalRef } from "@trussworks/react-uswds";
import styles from "./header.module.css";
import { metadata } from "@/app/constants";
import classNames from "classnames";
/**
* Produces the header.
* @returns The HeaderComponent component.
*/
export default function HeaderComponent() {
const modalRef = useRef<ModalRef>(null);
const [isClient, setIsClient] = useState(false);
const [showMenu, setShowMenu] = useState(false);

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

const router = useRouter();
const path = usePathname();

const handleClick = () => {
router.push(`/signin`);
};

const toggleMenuDropdown = () => {
setShowMenu(!showMenu);
};
const backLink =
process.env.NODE_ENV === "production" ? "/tefca-viewer" : "/";

const isProduction = process.env.NODE_ENV === "production";
fzhao99 marked this conversation as resolved.
Show resolved Hide resolved

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",
}}
className={classNames(
fzhao99 marked this conversation as resolved.
Show resolved Hide resolved
"header-footer-content",
"usa-nav-container",
styles.headerContentContainer,
)}
>
<div style={{ display: "flex", alignItems: "center" }}>
<div className="usa-logo" style={{ marginLeft: "16px" }}>
<div className={classNames("display-flex", "flex-align-center")}>
<div className="usa-logo margin-left-1">
<em className="usa-logo__text text-base-lightest">
<a
className="text-base-lightest font-sans-xl text-bold"
href="/tefca-viewer"
title={metadata.title}
>
<a className="siteTitle" href={backLink} title={metadata.title}>
{metadata.title}
</a>
</em>
</div>
</div>
<div
style={{
whiteSpace: "nowrap",
textAlign: "right",
marginLeft: "auto",
}}
className={classNames(
"margin-left-auto",
"display-flex",
"flex-align-center",
)}
>
{isClient && (
{path != "/signin" && isClient && (
<ModalButton
modalRef={modalRef}
title={"Data Usage Policy"}
className={styles.dataUsagePolicyButton}
/>
)}
{/* TODO: Rework show/hide rules based on actual auth status */}
{path != "/signin" && !LOGGED_IN_PATHS.includes(path) && (
fzhao99 marked this conversation as resolved.
Show resolved Hide resolved
<Button
className={styles.signinButton}
type="button"
id="signin-button"
title={"Sign in button"}
onClick={() => handleClick()}
>
Sign in
</Button>
)}
{LOGGED_IN_PATHS.includes(path) && (
<button
onClick={toggleMenuDropdown}
className={classNames(
styles.menuButton,
"usa-accordion__button",
"usa-nav__link",
"usa-current",
)}
aria-expanded="false"
aria-controls="dropdown-menu"
>
<Icon.Settings
className="usa-icon qc-settings"
size={3}
color="#fff"
aria-label="Gear icon indicating settings menu"
/>
</button>
)}
</div>
</div>
</header>
Expand All @@ -67,6 +112,30 @@ export default function HeaderComponent() {
description="It's not! Data inputted into the TEFCA Query Connector is not persisted or stored anywhere."
></Modal>
)}

{showMenu && (
<div className={styles.menuDropdownContainer}>
<ul
id="dropdown-menu"
className={`usa-nav__submenu ${styles.menuDropdown}`}
>
{!isProduction && (
<li className={`usa-nav__submenu-item`}>
<a className={styles.menuItem} href={"/queryBuilding"}>
My queries
</a>
</li>
)}
<li className={`usa-nav__submenu-item`}>
<a className={styles.menuItem} href={backLink}>
Log out
</a>
</li>
</ul>
</div>
)}
</>
);
}

const LOGGED_IN_PATHS = ["/query", "/queryBuilding"];
Loading
Loading