mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-26 06:01:49 +00:00
feat(kanban-dashboard): native <details> collapse + skip empty metadata
Two follow-up improvements to Tranquil-Flow's metadata-panel restyle.
Both stay within the parent PR's "tone down the panel" scope.
1. Native <details>/<summary> collapse for verbose metadata.
The parent PR consciously deferred this ("adding native expand/collapse
would be the next step but requires UX agreement"). The default they
asked for is straightforward: collapsed when the rendered JSON exceeds
300 chars (the threshold where the max-height: 8.5rem cap actually
starts mattering), expanded otherwise. <details>/<summary> is the right
primitive — zero JS, browser-handled state, accessible by default
(keyboard-navigable, screen-reader announces the disclosure state),
and survives any react-state churn for free.
The OS-default disclosure marker is suppressed (list-style: none +
::-webkit-details-marker hidden) and replaced with a CSS ::before
chevron that rotates 90deg on the [open] attribute, so the look is
consistent across Firefox/WebKit/Blink without the double-marker
that would otherwise appear on the platforms that still render the
default triangle.
2. Skip rendering when metadata is an empty object.
`r.metadata && ...` truthy-checks, but `{}` is truthy in JS — so a
completed task with no actual metadata would render a "Metadata"
labeled disclosure block containing literal `{}`. Adds an
Object.keys(r.metadata).length > 0 guard so empty payloads render
nothing instead of an empty disclosure stub.
Tests: three new static-asset assertions covering the <details> shape,
the empty-object skip, and the suppress-default-marker + animated-chevron
CSS — all in `tests/plugins/test_kanban_dashboard_plugin.py`.
This commit is contained in:
parent
0e0ddaac8f
commit
a91e5a8759
3 changed files with 77 additions and 6 deletions
18
plugins/kanban/dashboard/dist/index.js
vendored
18
plugins/kanban/dashboard/dist/index.js
vendored
|
|
@ -2397,12 +2397,18 @@
|
|||
r.error
|
||||
? h("div", { className: "hermes-kanban-run-error" }, r.error)
|
||||
: null,
|
||||
r.metadata
|
||||
? h("div", { className: "hermes-kanban-run-meta-block" },
|
||||
h("div", { className: "hermes-kanban-run-meta-label" }, "Metadata"),
|
||||
h("code", { className: "hermes-kanban-run-meta" },
|
||||
JSON.stringify(r.metadata, null, 2)),
|
||||
)
|
||||
(r.metadata && Object.keys(r.metadata).length > 0)
|
||||
? (function () {
|
||||
var json = JSON.stringify(r.metadata, null, 2);
|
||||
var collapsed = json.length > 300;
|
||||
return h("details", {
|
||||
className: "hermes-kanban-run-meta-block",
|
||||
open: !collapsed,
|
||||
},
|
||||
h("summary", { className: "hermes-kanban-run-meta-label" }, "Metadata"),
|
||||
h("code", { className: "hermes-kanban-run-meta" }, json),
|
||||
);
|
||||
})()
|
||||
: null,
|
||||
);
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue