From fcdff8bc9b56bc04bf5b5ce831e54bf2bf370636 Mon Sep 17 00:00:00 2001 From: syao1226 <146495172+syao1226@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:57:52 -0400 Subject: [PATCH] fix(app): fix highlighted style and text overlapping issues (#16097) fix RQA-2960 and RQA-3082 # Overview Fixed the highlighted blue when not hovered over the upload file box on desktop app. Also, fixed the texts overlapping issue happened when last run is "less than a minute ago" on ODD. ## Test Plan and Hands on Testing Highlighted style issue: - Click into the drag and drop box for importing a protocol file then exit the OS file browser. - View drag and drop box. - Dashed box would be set to unselected gray instead of highlighted blue. Text wrapping issue: - Run a protocol on ODD and then cancel the run. - Return to Protocol screen to ensure that the text "less than a minute ago" for last run is wrapped downward. ## Changelog - Removed the `focus-within` CSS psuedo class under CSS const `StyleLabel`. - Added a condition to display between 'normal' and 'nowrap' whiteSpace CSS property. ## Review requests ## Risk assessment --------- Co-authored-by: shiyaochen --- app/src/molecules/UploadInput/index.tsx | 3 +-- app/src/pages/ProtocolDashboard/ProtocolCard.tsx | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/molecules/UploadInput/index.tsx b/app/src/molecules/UploadInput/index.tsx index 62a6cccfe0e..9802f6d28b5 100644 --- a/app/src/molecules/UploadInput/index.tsx +++ b/app/src/molecules/UploadInput/index.tsx @@ -29,8 +29,7 @@ const StyledLabel = styled.label` text-align: ${TYPOGRAPHY.textAlignCenter}; background-color: ${COLORS.white}; - &:hover, - &:focus-within { + &:hover { border: 2px dashed ${COLORS.blue50}; } ` diff --git a/app/src/pages/ProtocolDashboard/ProtocolCard.tsx b/app/src/pages/ProtocolDashboard/ProtocolCard.tsx index ed29d904895..4016eae71ef 100644 --- a/app/src/pages/ProtocolDashboard/ProtocolCard.tsx +++ b/app/src/pages/ProtocolDashboard/ProtocolCard.tsx @@ -194,6 +194,15 @@ export function ProtocolCard(props: ProtocolCardProps): JSX.Element { if (isFailedAnalysis) protocolCardBackgroundColor = COLORS.red35 if (isRequiredCSV) protocolCardBackgroundColor = COLORS.yellow35 + const textWrap = (lastRun?: string): string => { + if (lastRun != null) { + lastRun = formatDistance(new Date(lastRun), new Date(), { + addSuffix: true, + }).replace('about ', '') + } + return lastRun === 'less than a minute ago' ? 'normal' : 'nowrap' + } + return ( - + {lastRun != null ? formatDistance(new Date(lastRun), new Date(), { addSuffix: true,