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(search): add button to navigate to frame in timeline

Louis Beaumontfaa5a820ea56
diff --git a/screenpipe-app-tauri/app/search/page.tsx b/screenpipe-app-tauri/app/search/page.tsx
index cf60b76f0..f5ebb408d 100644
--- a/screenpipe-app-tauri/app/search/page.tsx
+++ b/screenpipe-app-tauri/app/search/page.tsx
@@ -12,7 +12,9 @@ import { parser } from "@/lib/keyword-parser";
import { CurrentFrame } from "@/components/rewind/current-frame-search";
import { useKeywordParams } from "@/lib/hooks/use-keyword-params";
import { AppSelect } from "@/components/rewind/search-command";
-import { ArrowLeft } from "lucide-react";
+import { ArrowLeft, Clock } from "lucide-react";
+import { emit } from "@tauri-apps/api/event";
+import { commands } from "@/lib/utils/tauri";
function SearchPage() {
const [querys, setQuerys] = useKeywordParams();
@@ -106,7 +108,28 @@ function SearchPage() {
/>
</div>
</div>
- <CurrentFrame />
+ <div className="relative">
+ <CurrentFrame />
+ {currentResultIndex >= 0 && searchResults[currentResultIndex] && (
+ <Button
+ variant="secondary"
+ size="sm"
+ className="absolute bottom-2 right-2 gap-1.5"
+ onClick={async () => {
+ const timestamp = searchResults[currentResultIndex].timestamp;
+ // Show main timeline window
+ await commands.showWindow("Main");
+ // Emit event to navigate to the timestamp
+ await emit("navigate-to-timestamp", timestamp);
+ // Close search window
+ await commands.closeWindow({ Search: { query: null } });
+ }}
+ >
+ <Clock className="h-3.5 w-3.5" />
+ view in timeline
+ </Button>
+ )}
+ </div>
</div>
{!querys.query && (
<div className="h-64 w-96 flex mx-auto items-center justify-center">
diff --git a/screenpipe-app-tauri/components/rewind/timeline.tsx b/screenpipe-app-tauri/components/rewind/timeline.tsx
index bcf644089..1a1e58b4c 100644
--- a/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -126,6 +126,30 @@ export default function Timeline() {
};
}, [onWindowFocus]);
+ // Listen for navigate-to-timestamp events from search window
+ useEffect(() => {
+ const unlisten = listen<string>("navigate-to-timestamp", async (event) => {
+ const targetTimestamp = event.payload;
+ console.log("Navigating to timestamp:", targetTimestamp);
+
+ const targetDate = new Date(targetTimestamp);
+
+ // First, navigate to the correct date if needed
+ if (!isSameDay(targetDate, currentDate)) {
+ await handleDateChange(targetDate);
+ }
+
+ // Then jump to the specific time (after a short delay to let frames load)
+ setTimeout(() => {
+ jumpToTime(targetDate);
+ }, 500);
+ });
+
+ return () => {
+ unlisten.then((fn) => fn());
+ };
+ }, [currentDate]);
+
// Progressive loading: show UI immediately once we have any frames
const hasInitialFrames = frames.length > 0;
const showBlockingLoader = isLoading && !hasInitialFrames;