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): improve search UX and fix browser button visibility

Louis Beaumontbadbd5e761e5
diff --git a/screenpipe-app-tauri/components/rewind/current-frame-search.tsx b/screenpipe-app-tauri/components/rewind/current-frame-search.tsx
index 3e285de95..968fe9525 100644
--- a/screenpipe-app-tauri/components/rewind/current-frame-search.tsx
+++ b/screenpipe-app-tauri/components/rewind/current-frame-search.tsx
@@ -1,70 +1,15 @@
import { MainImage } from "./image-card";
import { cn } from "@/lib/utils";
-import { useKeywordSearchStore } from "@/lib/hooks/use-keyword-search-store";
-import { Copy, Check, Link } from "lucide-react";
-import { useState } from "react";
-import { toast } from "sonner";
-
-function isValidURL(url: string) {
- try {
- new URL(url);
- return true;
- } catch (error) {
- return false;
- }
-}
export const CurrentFrame = () => {
- const { currentResultIndex, searchResults } = useKeywordSearchStore();
- const [copied, setCopied] = useState(false);
-
- const currentFrame = searchResults[currentResultIndex];
-
- const copyUrl = async () => {
- if (currentFrame?.url && isValidURL(currentFrame.url)) {
- await navigator.clipboard.writeText(currentFrame.url);
- setCopied(true);
- toast.success("URL copied to clipboard");
- setTimeout(() => setCopied(false), 2000);
- }
- };
-
return (
<div
className={cn(
- "grid md:gap-4 gap-y-4 w-4/5 mx-auto min-h-[40%] max-h-[50%] max-w-[55vw] overflow-hidden",
+ "grid md:gap-4 gap-y-4 w-4/5 mx-auto min-h-[40%] max-h-[50%] max-w-[55vw] overflow-hidden",
)}
>
<div className={cn("relative group w-full")}>
<MainImage />
- {currentFrame?.url && isValidURL(currentFrame.url) && (
- <div className="absolute bottom-4 right-4 flex items-center gap-2">
- <button
- onClick={copyUrl}
- className={cn(
- "flex items-center gap-1 text-xs rounded bg-muted p-1.5 font-mono opacity-80 group-hover:opacity-100 transition-all duration-200 hover:bg-muted/80",
- )}
- title="Copy URL"
- >
- {copied ? (
- <Check className="h-3 w-3 text-green-500" />
- ) : (
- <Copy className="h-3 w-3" />
- )}
- </button>
- <a
- className={cn(
- "flex items-center gap-1 text-xs rounded bg-muted p-1.5 font-mono opacity-80 group-hover:opacity-100 transition-all duration-200 hover:bg-muted/80",
- )}
- target="_blank"
- href={currentFrame.url}
- title="Open URL"
- >
- <Link className="h-3 w-3" />
- Open
- </a>
- </div>
- )}
</div>
</div>
);
diff --git a/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx b/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
index 5dfee664a..5b8ca83a8 100644
--- a/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
+++ b/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
@@ -55,7 +55,9 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
}
}, [browserUrl]);
- const hasValidUrl = browserUrl && browserUrl.length > 0 && browserUrl !== "null";
+ // Only show "Open in Browser" for actual HTTP/HTTPS URLs
+ const hasValidUrl = browserUrl &&
+ (browserUrl.startsWith("http://") || browserUrl.startsWith("https://"));
// Reset loading state when frame changes, but be smarter about it
React.useEffect(() => {
diff --git a/screenpipe-app-tauri/components/rewind/image-card.tsx b/screenpipe-app-tauri/components/rewind/image-card.tsx
index b29ff8937..e1c79b714 100644
--- a/screenpipe-app-tauri/components/rewind/image-card.tsx
+++ b/screenpipe-app-tauri/components/rewind/image-card.tsx
@@ -284,7 +284,9 @@ export const MainImage = () => {
);
}
- const hasValidUrl = currentFrame?.url && currentFrame.url.length > 0 && currentFrame.url !== "null";
+ // Only show "Open in Browser" for actual HTTP/HTTPS URLs
+ const hasValidUrl = currentFrame?.url &&
+ (currentFrame.url.startsWith("http://") || currentFrame.url.startsWith("https://"));
return (
<div
diff --git a/screenpipe-app-tauri/components/rewind/search-command.tsx b/screenpipe-app-tauri/components/rewind/search-command.tsx
index ec8fd846c..b8b548cf6 100644
--- a/screenpipe-app-tauri/components/rewind/search-command.tsx
+++ b/screenpipe-app-tauri/components/rewind/search-command.tsx
@@ -125,7 +125,10 @@ export function SearchCommand() {
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
- handleSearch();
+ if (options.query?.trim()) {
+ commands.openSearchWindow(querySerializer(options));
+ setOpen(false);
+ }
}
};
@@ -172,6 +175,7 @@ export function SearchCommand() {
setOptions((prev) => ({ ...prev, query: e.target.value }));
}}
onKeyDown={handleKeyDown}
+ autoFocus
/>
{isSearching && <Loader2 className="h-4 w-4 animate-spin" />}
</div>