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): centre home tile labels and give "+ Custom" its own hover

Manas Raghuwanshi0beca523a622
diff --git a/apps/screenpipe-app-tauri/components/chat/summary-cards.test.tsx b/apps/screenpipe-app-tauri/components/chat/summary-cards.test.tsx
index f31d9f5ba..c961a5368 100644
--- a/apps/screenpipe-app-tauri/components/chat/summary-cards.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/summary-cards.test.tsx
@@ -188,6 +188,51 @@ describe("SummaryCards", () => {
expect(quickAction.className).toContain("focus-visible:ring-1");
});
+ it("centres chip labels until the agent logos need room", () => {
+ render(
+ <SummaryCards
+ onSendMessage={vi.fn()}
+ customTemplates={[{ id: "t1", title: "Client recap", description: "", prompt: "p", timeRange: "today", createdAt: "" }]}
+ onSaveCustomTemplate={vi.fn()}
+ onUpdateCustomTemplate={vi.fn()}
+ onDeleteCustomTemplate={vi.fn()}
+ userGoalCategory="work_memory"
+ />,
+ );
+
+ for (const name of ["Time Breakdown", "Meeting Prep", "Client recap"]) {
+ const chip = screen.getByRole("button", { name });
+ // Reserving the logos' slot at rest pushed each label off-centre.
+ expect(chip).toHaveClass("px-2");
+ expect(chip.className).not.toMatch(/(^|\s)p[lr]-12(\s|$)/);
+ expect(chip).toHaveClass(
+ "group-hover/home-card:pr-12",
+ "group-focus-within/home-card:pr-12",
+ // A launch keeps the logos open after the pointer leaves.
+ "group-has-[[data-expanded=true]]/home-card:pr-12",
+ "[@media(hover:none)]:pr-12",
+ );
+ }
+ });
+
+ it("keeps the dashed Custom slot outlined on hover instead of inverting it", () => {
+ render(
+ <SummaryCards
+ onSendMessage={vi.fn()}
+ customTemplates={[]}
+ onSaveCustomTemplate={vi.fn()}
+ onUpdateCustomTemplate={vi.fn()}
+ onDeleteCustomTemplate={vi.fn()}
+ />,
+ );
+
+ const custom = screen.getByTestId("custom-summary-open");
+ expect(custom).toHaveClass("border-dashed", "hover:bg-card", "focus-visible:bg-card");
+ // A solid fill would hide the dashes that mark it as an empty slot.
+ expect(custom.className).not.toMatch(/(hover|focus-visible):bg-foreground/);
+ expect(custom.className).toContain("motion-reduce:transition-none");
+ });
+
it("previews a card prompt on hover and keyboard focus without sending", () => {
const onPreviewPrompt = vi.fn();
const onSendMessage = vi.fn();
diff --git a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
index df8f278ea..4b5ea7039 100644
--- a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
@@ -95,6 +95,13 @@ export function homeCardSlugsForGoal(category: UserGoalCategory): string[] {
return HOME_CARD_SLUGS_BY_GOAL[category];
}
+// Chip labels centre in the whole chip. The agent logos only appear on hover,
+// focus or while a launch opens (always on touch screens), so room for them
+// opens only then; reserving it at rest pushed every label off-centre by a
+// different amount.
+const CHIP_LABEL_ROOM =
+ "px-2 group-hover/home-card:pr-12 group-focus-within/home-card:pr-12 group-has-[[data-expanded=true]]/home-card:pr-12 [@media(hover:none)]:pr-12";
+
const QUICK_SUMMARY_TASKS = [
{
name: "meeting-prep",
@@ -343,7 +350,7 @@ export function SummaryCards({
previewPromptForPipe(pipe),
onPreviewPrompt,
)}
- className="group/card-primary h-10 w-full cursor-pointer rounded-md border border-foreground/20 bg-card pl-2 pr-12 text-[11px] text-foreground/75 transition-colors duration-150 hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none"
+ className={`group/card-primary h-10 w-full cursor-pointer rounded-md border border-foreground/20 bg-card ${CHIP_LABEL_ROOM} text-[11px] text-foreground/75 transition-[color,background-color,border-color,padding] duration-150 ease-out hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none`}
>
<span className="transition-opacity duration-150 motion-reduce:transition-none">
{templateLabel(pipe, "title")}
@@ -374,7 +381,7 @@ export function SummaryCards({
"other_builtin",
);
}}
- className="group/card-primary h-10 w-full cursor-pointer rounded-md border border-foreground/20 bg-card pl-2 pr-12 text-[11px] text-foreground/75 transition-colors duration-150 hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none"
+ className={`group/card-primary h-10 w-full cursor-pointer rounded-md border border-foreground/20 bg-card ${CHIP_LABEL_ROOM} text-[11px] text-foreground/75 transition-[color,background-color,border-color,padding] duration-150 ease-out hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none`}
>
<span className="transition-opacity duration-150 motion-reduce:transition-none">
{task.title}
@@ -405,7 +412,7 @@ export function SummaryCards({
)}
onClick={() => handleCustomTemplateClick(ct)}
title={ct.description || ct.timeRange}
- className="group/card-primary inline-flex h-10 w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-foreground/20 bg-card pl-2 pr-12 text-[11px] text-foreground/70 transition-colors duration-150 hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none"
+ className={`group/card-primary inline-flex h-10 w-full cursor-pointer items-center justify-center gap-1 rounded-md border border-foreground/20 bg-card ${CHIP_LABEL_ROOM} text-[11px] text-foreground/70 transition-[color,background-color,border-color,padding] duration-150 ease-out hover:border-foreground hover:bg-foreground hover:text-background focus-visible:border-foreground focus-visible:bg-foreground focus-visible:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none`}
>
<span className="inline-flex min-w-0 items-center gap-1 transition-opacity duration-150 motion-reduce:transition-none">
<Pin className="h-3 w-3 shrink-0" strokeWidth={1.5} />
@@ -419,15 +426,18 @@ export function SummaryCards({
/>
</div>
))}
+ {/* An empty slot, not a ready action: hover fills it in as a card
+ instead of inverting, so the dashed outline still reads as "add". */}
<button
type="button"
onClick={() => {
posthog.capture("home_card_clicked", { kind: "custom_summary_open" });
setShowBuilder(true);
}}
- className="group/card-primary h-10 min-w-[148px] flex-1 cursor-pointer rounded-md border border-dashed border-foreground/25 px-1 text-[11px] text-muted-foreground transition-colors duration-150 hover:border-foreground hover:bg-foreground hover:text-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none"
+ data-testid="custom-summary-open"
+ className="h-10 min-w-[148px] flex-1 cursor-pointer rounded-md border border-dashed border-foreground/25 px-1 text-[11px] text-muted-foreground transition-colors duration-150 ease-out hover:border-foreground/60 hover:bg-card hover:text-foreground focus-visible:border-foreground/60 focus-visible:bg-card focus-visible:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground focus-visible:ring-offset-1 focus-visible:ring-offset-background active:bg-muted motion-reduce:transition-none"
>
- + Custom
+ {ui("+ Custom")}
</button>
</div>