Skip to content

Commit

Permalink
CORE-2002 Replace dashboard AnalysisSubheader with countdown
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
psarando committed Aug 9, 2024
1 parent ef06057 commit e3ae2ff
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/components/dashboard/dashboardItem/ItemBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -117,11 +117,17 @@ const DashboardItem = ({ item }) => {
classes: { colorPrimary: classes.cardHeaderText },
}}
subheader={
item.kind === constants.KIND_ANALYSES ? (
<AnalysisSubheader
analysis={item.content}
date={date}
/>
isAnalysis ? (
timeLimitCountdown ? (
t("analyses:timeLimitCountdown", {
timeLimitCountdown,
})
) : (
<AnalysisSubheader
analysis={item.content}
date={date}
/>
)
) : (
t("origination", {
origination,
Expand All @@ -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 && (
<CardHeader
className={running.backdrop}
title={t("analyses:timeLimitCountdown", {
timeLimitCountdown,
})}
titleTypographyProps={{
noWrap: true,
variant: "subtitle2",
style: { color: theme.palette.primary.main },
}}
/>
)}
<CardContent
classes={{
root: classes.root,
Expand Down

0 comments on commit e3ae2ff

Please sign in to comment.