Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): keep inline charts full width

Louis Beaumonte11989ded273
diff --git a/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.test.tsx b/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.test.tsx
index b4b8deae0..c00d1c1c2 100644
--- a/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.test.tsx
@@ -64,6 +64,22 @@ describe("ChatChart actions", () => {
).toBeInTheDocument();
});
+ it("keeps the action wrapper stretched to the full message width", () => {
+ const spec = specFrom({
+ type: "bar",
+ items: [{ label: "Chrome", value: 92 }],
+ });
+ render(<ChatChart spec={spec} onSendPrompt={vi.fn()} />);
+
+ const frame = screen.getByTestId("chat-chart");
+ expect(frame.parentElement).toHaveClass(
+ "w-full",
+ "min-w-0",
+ "max-w-full",
+ "self-stretch",
+ );
+ });
+
it("sends the validated chart spec back through chat for Live View conversion", () => {
const onSendPrompt = vi.fn();
const spec = specFrom({
diff --git a/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.tsx b/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.tsx
index 03663c266..3af490d47 100644
--- a/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/charts/chat-chart.tsx
@@ -155,7 +155,7 @@ export function ChatChart({
<div
className={
onSendPrompt
- ? "relative my-3 [&>figure]:my-0 [&>figure]:pr-11"
+ ? "relative my-3 w-full min-w-0 max-w-full self-stretch [&>figure]:my-0 [&>figure]:pr-11"
: "contents"
}
>
diff --git a/apps/screenpipe-app-tauri/e2e/specs/chat-inline-charts.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/chat-inline-charts.spec.ts
index fa34c5e5c..632191aa7 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/chat-inline-charts.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/chat-inline-charts.spec.ts
@@ -18,6 +18,7 @@
* 4. a malformed fence falls back to a code block instead of vanishing
* 5. no chart uses a rounded corner (DESIGN.md: sharp corners always)
* 6. every chat chart exposes the Live View prompt handoff menu
+ * 7. the action-menu wrapper preserves the chart's full message width
*
* No model run and no network: the assistant message is seeded directly.
*
@@ -218,6 +219,28 @@ describe("Inline charts in chat", function () {
expect(Math.abs(third / second - 0.5)).toBeLessThan(0.08);
});
+ it("keeps charts full-width after adding the Live View action menu", async () => {
+ const layout = await browser.execute(() => {
+ const chart = document.querySelector<HTMLElement>(
+ '[data-chart-type="bar"]',
+ );
+ const message = chart?.closest<HTMLElement>(".prose");
+ if (!chart || !message) return null;
+ const chartRect = chart.getBoundingClientRect();
+ const messageRect = message.getBoundingClientRect();
+ return {
+ chartLeft: chartRect.left,
+ chartRight: chartRect.right,
+ messageLeft: messageRect.left,
+ messageRight: messageRect.right,
+ };
+ });
+
+ expect(layout).not.toBe(null);
+ expect(Math.abs(layout!.chartLeft - layout!.messageLeft)).toBeLessThan(2);
+ expect(Math.abs(layout!.chartRight - layout!.messageRight)).toBeLessThan(2);
+ });
+
it("shows a tooltip and highlights the mark on hover", async () => {
const before = await browser.execute(() => {
const bar = document.querySelector('[data-chart-type="bar"]');