Add tooltip for icons in review event list (#13334)

This commit is contained in:
Nicolas Mowen 2024-08-25 06:57:10 -06:00
parent 70aab068fd
commit 190ce5ee31

View File

@ -32,6 +32,8 @@ import { Drawer, DrawerContent } from "../ui/drawer";
import axios from "axios"; import axios from "axios";
import { toast } from "sonner"; import { toast } from "sonner";
import useKeyboardListener from "@/hooks/use-keyboard-listener"; import useKeyboardListener from "@/hooks/use-keyboard-listener";
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip";
import { capitalizeFirstLetter } from "@/utils/stringUtil";
type ReviewCardProps = { type ReviewCardProps = {
event: ReviewSegment; event: ReviewSegment;
@ -153,21 +155,43 @@ export default function ReviewCard({
}} }}
/> />
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center justify-evenly gap-1"> <Tooltip>
{event.data.objects.map((object) => { <TooltipTrigger asChild>
return getIconForLabel( <div className="flex items-center justify-evenly gap-1">
object, <>
"size-3 text-primary dark:text-white", {event.data.objects.map((object) => {
); return getIconForLabel(
})} object,
{event.data.audio.map((audio) => { "size-3 text-primary dark:text-white",
return getIconForLabel( );
audio, })}
"size-3 text-primary dark:text-white", {event.data.audio.map((audio) => {
); return getIconForLabel(
})} audio,
<div className="font-extra-light text-xs">{formattedDate}</div> "size-3 text-primary dark:text-white",
</div> );
})}
</>
<div className="font-extra-light text-xs">{formattedDate}</div>
</div>
</TooltipTrigger>
<TooltipContent className="capitalize">
{[
...new Set([
...(event.data.objects || []),
...(event.data.sub_labels || []),
...(event.data.audio || []),
]),
]
.filter(
(item) => item !== undefined && !item.includes("-verified"),
)
.map((text) => capitalizeFirstLetter(text))
.sort()
.join(", ")
.replaceAll("-verified", "")}
</TooltipContent>
</Tooltip>
<TimeAgo <TimeAgo
className="text-xs text-muted-foreground" className="text-xs text-muted-foreground"
time={event.start_time * 1000} time={event.start_time * 1000}