From a43756c5052e0f7e39e368f2187527ff413aee4e Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Fri, 12 Apr 2024 04:36:31 -0700 Subject: [PATCH 1/4] button updates --- src/components/DisplayBox/DisplayBox.jsx | 147 +++++++++++++++-------- 1 file changed, 97 insertions(+), 50 deletions(-) diff --git a/src/components/DisplayBox/DisplayBox.jsx b/src/components/DisplayBox/DisplayBox.jsx index a8d9265..9dbd726 100644 --- a/src/components/DisplayBox/DisplayBox.jsx +++ b/src/components/DisplayBox/DisplayBox.jsx @@ -1,11 +1,21 @@ import React, { useEffect, useState } from 'react'; import './card-list.css'; -import { Button, Card, CardActions, CardContent, Typography } from '@mui/material'; +import { Button, Box, Card, CardActions, CardContent, Typography } from '@mui/material'; import axios from 'axios'; import ReactMarkdown from 'react-markdown'; import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf'; import { retrieveLaunchContext } from '../../util/util'; import './displayBox.css'; +import ArrowForwardIosRoundedIcon from '@mui/icons-material/ArrowForwardIosRounded'; +import Accordion from '@mui/material/Accordion'; +import AccordionSummary from '@mui/material/AccordionSummary'; +import AccordionDetails from '@mui/material/AccordionDetails'; +import KeyboardArrowDownRoundedIcon from '@mui/icons-material/KeyboardArrowDownRounded'; +import List from '@mui/material/List'; +import ListItem from '@mui/material/ListItem'; +import AddCircleOutlineRoundedIcon from '@mui/icons-material/AddCircleOutlineRounded'; + + const DisplayBox = props => { const [state, setState] = useState({ smartLink: '', response: {} }); @@ -54,6 +64,8 @@ const DisplayBox = props => { const element = document.getElementById(buttonId); element.setAttribute('disabled', 'true'); element.setAttribute('style', 'background-color:#4BB543;'); + element.setAttribute('style', ); + } if (suggestion.label) { @@ -182,7 +194,7 @@ const DisplayBox = props => { } if (!isDemoCard) { return ( -
+
Source:{' '} { card.suggestions.forEach((item, ind) => { var buttonId = 'suggestion_button-' + cardInd + '-' + ind; buttonList.push(buttonId); - suggestionsSection.push( - + + + ); }); } @@ -276,45 +289,79 @@ const DisplayBox = props => { linksSection = card.links.map((link, ind) => { if (link.type === 'smart') { return ( - + + + ); } + }); + } + + let documentationSection; + if (card.links) { + card.links = modifySmartLaunchUrls(card) || card.links; + documentationSection = card.links.map((link, ind) => { const pdfIcon = ; - return ( - - ); + if (link.type === 'absolute') { + return ( + + + + + + ); + } }); } const cardSectionHeaderStyle = { marginBottom: '2px', color: 'black' }; const builtCard = ( - - - - - Summary - - - {summarySection} - -
- - Details - - {detailSection} -
- - {sourceSection} - -
- {linksSection} - {suggestionsSection} -
+ + + + + + {summarySection} + + + Required Forms + + {detailSection} + {linksSection} + + Add To Task List + + {suggestionsSection} + + + } > + View documentation and guides + + + {documentationSection} + + + + {sourceSection} + + + + ); From 44760648a606029d0e1bbfaef6642c5c648f9d20 Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Fri, 17 May 2024 09:45:54 -0700 Subject: [PATCH 2/4] Updated headers to hide when no links returned --- src/components/DisplayBox/DisplayBox.jsx | 75 +++++++++++++++--------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/src/components/DisplayBox/DisplayBox.jsx b/src/components/DisplayBox/DisplayBox.jsx index 9dbd726..54f2744 100644 --- a/src/components/DisplayBox/DisplayBox.jsx +++ b/src/components/DisplayBox/DisplayBox.jsx @@ -6,7 +6,7 @@ import ReactMarkdown from 'react-markdown'; import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf'; import { retrieveLaunchContext } from '../../util/util'; import './displayBox.css'; -import ArrowForwardIosRoundedIcon from '@mui/icons-material/ArrowForwardIosRounded'; +import ArrowForwardRoundedIcon from '@mui/icons-material/ArrowForwardRounded'; import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; @@ -64,7 +64,7 @@ const DisplayBox = props => { const element = document.getElementById(buttonId); element.setAttribute('disabled', 'true'); element.setAttribute('style', 'background-color:#4BB543;'); - element.setAttribute('style', ); + element.setAttribute('style',); } @@ -260,7 +260,7 @@ const DisplayBox = props => { buttonList.push(buttonId); suggestionsSection.push( - @@ -283,12 +282,12 @@ const DisplayBox = props => { } // -- Links -- - let linksSection; + let linksSection = []; if (card.links) { card.links = modifySmartLaunchUrls(card) || card.links; - linksSection = card.links.map((link, ind) => { + card.links.map((link, ind) => { if (link.type === 'smart') { - return ( + linksSection.push( @@ -331,31 +330,49 @@ const DisplayBox = props => { const cardSectionHeaderStyle = { marginBottom: '2px', color: 'black' }; const builtCard = ( - - + + {summarySection} - - Required Forms - - {detailSection} - {linksSection} - - Add To Task List - - {suggestionsSection} - - - } > - View documentation and guides - - - {documentationSection} - - + + + {/* Forms */} + {linksSection.length !== 0 ? +
+ + Required Forms + + {detailSection} + {linksSection} +
+ : + <> + } + + {/* Suggestions */} + {suggestionsSection.length !== 0 ? +
+ + Suggestions + + {suggestionsSection} +
+ : + <> + } + + {/* Documentation and Guides */} + + } > + View documentation and guides + + + {documentationSection} + + {sourceSection} From ea212672db7ee634884a42ce7a73c8c22a747e40 Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Mon, 20 May 2024 07:59:32 -0700 Subject: [PATCH 3/4] prettier + ability to hide guides if empty --- src/components/DisplayBox/DisplayBox.jsx | 108 +++++++++++++++-------- 1 file changed, 69 insertions(+), 39 deletions(-) diff --git a/src/components/DisplayBox/DisplayBox.jsx b/src/components/DisplayBox/DisplayBox.jsx index 54f2744..87975ec 100644 --- a/src/components/DisplayBox/DisplayBox.jsx +++ b/src/components/DisplayBox/DisplayBox.jsx @@ -15,8 +15,6 @@ import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import AddCircleOutlineRoundedIcon from '@mui/icons-material/AddCircleOutlineRounded'; - - const DisplayBox = props => { const [state, setState] = useState({ smartLink: '', response: {} }); const { isDemoCard, fhirAccessToken, ehrLaunch, patientId, client, response } = props; @@ -64,8 +62,7 @@ const DisplayBox = props => { const element = document.getElementById(buttonId); element.setAttribute('disabled', 'true'); element.setAttribute('style', 'background-color:#4BB543;'); - element.setAttribute('style',); - + element.setAttribute('style'); } if (suggestion.label) { @@ -260,7 +257,9 @@ const DisplayBox = props => { buttonList.push(buttonId); suggestionsSection.push( - @@ -289,14 +289,21 @@ const DisplayBox = props => { if (link.type === 'smart') { linksSection.push( - @@ -313,11 +320,17 @@ const DisplayBox = props => { if (link.type === 'absolute') { return ( - - @@ -330,7 +343,12 @@ const DisplayBox = props => { const cardSectionHeaderStyle = { marginBottom: '2px', color: 'black' }; const builtCard = ( - + @@ -338,41 +356,53 @@ const DisplayBox = props => { {summarySection} - {/* Forms */} - {linksSection.length !== 0 ? + {linksSection.length !== 0 ? (
- - Required Forms - + Required Forms {detailSection} {linksSection}
- : + ) : ( <> - } + )} {/* Suggestions */} - {suggestionsSection.length !== 0 ? + {suggestionsSection.length !== 0 ? (
- + Suggestions {suggestionsSection}
- : + ) : ( <> - } + )} {/* Documentation and Guides */} - - } > - View documentation and guides - - - {documentationSection} - - + {documentationSection.length !== 0 ? ( + + }> + + View documentation and guides + + + + {documentationSection} + + + ) : ( + <> + )} + {sourceSection} From ac3ad711dc96f9df8f40812edb05f75556f83c2e Mon Sep 17 00:00:00 2001 From: Zach Robin Date: Mon, 20 May 2024 08:51:42 -0700 Subject: [PATCH 4/4] fixed issue with Turalio empty documents section --- src/components/DisplayBox/DisplayBox.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/DisplayBox/DisplayBox.jsx b/src/components/DisplayBox/DisplayBox.jsx index 87975ec..04b37a9 100644 --- a/src/components/DisplayBox/DisplayBox.jsx +++ b/src/components/DisplayBox/DisplayBox.jsx @@ -312,13 +312,13 @@ const DisplayBox = props => { }); } - let documentationSection; + let documentationSection = []; + const pdfIcon = ; if (card.links) { card.links = modifySmartLaunchUrls(card) || card.links; - documentationSection = card.links.map((link, ind) => { - const pdfIcon = ; + card.links.map((link, ind) => { if (link.type === 'absolute') { - return ( + documentationSection.push(