diff --git a/.prettierrc b/.prettierrc index 0ba8bf09..d0afb198 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,7 +6,7 @@ "experimentalTernaries": false, "singleQuote": true, "jsxSingleQuote": false, - "quoteProps": "consistent", + "quoteProps": "as-needed", "trailingComma": "es5", "singleAttributePerLine": false, "htmlWhitespaceSensitivity": "css", diff --git a/src/components/direct/hisp/TestCard.tsx b/src/components/direct/hisp/TestCard.tsx index cb0a340f..edf7b037 100644 --- a/src/components/direct/hisp/TestCard.tsx +++ b/src/components/direct/hisp/TestCard.tsx @@ -1,5 +1,4 @@ import DynamicTable from './DynamicTable' -import InfoIcon from '@mui/icons-material/Info' import _ from 'lodash' import React, { useState } from 'react' import DocumentSelector from './DocumentSelector' @@ -23,6 +22,7 @@ import { Checkbox, TextField, SelectChangeEvent, + Popover, } from '@mui/material' export type TestCaseFields = { @@ -100,6 +100,10 @@ const TestCard = ({ tlsRequired = false, receive, }: TestCardProps) => { + const [popoverAnchorEl, setPopoverAnchorEl] = useState(null) + const popoverOpen = Boolean(popoverAnchorEl) + const popoverId = popoverOpen ? 'ccda-file-required-popover' : undefined + const [autoCloseTimer, setAutoCloseTimer] = useState(null) const attachmentTypeTestIDs = [231, 331] const manualValidationCriteria = [ "['b1-5']", @@ -118,7 +122,6 @@ const TestCard = ({ const [isFinished, setIsFinished] = useState(false) const [apiError, setApiError] = useState(false) const [attachmentType, setAttachmentType] = useState('') - const apiUrl = process.env.CCDA_DOCUMENTS || 'https://ett.healthit.gov/ett/api/ccdadocuments' const handleDocumentConfirm = (selectedData: SelectedDocument) => { console.log('Confirmed Document', selectedData) @@ -194,9 +197,21 @@ const TestCard = ({ setFormData((prev) => ({ ...prev, [name]: value })) } + const handleClosePopover = () => { + if (autoCloseTimer) { + clearTimeout(autoCloseTimer) + setAutoCloseTimer(null) + } + setPopoverAnchorEl(null) + } + const handleRunTest = async () => { if (test.ccdaFileRequired && !documentDetails) { - alert('This test requires a CCDA document to be selected. Please select a document before running the test.') + setPopoverAnchorEl(document.activeElement as HTMLButtonElement) + const timer = setTimeout(() => { + handleClosePopover() + }, 2500) + setAutoCloseTimer(timer) } else { try { setIsLoading(true) @@ -294,7 +309,25 @@ const TestCard = ({ - + {} + + + This test requires a CCDA document to be selected. Please select a document before running the test. + + {showDetail ? ( <> @@ -353,10 +386,10 @@ const TestCard = ({ diff --git a/src/components/direct/test-by-criteria/ServerActions.ts b/src/components/direct/test-by-criteria/ServerActions.ts index 51c92c43..e733fb42 100644 --- a/src/components/direct/test-by-criteria/ServerActions.ts +++ b/src/components/direct/test-by-criteria/ServerActions.ts @@ -131,6 +131,7 @@ export async function handleXDRAPICall(data: XDRAPICallData): Promise