/** biome-ignore-all lint/security/noDangerouslySetInnerHtml: log HTML is generated locally by Shiki */ import { t } from "@lingui/core/macro" import { useStore } from "@nanostores/react" import { ClockIcon, RefreshCwIcon } from "lucide-react" import { type ComponentProps, type FocusEvent, type RefObject, useEffect, useRef } from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogTitle, dialogIconButtonClassName } from "@/components/ui/dialog" import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip" import { $showLogTimestamps, toggleLogTimestamps } from "@/lib/stores" import { cn } from "@/lib/utils" type LogsDisplayProps = { logsDisplay: string containerRef: RefObject } // Radix opens a tooltip on any focus, including when a sheet or dialog moves focus to // the button on open / close. Limit it to keyboard focus. function keyboardFocusOnly(e: FocusEvent) { if (!e.currentTarget.matches(":focus-visible")) { e.preventDefault() } } // Icon button with a tooltip, used in the log panel headers. export function LogsIconButton({ label, className, ...props }: { label: string } & ComponentProps) { return ( {t`Refresh`} ) }