Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat(severity-indicator): adjusted logic for getting thermometer time…
Browse files Browse the repository at this point in the history
…line event title and description from the associated level definition rather than the event itself; adjusted tooltip content to properly show the updated contents;
  • Loading branch information
VWSCoronaDashboard26 committed Dec 14, 2022
1 parent b575db5 commit de89714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ export const TimelineTooltipContent = ({ config, hasMultipleEvents, onNext, onPr
<BoldText>{config.title}</BoldText>
</Box>

<Text variant="label1">{config.description}</Text>
<Text variant="label1">
{replaceVariablesInText(config.description.split('**').join(''), {
label: config.title.toLowerCase(),
})}
</Text>

{currentEstimationLabel && (
<Box textVariant="label1">
Expand Down
10 changes: 3 additions & 7 deletions packages/app/src/queries/get-topical-structure-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,12 @@ export function getTopicalStructureQuery(locale: string) {
}

export const getThermometerEvents = (thermometerEvents: ThermometerTimelineEvent[], thermometerLevels: ThermometerLevel[]) => {
// 1. USE thermometerEvent.level TO FIND level IN thermometerLevels
// 2. USE level TO REFERENCE level.title AND level.description

return thermometerEvents.map<SeverityIndicatorTimelineEventConfig>((thermometerEvent) => {
// STEP 1 GOES HERE
const currentLevel = thermometerLevels?.find((thermometerLevel) => thermometerLevel.level === (thermometerEvent.level as SeverityLevel));
const levelDetails = thermometerLevels.find((thermometerLevel) => thermometerLevel.level === (thermometerEvent.level as SeverityLevel)) as ThermometerLevel;

return {
title: currentLevel?.label ?? thermometerEvent.title, // STEP 2.1 - title
description: currentLevel?.description ?? thermometerEvent.description, // STEP 2.2 - description
title: levelDetails.label,
description: levelDetails.description,
level: thermometerEvent.level,
start: new Date(thermometerEvent.date).getTime() / 1000,
end: new Date(thermometerEvent.dateEnd).getTime() / 1000,
Expand Down

0 comments on commit de89714

Please sign in to comment.