UNPKG

@flanksource/clicky-ui

Version:

Flanksource Clicky UI — React component library built on shadcn/ui with light/dark and density theming.

79 lines (78 loc) 3.2 kB
import { jsxs, jsx } from "react/jsx-runtime"; import { JvmStackTrace } from "./JvmStackTrace.js"; function threadStateBadge(state) { switch (state) { case "runnable": return "bg-green-50 text-green-700 dark:bg-green-500/20 dark:text-green-300"; case "blocked": return "bg-red-50 text-red-700 dark:bg-red-500/20 dark:text-red-300"; case "waiting": case "timed_waiting": return "bg-blue-50 text-blue-700 dark:bg-blue-500/20 dark:text-blue-300"; case "new": return "bg-amber-50 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300"; case "terminated": return "bg-muted text-muted-foreground"; default: return "bg-muted text-muted-foreground"; } } function threadStateDot(state) { switch (state) { case "runnable": return "bg-green-500"; case "blocked": return "bg-red-500"; case "waiting": case "timed_waiting": return "bg-blue-500"; case "new": return "bg-amber-500"; case "terminated": return "bg-muted-foreground/40"; default: return "bg-muted-foreground/40"; } } function ThreadCard({ thread, search, hideRuntimeOnly }) { const frames = hideRuntimeOnly ? thread.frames.filter((f) => f.kind !== "frame" || !f.runtime) : thread.frames; const defaultOpen = thread.state === "runnable" || thread.state === "blocked" || !!search; return /* @__PURE__ */ jsxs("details", { className: "border-0 bg-transparent", open: defaultOpen, children: [ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer list-none px-0 py-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [ /* @__PURE__ */ jsxs("span", { className: "font-mono text-xs font-semibold text-foreground", children: [ "#", thread.id ] }), /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-xs text-foreground", children: thread.name }), /* @__PURE__ */ jsxs( "span", { className: `inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] ${threadStateBadge( thread.state )}`, children: [ /* @__PURE__ */ jsx("span", { className: `h-2 w-2 rounded-full ${threadStateDot(thread.state)}` }), thread.rawState || thread.state ] } ), thread.daemon && /* @__PURE__ */ jsx("span", { className: "rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: "daemon" }), /* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [ frames.length, "f" ] }), thread.userFrameCount > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[11px] text-muted-foreground", children: [ thread.userFrameCount, "u" ] }), thread.topFunction && /* @__PURE__ */ jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: thread.topFunction }) ] }) }), /* @__PURE__ */ jsx(JvmStackTrace, { frames, className: "space-y-0.5 py-1 pl-3" }) ] }); } export { ThreadCard, threadStateBadge, threadStateDot }; //# sourceMappingURL=ThreadCard.js.map