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

feat(chat): add history toggle button to left sidebar

Louis Beaumont7c710388bc00
diff --git a/apps/screenpipe-app-tauri/app/home/page.tsx b/apps/screenpipe-app-tauri/app/home/page.tsx
index b45fbadbf..789106fc0 100644
--- a/apps/screenpipe-app-tauri/app/home/page.tsx
+++ b/apps/screenpipe-app-tauri/app/home/page.tsx
@@ -31,6 +31,7 @@ import {
Sparkles,
Bell,
BarChart3,
+ History,
} from "lucide-react";
import { useOverlayData } from "@/app/shortcut-reminder/use-overlay-data";
import { cn } from "@/lib/utils";
@@ -55,7 +56,7 @@ import { HomeStatsBadge } from "@/components/home-stats-badge";
import { StandaloneChat } from "@/components/standalone-chat";
import Timeline from "@/components/rewind/timeline";
import { useQueryState } from "nuqs";
-import { listen } from "@tauri-apps/api/event";
+import { emit, listen } from "@tauri-apps/api/event";
import { useSettings } from "@/lib/hooks/use-settings";
import { useTeam } from "@/lib/hooks/use-team";
import { useEnterprisePolicy } from "@/lib/hooks/use-enterprise-policy";
@@ -564,6 +565,42 @@ function SettingsPageContent() {
})}
</div>
+ {/* Chat history toggle — only visible when on home (chat) */}
+ {activeSection === "home" && !settingsModalOpen && (
+ <div className="mt-1">
+ {(() => {
+ const btn = (
+ <button
+ onClick={() => {
+ setActiveSection("home");
+ setSettingsModalOpen(false);
+ emit("toggle-chat-history", {});
+ }}
+ className={cn(
+ "w-full flex items-center px-3 py-2 rounded-lg transition-all duration-150 text-left group",
+ sidebarCollapsed ? "justify-center" : "space-x-2.5",
+ isTranslucent
+ ? "vibrant-nav-item vibrant-nav-hover"
+ : "hover:bg-card/50 text-muted-foreground hover:text-foreground",
+ )}
+ >
+ <History className={cn("h-4 w-4 flex-shrink-0 transition-colors", isTranslucent ? "" : "text-muted-foreground group-hover:text-foreground")} />
+ {!sidebarCollapsed && <span className="text-sm font-medium">History</span>}
+ </button>
+ );
+ if (sidebarCollapsed) {
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{btn}</TooltipTrigger>
+ <TooltipContent side="right" className="text-xs">History</TooltipContent>
+ </Tooltip>
+ );
+ }
+ return btn;
+ })()}
+ </div>
+ )}
+
{/* Stats badge */}
{!sidebarCollapsed && (
<div className="px-2 py-1.5">
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 09b5f5983..d74d4a945 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -1191,6 +1191,17 @@ export function StandaloneChat({ className }: { className?: string } = {}) {
return () => { unlisten.then((fn) => fn()); };
}, []);
+ // Listen for toggle-chat-history event from sidebar
+ useEffect(() => {
+ const unlisten = listen("toggle-chat-history", async () => {
+ if (!showHistory) {
+ await reloadStore();
+ }
+ setShowHistory((prev) => !prev);
+ });
+ return () => { unlisten.then((fn) => fn()); };
+ }, [showHistory, reloadStore, setShowHistory]);
+
// Guard against duplicate chat-prefill processing. The listener below
// re-subscribes when piInfo changes; during the brief overlap window
// (async unlisten hasn't resolved yet) both old and new listeners can