-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add navigation back to search results (#2305)
* move Mode to constants & add multiple-patients-results Mode * add context for Mode constant * rename component to ResultsView * ensure unique keys * add Mode import from constants * add goBack button & setSingleUseCaseRequest * [pre-commit.ci] auto fixes from pre-commit hooks * linting * [pre-commit.ci] auto fixes from pre-commit hooks * update source of Mode * formatting * [pre-commit.ci] auto fixes from pre-commit hooks * add separate button to go back to multiple patients * [pre-commit.ci] auto fixes from pre-commit hooks * update docstring + props * update tests * [pre-commit.ci] auto fixes from pre-commit hooks * add test for returning multiple patients * [pre-commit.ci] auto fixes from pre-commit hooks * add test for new buttons * [pre-commit.ci] auto fixes from pre-commit hooks * add documentation for running a specific test by name --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8866dc8
commit 87e27f8
Showing
11 changed files
with
161 additions
and
66 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
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
2 changes: 1 addition & 1 deletion
2
containers/tefca-viewer/src/app/query/components/NoPatientsFound.tsx
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 |
---|---|---|
|
@@ -2,24 +2,26 @@ import { UseCaseQueryResponse } from "../../query-service"; | |
import AccordionContainer from "./AccordionContainer"; | ||
import SideNav from "./SideNav"; | ||
import React, { useEffect } from "react"; | ||
import { Mode } from "../page"; | ||
import { Alert } from "@trussworks/react-uswds"; | ||
import { Alert, Icon } from "@trussworks/react-uswds"; | ||
|
||
type QueryViewProps = { | ||
type ResultsViewProps = { | ||
useCaseQueryResponse: UseCaseQueryResponse; | ||
setMode: (mode: Mode) => void; | ||
goBack: () => void; | ||
goBackToMultiplePatients?: () => void; | ||
}; | ||
|
||
/** | ||
* The QueryView component to render the query results. | ||
* @param props - The props for the QueryView component. | ||
* @param props.useCaseQueryResponse - The response from the query service. | ||
* @param props.setMode - The function to set the mode of the query page. | ||
* @param props.goBack - The function to go back to the previous page. | ||
* @param props.goBackToMultiplePatients - The function to go back to the multiple patients selection page. | ||
* @returns The QueryView component. | ||
*/ | ||
const QueryView: React.FC<QueryViewProps> = ({ | ||
const ResultsView: React.FC<ResultsViewProps> = ({ | ||
useCaseQueryResponse, | ||
setMode, | ||
goBack, | ||
goBackToMultiplePatients, | ||
}) => { | ||
useEffect(() => { | ||
window.scrollTo(0, 0); | ||
|
@@ -40,10 +42,25 @@ const QueryView: React.FC<QueryViewProps> = ({ | |
[email protected] | ||
</a> | ||
</Alert> | ||
|
||
<div className="results-banner"> | ||
<div className="results-banner-content usa-nav-container"> | ||
<a href="#" onClick={() => setMode("search")}> | ||
Return to search | ||
{goBackToMultiplePatients && ( | ||
<> | ||
<a | ||
href="#" | ||
onClick={() => goBackToMultiplePatients()} | ||
className="back-link" | ||
> | ||
<Icon.ArrowBack /> | ||
Return to search results | ||
</a> | ||
<div className="results-banner-divider">|</div> | ||
</> | ||
)} | ||
|
||
<a href="#" onClick={() => goBack()} className="back-link"> | ||
New patient search | ||
</a> | ||
</div> | ||
</div> | ||
|
@@ -69,4 +86,4 @@ const QueryView: React.FC<QueryViewProps> = ({ | |
</> | ||
); | ||
}; | ||
export default QueryView; | ||
export default ResultsView; |
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
Oops, something went wrong.