From e3ae2ffaa5e813f165f20e2a3ec4dd36eaabbd38 Mon Sep 17 00:00:00 2001 From: Paul Sarando Date: Fri, 9 Aug 2024 15:36:52 -0700 Subject: [PATCH] CORE-2002 Replace dashboard AnalysisSubheader with countdown Adding another CardHeader for the countdown timer can hide the actions at the bottom of the card, so replace the "Running" subheader with the countdown timer instead. --- .../dashboard/dashboardItem/ItemBase.js | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/components/dashboard/dashboardItem/ItemBase.js b/src/components/dashboard/dashboardItem/ItemBase.js index d3ab36a10..4047f96c6 100644 --- a/src/components/dashboard/dashboardItem/ItemBase.js +++ b/src/components/dashboard/dashboardItem/ItemBase.js @@ -83,9 +83,9 @@ const DashboardItem = ({ item }) => { const description = fns.cleanDescription(item.content.description); const [origination, date] = item.getOrigination(t); + const isAnalysis = item.kind === constants.KIND_ANALYSES; const isRunningAnalysis = - item.kind === "analyses" && - item.content.status === analysisStatus.RUNNING; + isAnalysis && item.content.status === analysisStatus.RUNNING; const { timeLimitCountdown } = useAnalysisTimeLimitCountdown( isRunningAnalysis && item.content @@ -117,11 +117,17 @@ const DashboardItem = ({ item }) => { classes: { colorPrimary: classes.cardHeaderText }, }} subheader={ - item.kind === constants.KIND_ANALYSES ? ( - + isAnalysis ? ( + timeLimitCountdown ? ( + t("analyses:timeLimitCountdown", { + timeLimitCountdown, + }) + ) : ( + + ) ) : ( t("origination", { origination, @@ -133,22 +139,14 @@ const DashboardItem = ({ item }) => { subheaderTypographyProps={{ noWrap: true, variant: "caption", - classes: { colorPrimary: classes.cardHeaderText }, + style: + isRunningAnalysis && timeLimitCountdown + ? { + color: theme.palette.primary.main, + } + : null, }} /> - {timeLimitCountdown && ( - - )}