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
fix: issue with onboarding and store
Louis Beaumont5606fa912989
diff --git a/screenpipe-app-tauri/app/globals.css b/screenpipe-app-tauri/app/globals.cssindex 831b79ebd..7437b7e78 100644--- a/screenpipe-app-tauri/app/globals.css+++ b/screenpipe-app-tauri/app/globals.css@@ -113,11 +113,7 @@@apply bg-background text-foreground !pointer-events-auto;}}-.pf-v6-c-log-viewer__text {- font-family: monospace!important;- padding-inline-end: 16px!important;- padding-inline-start: 16px!important;-}+.pf-v6-c-text-input-group__text-input {overflow: hidden;text-overflow: ellipsis;@@ -143,21 +139,4 @@position: absolute!important;}-.pf-v6-c-log-viewer.pf-m-line-numbers .pf-v6-c-log-viewer__list::before {- position: absolute!important;- inset-block-start: 0!important;- inset-block-end: 0!important;- inset-inline-start: 0!important;- width: 1px!important;- content: ""!important;- background: rgb(199, 199, 199)!important;-}--.pf-v6-c-log-viewer__index {- padding-inline-start: 16px!important;- font-family: monospace!important;-}-.pf-v6-c-log-viewer__string.pf-m-current {- background-color: #dca614!important;-}\ No newline at end of filediff --git a/screenpipe-app-tauri/components/log-file-button.tsx b/screenpipe-app-tauri/components/log-file-button.tsxindex c3625370e..9a0f1d927 100644--- a/screenpipe-app-tauri/components/log-file-button.tsx+++ b/screenpipe-app-tauri/components/log-file-button.tsx@@ -1,4 +1,4 @@-import { useToast } from "./ui/use-toast";+import { toast, useToast } from "./ui/use-toast";import {Tooltip,TooltipContent,@@ -6,7 +6,7 @@ import {TooltipTrigger,} from "./ui/tooltip";import { Button } from "./ui/button";-import { FileText, Copy } from "lucide-react";+import { FileText, Copy, AppWindow } from "lucide-react";import { readTextFile } from "@tauri-apps/plugin-fs";import { useCopyToClipboard } from "@/lib/hooks/use-copy-to-clipboard";import { cn } from "@/lib/utils";@@ -24,25 +24,59 @@ import { invoke } from "@tauri-apps/api/core";import React from "react";import { LogViewer, LogViewerSearch } from "@patternfly/react-log-viewer";import { Toolbar, ToolbarContent, ToolbarItem } from "@patternfly/react-core";+import { open } from "@tauri-apps/plugin-shell";++const LogContent = ({+ content,+ filePath,+}: {+ content: string;+ filePath: string;+}) => {+ const handleOpenInDefaultApp = async () => {+ try {+ await open(filePath);+ } catch (error) {+ console.error("failed to open log file:", error);+ toast({+ title: "error",+ description: "failed to open log file",+ variant: "destructive",+ });+ }+ };-const LogContent = ({ content }: { content: string }) => {return (- <LogViewer- theme="dark"- isTextWrapped={false}- hasLineNumbers={true}- data={content}- height="58vh"- toolbar={- <Toolbar>- <ToolbarContent>- <ToolbarItem>- <LogViewerSearch placeholder="Search value" minSearchChars={3} />- </ToolbarItem>- </ToolbarContent>- </Toolbar>- }- />+ <div className="relative">+ <LogViewer+ theme="dark"+ isTextWrapped={false}+ hasLineNumbers={true}+ data={content}+ height="58vh"+ toolbar={+ <Toolbar>+ <ToolbarContent className="p-2 relative w-full">+ <ToolbarItem>+ <LogViewerSearch+ placeholder="Search value"+ minSearchChars={3}+ />+ </ToolbarItem>+ <ToolbarItem className="p-2 absolute right-0 top-0">+ <Button+ variant="outline"+ size="sm"+ onClick={handleOpenInDefaultApp}+ >+ open in default app+ </Button>+ </ToolbarItem>+ </ToolbarContent>+ </Toolbar>+ }+ />+ </div>);};LogContent.displayName = "LogContent";@@ -58,7 +92,6 @@ export const LogFileButton = ({}) => {const { toast } = useToast();const { copyToClipboard } = useCopyToClipboard({ timeout: 3000 });- const { getDataDir } = useSettings();const [isOpen, setIsOpen] = useState(false);const [logPath, setLogPath] = useState("");@@ -171,7 +204,11 @@ export const LogFileButton = ({className="w-full justify-start text-xs"onClick={() => loadLogContent(file.path)}>- <FileText className="h-3 w-3 mr-2" />+ {file.name.includes("app") ? (+ <AppWindow className="h-3 w-3 mr-2" />+ ) : (+ <FileText className="h-3 w-3 mr-2" />+ )}<span className="truncate">{file.name}</span></Button>))}@@ -184,22 +221,14 @@ export const LogFileButton = ({{logPath && (<><div className="relative flex-1 border rounded-md">- <LogContent content={logContent} />- <Button- variant="outline"- size="sm"- className="absolute top-2 right-2 opacity-0 transition-opacity hover:opacity-100 group-hover:opacity-100 focus:opacity-100"- onClick={() => copyToClipboard(logContent)}- >- <Copy className="h-3 w-3" />- </Button>+ <LogContent content={logContent} filePath={logPath} /></div><div className="flex items-center justify-between px-2 py-1 bg-secondary/50 rounded-md"><code className="text-sm font-mono">{logPath}</code><Buttonvariant="ghost"size="sm"- onClick={() => copyToClipboard(logPath)}+ onClick={() => copyToClipboard(logContent)}><Copy className="h-3 w-3" /></Button>diff --git a/screenpipe-app-tauri/components/onboarding.tsx b/screenpipe-app-tauri/components/onboarding.tsxindex 45ef586e2..bea2cea40 100644--- a/screenpipe-app-tauri/components/onboarding.tsx+++ b/screenpipe-app-tauri/components/onboarding.tsx@@ -17,10 +17,6 @@ import OnboardingLogin from "./onboarding/login";import OnboardingPipeStore from "./onboarding/pipe-store";import posthog from "posthog-js";-const setFirstTimeUserFlag = async () => {- await localforage.setItem("isFirstTimeUser", false);-};-type SlideKey =| "intro"| "status"@@ -271,7 +267,6 @@ const Onboarding: React.FC = () => {});setShowOnboarding(false);- await setFirstTimeUserFlag();updateSettings({isFirstTimeUser: false,});diff --git a/screenpipe-app-tauri/components/onboarding/introduction.tsx b/screenpipe-app-tauri/components/onboarding/introduction.tsxindex 94c04c920..d3d732713 100644--- a/screenpipe-app-tauri/components/onboarding/introduction.tsx+++ b/screenpipe-app-tauri/components/onboarding/introduction.tsx@@ -3,6 +3,9 @@ import { DialogHeader, DialogTitle } from "@/components/ui/dialog";import { Button } from "@/components/ui/button";import { RainbowButton } from "../ui/rainbow-button";import { ArrowRight } from "lucide-react";+import { useSettings } from "@/lib/hooks/use-settings";+import posthog from "posthog-js";+import { useOnboarding } from "@/lib/hooks/use-onboarding";interface OnboardingIntroProps {className?: string;@@ -12,36 +15,57 @@ interface OnboardingIntroProps {const OnboardingIntro: React.FC<OnboardingIntroProps> = ({className = "",handleNextSlide,-}) => (- <div className={` flex justify-center items-center flex-col ${className}`}>- <DialogHeader className="flex flex-col px-2 justify-center items-center">- <img- className="w-24 h-24 justify-center"- src="/128x128.png"- alt="screenpipe-logo"- />- <DialogTitle className="text-center text-2xl">- where pixels become magic- </DialogTitle>- <h2 className="text-center text-sm">- welcome to screenpipe, excited to have you here- </h2>- </DialogHeader>- <video- width="600px"- className="mt-2 rounded-md"- autoPlay- controls- preload="true"- >- <source src="/onboarding-screenpipe.mp4" type="video/mp4" />- your browser does not support the video tag.- </video>- <RainbowButton className="mt-4" onClick={handleNextSlide}>- get started- <ArrowRight className="w-4 h-4 ml-2" />- </RainbowButton>- </div>-);+}) => {+ const { updateSettings } = useSettings();+ const { setShowOnboarding } = useOnboarding();+ const handleSkip = () => {+ updateSettings({+ isFirstTimeUser: false,+ });+ setShowOnboarding(false);+ posthog.capture("onboarding_skipped");+ };++ return (+ <div className={` flex justify-center items-center flex-col ${className}`}>+ <DialogHeader className="flex flex-col px-2 justify-center items-center">+ <img+ className="w-24 h-24 justify-center"+ src="/128x128.png"+ alt="screenpipe-logo"+ />+ <DialogTitle className="text-center text-2xl">+ where pixels become magic+ </DialogTitle>+ <h2 className="text-center text-sm">+ welcome to screenpipe, excited to have you here+ </h2>+ </DialogHeader>+ <video+ width="600px"+ className="mt-2 rounded-md"+ autoPlay+ controls+ preload="true"+ >+ <source src="/onboarding-screenpipe.mp4" type="video/mp4" />+ your browser does not support the video tag.+ </video>+ <div className="flex gap-4 mt-4">+ <Button+ variant="ghost"+ onClick={handleSkip}+ className="text-muted-foreground"+ >+ skip onboarding+ </Button>+ <RainbowButton onClick={handleNextSlide}>+ get started+ <ArrowRight className="w-4 h-4 ml-2" />+ </RainbowButton>+ </div>+ </div>+ );+};export default OnboardingIntro;diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsxindex de9cefb36..9bd717c5f 100644--- a/screenpipe-app-tauri/components/pipe-store.tsx+++ b/screenpipe-app-tauri/components/pipe-store.tsx@@ -189,11 +189,11 @@ const corePipes: (CorePipe & { fullDescription?: string })[] = [paid: false,},{- id: "pipe-reddit-auto-posts",+ id: "reddit-auto-posts",name: "reddit auto posts",description:"promote your content, grow your audience, or learn new things with this automated reddit post generator based on your screen recordings",- url: "https://github.com/mediar-ai/screenpipe/tree/main/pipes/pipe-reddit-auto-posts",+ url: "https://github.com/mediar-ai/screenpipe/tree/main/pipes/reddit-auto-posts",credits: 20,paid: true,},diff --git a/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx b/screenpipe-app-tauri/lib/hooks/use-onboarding.tsxindex 6d0002282..c31ce5226 100644--- a/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-onboarding.tsx@@ -1,5 +1,6 @@-import localforage from "localforage";import React, { createContext, useState, useContext, useEffect } from "react";+import { useSettings } from "./use-settings";+import localforage from "localforage";interface OnboardingContextType {showOnboarding: boolean;@@ -14,15 +15,20 @@ export const OnboardingProvider: React.FC<{ children: React.ReactNode }> = ({children,}) => {const [showOnboarding, setShowOnboarding] = useState(false);+ const { settings } = useSettings();useEffect(() => {const checkFirstTimeUser = async () => {- const isFirstTime = await localforage.getItem<boolean>("isFirstTimeUser");- if (isFirstTime === null) {+ // settings unreliable here ... race condition+ const isFirstTime = await localforage.getItem("showOnboarding");+ if (isFirstTime) {setShowOnboarding(true);}};checkFirstTimeUser();- }, []);+ }, [settings]);+ useEffect(() => {+ localforage.setItem("showOnboarding", showOnboarding);+ }, [showOnboarding]);return (<OnboardingContext.Provider value={{ showOnboarding, setShowOnboarding }}>{children}diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex 9cc7bc36b..f1c388bf9 100755--- a/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -5165,7 +5165,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "0.25.2"+version = "0.25.3"dependencies = ["anyhow","axum",diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex da4b5a516..afa1e38f3 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -1006,6 +1006,9 @@ async fn main() {let app_handle = app.handle().clone();+ info!("is_first_time_user: {}", is_first_time_user);+ info!("use_dev_mode: {}", use_dev_mode);+info!("will start sidecar: {}",!use_dev_mode && !is_first_time_user