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(timeline): refine daily summary controls

Louis Beaumont9d3c3ed49702
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx
index 73ca9dd19..f5a6fbfe1 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx
@@ -150,6 +150,41 @@ describe("TimelineDailySummary", () => {
mocks.posthogCapture.mockReset();
});
+ it("renders a compact icon-only trigger with an accessible label", () => {
+ render(<TimelineDailySummary currentDate={new Date(2026, 6, 25)} />);
+
+ const trigger = screen.getByTestId("timeline-daily-summary-trigger");
+ expect(trigger).toHaveClass("h-10", "w-10");
+ expect(trigger).toHaveAccessibleName(
+ "Turn on Enhanced AI to generate a summary for this day",
+ );
+ expect(trigger).not.toHaveTextContent("daily summary");
+ });
+
+ it("keeps wheel navigation inside the summary content and closes on outside click", async () => {
+ const selectedDate = new Date(2026, 6, 25);
+ mocks.settings.enhancedAI = true;
+ window.localStorage.setItem(dailySummaryCacheKey(selectedDate), "A cached daily summary.");
+ render(<TimelineDailySummary currentDate={selectedDate} />);
+
+ const trigger = screen.getByTestId("timeline-daily-summary-trigger");
+ fireEvent.click(trigger);
+
+ const panel = screen.getByTestId("timeline-daily-summary-panel");
+ const scrollContent = screen.getByTestId("daily-summary-scroll-content");
+ expect(panel).toHaveClass("ai-panel");
+ expect(scrollContent).toHaveClass("overflow-y-auto", "overscroll-contain");
+
+ fireEvent.pointerDown(scrollContent);
+ expect(trigger).toHaveAttribute("aria-expanded", "true");
+
+ fireEvent.pointerDown(document.body);
+ await waitFor(() => {
+ expect(trigger).toHaveAttribute("aria-expanded", "false");
+ expect(screen.queryByTestId("timeline-daily-summary-panel")).not.toBeInTheDocument();
+ });
+ });
+
it("asks for consent instead of generating when Enhanced AI is off", () => {
render(<TimelineDailySummary currentDate={new Date(2026, 6, 25)} />);
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx
index 59973d5dd..b854b6ec3 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx
@@ -10,7 +10,6 @@ import {
Check,
Copy,
Loader2,
- LockKeyhole,
LogIn,
RefreshCw,
ShieldCheck,
@@ -187,6 +186,8 @@ export function TimelineDailySummary({
const [error, setError] = useState("");
const [copied, setCopied] = useState(false);
const abortRef = useRef<AbortController | null>(null);
+ const triggerRef = useRef<HTMLButtonElement | null>(null);
+ const panelRef = useRef<HTMLElement | null>(null);
const dateId = format(currentDate, "yyyy-MM-dd");
const enhancedAI = settings?.enhancedAI ?? false;
const userToken = settings?.user?.token ?? "";
@@ -380,14 +381,28 @@ export function TimelineDailySummary({
}
};
- const closePanel = () => {
+ const closePanel = useCallback(() => {
if (isGenerating) {
abortRef.current?.abort();
setStatus("idle");
setSummary("");
}
setPanelOpen(false);
- };
+ }, [isGenerating]);
+
+ useEffect(() => {
+ if (!panelOpen) return;
+
+ const handleOutsidePointerDown = (event: PointerEvent) => {
+ const target = event.target;
+ if (!(target instanceof Node)) return;
+ if (panelRef.current?.contains(target) || triggerRef.current?.contains(target)) return;
+ closePanel();
+ };
+
+ document.addEventListener("pointerdown", handleOutsidePointerDown, true);
+ return () => document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
+ }, [closePanel, panelOpen]);
const copySummary = async () => {
if (!summary) return;
@@ -419,11 +434,12 @@ export function TimelineDailySummary({
<Tooltip>
<TooltipTrigger asChild>
<button
+ ref={triggerRef}
type="button"
data-testid="timeline-daily-summary-trigger"
onClick={handleTriggerClick}
className={cn(
- "group relative flex h-10 items-center gap-2 border border-border bg-background px-3 font-mono text-xs text-foreground transition-colors duration-150 hover:bg-foreground hover:text-background",
+ "group relative flex h-10 w-10 shrink-0 items-center justify-center border border-border bg-background text-foreground transition-colors duration-150 hover:bg-foreground hover:text-background",
panelOpen && "bg-foreground text-background",
)}
aria-label={tooltipText}
@@ -437,8 +453,6 @@ export function TimelineDailySummary({
<Sparkles className="absolute -right-1.5 -top-1.5 h-2.5 w-2.5 fill-current" />
</span>
)}
- <span className={cn(embedded && "hidden min-[980px]:inline")}>daily summary</span>
- {!enhancedAI && <LockKeyhole className="h-3 w-3 opacity-50" />}
{summary && !isGenerating && (
<span className="absolute -right-1 -top-1 h-2.5 w-2.5 border-2 border-background bg-foreground" />
)}
@@ -453,13 +467,14 @@ export function TimelineDailySummary({
<AnimatePresence>
{panelOpen && (
<motion.aside
+ ref={panelRef}
data-testid="timeline-daily-summary-panel"
initial={{ opacity: 0, y: -10, scale: 0.985 }}
animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: -6, scale: 0.99 }}
transition={{ duration: 0.15, ease: "easeOut" }}
className={cn(
- "fixed right-5 z-[150] flex max-h-[min(620px,calc(100vh-112px))] w-[min(420px,calc(100vw-32px))] flex-col overflow-hidden border border-border bg-background/95 text-foreground shadow-lg shadow-black/5 backdrop-blur-xl",
+ "ai-panel fixed right-5 z-[150] flex max-h-[min(620px,calc(100vh-112px))] w-[min(420px,calc(100vw-32px))] flex-col overflow-hidden border border-border bg-background/95 text-foreground shadow-lg shadow-black/5 backdrop-blur-xl",
embedded ? "top-[68px]" : "top-[calc(env(safe-area-inset-top)+76px)]",
)}
onWheel={(event) => event.stopPropagation()}
@@ -505,7 +520,10 @@ export function TimelineDailySummary({
</div>
)}
- <div className="min-h-0 flex-1 overflow-y-auto px-4 py-4 select-text">
+ <div
+ data-testid="daily-summary-scroll-content"
+ className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 select-text"
+ >
{status === "gathering" && !summary && (
<div className="space-y-4" data-testid="daily-summary-gathering">
<div className="flex items-center gap-2 font-mono text-xs text-muted-foreground">