feat(MED-105): show analysis date in tooltip for now
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
import { Info } from 'lucide-react';
|
||||
|
||||
@@ -61,21 +62,23 @@ 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="flex items-center gap-2 font-semibold">
|
||||
{name}
|
||||
<div
|
||||
className="group/tooltip relative"
|
||||
onClick={() => setShowTooltip(!showTooltip)}
|
||||
onMouseLeave={() => setShowTooltip(false)}
|
||||
>
|
||||
<Info className="hover" />{' '}
|
||||
{results?.response_time && (
|
||||
<div
|
||||
className={cn(
|
||||
'absolute bottom-full left-1/2 z-10 mb-2 hidden -translate-x-1/2 rounded border bg-white p-4 text-sm whitespace-nowrap group-hover/tooltip:block',
|
||||
{ block: showTooltip },
|
||||
)}
|
||||
className="group/tooltip relative"
|
||||
onClick={() => setShowTooltip(!showTooltip)}
|
||||
onMouseLeave={() => setShowTooltip(false)}
|
||||
>
|
||||
This text changes when you hover the box above.
|
||||
<Info className="hover" />{' '}
|
||||
<div
|
||||
className={cn(
|
||||
'absolute bottom-full left-1/2 z-10 mb-2 hidden -translate-x-1/2 rounded border bg-white p-4 text-sm whitespace-nowrap group-hover/tooltip:block',
|
||||
{ block: showTooltip },
|
||||
)}
|
||||
>
|
||||
<Trans i18nKey="analysis-results:analysisDate" />{': '}{format(new Date(results.response_time), 'dd.MM.yyyy HH:mm')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{results ? (
|
||||
<>
|
||||
|
||||
@@ -51,16 +51,12 @@ async function AnalysisResultsPage() {
|
||||
const analysisElements = await getAnalysisElements({ ids: analysisElementIds });
|
||||
const analysisElementsWithResults = analysisResponseElements
|
||||
?.sort((a, b) => {
|
||||
if (!a.updated_at || !b.updated_at) {
|
||||
if (!a.response_time || !b.response_time) {
|
||||
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) => {
|
||||
return {
|
||||
results,
|
||||
}
|
||||
}) ?? [];
|
||||
.map((results) => ({ results })) ?? [];
|
||||
const analysisElementsWithoutResults = analysisElements
|
||||
.filter((element) => !analysisElementsWithResults?.some(({ results }) => results.analysis_element_original_id === element.analysis_id_original));
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"orderNewAnalysis": "Order new analyses",
|
||||
"waitingForResults": "Waiting for results",
|
||||
"noAnalysisElements": "No analysis orders found",
|
||||
"analysisDate": "Analysis result date",
|
||||
"results": {
|
||||
"range": {
|
||||
"normal": "Normal range"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"orderNewAnalysis": "Telli uued analüüsid",
|
||||
"waitingForResults": "Tulemuse ootel",
|
||||
"noAnalysisElements": "Veel ei ole tellitud analüüse",
|
||||
"analysisDate": "Analüüsi vastuse kuupäev",
|
||||
"results": {
|
||||
"range": {
|
||||
"normal": "Normaalne vahemik"
|
||||
|
||||
Reference in New Issue
Block a user