feat(MED-105): show analysis date in tooltip for now

This commit is contained in:
2025-08-11 09:21:33 +03:00
parent 37f233e363
commit 556d7bd321
4 changed files with 20 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
'use client'; 'use client';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { format } from 'date-fns';
import { Info } from 'lucide-react'; import { Info } from 'lucide-react';
@@ -61,6 +62,7 @@ const Analysis = ({
<div className="border-border items-center justify-between rounded-lg border px-5 py-3 sm:h-[65px] flex flex-col sm:flex-row px-12 gap-2 sm:gap-0"> <div className="border-border items-center justify-between rounded-lg border px-5 py-3 sm:h-[65px] flex flex-col sm:flex-row px-12 gap-2 sm:gap-0">
<div className="flex items-center gap-2 font-semibold"> <div className="flex items-center gap-2 font-semibold">
{name} {name}
{results?.response_time && (
<div <div
className="group/tooltip relative" className="group/tooltip relative"
onClick={() => setShowTooltip(!showTooltip)} onClick={() => setShowTooltip(!showTooltip)}
@@ -73,9 +75,10 @@ const Analysis = ({
{ block: showTooltip }, { block: showTooltip },
)} )}
> >
This text changes when you hover the box above. <Trans i18nKey="analysis-results:analysisDate" />{': '}{format(new Date(results.response_time), 'dd.MM.yyyy HH:mm')}
</div> </div>
</div> </div>
)}
</div> </div>
{results ? ( {results ? (
<> <>

View File

@@ -51,16 +51,12 @@ async function AnalysisResultsPage() {
const analysisElements = await getAnalysisElements({ ids: analysisElementIds }); const analysisElements = await getAnalysisElements({ ids: analysisElementIds });
const analysisElementsWithResults = analysisResponseElements const analysisElementsWithResults = analysisResponseElements
?.sort((a, b) => { ?.sort((a, b) => {
if (!a.updated_at || !b.updated_at) { if (!a.response_time || !b.response_time) {
return 0; return 0;
} }
return new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(); return new Date(b.response_time).getTime() - new Date(a.response_time).getTime();
}) })
.map((results) => { .map((results) => ({ results })) ?? [];
return {
results,
}
}) ?? [];
const analysisElementsWithoutResults = analysisElements const analysisElementsWithoutResults = analysisElements
.filter((element) => !analysisElementsWithResults?.some(({ results }) => results.analysis_element_original_id === element.analysis_id_original)); .filter((element) => !analysisElementsWithResults?.some(({ results }) => results.analysis_element_original_id === element.analysis_id_original));

View File

@@ -5,6 +5,7 @@
"orderNewAnalysis": "Order new analyses", "orderNewAnalysis": "Order new analyses",
"waitingForResults": "Waiting for results", "waitingForResults": "Waiting for results",
"noAnalysisElements": "No analysis orders found", "noAnalysisElements": "No analysis orders found",
"analysisDate": "Analysis result date",
"results": { "results": {
"range": { "range": {
"normal": "Normal range" "normal": "Normal range"

View File

@@ -5,6 +5,7 @@
"orderNewAnalysis": "Telli uued analüüsid", "orderNewAnalysis": "Telli uued analüüsid",
"waitingForResults": "Tulemuse ootel", "waitingForResults": "Tulemuse ootel",
"noAnalysisElements": "Veel ei ole tellitud analüüse", "noAnalysisElements": "Veel ei ole tellitud analüüse",
"analysisDate": "Analüüsi vastuse kuupäev",
"results": { "results": {
"range": { "range": {
"normal": "Normaalne vahemik" "normal": "Normaalne vahemik"