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 lags + winwodws

Louis Beaumontde5a03c67d5d
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index f7514fa87..8a48f354d 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -283,12 +283,6 @@ jobs:
# Remove unused Windows features
dism.exe /online /cleanup-image /startcomponentcleanup /resetbase
- - name: Clean NSIS temp files
- if: matrix.args == '--target x86_64-pc-windows-msvc'
- run: |
- Remove-Item -Path "$env:TEMP\*.tmp" -Force -Recurse
- Remove-Item -Path "$env:TEMP\nsis*" -Force -Recurse
-
- name: Build
uses: tauri-apps/tauri-action@v0
env:
diff --git a/screenpipe-app-tauri/app/timeline/page.tsx b/screenpipe-app-tauri/app/timeline/page.tsx
index f2d5d7f44..027c154eb 100644
--- a/screenpipe-app-tauri/app/timeline/page.tsx
+++ b/screenpipe-app-tauri/app/timeline/page.tsx
@@ -10,6 +10,7 @@ import { AIPanel } from "@/components/timeline/ai-panel";
import { TimelineProvider } from "@/lib/hooks/use-timeline-selection";
import { throttle } from "lodash";
import { AGENTS } from "@/components/timeline/agents";
+import { TimelineSelection } from "@/components/timeline/timeline-selection";
export interface StreamTimeSeriesResponse {
timestamp: string;
@@ -187,12 +188,15 @@ export default function Timeline() {
const handleScroll = useMemo(
() =>
throttle((e: React.WheelEvent<HTMLDivElement>) => {
- const isWithinAiPanel = aiPanelRef.current?.contains(e.target as Node);
+ const isWithinAiPanel = document
+ .querySelector('.ai-panel')
+ ?.contains(e.target as Node);
const isWithinAudioPanel = document
- .querySelector(".audio-transcript-panel")
+ .querySelector('.audio-transcript-panel')
?.contains(e.target as Node);
if (isWithinAiPanel || isWithinAudioPanel) {
+ e.stopPropagation();
return;
}
@@ -214,7 +218,7 @@ export default function Timeline() {
setCurrentIndex(newIndex);
frames[newIndex] && setCurrentFrame(frames[newIndex].devices[0]);
}
- }, 16), // Throttle to ~60fps
+ }, 16),
[currentIndex, frames]
);
@@ -229,16 +233,24 @@ export default function Timeline() {
}
const frameTime = new Date(currentFrame.timestamp);
- const totalVisibleMilliseconds = loadedTimeRange.end.getTime() - loadedTimeRange.start.getTime();
- const currentMilliseconds = frameTime.getTime() - loadedTimeRange.start.getTime();
+ const totalVisibleMilliseconds =
+ loadedTimeRange.end.getTime() - loadedTimeRange.start.getTime();
+ const currentMilliseconds =
+ frameTime.getTime() - loadedTimeRange.start.getTime();
return (currentMilliseconds / totalVisibleMilliseconds) * 100;
}, [currentIndex, frames, loadedTimeRange]);
useEffect(() => {
const preventScroll = (e: WheelEvent) => {
- const isWithinAiPanel = aiPanelRef.current?.contains(e.target as Node);
- if (!isWithinAiPanel) {
+ const isWithinAiPanel = document
+ .querySelector('.ai-panel')
+ ?.contains(e.target as Node);
+ const isWithinAudioPanel = document
+ .querySelector('.audio-transcript-panel')
+ ?.contains(e.target as Node);
+
+ if (!isWithinAiPanel && !isWithinAudioPanel) {
e.preventDefault();
}
};
@@ -329,12 +341,9 @@ export default function Timeline() {
<div className="w-4/5 mx-auto my-8 relative select-none">
<div className="h-[60px] bg-card border rounded-lg shadow-sm cursor-crosshair relative">
- {/* <div className="relative h-full bg-muted rounded-md overflow-hidden">
- {loadedTimeRange && (
- <TimelineBlocks frames={frames} timeRange={loadedTimeRange!} />
- )}
- </div> */}
-
+ {loadedTimeRange && (
+ <TimelineSelection loadedTimeRange={loadedTimeRange} />
+ )}
<div
className="absolute top-0 h-full w-1 bg-foreground/50 shadow-sm opacity-80 z-10"
style={{ left: `${timePercentage}%` }}
diff --git a/screenpipe-app-tauri/components/timeline/ai-panel.tsx b/screenpipe-app-tauri/components/timeline/ai-panel.tsx
index 3b56c6a93..4354eafd4 100644
--- a/screenpipe-app-tauri/components/timeline/ai-panel.tsx
+++ b/screenpipe-app-tauri/components/timeline/ai-panel.tsx
@@ -234,6 +234,7 @@ export function AIPanel({
return (
<div
ref={aiPanelRef}
+ className="ai-panel bg-background border border-muted-foreground rounded-lg shadow-lg transition-all duration-300 ease-in-out z-[100]"
style={{
position: "fixed",
left: position.x,
@@ -242,7 +243,6 @@ export function AIPanel({
height: isExpanded ? chatWindowSize.height : 120,
cursor: isDraggingPanel ? "grabbing" : "default",
}}
- className="bg-background border border-muted-foreground rounded-lg shadow-lg transition-all duration-300 ease-in-out z-[100]"
>
<div
className="select-none cursor-grab active:cursor-grabbing"
@@ -295,6 +295,8 @@ export function AIPanel({
MozUserSelect: "text",
msUserSelect: "text",
overscrollBehavior: "contain",
+ overflowY: "scroll",
+ height: "100%",
}}
>
{chatMessages.map((msg, index) => (
diff --git a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx
index 4b00da828..e2459d430 100644
--- a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx
+++ b/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx
@@ -30,14 +30,13 @@ export function TimelineIconsSection({
const processedBlocks = useMemo<ProcessedBlock[]>(() => {
if (!timeRange) return [];
- // Group frames by app name first
const appGroups: { [key: string]: Date[] } = {};
blocks.forEach((frame) => {
- // Remove any filtering on devices/metadata to show more apps
+ // Show all devices without filtering
frame.devices.forEach((device) => {
if (!device.metadata?.app_name) return;
-
+
const timestamp = new Date(frame.timestamp);
const appName = device.metadata.app_name;
@@ -55,8 +54,8 @@ export function TimelineIconsSection({
Object.entries(appGroups).forEach(([appName, timestamps]) => {
timestamps.sort((a, b) => a.getTime() - b.getTime());
- // Reduce gap threshold to 5 seconds to create more blocks
- const GAP_THRESHOLD = 5000; // 5 seconds in milliseconds
+ // Changed from 30s to 15s for a more balanced approach
+ const GAP_THRESHOLD = 15000; // 15 seconds in milliseconds
let blockStart = timestamps[0];
let lastTimestamp = timestamps[0];
@@ -81,6 +80,7 @@ export function TimelineIconsSection({
lastTimestamp = timestamp;
});
+ // Always add the last block
b.push({
appName,
timestamp: new Date(
@@ -97,14 +97,14 @@ export function TimelineIconsSection({
});
});
- // Reduce minimum spacing between blocks to 0.5%
+ // Changed from 0.1% to 0.25% for better spacing while still showing more icons
return b
.sort((a, b) => a.percentThroughDay - b.percentThroughDay)
.filter((block, index, array) => {
if (index === 0) return true;
const prevBlock = array[index - 1];
return (
- Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 0.5
+ Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 0.25
);
});
}, [blocks, iconCache, timeRange]);
diff --git a/screenpipe-app-tauri/components/timeline/timeline-selection.tsx b/screenpipe-app-tauri/components/timeline/timeline-selection.tsx
new file mode 100644
index 000000000..81eb94886
--- /dev/null
+++ b/screenpipe-app-tauri/components/timeline/timeline-selection.tsx
@@ -0,0 +1,97 @@
+import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";
+import { useState, useCallback, MouseEvent } from "react";
+
+interface TimelineSelectionProps {
+ loadedTimeRange: { start: Date; end: Date };
+ numChunks?: number;
+}
+
+export function TimelineSelection({
+ loadedTimeRange,
+ numChunks = 60,
+}: TimelineSelectionProps) {
+ const { setSelectionRange, selectionRange } = useTimelineSelection();
+ const [isDragging, setIsDragging] = useState(false);
+ const [currentChunk, setCurrentChunk] = useState<number | null>(null);
+ const [startChunk, setStartChunk] = useState<number | null>(null);
+
+ const getDateFromChunk = useCallback(
+ (chunkIndex: number) => {
+ const totalMs =
+ loadedTimeRange.end.getTime() - loadedTimeRange.start.getTime();
+ const msPerChunk = totalMs / numChunks;
+ return new Date(
+ loadedTimeRange.start.getTime() + chunkIndex * msPerChunk
+ );
+ },
+ [loadedTimeRange, numChunks]
+ );
+
+ const handleMouseDown = (e: MouseEvent, chunkIndex: number) => {
+ e.preventDefault(); // Prevent text selection
+ setIsDragging(true);
+ setStartChunk(chunkIndex);
+ setCurrentChunk(chunkIndex);
+ const date = getDateFromChunk(chunkIndex);
+ setSelectionRange({ start: date, end: date });
+ };
+
+ const handleMouseMove = (e: MouseEvent, chunkIndex: number) => {
+ if (!isDragging || startChunk === null) return;
+ setCurrentChunk(chunkIndex);
+
+ const start = Math.min(startChunk, chunkIndex);
+ const end = Math.max(startChunk, chunkIndex);
+
+ setSelectionRange({
+ start: getDateFromChunk(start),
+ end: getDateFromChunk(end + 1), // +1 to include the full chunk
+ });
+ };
+
+ const handleMouseUp = () => {
+ setIsDragging(false);
+ setStartChunk(null);
+ setCurrentChunk(null);
+ };
+
+ const isChunkSelected = useCallback(
+ (chunkIndex: number) => {
+ if (isDragging && startChunk !== null && currentChunk !== null) {
+ const start = Math.min(startChunk, currentChunk);
+ const end = Math.max(startChunk, currentChunk);
+ return chunkIndex >= start && chunkIndex <= end;
+ } else if (selectionRange) {
+ const chunkDate = getDateFromChunk(chunkIndex);
+ const nextChunkDate = getDateFromChunk(chunkIndex + 1);
+ return (
+ chunkDate >= selectionRange.start && chunkDate < selectionRange.end
+ );
+ }
+ return false;
+ },
+ [isDragging, startChunk, currentChunk, selectionRange, getDateFromChunk]
+ );
+
+ return (
+ <div
+ className="absolute inset-0 flex"
+ onMouseLeave={handleMouseUp}
+ onMouseUp={handleMouseUp}
+ >
+ {Array.from({ length: numChunks }).map((_, i) => (
+ <div
+ key={i}
+ className={`h-full flex-1 border-r border-foreground/5 transition-colors ${
+ isChunkSelected(i) ? "bg-primary/30" : "hover:bg-foreground/10"
+ }`}
+ style={{
+ cursor: isDragging ? "col-resize" : "pointer",
+ }}
+ onMouseDown={(e) => handleMouseDown(e, i)}
+ onMouseMove={(e) => handleMouseMove(e, i)}
+ />
+ ))}
+ </div>
+ );
+}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index d8b3ab046..32ea01c5c 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -3777,7 +3777,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "0.9.18"
+version = "0.9.19"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 7e52c3867..eb29bdbd1 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.9.18"
+version = "0.9.19"
description = ""
authors = ["you"]
license = ""