"use client" import { useState } from "react" import { Minus, Plus } from "lucide-react" import { cn } from "@/lib/utils" import { Badge } from "@/components/ui/badge" import { LevelType } from "@/features/logs/types" import { JobLog } from "@/db/schema/17_job-log" import { formatLocalizedDate } from "@/utils/date-formatting" import { formatDuration } from "@/utils/text" const levelLabel: Record = { info: "Info", debug: "Debug", error: "Error", warn: "Warning", } function TypeBadge({ entry }: { entry: JobLog }) { const isCommand = entry.entryType === "command" const label = isCommand ? "Command" : levelLabel[entry.level] const styles = isCommand ? "border-transparent bg-secondary text-secondary-foreground" : entry.level === "error" ? "border-transparent bg-destructive/20 text-destructive" : entry.level === "warn" ? "border-transparent bg-amber-500/20 text-amber-600 dark:text-amber-300" : entry.level === "debug" ? "border-transparent bg-muted text-muted-foreground" : "border-transparent bg-sky-500/20 text-sky-600 dark:text-sky-300" return ( {label} ) } export function LogRow({ entry }: { entry: JobLog }) { const [open, setOpen] = useState(true) const isCommand = entry.entryType === "command" const date = formatLocalizedDate(entry.loggedAt) const accent = entry.level === "error" ? "bg-destructive" : entry.level === "warn" ? "bg-amber-500" : isCommand ? "bg-emerald-500" : "bg-sky-500" return (
) }