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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
small timeline ui improvements
Louis Beaumontefb179196195
diff --git a/screenpipe-app-tauri/components/timeline/audio-transcript.tsx b/screenpipe-app-tauri/components/timeline/audio-transcript.tsxindex 63152335f..7551cf181 100644--- a/screenpipe-app-tauri/components/timeline/audio-transcript.tsx+++ b/screenpipe-app-tauri/components/timeline/audio-transcript.tsx@@ -37,6 +37,7 @@ export function AudioTranscript({const [windowSize, setWindowSize] = useState({ width: 300, height: 500 });const resizerRef = useRef<HTMLDivElement | null>(null);const panelRef = useRef<HTMLDivElement | null>(null);+ const [isVisible, setIsVisible] = useState(true);// Group audio files from nearby framesuseEffect(() => {@@ -53,6 +54,14 @@ export function AudioTranscript({return frameTime >= windowStart && frameTime <= windowEnd;});+ // Check if any nearby frames have audio+ const hasNearbyAudio = nearbyFrames.some(frame =>+ frame.devices.some(device => device.audio.length > 0)+ );++ // Show/hide panel based on nearby audio+ setIsVisible(hasNearbyAudio);+// Group audio by deviceconst groups = new Map<string, AudioGroup>();@@ -143,7 +152,13 @@ export function AudioTranscript({e.stopPropagation(); // Stop the event from reaching the timeline};- return (+ const handleClose = (e: React.MouseEvent) => {+ e.stopPropagation();+ setIsVisible(false);+ onClose?.();+ };++ return isVisible ? (<divref={panelRef}style={{@@ -172,19 +187,16 @@ export function AudioTranscript({variant="ghost"size="sm"className="h-6 w-6 p-0"- onClick={(e) => {- e.stopPropagation(); // Stop event from bubbling up- onClose?.();- }}+ onClick={handleClose}><X className="h-3 w-3" /></Button></div></div>- <div+ <divclassName="space-y-2 p-2 overflow-y-auto"- style={{+ style={{height: "calc(100% - 37px)",overscrollBehavior: "contain", // Prevent scroll chainingWebkitOverflowScrolling: "touch", // Smooth scrolling on iOS@@ -249,5 +261,5 @@ export function AudioTranscript({}}/></div>- );+ ) : null;}diff --git a/screenpipe-app-tauri/components/timeline/timeline-block.tsx b/screenpipe-app-tauri/components/timeline/timeline-block.tsxindex 0a5e2111d..b8cace0c1 100644--- a/screenpipe-app-tauri/components/timeline/timeline-block.tsx+++ b/screenpipe-app-tauri/components/timeline/timeline-block.tsx@@ -35,13 +35,13 @@ export function TimelineBlocks({ frames, timeRange }: TimelineBlocksProps) {0);- // Use golden ratio for better color distribution+ // Use golden ratio with a larger step for more distinct huesconst golden_ratio = 0.618033988749895;- const hue = ((hash * golden_ratio) % 1) * 360;+ const hue = ((hash * golden_ratio * 1.5) % 1) * 360;- // Vary saturation and lightness slightly based on hash- const sat = 65 + (hash % 20); // 65-85%- const light = 45 + (hash % 15); // 45-60%+ // Increase saturation and use fixed lightness for better distinction+ const sat = 85 + (hash % 15); // 85-100%+ const light = 60; // Fixed lightness for better visibilityconst color = `hsl(${hue}, ${sat}%, ${light}%)`;colorCache.set(appName, color);diff --git a/screenpipe-app-tauri/components/timeline/timeline-dock.tsx b/screenpipe-app-tauri/components/timeline/timeline-dock.tsxindex 0b92c4eb1..b416ed158 100644--- a/screenpipe-app-tauri/components/timeline/timeline-dock.tsx+++ b/screenpipe-app-tauri/components/timeline/timeline-dock.tsx@@ -193,39 +193,87 @@ export function TimelineIconsSection({const processedBlocks = useMemo<ProcessedBlock[]>(() => {if (!timeRange) return [];- const totalRange = timeRange.end.getTime() - timeRange.start.getTime();+ // Use the same block calculation logic as timeline-block.tsx+ const blocks: {+ appName: string;+ startTime: Date;+ endTime: Date;+ }[] = [];++ let currentBlock: {+ appName: string;+ startTime: Date;+ endTime: Date;+ } | null = null;- return (- significantBlocks- .map((block) => {- const appName = block.devices.find(- (device) => device.metadata.app_name- )?.metadata.app_name!;- const blockTime = new Date(block.timestamp);-- // Calculate percentage based on visible time range- const percentPosition =- ((blockTime.getTime() - timeRange.start.getTime()) / totalRange) *- 100;-- return {- appName,- percentThroughDay: percentPosition,- timestamp: blockTime,- iconSrc: iconCache[appName],- };- })- // Filter out blocks that are too close to each other (less than 1% apart)- .filter((block, index, array) => {- if (index === 0) return true;- const prevBlock = array[index - 1];- const minDuration = 0.4; // 1% minimum gap between icons- return (- Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) >- minDuration- );- })+ // Sort frames by timestamp first+ const sortedFrames = [...significantBlocks].sort(+ (a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());++ sortedFrames.forEach((frame) => {+ const timestamp = new Date(frame.timestamp);+ // Ensure we have devices data+ if (!frame.devices?.[0]?.metadata?.app_name) return;++ const appName = frame.devices[0].metadata.app_name;+ if (timestamp < timeRange.start || timestamp > timeRange.end) return;++ if (!currentBlock) {+ currentBlock = {+ appName,+ startTime: timestamp,+ endTime: timestamp,+ };+ } else if (currentBlock.appName !== appName) {+ blocks.push(currentBlock);+ currentBlock = {+ appName,+ startTime: timestamp,+ endTime: timestamp,+ };+ } else {+ currentBlock.endTime = timestamp;+ }+ });++ if (currentBlock) blocks.push(currentBlock);++ console.log("Initial blocks:", blocks);++ // Convert blocks to icons+ // Only show icons for blocks that are longer than 5% of total time+ const totalRange = timeRange.end.getTime() - timeRange.start.getTime();+ const minDuration = totalRange * 0.05;++ return blocks+ .filter(block => {+ const duration = block.endTime.getTime() - block.startTime.getTime();+ return duration > minDuration;+ })+ .map(block => {+ // Place icon at the middle of the block+ const middleTime = new Date(+ block.startTime.getTime() ++ (block.endTime.getTime() - block.startTime.getTime()) / 2+ );++ const percentPosition =+ ((middleTime.getTime() - timeRange.start.getTime()) / totalRange) * 100;++ return {+ appName: block.appName,+ percentThroughDay: percentPosition,+ timestamp: middleTime,+ iconSrc: iconCache[block.appName],+ };+ })+ .filter((block, index, array) => {+ if (index === 0) return true;+ const prevBlock = array[index - 1];+ // Ensure icons don't overlap+ return Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 3;+ });}, [significantBlocks, iconCache, timeRange]);const loadAppIcon = useCallback(@@ -273,7 +321,6 @@ export function TimelineIconsSection({return (<div className="absolute -top-12 inset-x-0 pointer-events-none h-8">-{processedBlocks.map((block, i) => (<divkey={`${block.appName}-${i}`}diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex c62a2da7f..ff40b0e59 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.7"+version = "0.9.9"dependencies = ["anyhow","axum",