feat(charts): manage investigation charts in a scrolling workspace
Generic Container CI/CD / test-build-publish (push) Successful in 2m7s
Frontend CI/CD / build-test-publish-and-deploy (push) Successful in 2m8s

This commit is contained in:
2026-11-10 17:56:23 +08:00
parent 865491cb23
commit 0ae0a41e61
80 changed files with 4672 additions and 470 deletions
@@ -0,0 +1,23 @@
import type { AnswerUiBlock } from "@/features/agent";
/** Include only reachable Chart nodes, preserving report props and their source. */
export function presentationChartBlocks(blocks: AnswerUiBlock[]): AnswerUiBlock[] {
return blocks.flatMap((block) => {
const charts: AnswerUiBlock[] = [];
const visited = new Set<string>();
const visit = (id: string) => {
if (visited.has(id)) return;
visited.add(id);
const element = block.spec.elements[id];
if (!element) return;
if (element.type === "Chart") charts.push({
...block,
block_id: `${block.block_id}:${id}`,
spec: { root: id, elements: { [id]: element } }
});
else element.children?.forEach(visit);
};
visit(block.spec.root);
return charts;
});
}