Skip to content

Commit aa996d6

Browse files
mainawycliffemoshloop
authored andcommitted
fix: add tooltip for the canary history age column
Fixes #2335
1 parent 3a9a054 commit aa996d6

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/components/Canary/CanaryPopup/StatusHistory/StatusHistory.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ import {
33
HealthCheck,
44
HealthCheckStatus
55
} from "@flanksource-ui/api/types/health";
6+
import { formatDateForTooltip } from "@flanksource-ui/ui/Age/Age";
67
import { DataTable } from "@flanksource-ui/ui/DataTable";
78
import { CellContext, ColumnDef } from "@tanstack/react-table";
89
import clsx from "clsx";
10+
import dayjs from "dayjs";
911
import { useAtom } from "jotai";
1012
import React, { useEffect, useMemo, useState } from "react";
13+
import { Tooltip } from "react-tooltip";
1114
import { format } from "timeago.js";
1215
import { toastError } from "../../../Toast/toast";
1316
import { refreshCheckModalAtomTrigger } from "../../ChecksListing";
@@ -23,12 +26,19 @@ const columns: ColumnDef<HealthCheckStatus, any>[] = [
2326
{
2427
header: "Age",
2528
id: "age",
26-
cell: function AgeCell({
27-
row,
28-
getValue
29-
}: CellContext<HealthCheckStatus, any>) {
29+
cell: ({ row }) => {
3030
const status = row.original;
31-
return <>{format(`${status.time} UTC`)}</>;
31+
return (
32+
<>
33+
<span data-tooltip-id={`age-tooltip-${status.time}`}>
34+
{format(`${status.time} UTC`)}
35+
</span>
36+
<Tooltip
37+
id={`age-tooltip-${status.time}`}
38+
content={formatDateForTooltip(dayjs(status.time))}
39+
/>
40+
</>
41+
);
3242
},
3343
aggregatedCell: "",
3444
accessorKey: "time"

0 commit comments

Comments
 (0)