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
improve onboarding and fix settings resetting,improve settings modal ui
shaik-zeeshanb26588b9de59
diff --git a/openrewind/app/page.tsx b/openrewind/app/page.tsxindex 92cb5543c..ad8297381 100644--- a/openrewind/app/page.tsx+++ b/openrewind/app/page.tsx@@ -13,6 +13,7 @@ import { BreakingChangesInstructionsDialog } from "@/components/breaking-changesimport { useChangelogDialog } from "@/lib/hooks/use-changelog-dialog";import { useStatusDialog } from "@/lib/hooks/use-status-dialog";import { useSettingsDialog } from "@/lib/hooks/use-settings-dialog";+import { useHealthCheck } from "@/lib/hooks/use-health-check";import { invoke } from "@tauri-apps/api/core";import { listen } from "@tauri-apps/api/event";@@ -24,15 +25,24 @@ import { onOpenUrl } from "@tauri-apps/plugin-deep-link";import { LoginDialog } from "../components/login-dialog";import { ModelDownloadTracker } from "../components/model-download-tracker";import Timeline from "@/components/rewind/timeline";+import { Button } from "@/components/ui/button";+import { Separator } from "@/components/ui/separator";+import { RefreshCw, AlertTriangle, Settings } from "lucide-react";+import { PermissionButtons } from "@/components/status/permission-buttons";+import { usePlatform } from "@/lib/hooks/use-platform";+import SplashScreen from "@/components/splash-screen";export default function Home() {- const { settings, updateSettings, loadUser, reloadStore } = useSettings();+ const { settings, updateSettings, loadUser, reloadStore, isSettingsLoaded, loadingError } = useSettings();const { setActiveProfile } = useProfiles();const { toast } = useToast();- const { showOnboarding, setShowOnboarding } = useOnboarding();+ const { showOnboarding, setShowOnboarding, initialized } = useOnboarding();const { setShowChangelogDialog } = useChangelogDialog();const { open: openStatusDialog } = useStatusDialog();const { setIsOpen: setSettingsOpen } = useSettingsDialog();+ const { isServerDown } = useHealthCheck();+ const { isMac } = usePlatform();+ const [isRestarting, setIsRestarting] = useState(false);const isProcessingRef = useRef(false);useEffect(() => {@@ -147,12 +157,17 @@ export default function Home() {"screenPermissionRestartPending");if (restartPending) {+ // Clear the restart pending flag+ await localforage.removeItem("screenPermissionRestartPending");setShowOnboarding(true);}};- checkScreenPermissionRestart();- }, [setShowOnboarding]);+ // Only check after onboarding is initialized+ if (initialized) {+ checkScreenPermissionRestart();+ }+ }, [setShowOnboarding, initialized]);useEffect(() => {const unlisten = listen("cli-login", async (event) => {@@ -165,21 +180,143 @@ export default function Home() {};}, []);+ const handleRestartServer = async () => {+ setIsRestarting(true);+ try {+ toast({+ title: "restarting server",+ description: "stopping screenpipe server...",+ duration: 3000,+ });++ // Stop the server first+ await invoke("stop_screenpipe");++ // Wait for proper cleanup+ await new Promise(resolve => setTimeout(resolve, 2000));++ toast({+ title: "restarting server",+ description: "starting screenpipe server...",+ duration: 3000,+ });++ // Start the server+ await invoke("spawn_screenpipe");++ toast({+ title: "server restarted",+ description: "screenpipe server has been restarted successfully.",+ duration: 3000,+ });+ } catch (error) {+ console.error("failed to restart server:", error);+ toast({+ title: "restart failed",+ description: "failed to restart screenpipe server. please check the logs.",+ variant: "destructive",+ duration: 5000,+ });+ } finally {+ setIsRestarting(false);+ }+ };+return (<div className="flex flex-col items-center flex-1 mx-auto relative scrollbar-hide"><LoginDialog /><ModelDownloadTracker /><NotificationHandler />- {showOnboarding ? (- <Onboarding />- ) : (+ {/* Only render content after both onboarding and settings are initialized */}+ {initialized && isSettingsLoaded ? (<>- <ChangelogDialog />- {/* <BreakingChangesInstructionsDialog /> */}- <div className="w-full scrollbar-hide">- <Timeline />- </div>+ {showOnboarding ? (+ <Onboarding />+ ) : (+ <>+ <ChangelogDialog />+ {/* <BreakingChangesInstructionsDialog /> */}+ {!isServerDown ? (+ <div className="w-full scrollbar-hide">+ <Timeline />+ </div>+ ) : (+ <div className="flex items-center justify-center h-screen p-4">+ <div className="max-w-lg w-full space-y-6">+ {/* Header */}+ <div className="text-center space-y-4">+ <div className="flex flex-col items-center gap-3">+ <div className="w-16 h-16 rounded-full bg-destructive/10 flex items-center justify-center">+ <AlertTriangle className="w-8 h-8 text-destructive" />+ </div>+ <div>+ <h2 className="text-2xl font-bold">Server Not Active</h2>+ <p className="text-muted-foreground mt-2">+ The screenpipe server is not running. Start the server or check permissions to continue.+ </p>+ </div>+ </div>+ </div>++ {/* Actions Card */}+ <div className="bg-card border rounded-lg p-6 space-y-6">+ {/* Server Control */}+ <div className="space-y-4">+ <div className="flex items-center justify-between">+ <div>+ <h3 className="font-semibold">Server Control</h3>+ <p className="text-sm text-muted-foreground">+ Start or restart the screenpipe server+ </p>+ </div>+ <Button+ onClick={handleRestartServer}+ disabled={isRestarting}+ className="flex items-center gap-2"+ >+ <RefreshCw className={`h-4 w-4 ${isRestarting ? 'animate-spin' : ''}`} />+ {isRestarting ? "Starting..." : "Start Server"}+ </Button>+ </div>+ </div>++ {/* Permissions Section - Only show on Mac */}+ {isMac && (+ <>+ <Separator />+ <div className="space-y-4">+ <div>+ <h3 className="font-semibold">System Permissions</h3>+ <p className="text-sm text-muted-foreground">+ Ensure screenpipe has the necessary permissions to function properly+ </p>+ </div>+ <div className="space-y-3">+ <div className="flex items-center justify-between">+ <span className="text-sm font-medium">Screen Recording</span>+ <PermissionButtons type="screen" />+ </div>+ <div className="flex items-center justify-between">+ <span className="text-sm font-medium">Audio Recording</span>+ <PermissionButtons type="audio" />+ </div>+ <div className="flex items-center justify-between">+ <span className="text-sm font-medium">Accessibility</span>+ <PermissionButtons type="accessibility" />+ </div>+ </div>+ </div>+ </>+ )}+ </div>+ </div>+ </div>+ )}+ </>+ )}</>+ ) : (+ <SplashScreen />)}</div>);diff --git a/openrewind/components/onboarding.tsx b/openrewind/components/onboarding.tsxindex 82ca2096b..77f6c175b 100644--- a/openrewind/components/onboarding.tsx+++ b/openrewind/components/onboarding.tsx@@ -1,133 +1,56 @@import localforage from "localforage";import React, { useState, useEffect } from "react";import { useToast } from "@/components/ui/use-toast";-import OnboardingPipes from "@/components/onboarding/pipes";import { Dialog, DialogContent } from "@/components/ui/dialog";import OnboardingStatus from "@/components/onboarding/status";import OnboardingIntro from "@/components/onboarding/introduction";import OnboardingAPISetup from "@/components/onboarding/api-setup";-import OnboardingPersonalize from "@/components/onboarding/personalize";-import OnboardingDevOrNonDev from "@/components/onboarding/dev-or-non-dev";-import OnboardingDevConfig from "@/components/onboarding/dev-configuration";-import OnboardingSelection from "@/components/onboarding/usecases-selection";import OnboardingInstructions from "@/components/onboarding/explain-instructions";import { useOnboarding } from "@/lib/hooks/use-onboarding";import { useSettings } from "@/lib/hooks/use-settings";import OnboardingLogin from "./onboarding/login";-import OnboardingPipeStore from "./onboarding/pipe-store";import posthog from "posthog-js";type SlideKey =| "intro"- | "status"+ | "status"| "login"- | "selection"- | "personalize"| "apiSetup"- | "devOrNonDev"- | "devConfig"- | "pipes"- | "pipeStore"| "instructions";-const slideFlow: Record<- SlideKey,- {- next: (- selectedOptions?: string[],- selectedPreference?: string | null,- selectedPersonalization?: string | null- ) => SlideKey | null;- prev: (- selectedOptions?: string[],- selectedPreference?: string | null,- selectedPersonalization?: string | null- ) => SlideKey | null;- }-> = {- intro: {- // introduction video of screenpipe- next: () => "status",- prev: () => null,- },- status: {- // status of screenpipe (blockage or not)- next: () => "login",- prev: () => "intro",- },- login: {- // login- next: () => "apiSetup",- prev: () => "status",- },- selection: {- // selection (four options)- next: (selectedOptions) => {- if (!Array.isArray(selectedOptions) || selectedOptions.length === 0)- return null;- return "devOrNonDev";- },- prev: () => "status",- },- personalize: {- // personalize (with ai or without ai)- next: (selectedOptions, __, selectedPersonalization) => {- if (selectedPersonalization === "withAI") return "apiSetup";- if (- selectedOptions?.includes("personalUse") &&- selectedPersonalization === "withoutAI"- )- return "instructions";+// Simplified flow - linear progression+const getNextSlide = (currentSlide: SlideKey): SlideKey | null => {+ switch (currentSlide) {+ case "intro":+ return "status";+ case "status":+ return "login";+ case "login":+ return "apiSetup";+ case "apiSetup":return "instructions";- },- prev: () => "selection",- },- apiSetup: {- // api setup & validation- next: () => "pipeStore",- prev: () => "login",- },- pipeStore: {- // pipe store- next: () => null,- prev: () => "apiSetup",- },- devOrNonDev: {- // dev or no dev- next: (selectedOptions, selectedPreference, selectedPersonalization) => {- if (- selectedOptions?.includes("personalUse") &&- selectedPersonalization === "withoutAI" &&- selectedPreference === "nonDevMode"- )- return "instructions";- if (selectedPreference === "devMode") return "devConfig";- return "personalize";- },- prev: () => "selection",- },- devConfig: {- // dev configuration- next: () => "pipes",- prev: () => "devOrNonDev",- },- pipes: {- // explain about pipes to dev- next: () => "instructions",- prev: () => "devConfig",- },- instructions: {- // instructions for every type of user- next: () => null,- prev: (selectedOptions, selectedPreference, selectedPersonalization) => {- if (selectedPreference === "devMode") return "pipes";- if (selectedOptions?.includes("personalUse")) return "personalize";- if (selectedOptions?.includes("professionalUse")) return "personalize";- if (selectedOptions?.includes("developmentlUse")) return "personalize";- if (selectedPersonalization === "withAI") return "apiSetup";- return "devOrNonDev";- },- },+ case "instructions":+ return null;+ default:+ return null;+ }+};++const getPrevSlide = (currentSlide: SlideKey): SlideKey | null => {+ switch (currentSlide) {+ case "intro":+ return null;+ case "status":+ return "intro";+ case "login":+ return "status";+ case "apiSetup":+ return "login";+ case "instructions":+ return "apiSetup";+ default:+ return null;+ }};const trackOnboardingStep = (@@ -143,15 +66,9 @@ const trackOnboardingStep = (const Onboarding: React.FC = () => {const { toast } = useToast();const [currentSlide, setCurrentSlide] = useState<SlideKey>("intro");- const [selectedOptions, setSelectedOptions] = useState<string[]>([]); // use case selection (four options)- const [selectedPersonalization, setSelectedPersonalization] = useState<- string | null- >(null); // with ai or without ai- const [selectedPreference, setSelectedPreference] = useState<string | null>(- null- ); // dev or non devconst [error, setError] = useState<string | null>(null);const [isVisible, setIsVisible] = useState(false);+ const [visitedSlides, setVisitedSlides] = useState<SlideKey[]>(["intro"]);const { showOnboarding, setShowOnboarding } = useOnboarding();useEffect(() => {@@ -173,7 +90,7 @@ const Onboarding: React.FC = () => {useEffect(() => {if (error) {toast({- title: "error",+ title: "Error",description: error,variant: "destructive",});@@ -181,42 +98,21 @@ const Onboarding: React.FC = () => {}, [error, toast]);const handleNextSlide = () => {- const nextSlide = slideFlow[currentSlide].next(- selectedOptions,- selectedPreference,- selectedPersonalization- );+ const nextSlide = getNextSlide(currentSlide);trackOnboardingStep(currentSlide, {- selectedOptions,- selectedPreference,- selectedPersonalization,direction: "next",});- if (- currentSlide === "selection" &&- (!selectedOptions || selectedOptions.length === 0)- ) {- setError("please select at least one option before proceeding!");- return;- }- if (currentSlide === "personalize" && !selectedPersonalization) {- setError("please choose a personalization option!");- return;- }- if (currentSlide === "devOrNonDev" && !selectedPreference) {- setError("please choose a preference option!");- return;- }if (nextSlide) {setIsVisible(false);setTimeout(() => {setCurrentSlide(nextSlide);+ setVisitedSlides(prev => [...prev, nextSlide]);setError(null);}, 300);} else {- setError("Please validate selection");+ handleEnd();}};@@ -224,18 +120,12 @@ const Onboarding: React.FC = () => {setIsVisible(false);trackOnboardingStep(currentSlide, {- selectedOptions,- selectedPreference,- selectedPersonalization,direction: "back",});setTimeout(() => {- const prevSlide = slideFlow[currentSlide].prev(- selectedOptions,- selectedPreference,- selectedPersonalization- );+ let prevSlide = getPrevSlide(currentSlide);+if (prevSlide) {setError(null);setCurrentSlide(prevSlide);@@ -243,15 +133,6 @@ const Onboarding: React.FC = () => {}, 300);};- const handleOptionClick = (option: string) => {- setSelectedOptions((prevOptions) =>- prevOptions.includes(option)- ? prevOptions.filter((opt) => opt !== option)- : [...prevOptions, option]- );- setError(null);- };-const handleDialogClose = (open: boolean) => {if (!open && currentSlide) {setShowOnboarding(open);@@ -259,18 +140,20 @@ const Onboarding: React.FC = () => {};const handleEnd = async () => {- trackOnboardingStep("completed", {- finalOptions: selectedOptions,- finalPreference: selectedPreference,- finalPersonalization: selectedPersonalization,+ trackOnboardingStep("completed");++ // Save user preferences+ await localforage.setItem("user_preferences", {+ completedAt: new Date().toISOString(),});+ // This will automatically set onboarding_completed to truesetShowOnboarding(false);};return (<Dialog open={showOnboarding} onOpenChange={handleDialogClose}>- <DialogContent className="max-w-4xl h-[640px] max-h-[100vh]">+ <DialogContent className="max-w-5xl min-w-[1000px] min-h-[640px] max-h-[calc(100vh-100px)] overflow-hidden"><div className="flex flex-col w-full h-full overflow-hidden">{currentSlide === "intro" && (<OnboardingIntro@@ -295,26 +178,6 @@ const Onboarding: React.FC = () => {handlePrevSlide={handlePrevSlide}/>)}- {currentSlide === "selection" && (- <OnboardingSelection- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleOptionClick={handleOptionClick}- selectedOptions={selectedOptions}- handlePrevSlide={handlePrevSlide}- handleNextSlide={handleNextSlide}- />- )}- {currentSlide === "personalize" && (- <OnboardingPersonalize- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleOptionClick={setSelectedPersonalization}- selectedPersonalization={selectedPersonalization}- handlePrevSlide={handlePrevSlide}- handleNextSlide={handleNextSlide}- />- )}{currentSlide === "apiSetup" && (<OnboardingAPISetupclassName={`transition-opacity duration-300 ease-in-out@@ -323,40 +186,6 @@ const Onboarding: React.FC = () => {handlePrevSlide={handlePrevSlide}/>)}- {currentSlide === "pipeStore" && (- <OnboardingPipeStore- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleNextSlide={handleEnd}- handlePrevSlide={handlePrevSlide}- />- )}- {currentSlide === "devOrNonDev" && (- <OnboardingDevOrNonDev- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleOptionClick={setSelectedPreference}- selectedPreference={selectedPreference}- handlePrevSlide={handlePrevSlide}- handleNextSlide={handleNextSlide}- />- )}- {currentSlide === "devConfig" && (- <OnboardingDevConfig- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleNextSlide={handleNextSlide}- handlePrevSlide={handlePrevSlide}- />- )}- {currentSlide === "pipes" && (- <OnboardingPipes- className={`transition-opacity duration-300 ease-in-out- ${isVisible ? "opacity-100 ease-out" : "opacity-0 ease-in"}`}- handleNextSlide={handleNextSlide}- handlePrevSlide={handlePrevSlide}- />- )}{currentSlide === "instructions" && (<OnboardingInstructionsclassName={`transition-opacity duration-300 ease-in-outdiff --git a/openrewind/components/onboarding/explain-instructions.tsx b/openrewind/components/onboarding/explain-instructions.tsxindex 827bb7f34..df68246a4 100644--- a/openrewind/components/onboarding/explain-instructions.tsx+++ b/openrewind/components/onboarding/explain-instructions.tsx@@ -1,127 +1,159 @@import React from "react";-import { HelpCircle, Info } from "lucide-react";-import { open } from "@tauri-apps/plugin-shell";import { DialogHeader, DialogTitle } from "@/components/ui/dialog";-import OnboardingNavigation from "@/components/onboarding/navigation";+import { Button } from "@/components/ui/button";+import { RainbowButton } from "../ui/rainbow-button";import {- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger,-} from "@/components/ui/tooltip";+ CheckCircle,+ Play,+ Search,+ MessageSquare,+ ArrowRight,+ Sparkles,+} from "lucide-react";+import OnboardingNavigation from "@/components/onboarding/navigation";+import { motion } from "framer-motion";interface OnboardingInstructionsProps {className?: string;- handlePrevSlide: () => void;handleNextSlide: () => void;+ handlePrevSlide: () => void;}const OnboardingInstructions: React.FC<OnboardingInstructionsProps> = ({- className = "",- handlePrevSlide,+ className,handleNextSlide,+ handlePrevSlide,}) => {+ const features = [+ {+ icon: Play,+ title: "Recording Started",+ description: "OpenRewind is now capturing your screen and audio",+ status: "active"+ },+ {+ icon: Search,+ title: "Timeline Ready",+ description: "View and navigate through your recorded activities",+ status: "ready"+ },+ {+ icon: MessageSquare,+ title: "AI Assistant",+ description: "Ask questions about your recorded data",+ status: "ready"+ }+ ];++ const quickTips = [+ "Use the timeline at the bottom to navigate through your day",+ "Scroll through your screen recordings with your mouse wheel",+ "Click the AI panel to ask questions about what you've recorded",+ "Audio transcriptions will appear automatically for meetings and calls"+ ];+return (- <div className={`${className} w-full flex justify-center flex-col overflow-y-auto`}>- <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">- screenpipe tips+ <div className={`${className} flex flex-col h-full`}>+ <DialogHeader className="flex flex-col px-2 justify-center items-center mb-6">+ <motion.div+ initial={{ scale: 0.8, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{ duration: 0.5 }}+ className="relative"+ >+ <img+ className="w-20 h-20 justify-center mb-4"+ src="/128x128.png"+ alt="openrewind-logo"+ />+ <div className="absolute -top-2 -right-2">+ <CheckCircle className="w-8 h-8 text-green-500 bg-white rounded-full" />+ </div>+ </motion.div>++ <DialogTitle className="text-center text-2xl font-bold">+ You're all set! 🎉</DialogTitle>+ <p className="text-center text-muted-foreground mt-2 max-w-md">+ OpenRewind is ready to help you remember, find, and understand everything you do on your computer.+ </p></DialogHeader>- <div className="flex justify-center">- <div className="h-[1px] w-40 rounded-full bg-gradient-to-l from-slate-500/30 to-transparent"></div>- <div className="h-[1px] w-40 rounded-full bg-gradient-to-r from-slate-500/30 to-transparent"></div>- </div>- <div className="mt-2 w-full flex justify-around flex-col ">- <div className="mx-4 mb-2">- <h2 className="font-semibold text-md">search functionality:</h2>- <p className="text-muted-foreground text-[14px]">- <span className="font-medium text-nowrap text-[14px] prose mr-1">- on screenpipe's main menu,- </span>- you'll find an advanced search interface to query your 24/7 screen & mic recordings. it- lets you select specific results for ai summarization and chatting,- providing valuable insights.- <br />- use cases:- <ul>- <li>- meeting or general conversation summaries</li>- <li>- activity summaries (youtube, browsing, etc.)</li>- <li>- education (lecture, tutorial, etc.)</li>- <li>- etc.</li>- </ul>- </p>- </div>- <div className="flex justify-center">- <div className="h-[1px] w-[80%] rounded-full bg-gradient-to-l from-slate-500/30 to-transparent"></div>- <div className="h-[1px] w-[80%] rounded-full bg-gradient-to-r from-slate-500/30 to-transparent"></div>- </div>- <div className="mx-4 mb-2">- <h2 className="font-medium text-md">status menu:</h2>- <p className="text-muted-foreground text-[14px]">- <span className="font-medium text-nowrap text-[14px] prose mr-1">- screenpipe status menu serves- </span>- as a health and process monitor and allows you to adjust advanced- preferences for the recording processes- </p>- </div>- <div className="flex justify-center">- <div className="h-[1px] w-[80%] rounded-full bg-gradient-to-l from-slate-500/30 to-transparent"></div>- <div className="h-[1px] w-[80%] rounded-full bg-gradient-to-r from-slate-500/30 to-transparent"></div>- </div>- <div className="mx-4 mb-2">- <h2 className="font-medium text-md">settings menu:</h2>- <p className="text-muted-foreground text-[14px]">- <span className="font-medium text-nowrap text-[14px] prose mr-1">- the settings menu,- </span>- is where you can configure various options like recording- settings and ai preferences- </p>- </div>- <div className="flex justify-center">- <div className="h-[1px] w-40 rounded-full bg-gradient-to-l from-slate-500/30 to-transparent"></div>- <div className="h-[1px] w-40 rounded-full bg-gradient-to-r from-slate-500/30 to-transparent"></div>- </div>- <div className="mx-4">- <h2 className="font-medium text-md">- meetings tracking (experimental):- </h2>- <p className="text-muted-foreground text-[14px]">- <span className="font-medium text-nowrap text-[14px] prose mr-1">- this features of screenpipe- </span>- tracks your meetings and generates- summaries for you using ai- </p>++ <div className="flex-1 flex flex-col items-center justify-center space-y-6">+ {/* Status Cards */}+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4 max-w-4xl">+ {features.map((feature, index) => (+ <motion.div+ key={index}+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: index * 0.1 }}+ className="bg-card border rounded-xl p-4 text-center"+ >+ <div className="flex items-center justify-center mb-3">+ <feature.icon className="w-8 h-8 text-primary" />+ {feature.status === "active" && (+ <div className="ml-2 w-2 h-2 bg-green-500 rounded-full animate-pulse" />+ )}+ </div>+ <h3 className="font-semibold text-sm mb-1">{feature.title}</h3>+ <p className="text-xs text-muted-foreground">{feature.description}</p>+ </motion.div>+ ))}</div>- <div className="mx-4">- <h2 className="font-medium text-md">pipe store (experimental):</h2>- <p className="text-muted-foreground text-[14px]">- <span className="font-medium text-nowrap text-[14px] prose mr-1">- this features of screenpipe- </span>- extend your 24/7 data through plugins you can install in seconds,- create, share and sell your own++ {/* Quick Tips */}+ <motion.div+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: 0.4 }}+ className="bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-950/20 dark:to-purple-950/20 rounded-xl p-6 max-w-2xl"+ >+ <div className="flex items-center justify-center mb-4">+ <Sparkles className="w-5 h-5 text-orange-500 mr-2" />+ <h3 className="text-lg font-semibold">Quick Tips</h3>+ </div>+ <ul className="space-y-2 text-sm">+ {quickTips.map((tip, index) => (+ <li key={index} className="flex items-start">+ <div className="w-2 h-2 bg-primary rounded-full mt-2 mr-3 flex-shrink-0" />+ <span className="text-muted-foreground">{tip}</span>+ </li>+ ))}+ </ul>+ </motion.div>++ {/* Next Steps */}+ <motion.div+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: 0.6 }}+ className="text-center"+ >+ <p className="text-sm text-muted-foreground mb-4">+ Start using your computer normally. OpenRewind will build your timeline in the background.</p>- </div>+ <div className="bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3">+ <p className="text-xs text-amber-800 dark:text-amber-200">+ 💡 <strong>Pro tip:</strong> Come back in a few minutes to see your first recorded activities!+ </p>+ </div>+ </motion.div></div>- <div className="h-[100px] my-16" />-- <OnboardingNavigation- className="mt-8"- handlePrevSlide={handlePrevSlide}- handleNextSlide={handleNextSlide}- prevBtnText="previous"- nextBtnText="next"- />+ <div className="flex justify-center gap-4 mt-6">+ <Button+ variant="ghost"+ onClick={handlePrevSlide}+ className="text-muted-foreground"+ >+ Back+ </Button>+ <RainbowButton onClick={handleNextSlide}>+ Start Using OpenRewind+ <ArrowRight className="w-4 h-4 ml-2" />+ </RainbowButton>+ </div></div>);};diff --git a/openrewind/components/onboarding/introduction.tsx b/openrewind/components/onboarding/introduction.tsxindex 129dbf348..b24de68d8 100644--- a/openrewind/components/onboarding/introduction.tsx+++ b/openrewind/components/onboarding/introduction.tsx@@ -1,11 +1,12 @@-import React from "react";+import React, { useState } from "react";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 { ArrowRight, Video, Mic, Brain, Clock, Play } from "lucide-react";import { useSettings } from "@/lib/hooks/use-settings";import posthog from "posthog-js";import { useOnboarding } from "@/lib/hooks/use-onboarding";+import { motion } from "framer-motion";interface OnboardingIntroProps {className?: string;@@ -17,46 +18,182 @@ const OnboardingIntro: React.FC<OnboardingIntroProps> = ({handleNextSlide,}) => {const { setShowOnboarding } = useOnboarding();+ const [currentStep, setCurrentStep] = useState(0);+ const [showDemo, setShowDemo] = useState(false);+const handleSkip = () => {setShowOnboarding(false);posthog.capture("onboarding_skipped");};+ const features = [+ {+ icon: Video,+ title: "Records Your Screen",+ description: "Captures everything you see and do on your computer",+ color: "text-blue-500"+ },+ {+ icon: Mic,+ title: "Captures Audio",+ description: "Records conversations, meetings, and all audio interactions",+ color: "text-green-500"+ },+ {+ icon: Clock,+ title: "Creates a Timeline",+ description: "Organizes everything into an easy-to-navigate visual timeline",+ color: "text-purple-500"+ },+ {+ icon: Brain,+ title: "AI-Powered Search",+ description: "Ask questions about your recorded data using AI",+ color: "text-orange-500"+ }+ ];++ const demoSteps = [+ "🖥️ OpenRewind quietly records your screen activity",+ "🎙️ Captures audio from meetings and conversations",+ "📅 Creates a beautiful timeline of your day",+ "🤖 AI helps you find anything: 'What did I discuss in my 2pm meeting?'"+ ];+return (- <div className={` flex justify-center items-center flex-col ${className}`}>+ <div className={`flex justify-center items-center flex-col space-y-6 ${className}`}><DialogHeader className="flex flex-col px-2 justify-center items-center">- <img+ <motion.imgclassName="w-24 h-24 justify-center"src="/128x128.png"- alt="screenpipe-logo"+ alt="openrewind-logo"+ initial={{ scale: 0.8, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{ duration: 0.5 }}/>- <DialogTitle className="text-center text-2xl">- screenpipe+ <DialogTitle className="text-center text-3xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">+ Welcome to OpenRewind</DialogTitle>+ <p className="text-center text-lg text-muted-foreground mt-2">+ Your AI-powered digital memory assistant+ </p></DialogHeader>- <iframe- width="600"- height="338"- className="mt-2 rounded-md"- src="https://www.youtube.com/embed/2963sr3IPHY"- title="screenpipe introduction"- frameBorder="0"- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"- allowFullScreen- ></iframe>- <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>++ {!showDemo ? (+ <>+ <div className="grid grid-cols-2 gap-4 max-w-2xl">+ {features.map((feature, index) => (+ <motion.div+ key={index}+ className="bg-card border rounded-xl p-4 hover:shadow-lg transition-all duration-300"+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: index * 0.1 }}+ >+ <feature.icon className={`w-8 h-8 ${feature.color} mb-3`} />+ <h3 className="font-semibold text-sm mb-1">{feature.title}</h3>+ <p className="text-xs text-muted-foreground">{feature.description}</p>+ </motion.div>+ ))}+ </div>++ <div className="bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-950/20 dark:to-purple-950/20 rounded-xl p-6 max-w-2xl">+ <h3 className="text-lg font-semibold text-center mb-3">How it works</h3>+ <div className="flex items-center justify-center space-x-3 text-sm">+ <div className="flex items-center space-x-1">+ <Video className="w-4 h-4 text-blue-500" />+ <span>Record</span>+ </div>+ <ArrowRight className="w-4 h-4 text-muted-foreground" />+ <div className="flex items-center space-x-1">+ <Clock className="w-4 h-4 text-purple-500" />+ <span>Timeline</span>+ </div>+ <ArrowRight className="w-4 h-4 text-muted-foreground" />+ <div className="flex items-center space-x-1">+ <Brain className="w-4 h-4 text-orange-500" />+ <span>AI Search</span>+ </div>+ </div>+ </div>++ <div className="flex gap-4 mt-6">+ <Button+ variant="ghost"+ onClick={() => setShowDemo(true)}+ className="text-muted-foreground"+ >+ <Play className="w-4 h-4 mr-2" />+ See Demo+ </Button>+ <Button+ variant="ghost"+ onClick={handleSkip}+ className="text-muted-foreground"+ >+ Skip Setup+ </Button>+ <RainbowButton onClick={handleNextSlide}>+ Get Started+ <ArrowRight className="w-4 h-4 ml-2" />+ </RainbowButton>+ </div>+ </>+ ) : (+ <div className="max-w-2xl">+ <div className="bg-black rounded-xl overflow-hidden shadow-2xl">+ <div className="bg-gray-800 px-4 py-2 flex items-center space-x-2">+ <div className="w-3 h-3 bg-red-500 rounded-full"></div>+ <div className="w-3 h-3 bg-yellow-500 rounded-full"></div>+ <div className="w-3 h-3 bg-green-500 rounded-full"></div>+ <span className="text-gray-300 text-sm ml-2">OpenRewind Demo</span>+ </div>+ <div className="p-6 h-64 bg-gradient-to-br from-gray-900 to-gray-800 relative overflow-hidden">+ <motion.div+ className="absolute inset-0 flex items-center justify-center"+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ transition={{ duration: 0.5 }}+ >+ <div className="text-center text-white space-y-4">+ {demoSteps.map((step, index) => (+ <motion.p+ key={index}+ className="text-lg"+ initial={{ opacity: 0, x: -20 }}+ animate={{ opacity: 1, x: 0 }}+ transition={{ delay: index * 0.8, duration: 0.5 }}+ >+ {step}+ </motion.p>+ ))}+ </div>+ </motion.div>+ </div>+ </div>++ <div className="flex gap-4 mt-6 justify-center">+ <Button+ variant="ghost"+ onClick={() => setShowDemo(false)}+ className="text-muted-foreground"+ >+ Back+ </Button>+ <Button+ variant="ghost"+ onClick={handleSkip}+ className="text-muted-foreground"+ >+ Skip Setup+ </Button>+ <RainbowButton onClick={handleNextSlide}>+ Get Started+ <ArrowRight className="w-4 h-4 ml-2" />+ </RainbowButton>+ </div>+ </div>+ )}</div>);};diff --git a/openrewind/components/onboarding/personalize.tsx b/openrewind/components/onboarding/personalize.tsxindex 38604d8c6..eefa13176 100644--- a/openrewind/components/onboarding/personalize.tsx+++ b/openrewind/components/onboarding/personalize.tsx@@ -1,111 +1,159 @@import React from "react";-import { Card, CardContent } from "@/components/ui/card";-import { TextSearch, BotMessageSquare } from "lucide-react";import { DialogHeader, DialogTitle } from "@/components/ui/dialog";+import {+ Brain,+ CircleCheck,+ Zap,+ Shield,+ Settings,+} from "lucide-react";import OnboardingNavigation from "@/components/onboarding/navigation";+import { motion } from "framer-motion";interface OnboardingPersonalizeProps {+ className?: string;+ selectedPersonalization: string | null;handleOptionClick: (option: string) => void;handleNextSlide: () => void;handlePrevSlide: () => void;- selectedPersonalization?: string | null;- className?: string;}-const PERSONALIZATION_OPTIONS = [+const OPTIONS = [{- key: "withoutAI",- icon: TextSearch,- title: "conventional search",- description:- "use advanced search capabilities on top of your 24/7 recordings or the pipe store",- note: "no api key needed.",+ key: "maxAI",+ icon: Brain,+ label: "Maximum AI assistance",+ description: "Full AI analysis with cloud processing for best results",+ features: ["Best search accuracy", "Real-time analysis", "Advanced summaries"],+ recommended: true},{- key: "withAI",- icon: BotMessageSquare,- title: "ai-enhanced Search",- description:- "use ai capabilities to summarize your recordings, extract insights, or use meeting summaries.",- note: "api key required.",+ key: "balancedAI",+ icon: Zap,+ label: "Balanced AI assistance",+ description: "Good AI analysis with some local processing",+ features: ["Good search accuracy", "Periodic analysis", "Basic summaries"],+ recommended: false},+ {+ key: "minimalAI",+ icon: Shield,+ label: "Minimal AI assistance",+ description: "Basic analysis with local processing only",+ features: ["Basic search", "Manual triggers", "Data stays local"],+ recommended: false+ }];-const CardItem: React.FC<{- option: (typeof PERSONALIZATION_OPTIONS)[number];- isSelected: boolean;+const SelectionItem: React.FC<{+ option: (typeof OPTIONS)[number];+ isSelected: boolean | undefined;onClick: () => void;-}> = ({ option, isSelected, onClick }) => {- const { icon: Icon, title, description, note } = option;-+ index: number;+}> = ({ option, isSelected, onClick, index }) => {+ const { icon: Icon, label, description, features, recommended } = option;return (- <div className="relative group h-[270px]">- <div- className={`absolute h-full !mt-[-5px] inset-0 rounded-lg transition-all duration-300 ease-out group-hover:before:opacity-100 group-hover:before:scale-100- before:absolute before:inset-0 before:rounded-lg before:border-2 before:border-black dark:before:border-white before:opacity-0 before:scale-95 before:transition-all- before:duration-300 before:ease-out ${- isSelected ? "before:!border-none" : ""- }`}- />- <Card- className={`p-4 h-full !mt-[-5px] cursor-pointer bg-white dark:bg-gray-800 hover:bg-accent transition-all relative z-[1] duration-300 ease-out group-hover:scale-[0.98]+ <motion.div+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: index * 0.1 }}+ className={`relative w-full max-w-sm flex flex-col border rounded-xl p-6 m-2 hover:shadow-lg cursor-pointer transition-all duration-300${isSelected- ? "bg-accent transition-transform relative border-2 border-black dark:border-white"- : ""+ ? "bg-primary text-primary-foreground border-primary shadow-lg transform scale-105"+ : "bg-card hover:bg-accent"}`}- onClick={onClick}- >- <CardContent className="flex flex-col w-[250px] justify-center">- <Icon className="w-16 h-16 mx-auto" />- <h2 className="font-semibold text-xl text-center mt-1">{title}</h2>- <span className="prose prose-sm mt-1">{description}</span>- <span className="text-muted-foreground text-center prose-sm mt-4">- {note}+ onClick={onClick}+ >+ {recommended && (+ <div className="absolute -top-3 left-1/2 transform -translate-x-1/2">+ <span className="bg-orange-500 text-white text-xs px-3 py-1 rounded-full font-medium">+ Recommended</span>- </CardContent>- </Card>- </div>+ </div>+ )}++ <div className="flex items-center justify-between mb-4">+ <Icon className={`h-8 w-8 ${isSelected ? 'text-primary-foreground' : 'text-primary'}`} />+ {isSelected && <CircleCheck className="h-6 w-6 flex-shrink-0" />}+ </div>++ <h3 className="font-semibold text-lg mb-2">{label}</h3>++ <p className={`text-sm mb-4 ${isSelected ? 'text-primary-foreground/90' : 'text-muted-foreground'}`}>+ {description}+ </p>++ <div className="space-y-2">+ {features.map((feature, featureIndex) => (+ <div key={featureIndex} className="flex items-center text-sm">+ <div className={`w-2 h-2 rounded-full mr-2 ${isSelected ? 'bg-primary-foreground/60' : 'bg-primary/60'}`} />+ <span className={isSelected ? 'text-primary-foreground/90' : 'text-muted-foreground'}>+ {feature}+ </span>+ </div>+ ))}+ </div>+ </motion.div>);};const OnboardingPersonalize: React.FC<OnboardingPersonalizeProps> = ({- className = "",- selectedPersonalization = "",+ className,+ selectedPersonalization,handleOptionClick,handleNextSlide,handlePrevSlide,}) => {return (- <div- className={`${className} w-full flex justify-center flex-col relative`}- >- <DialogHeader className="flex flex-col px-2 justify-center items-center">- <img- className="w-24 h-24 justify-center"+ <div className={`${className} flex flex-col h-full`}>+ <DialogHeader className="flex flex-col px-2 justify-center items-center mb-6">+ <motion.img+ className="w-20 h-20 justify-center mb-4"src="/128x128.png"- alt="screenpipe-logo"+ alt="openrewind-logo"+ initial={{ scale: 0.8, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{ duration: 0.5 }}/>- <DialogTitle className="text-center text-2xl">- do you want to use AI or just plain search?+ <DialogTitle className="text-center text-2xl font-bold">+ Choose your AI assistance level</DialogTitle>+ <p className="text-center text-muted-foreground mt-2 max-w-md">+ OpenRewind uses AI to help you find and understand your recorded data. Choose how much AI assistance you'd like.+ </p></DialogHeader>- <div className="flex w-full justify-around mt-6">- {PERSONALIZATION_OPTIONS.map((option) => (- <CardItem- key={option.key}- option={option}- isSelected={selectedPersonalization === option.key}- onClick={() => handleOptionClick(option.key)}- />- ))}++ <div className="flex-1 flex flex-col items-center justify-center">+ <div className="flex flex-wrap justify-center gap-4 max-w-6xl">+ {OPTIONS.map((option, index) => (+ <SelectionItem+ key={option.key}+ option={option}+ isSelected={selectedPersonalization === option.key}+ onClick={() => handleOptionClick(option.key)}+ index={index}+ />+ ))}+ </div>++ {selectedPersonalization && (+ <motion.div+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ className="mt-6 text-center text-sm text-muted-foreground max-w-md"+ >+ <Settings className="h-4 w-4 inline mr-1" />+ You can always change this setting later in preferences.+ </motion.div>+ )}</div>+<OnboardingNavigation- className="mt-9"handlePrevSlide={handlePrevSlide}handleNextSlide={handleNextSlide}- prevBtnText="previous"- nextBtnText="next"+ prevBtnText="Back"+ nextBtnText="Continue"/></div>);diff --git a/openrewind/components/onboarding/usecases-selection.tsx b/openrewind/components/onboarding/usecases-selection.tsxindex fd9c611d8..e9a07de60 100644--- a/openrewind/components/onboarding/usecases-selection.tsx+++ b/openrewind/components/onboarding/usecases-selection.tsx@@ -1,14 +1,16 @@import React from "react";import { DialogHeader, DialogTitle } from "@/components/ui/dialog";import {- UserRound,+ Brain,CircleCheck,- BriefcaseBusiness,- Wrench,- SlidersHorizontal,+ Search,+ Calendar,+ Users,+ MessageSquare,} from "lucide-react";import OnboardingNavigation from "@/components/onboarding/navigation";import posthog from "posthog-js";+import { motion } from "framer-motion";interface OnboardingSelectionProps {className?: string;@@ -20,57 +22,72 @@ interface OnboardingSelectionProps {const OPTIONS = [{- key: "personalUse",- icon: UserRound,- label: "personal use",- description:- "personal knowledge management, productivity, custom dev, etc.",+ key: "findInfo",+ icon: Search,+ label: "Find information quickly",+ description: "Search through your recorded activities and conversations",+ example: '"What was discussed in my morning meeting?"'},{- key: "professionalUse",- icon: BriefcaseBusiness,- label: "professional use",- description:- "out of the box productivity, meeting summaries, automation, etc.",+ key: "meetingSummaries",+ icon: Users,+ label: "Get meeting summaries",+ description: "Automatically summarize meetings and conversations",+ example: '"Summarize my call with the client yesterday"'},{- key: "developmentlUse",- icon: Wrench,- label: "development purpose",- description:- "integrate in your business product, build on top, resell, etc.",+ key: "rememberContext",+ icon: Brain,+ label: "Remember context",+ description: "Recall details about projects, decisions, and conversations",+ example: '"What was the reason we chose option A?"'},{- key: "otherUse",- icon: SlidersHorizontal,- label: "other",- description: "", // TODO editable- },+ key: "trackActivities",+ icon: Calendar,+ label: "Track daily activities",+ description: "See how you spend your time and improve productivity",+ example: '"How much time did I spend coding today?"'+ }];const SelectionItem: React.FC<{option: (typeof OPTIONS)[number];isSelected: boolean | undefined;onClick: () => void;-}> = ({ option, isSelected, onClick }) => {- const { icon: Icon, label, description } = option;+ index: number;+}> = ({ option, isSelected, onClick, index }) => {+ const { icon: Icon, label, description, example } = option;return (- <div- className={`w-[90%] flex items-center border prose prose-sm rounded-lg m-[10px] px-4 py-[10px] hover:bg-accent cursor-pointer+ <motion.div+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ delay: index * 0.1 }}+ className={`w-full max-w-md flex flex-col border rounded-xl p-4 m-2 hover:shadow-lg cursor-pointer transition-all duration-300${isSelected- ? "bg-primary text-primary-foreground transition duration-300 hover:bg-primary/90"- : ""+ ? "bg-primary text-primary-foreground border-primary shadow-lg transform scale-105"+ : "bg-card hover:bg-accent"}`}onClick={onClick}>- <span className="float-left">- <Icon className="inline h-4 w-4 mr-2" />- {label}{" "}- {description && <span className="text-[12px]">({description})</span>}- </span>- {isSelected && <CircleCheck className="inline h-4 w-4 ml-auto" />}- </div>+ <div className="flex items-start justify-between mb-3">+ <div className="flex items-center">+ <Icon className={`h-5 w-5 mr-3 ${isSelected ? 'text-primary-foreground' : 'text-primary'}`} />+ <span className="font-medium">{label}</span>+ </div>+ {isSelected && <CircleCheck className="h-5 w-5 flex-shrink-0" />}+ </div>++ <p className={`text-sm mb-2 ${isSelected ? 'text-primary-foreground/90' : 'text-muted-foreground'}`}>+ {description}+ </p>++ <div className={`text-xs italic ${isSelected ? 'text-primary-foreground/75' : 'text-muted-foreground/75'} bg-opacity-20 rounded p-2 ${isSelected ? 'bg-white/10' : 'bg-muted/50'}`}>+ <MessageSquare className="h-3 w-3 inline mr-1" />+ {example}+ </div>+ </motion.div>);};@@ -93,35 +110,52 @@ const OnboardingSelection: React.FC<OnboardingSelectionProps> = ({return (<div className={`${className} flex flex-col h-full`}>- <DialogHeader className="flex flex-col px-2 justify-center items-center">- <img- className="w-24 h-24 justify-center"+ <DialogHeader className="flex flex-col px-2 justify-center items-center mb-6">+ <motion.img+ className="w-20 h-20 justify-center mb-4"src="/128x128.png"- alt="screenpipe-logo"+ alt="openrewind-logo"+ initial={{ scale: 0.8, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{ duration: 0.5 }}/>- <DialogTitle className="text-center text-2xl">- what are you planning to use the screenpipe for?+ <DialogTitle className="text-center text-2xl font-bold">+ What would you like to do with your recorded data?</DialogTitle>+ <p className="text-center text-muted-foreground mt-2">+ Select the features that interest you most (you can choose multiple)+ </p></DialogHeader>- <div className="flex relative mt-8 justify-center items-center flex-col">- <span className="text-[15px] w-full text-center text-muted-foreground mb-2">- you can select multiple options:- </span>- {OPTIONS.map((option) => (- <SelectionItem- key={option.key}- option={option}- isSelected={selectedOptions?.includes(option.key)}- onClick={() => handleOptionClick(option.key)}- />- ))}+ <div className="flex-1 flex flex-col items-center justify-center">+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4 max-w-4xl">+ {OPTIONS.map((option, index) => (+ <SelectionItem+ key={option.key}+ option={option}+ isSelected={selectedOptions?.includes(option.key)}+ onClick={() => handleOptionClick(option.key)}+ index={index}+ />+ ))}+ </div>++ {selectedOptions && selectedOptions.length > 0 && (+ <motion.div+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ className="mt-6 text-center text-sm text-muted-foreground"+ >+ Great! We'll customize your experience for these features.+ </motion.div>+ )}</div>+<OnboardingNavigationhandlePrevSlide={handlePrevSlide}handleNextSlide={handleNext}- prevBtnText="previous"- nextBtnText="next"+ prevBtnText="Back"+ nextBtnText="Continue"/></div>);diff --git a/openrewind/components/rewind/ai-presets-selector.tsx b/openrewind/components/rewind/ai-presets-selector.tsxindex 8d99ea325..4411cc332 100644--- a/openrewind/components/rewind/ai-presets-selector.tsx+++ b/openrewind/components/rewind/ai-presets-selector.tsx@@ -716,6 +716,7 @@ interface AIPresetDialogProps {interface AIPresetsSelectorProps {recommendedPresets?: RecommendedPreset[];shortcutKey?: string;+ onPresetChange?: (preset: AIPreset) => void;}export const AIPresetDialog = ({@@ -781,6 +782,7 @@ export const AIPresetDialog = ({export const AIPresetsSelector = ({recommendedPresets,shortcutKey = "/",+ onPresetChange,}: AIPresetsSelectorProps) => {const { settings, updateSettings } = useSettings();const [open, setOpen] = useState(false);@@ -793,10 +795,18 @@ export const AIPresetsSelector = ({const selectedPreset = useMemo(() => {// Use the first preset or default preset- const defaultPreset = settings?.aiPresets?.find(preset => preset.defaultPreset);- return defaultPreset?.id || settings?.aiPresets?.[0]?.id;+ const defaultPreset = settings?.aiPresets?.find(+ (preset) => preset.defaultPreset,+ );+ return defaultPreset?.id || settings?.aiPresets?.[0]?.id || undefined;}, [settings?.aiPresets]);+ useEffect(() => {+ if (onPresetChange) {+ onPresetChange(aiPresets.find((p) => p.id === selectedPreset) as AIPreset);+ }+ }, [selectedPreset, onPresetChange]);+useEffect(() => {const handleKeyDown = (e: KeyboardEvent) => {// Check for Cmd/Ctrl + /diff --git a/openrewind/components/rewind/image-card.tsx b/openrewind/components/rewind/image-card.tsxindex 8bf7d1043..79523165c 100644--- a/openrewind/components/rewind/image-card.tsx+++ b/openrewind/components/rewind/image-card.tsx@@ -110,7 +110,16 @@ export const ImageGrid = ({useEffect(() => {const preventScroll = (e: WheelEvent) => {- e.preventDefault();+ const isWithinSettingsDialog = document+ .querySelector('[data-settings-dialog]')+ ?.contains(e.target as Node);+ const isWithinDialog = document+ .querySelector('[role="dialog"]')+ ?.contains(e.target as Node);++ if (!isWithinSettingsDialog && !isWithinDialog) {+ e.preventDefault();+ }};document.addEventListener("wheel", preventScroll, { passive: false });diff --git a/openrewind/components/rewind/timeline.tsx b/openrewind/components/rewind/timeline.tsxindex d42af273c..cdd4af46f 100644--- a/openrewind/components/rewind/timeline.tsx+++ b/openrewind/components/rewind/timeline.tsx@@ -194,8 +194,11 @@ export default function Timeline() {const isWithinTimelineDialog = document.querySelector('[role="dialog"]')?.contains(e.target as Node);+ const isWithinSettingsDialog = document+ .querySelector('[data-settings-dialog]')+ ?.contains(e.target as Node);- if (!isWithinAiPanel && !isWithinAudioPanel && !isWithinTimelineDialog) {+ if (!isWithinAiPanel && !isWithinAudioPanel && !isWithinTimelineDialog && !isWithinSettingsDialog) {e.preventDefault();}};diff --git a/openrewind/components/rewind/timeline/ai-panel.tsx b/openrewind/components/rewind/timeline/ai-panel.tsxindex 0905e760c..0ad3a3e6e 100644--- a/openrewind/components/rewind/timeline/ai-panel.tsx+++ b/openrewind/components/rewind/timeline/ai-panel.tsx@@ -72,7 +72,7 @@ export function AIPanel({const { selectionRange, setSelectionRange } = useTimelineSelection();const isAvailable = settings.aiPresets && settings.aiPresets.length > 0;const error = !isAvailable ? "No AI presets configured" : "";- const [activePreset, setActivePreset] = useState<AIPreset | null>(null);+ const [activePreset, setActivePreset] = useState<AIPreset | undefined>(undefined);// Add abort controller refconst abortControllerRef = useRef<AbortController | null>(null);@@ -93,7 +93,7 @@ export function AIPanel({};const activePreset = settings.aiPresets.find((p) => p.defaultPreset);- setActivePreset(activePreset || null);+ setActivePreset(activePreset || undefined);setOsType(detectOS());}, []);@@ -281,13 +281,17 @@ export function AIPanel({new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),);+ if (!activePreset) return;++ const apiKey =+ activePreset?.provider === "screenpipe-cloud"+ ? settings.user?.token || ""+ : "apiKey" in activePreset+ ? (activePreset?.apiKey as string) || ""+ : "";+const openai = new OpenAI({- apiKey:- activePreset?.provider === "openai"- ? activePreset.apiKey- : activePreset?.provider === "custom"- ? activePreset.apiKey- : "",+ apiKey: apiKey,baseURL: activePreset?.url,dangerouslyAllowBrowser: true,});@@ -433,7 +437,9 @@ export function AIPanel({><div className="flex flex-col gap-2"><div>- <AIPresetsSelector />+ <AIPresetsSelector+ onPresetChange={setActivePreset}+ /></div><div className="flex items-center gap-2"><TooltipProvider>diff --git a/openrewind/components/rewind/timeline/timeline.tsx b/openrewind/components/rewind/timeline/timeline.tsxindex b51562c58..3b0261f3b 100644--- a/openrewind/components/rewind/timeline/timeline.tsx+++ b/openrewind/components/rewind/timeline/timeline.tsx@@ -36,7 +36,7 @@ export function stringToColor(str: string): string {}export const TimelineSlider = ({- frames,+ frames = [],currentIndex,onFrameChange,fetchNextDayData,@@ -61,18 +61,21 @@ export const TimelineSlider = ({const { setSelectionRange, selectionRange } = useTimelineSelection();const visibleFrames = useMemo(() => {+ if (!frames || frames.length === 0) return [];const start = Math.max(0, currentIndex - 100);const end = Math.min(frames.length, currentIndex + 100);return frames.slice(start, end);}, [frames, currentIndex]);const appGroups = useMemo(() => {+ if (!visibleFrames || visibleFrames.length === 0) return [];+const groups: AppGroup[] = [];let currentApp = "";let currentGroup: StreamTimeSeriesResponse[] = [];visibleFrames.forEach((frame) => {- const appName = frame.devices[0].metadata.app_name;+ const appName = frame?.devices?.[0]?.metadata?.app_name || 'Unknown';if (appName !== currentApp) {if (currentGroup.length > 0) {groups.push({@@ -163,7 +166,7 @@ export const TimelineSlider = ({};const handleDragOver = (index: number) => {- if (isDragging && dragStartIndex !== null) {+ if (isDragging && dragStartIndex !== null && frames && frames.length > 0) {const start = Math.min(dragStartIndex, index);const end = Math.max(dragStartIndex, index);const newSelection = new Set<number>();@@ -174,20 +177,20 @@ export const TimelineSlider = ({setSelectedIndices(newSelection);- // Get frame IDs for the selection+ // Get frame IDs for the selection - add safety checkconst selectedFrameIds = Array.from(newSelection).map(- (i) => frames[i].devices[0].frame_id,- );+ (i) => frames[i]?.devices?.[0]?.frame_id || '',+ ).filter(Boolean);// Update selection range with frame IDssetSelectionRange({- end: new Date(frames[start].timestamp),- start: new Date(frames[end].timestamp),+ end: new Date(frames[start]?.timestamp || Date.now()),+ start: new Date(frames[end]?.timestamp || Date.now()),frameIds: selectedFrameIds,});if (onSelectionChange) {- const selectedFrames = Array.from(newSelection).map((i) => frames[i]);+ const selectedFrames = Array.from(newSelection).map((i) => frames[i]).filter(Boolean);onSelectionChange(selectedFrames);}}@@ -240,7 +243,7 @@ export const TimelineSlider = ({frameDate >= selectionRange.start &&frameDate <= selectionRange.end;- const hasAudio = Boolean(frame.devices[0].audio.length);+ const hasAudio = Boolean(frame?.devices?.[0]?.audio?.length);return (<motion.div@@ -277,10 +280,10 @@ export const TimelineSlider = ({</div>)}{(hoveredTimestamp === frame.timestamp ||- frames[currentIndex].timestamp === frame.timestamp) && (+ frames[currentIndex]?.timestamp === frame.timestamp) && (<div className="absolute bottom-full left-1/2 z-50 -translate-x-1/2 mb-6 w-max bg-background border rounded-md px-2 py-1 text-xs shadow-lg"><p className="font-medium">- {frame.devices[0].metadata.app_name}+ {frame?.devices?.[0]?.metadata?.app_name || 'Unknown'}</p><p className="text-muted-foreground">{new Date(frame.timestamp).toLocaleString()}diff --git a/openrewind/components/screenpipe-status.tsx b/openrewind/components/screenpipe-status.tsxindex 8ff062c46..35cc4b29b 100644--- a/openrewind/components/screenpipe-status.tsx+++ b/openrewind/components/screenpipe-status.tsx@@ -12,8 +12,9 @@ import { toast } from "./ui/use-toast";import { Button } from "./ui/button";import { Separator } from "./ui/separator";import { useHealthCheck } from "@/lib/hooks/use-health-check";-import { Folder, Activity, Mic } from "lucide-react";+import { Folder, Activity, Mic, RefreshCw, AlertTriangle } from "lucide-react";import { open as openUrl } from "@tauri-apps/plugin-shell";+import { invoke } from "@tauri-apps/api/core";import { LogFileButton } from "./log-file-button";import { DevModeSettings } from "./dev-mode-settings";@@ -21,12 +22,15 @@ import { cn } from "@/lib/utils";import { useSettings } from "@/lib/hooks/use-settings";import { useStatusDialog } from "@/lib/hooks/use-status-dialog";import { PermissionButtons } from "./status/permission-buttons";+import { usePlatform } from "@/lib/hooks/use-platform";const HealthStatus = ({ className }: { className?: string }) => {- const { health } = useHealthCheck();+ const { health, isServerDown } = useHealthCheck();const { isOpen, open, close } = useStatusDialog();const { settings, getDataDir } = useSettings();const [localDataDir, setLocalDataDir] = useState("");+ const [isRestarting, setIsRestarting] = useState(false);+ const { isMac } = usePlatform();const handleOpenDataDir = async () => {try {@@ -43,6 +47,48 @@ const HealthStatus = ({ className }: { className?: string }) => {}};+ const handleRestartServer = async () => {+ setIsRestarting(true);+ try {+ toast({+ title: "restarting server",+ description: "stopping screenpipe server...",+ duration: 3000,+ });++ // Stop the server first+ await invoke("stop_screenpipe");++ // Wait a moment for cleanup+ await new Promise(resolve => setTimeout(resolve, 2000));++ toast({+ title: "restarting server",+ description: "starting screenpipe server...",+ duration: 3000,+ });++ // Start the server+ await invoke("spawn_screenpipe");++ toast({+ title: "server restarted",+ description: "screenpipe server has been restarted successfully.",+ duration: 3000,+ });+ } catch (error) {+ console.error("failed to restart server:", error);+ toast({+ title: "restart failed",+ description: "failed to restart screenpipe server. please check the logs.",+ variant: "destructive",+ duration: 5000,+ });+ } finally {+ setIsRestarting(false);+ }+ };+const getStatusColor = (status: string,frameStatus: string,@@ -158,149 +204,209 @@ const HealthStatus = ({ className }: { className?: string }) => {</div></DialogHeader><div className="flex-grow overflow-auto">- <p className="text-sm mb-4 font-semibold" aria-label="status-message-text">{statusMessage}</p>- <div className="space-y-2 text-sm">- {/* Screen Recording Status */}- <div className="flex items-center justify-between">- <div className="flex items-center gap-2">- <div- className={`w-2 h-2 rounded-full ${- health?.frame_status === "ok"- ? "bg-green-500"- : "bg-red-500"- }`}- />- <span className="text-sm">screen recording</span>- <span className="text-sm text-muted-foreground">- status: {health ? health.frame_status : "error"}, last- update:{" "}- {formatTimestamp(health?.last_frame_timestamp ?? null)}- </span>- </div>- <div className="flex-shrink-0">- <PermissionButtons type="screen" />- </div>- </div>-- {/* Audio Recording Status */}- <div className="flex items-center justify-between">- <div className="flex items-center gap-2">- <div- className={`w-2 h-2 rounded-full ${- settings.disableAudio- ? "bg-gray-400"- : health?.audio_status === "ok"- ? "bg-green-500"- : "bg-red-500"- }`}- />- <span className="text-sm">audio recording</span>- <span className="text-sm text-muted-foreground">- status:{" "}- {settings.disableAudio- ? "turned off"- : health- ? health.audio_status- : "error"}- , last update:{" "}- {settings.disableAudio- ? "n/a"- : formatTimestamp(health?.last_audio_timestamp ?? null)}- </span>- </div>- <div className="flex-shrink-0">- <PermissionButtons type="audio" />+ {isServerDown ? (+ // Server Down UI+ <div className="space-y-6">+ <div className="flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/20 rounded-lg">+ <AlertTriangle className="h-5 w-5 text-destructive" />+ <div>+ <p className="text-sm font-semibold text-destructive">+ screenpipe server is not running+ </p>+ <p className="text-xs text-muted-foreground">+ the server appears to be down or not responding+ </p>+ </div></div>- </div>- {/* Audio Devices Status */}- {!settings.disableAudio && health?.device_status_details && (- <div className="mt-1 mb-2 relative">- <div className="flex items-center">+ <div className="space-y-4">+ <div className="flex items-center justify-between">+ <h3 className="text-sm font-medium">server control</h3><Button- variant="ghost"- size="sm"- className="h-6 p-2"- onClick={() => {- const audioDevicesEl = document.getElementById(- "audio-devices-container"- );- if (audioDevicesEl) {- audioDevicesEl.classList.toggle("hidden");- }- }}+ onClick={handleRestartServer}+ disabled={isRestarting}+ className="flex items-center gap-2">- <Mic className="h-4 w-4 mr-2" />- <span className="text-xs font-medium">audio devices</span>- <svg- xmlns="http://www.w3.org/2000/svg"- width="16"- height="16"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- className="ml-1 h-4 w-4"- >- <path d="m6 9 6 6 6-6" />- </svg>+ <RefreshCw className={`h-4 w-4 ${isRestarting ? 'animate-spin' : ''}`} />+ {isRestarting ? "restarting..." : "restart server"}</Button></div>- <div- id="audio-devices-container"- className="mt-1 max-h-32 bg-background z-10 overflow-y-auto absolute rounded border border-border p-2 hidden"- >- {health.device_status_details- .split(", ")- .map((deviceStatus: string, index: number) => {- const isActive = deviceStatus.includes("active");-- return (- <div- key={index}- className="flex items-center mb-1 last:mb-0"- >- <div- className={`w-2 h-2 rounded-full mr-2 ${- isActive ? "bg-green-500" : "bg-red-500"- }`}- ></div>- <span className="text-xs">{deviceStatus}</span>+ {isMac && (+ <div className="space-y-4">+ <Separator />+ <div>+ <h3 className="text-sm font-medium mb-3">check permissions</h3>+ <p className="text-xs text-muted-foreground mb-4">+ ensure screenpipe has the necessary permissions to function properly+ </p>+ <div className="space-y-3">+ <div className="flex items-center justify-between">+ <span className="text-sm">screen recording</span>+ <PermissionButtons type="screen" /></div>- );- })}- </div>+ <div className="flex items-center justify-between">+ <span className="text-sm">audio recording</span>+ <PermissionButtons type="audio" />+ </div>+ <div className="flex items-center justify-between">+ <span className="text-sm">accessibility</span>+ <PermissionButtons type="accessibility" />+ </div>+ </div>+ </div>+ </div>+ )}</div>- )}-- {/* UI Monitoring Status */}- {settings.enableUiMonitoring && (- <div className="flex items-center justify-between">- <div className="flex items-center gap-2">- <div- className={`w-2 h-2 rounded-full ${- health?.ui_status === "ok"- ? "bg-green-500"- : "bg-red-500"- }`}- />- <span className="text-sm">ui monitoring</span>- <span className="text-sm text-muted-foreground">- status: {health?.ui_status}, last update:{" "}- {formatTimestamp(- health ? health.last_ui_timestamp : "error"- )}- </span>+ </div>+ ) : (+ // Normal Status UI+ <>+ <p className="text-sm mb-4 font-semibold" aria-label="status-message-text">{statusMessage}</p>+ <div className="space-y-2 text-sm">+ {/* Screen Recording Status */}+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <div+ className={`w-2 h-2 rounded-full ${+ health?.frame_status === "ok"+ ? "bg-green-500"+ : "bg-red-500"+ }`}+ />+ <span className="text-sm">screen recording</span>+ <span className="text-sm text-muted-foreground">+ status: {health ? health.frame_status : "error"}, last+ update:{" "}+ {formatTimestamp(health?.last_frame_timestamp ?? null)}+ </span>+ </div>+ <div className="flex-shrink-0">+ <PermissionButtons type="screen" />+ </div></div>- <div className="flex-shrink-0">- <PermissionButtons type="accessibility" />++ {/* Audio Recording Status */}+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <div+ className={`w-2 h-2 rounded-full ${+ settings.disableAudio+ ? "bg-gray-400"+ : health?.audio_status === "ok"+ ? "bg-green-500"+ : "bg-red-500"+ }`}+ />+ <span className="text-sm">audio recording</span>+ <span className="text-sm text-muted-foreground">+ status:{" "}+ {settings.disableAudio+ ? "turned off"+ : health+ ? health.audio_status+ : "error"}+ , last update:{" "}+ {settings.disableAudio+ ? "n/a"+ : formatTimestamp(health?.last_audio_timestamp ?? null)}+ </span>+ </div>+ <div className="flex-shrink-0">+ <PermissionButtons type="audio" />+ </div></div>++ {/* Audio Devices Status */}+ {!settings.disableAudio && health?.device_status_details && (+ <div className="mt-1 mb-2 relative">+ <div className="flex items-center">+ <Button+ variant="ghost"+ size="sm"+ className="h-6 p-2"+ onClick={() => {+ const audioDevicesEl = document.getElementById(+ "audio-devices-container"+ );+ if (audioDevicesEl) {+ audioDevicesEl.classList.toggle("hidden");+ }+ }}+ >+ <Mic className="h-4 w-4 mr-2" />+ <span className="text-xs font-medium">audio devices</span>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="16"+ height="16"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ className="ml-1 h-4 w-4"+ >+ <path d="m6 9 6 6 6-6" />+ </svg>+ </Button>+ </div>++ <div+ id="audio-devices-container"+ className="mt-1 max-h-32 bg-background z-10 overflow-y-auto absolute rounded border border-border p-2 hidden"+ >+ {health.device_status_details+ .split(", ")+ .map((deviceStatus: string, index: number) => {+ const isActive = deviceStatus.includes("active");++ return (+ <div+ key={index}+ className="flex items-center mb-1 last:mb-0"+ >+ <div+ className={`w-2 h-2 rounded-full mr-2 ${+ isActive ? "bg-green-500" : "bg-red-500"+ }`}+ ></div>+ <span className="text-xs">{deviceStatus}</span>+ </div>+ );+ })}+ </div>+ </div>+ )}++ {/* UI Monitoring Status */}+ {settings.enableUiMonitoring && (+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <div+ className={`w-2 h-2 rounded-full ${+ health?.ui_status === "ok"+ ? "bg-green-500"+ : "bg-red-500"+ }`}+ />+ <span className="text-sm">ui monitoring</span>+ <span className="text-sm text-muted-foreground">+ status: {health?.ui_status}, last update:{" "}+ {formatTimestamp(+ health ? health.last_ui_timestamp : "error"+ )}+ </span>+ </div>+ <div className="flex-shrink-0">+ <PermissionButtons type="accessibility" />+ </div>+ </div>+ )}</div>- )}- </div>+ </>+ )}<Separator className="my-12" /><DevModeSettings localDataDir={localDataDir} />diff --git a/openrewind/components/settings.tsx b/openrewind/components/settings.tsxindex adef58b5d..281817d74 100644--- a/openrewind/components/settings.tsx+++ b/openrewind/components/settings.tsx@@ -11,15 +11,14 @@ import {Plus,Trash2,Check,- HardDrive,- FolderInput,Settings as SettingsIcon,+ X,+ HardDrive,} from "lucide-react";import { DialogHeader, DialogTitle } from "./ui/dialog";import { cn } from "@/lib/utils";import { AccountSection } from "./settings/account-section";import ShortcutSection from "./settings/shortcut-section";-import DiskUsage from "./settings/disk-usage";import AISection from "./settings/ai-section";import { AIPresets } from "./settings/ai-presets";import {@@ -35,11 +34,11 @@ import { relaunch } from "@tauri-apps/plugin-process";import { invoke } from "@tauri-apps/api/core";import { useProfiles } from "@/lib/hooks/use-profiles";import { toast } from "./ui/use-toast";-import { DataImportSection } from "./settings/data-import-section";import { Dialog, DialogContent } from "./ui/dialog";import { useSettingsDialog } from "@/lib/hooks/use-settings-dialog";import { RecordingSettings } from "./settings/recording-settings";import GeneralSettings from "./settings/general-settings";+import { DiskUsageSection } from "./settings/disk-usage-section";type SettingsSection =| "general"@@ -47,8 +46,7 @@ type SettingsSection =| "shortcuts"| "recording"| "account"- | "diskUsage"- | "dataImport";+ | "disk-usage";export function Settings() {const { isOpen, setIsOpen: setSettingsOpen } = useSettingsDialog();@@ -60,7 +58,7 @@ export function Settings() {setActiveProfile,} = useProfiles();const [activeSection, setActiveSection] =- useState<SettingsSection>("account");+ useState<SettingsSection>("general");const [isCreatingProfile, setIsCreatingProfile] = useState(false);const [newProfileName, setNewProfileName] = useState("");const { settings } = useSettings();@@ -83,8 +81,9 @@ export function Settings() {const handleCreateProfile = async () => {if (newProfileName.trim() === "default") {toast({- title: "profile name is not allowed",+ title: "Profile name not allowed",description: "Please choose a different name for your profile",+ variant: "destructive",});return;}@@ -118,13 +117,50 @@ export function Settings() {return <RecordingSettings />;case "shortcuts":return <ShortcutSection />;- case "diskUsage":- return <DiskUsage />;- case "dataImport":- return <DataImportSection />;+ case "disk-usage":+ return <DiskUsageSection />;}};+ const settingsSections = [+ {+ id: "general",+ label: "General",+ icon: <SettingsIcon className="h-4 w-4" />,+ description: "Basic app settings and preferences",+ },+ {+ id: "account",+ label: "Account",+ icon: <User className="h-4 w-4" />,+ description: "User account and authentication",+ },+ {+ id: "recording",+ label: "Recording",+ icon: <Video className="h-4 w-4" />,+ description: "Screen and audio recording settings",+ },+ {+ id: "ai",+ label: "AI Settings",+ icon: <Brain className="h-4 w-4" />,+ description: "AI models and processing options",+ },+ {+ id: "shortcuts",+ label: "Shortcuts",+ icon: <Keyboard className="h-4 w-4" />,+ description: "Keyboard shortcuts and hotkeys",+ },+ {+ id: "disk-usage",+ label: "Disk Usage",+ icon: <HardDrive className="h-4 w-4" />,+ description: "Monitor storage usage for Screenpipe data",+ },+ ];+useEffect(() => {console.log(profiles, "profiles");}, [profiles]);@@ -132,154 +168,158 @@ export function Settings() {return (<Dialog modal={true} open={isOpen} onOpenChange={setSettingsOpen}><DialogContent- className="max-w-[80vw] w-full max-h-[80vh] h-full overflow-hidden p-0 [&>button]:hidden"+ className="max-w-7xl w-full max-h-[90vh] h-[90vh] overflow-hidden p-0 border-slate-200 dark:border-slate-700"onClick={(e) => e.stopPropagation()}>- <div className="flex h-full">+ <div className="flex h-full min-h-0">{/* Sidebar */}- <div className="w-64 border-r bg-[#f3f3f3]">- <DialogHeader className="flex items-center gap-4 ml-6 mt-4">- <DialogTitle className="text-2xl font-bold">settings</DialogTitle>- </DialogHeader>-- {/* Profile Selector */}- <div className="px-4 py-3 border-b">- <DropdownMenu>- <DropdownMenuTrigger asChild>+ <div className="w-80 border-r bg-gradient-to-b from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 flex flex-col min-h-0">+ <div className="p-6 border-b">+ <DialogHeader className="space-y-3">+ <div className="flex items-center justify-between">+ <DialogTitle className="text-2xl font-bold text-slate-900 dark:text-slate-100">+ Settings+ </DialogTitle><Button- variant="outline"- className="w-full justify-between font-mono text-sm"+ variant="ghost"+ size="sm"+ onClick={() => setSettingsOpen(false)}+ className="h-8 w-8 p-0">- {activeProfile}- <ChevronDown className="h-4 w-4 opacity-50" />+ <X className="h-4 w-4" /></Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="w-56">- {profiles?.map((profile) => (- <DropdownMenuItem- key={profile}- className="justify-between"- onSelect={() => handleSwitchProfile(profile)}- >- <span className="font-mono">{profile}</span>- {activeProfile === profile && (- <Check className="h-4 w-4" />- )}- {profile !== "default" && (- <Trash2- className="h-4 w-4 opacity-50 hover:opacity-100"- onClick={(e) => {- e.stopPropagation();- deleteProfile(profile);- }}- />- )}- </DropdownMenuItem>- ))}- <DropdownMenuSeparator />- {isCreatingProfile ? (- <div className="p-2">- <form- onSubmit={(e) => {- e.preventDefault();- handleCreateProfile();- }}- className="flex gap-2"+ </div>++ {/* Profile Selector */}+ <div className="space-y-2">+ <label className="text-sm font-medium text-slate-700 dark:text-slate-300">+ Profile+ </label>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="outline"+ className="w-full justify-between font-mono text-sm bg-white dark:bg-slate-800">- <Input- value={newProfileName}- onChange={(e) => setNewProfileName(e.target.value)}- placeholder="profile name"- className="h-8 font-mono"- autoFocus- />- <Button- type="submit"- size="sm"- disabled={!newProfileName.trim()}+ {activeProfile}+ <ChevronDown className="h-4 w-4 opacity-50" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent className="w-72">+ {profiles?.map((profile) => (+ <DropdownMenuItem+ key={profile}+ className="justify-between"+ onSelect={() => handleSwitchProfile(profile)}>- <Check className="h-4 w-4" />- </Button>- </form>- </div>- ) : (- <DropdownMenuItem- onSelect={(e) => {- e.preventDefault();- setIsCreatingProfile(true);- }}- className="gap-2"- >- <Plus className="h-4 w-4" />- <span>new profile</span>- </DropdownMenuItem>- )}- </DropdownMenuContent>- </DropdownMenu>+ <span className="font-mono">{profile}</span>+ <div className="flex items-center gap-2">+ {activeProfile === profile && (+ <Check className="h-4 w-4 text-green-600" />+ )}+ {profile !== "default" && (+ <Trash2+ className="h-4 w-4 opacity-50 hover:opacity-100 text-red-500"+ onClick={(e) => {+ e.stopPropagation();+ deleteProfile(profile);+ }}+ />+ )}+ </div>+ </DropdownMenuItem>+ ))}+ <DropdownMenuSeparator />+ {isCreatingProfile ? (+ <div className="p-2">+ <form+ onSubmit={(e) => {+ e.preventDefault();+ handleCreateProfile();+ }}+ className="flex gap-2"+ >+ <Input+ value={newProfileName}+ onChange={(e) => setNewProfileName(e.target.value)}+ placeholder="Profile name"+ className="h-8 font-mono"+ autoFocus+ />+ <Button+ type="submit"+ size="sm"+ disabled={!newProfileName.trim()}+ >+ <Check className="h-4 w-4" />+ </Button>+ </form>+ </div>+ ) : (+ <DropdownMenuItem+ onSelect={(e) => {+ e.preventDefault();+ setIsCreatingProfile(true);+ }}+ className="gap-2"+ >+ <Plus className="h-4 w-4" />+ <span>New profile</span>+ </DropdownMenuItem>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </DialogHeader></div>- {/* Existing Settings Navigation */}- <div className="flex flex-col space-y-1 p-4">- {[- {- id: "account",- label: "account",- icon: <User className="h-4 w-4" />,- },- {- id: "general",- label: "general",- icon: <SettingsIcon className="h-4 w-4" />,- },- {- id: "ai",- label: "ai settings",- icon: <Brain className="h-4 w-4" />,- },- {- id: "recording",- label: "recording",- icon: <Video className="h-4 w-4" />,- },- {- id: "shortcuts",- label: "shortcuts",- icon: <Keyboard className="h-4 w-4" />,- },- {- id: "diskUsage",- label: "disk usage",- icon: <HardDrive className="h-4 w-4" />,- },- {- id: "dataImport",- label: "data import",- icon: <FolderInput className="h-4 w-4" />,- },- ].map((section) => (+ {/* Navigation */}+ <div className="p-4 space-y-2 flex-1 overflow-y-auto">+ {settingsSections.map((section) => (<buttonkey={section.id}onClick={() =>setActiveSection(section.id as SettingsSection)}className={cn(- "flex items-center space-x-2 px-4 py-1.5 rounded-lg transition-colors",+ "w-full flex items-start space-x-3 px-4 py-3 rounded-xl transition-all duration-200 text-left group",activeSection === section.id- ? "bg-black/90 text-white"- : "hover:bg-black/10",+ ? "bg-white dark:bg-slate-800 shadow-sm border border-slate-200 dark:border-slate-700 text-slate-900 dark:text-slate-100"+ : "hover:bg-white/50 dark:hover:bg-slate-800/50 text-slate-700 dark:text-slate-300 hover:text-slate-900 dark:hover:text-slate-100",)}>- {section.icon}- <span>{section.label}</span>+ <div className={cn(+ "mt-0.5 transition-colors",+ activeSection === section.id+ ? "text-blue-600 dark:text-blue-400"+ : "text-slate-500 group-hover:text-slate-700 dark:group-hover:text-slate-300"+ )}>+ {section.icon}+ </div>+ <div className="flex-1 min-w-0">+ <div className="font-medium text-sm">{section.label}</div>+ <div className="text-xs text-slate-500 dark:text-slate-400 mt-0.5 leading-relaxed">+ {section.description}+ </div>+ </div></button>))}</div>++ {/* Footer */}+ <div className="p-4 border-t border-slate-200 dark:border-slate-700 flex-shrink-0">+ <div className="text-xs text-slate-500 dark:text-slate-400 text-center">+ OpenRewind Settings+ </div>+ </div></div>{/* Content */}- <div className="flex-1 flex flex-col h-full max-h-[80vh]">- <div className="flex-1 overflow-y-auto px-4">- <div className="max-h-full">{renderSection()}</div>+ <div className="flex-1 flex flex-col h-full bg-slate-50 dark:bg-slate-900 min-h-0">+ <div className="flex-1 overflow-y-auto overflow-x-hidden min-h-0">+ <div className="p-8 pb-16 max-w-4xl mx-auto">+ {renderSection()}+ </div></div></div></div>diff --git a/openrewind/components/settings/account-section.tsx b/openrewind/components/settings/account-section.tsxindex cb3ad15bf..96c7e960a 100644--- a/openrewind/components/settings/account-section.tsx+++ b/openrewind/components/settings/account-section.tsx@@ -8,12 +8,6 @@ import {RefreshCw,UserCog,ExternalLinkIcon,- Key,- EyeOff,- Eye,- ArrowUpRight,- BookOpen,- X,} from "lucide-react";import { toast } from "@/components/ui/use-toast";import { open as openUrl } from "@tauri-apps/plugin-shell";@@ -21,12 +15,9 @@ import { Card } from "../ui/card";import { onOpenUrl } from "@tauri-apps/plugin-deep-link";import { invoke } from "@tauri-apps/api/core";import { PricingToggle } from "./pricing-toggle";-import { Label } from "@/components/ui/label";-import { Textarea } from "@/components/ui/textarea";-import { Input } from "@/components/ui/input";import posthog from "posthog-js";import { platform } from "@tauri-apps/plugin-os";-import { Dialog, DialogTrigger, DialogContent } from "@/components/ui/dialog";+function PlanCard({title,@@ -80,14 +71,7 @@ function PlanCard({export function AccountSection() {const { settings, updateSettings, loadUser } = useSettings();const [isConnectingStripe, setIsConnectingStripe] = useState(false);- const [showApiKey, setShowApiKey] = useState(false);const [isAnnual, setIsAnnual] = useState(true);- const [profileForm, setProfileForm] = useState({- bio: settings.user?.bio || "",- github_username: settings.user?.github_username || "",- website: settings.user?.website || "",- contact: settings.user?.contact || "",- });useEffect(() => {if (!settings.user?.email) {@@ -226,56 +210,21 @@ export function AccountSection() {}};- const updateProfile = async (updates: Partial<typeof settings.user>) => {- if (!settings.user?.token) return;-- try {- const response = await fetch(- "https://screenpi.pe/api/plugins/dev-profile",- {- method: "PUT",- headers: {- "Content-Type": "application/json",- Authorization: `Bearer ${settings.user.api_key}`,- },- body: JSON.stringify(updates),- }- );- if (!response.ok) throw new Error("failed to update profile");- } catch (error) {- console.error("failed to update profile:", error);- toast({- title: "update failed",- description: "couldn't save your profile changes",- variant: "destructive",- });- }- };-- // Initialize form only once when user data first loads- useEffect(() => {- if (- settings.user &&- !profileForm.bio &&- !profileForm.github_username &&- !profileForm.website &&- !profileForm.contact- ) {- setProfileForm({- bio: settings.user.bio || "",- github_username: settings.user.github_username || "",- website: settings.user.website || "",- contact: settings.user.contact || "",- });- }- }, [settings.user]); // Only run when settings.user changesreturn (- <div className="w-full space-y-6 py-4">+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ Account Settings+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Manage your account, subscription, and profile information+ </p>+ </div>+<div className="flex items-center justify-between"><div className="space-y-2">- <h1 className="text-2xl font-bold">account settings</h1>{settings.user?.token ? (<p className="text-sm text-muted-foreground flex items-center gap-2"><span className="inline-flex h-2 w-2 rounded-full bg-green-500" />@@ -369,365 +318,9 @@ export function AccountSection() {</div></div>- {settings.user?.token && (- <>- <Separator className="my-6" />- <div className="flex items-center justify-between">- <div className="space-y-1.5">- <h4 className="text-lg font-medium">developer access</h4>- <p className="text-sm text-muted-foreground">- get api key to start building pipes- </p>- </div>- </div>- <div className="p-5 border border-border/50 rounded-lg bg-background/50 hover:bg-background/80 transition-colors">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-3">- <div className="w-8 h-8 flex items-center justify-center bg-gray-900/10 rounded-md">- <Key className="w-4 h-4 text-gray-900/60" />- </div>- <div className="space-y-1">- <div className="flex items-center gap-2">- <div className="text-sm font-medium">api key</div>- {settings.user?.api_key && (- <Button- variant="ghost"- size="icon"- className="h-4 w-4 hover:bg-transparent"- onClick={() => setShowApiKey(!showApiKey)}- >- {showApiKey ? (- <EyeOff className="h-3 w-3" />- ) : (- <Eye className="h-3 w-3" />- )}- </Button>- )}- </div>- {settings.user?.api_key ? (- <p className="text-xs font-mono text-muted-foreground">- {showApiKey- ? settings.user.api_key- : settings.user.api_key.replace(/./g, "*")}- </p>- ) : (- <p className="text-xs text-muted-foreground">- no api key yet - generate one to start building- </p>- )}- </div>- </div>- {settings.user?.api_key ? (- <Button- variant="secondary"- size="sm"- className="h-9"- onClick={() => {- navigator.clipboard.writeText(settings.user.api_key!);- toast({- title: "copied to clipboard",- description:- "your api key has been copied to your clipboard",- });- }}- >- copy- </Button>- ) : (- <Button- variant="secondary"- size="sm"- className="h-9"- onClick={async () => {- try {- const response = await fetch(- "https://screenpi.pe/api/dev/create",- {- method: "POST",- headers: {- "Content-Type": "application/json",- Authorization: `Bearer ${settings.user?.token}`,- },- }- );-- if (!response.ok)- throw new Error("failed to generate api key");- const { api_key } = await response.json();- if (settings.user) {- const updatedUser = { ...settings.user, api_key };- updateSettings({ user: updatedUser });- toast({- title: "api key generated",- description: "you can now start building pipes",- });- }- } catch (error) {- console.error("failed to generate api key:", error);- toast({- title: "generation failed",- description: "couldn't generate api key",- variant: "destructive",- });- }- }}- >- generate- </Button>- )}- </div>- </div>- <div className="p-5 border border-border/50 rounded-lg bg-background/50 hover:bg-background/80 transition-colors">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-3">- <div className="w-8 h-8 flex items-center justify-center bg-gray-900/10 rounded-md">- <BookOpen className="w-4 h-4 text-gray-900/60" />- </div>- <div className="space-y-1">- <div className="text-sm font-medium">documentation</div>- <p className="text-xs text-muted-foreground">- learn how to build and publish custom pipes- </p>- </div>- </div>- <a- href="https://docs.screenpi.pe/plugins"- target="_blank"- rel="noopener noreferrer"- className="inline-flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors rounded-md bg-secondary hover:bg-secondary/80"- >- read docs- <ArrowUpRight className="w-3 h-3" />- </a>- </div>- </div>- <div className="p-5 border border-border/50 rounded-lg bg-background/50 hover:bg-background/80 transition-colors">- <div className="flex items-center justify-between">- <div className="flex items-center space-x-3">- <div className="w-8 h-8 flex items-center justify-center bg-[#635BFF]/10 rounded-md">- {/* eslint-disable-next-line @next/next/no-img-element */}- <img- className="rounded-md"- src="https://images.stripeassets.com/fzn2n1nzq965/HTTOloNPhisV9P4hlMPNA/cacf1bb88b9fc492dfad34378d844280/Stripe_icon_-_square.svg?q=80&w=1082"- alt=""- />- </div>- <div className="space-y-1">- <div className="text-sm font-medium flex items-center gap-2">- stripe connect- {settings.user?.stripe_connected &&- settings.user?.stripe_account_status && (- <div- className={cn(- "px-2 py-0.5 text-xs rounded-full",- settings.user.stripe_account_status === "pending"- ? "bg-yellow-500/10 text-yellow-500"- : "bg-green-500/10 text-green-500"- )}- title={- settings.user.stripe_account_status === "pending"- ? "go to stripe and complete your account verification (bank account, id verification...)"- : "your stripe account is fully verified and you can start receiving earnings from your pipes"- }- >- {settings.user.stripe_account_status}- </div>- )}- </div>- <p className="text-xs text-muted-foreground">- receive earnings from your pipes (- <a- href="https://discord.gg/dU9EBuw7Uq"- className="underline hover:text-primary"- target="_blank"- >- dm @louis030195- </a>{" "}- for any questions)- </p>- </div>- </div>- {settings.user?.stripe_connected ? (- <div className="flex gap-2">- <Button- variant="secondary"- size="sm"- className="h-9"- onClick={() => openUrl("https://dashboard.stripe.com/")}- >- manage- </Button>- <Button- variant="ghost"- size="icon"- className="h-9 w-9"- onClick={() => {- if (settings.user) {- const updatedUser = {- ...settings.user,- stripe_connected: false,- };- updateSettings({ user: updatedUser });- toast({- title: "stripe disconnected",- description:- "your stripe account has been disconnected",- });- }- }}- >- <X className="h-4 w-4" />- </Button>- </div>- ) : (- <Button- variant="secondary"- size="sm"- onClick={handleConnectStripe}- className="h-9"- disabled={isConnectingStripe || !settings.user?.id}- >- {isConnectingStripe ? (- <RefreshCw className="w-4 h-4 animate-spin" />- ) : (- "connect"- )}- </Button>- )}- </div>- </div>- </>- )}-- {settings.user?.api_key && (- <>- <Separator className="my-6" />-- <div className="flex items-center justify-between">- <div className="space-y-1.5">- <h4 className="text-lg font-medium">developer profile</h4>- <p className="text-sm text-muted-foreground">- customize your public developer profile, this will help us- approve your pipe faster and help you get more users- </p>- </div>- </div>-- <div className="space-y-6">- <div className="grid gap-4">- <div className="grid gap-2">- <Label htmlFor="bio">bio</Label>- <Textarea- id="bio"- placeholder="tell us about yourself..."- className="resize-none"- rows={3}- value={profileForm.bio}- disabled={!settings.user?.api_key}- onChange={(e) =>- setProfileForm((prev) => ({- ...prev,- bio: e.target.value,- }))- }- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- />- </div>-- <div className="grid gap-2">- <Label htmlFor="github">github username</Label>- <Input- id="github"- placeholder="username"- disabled={!settings.user?.api_key}- value={profileForm.github_username}- onChange={(e) =>- setProfileForm((prev) => ({- ...prev,- github_username: e.target.value,- }))- }- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- />- </div>-- <div className="grid gap-2">- <Label htmlFor="website">website</Label>- <Input- id="website"- type="url"- placeholder="https://..."- value={profileForm.website}- disabled={!settings.user?.api_key}- onChange={(e) =>- setProfileForm((prev) => ({- ...prev,- website: e.target.value,- }))- }- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- />- </div>-- <div className="grid gap-2">- <Label htmlFor="contact">additional contact</Label>- <Input- id="contact"- placeholder="discord, twitter, etc..."- value={profileForm.contact}- disabled={!settings.user?.api_key}- onChange={(e) =>- setProfileForm((prev) => ({- ...prev,- contact: e.target.value,- }))- }- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- />- </div>-- <div className="flex justify-end">- <Button- className="w-full"- disabled={!settings.user?.api_key}- onClick={async () => {- if (!settings.user) return;-- await updateProfile(profileForm);-- // Update the main settings after successful profile update- if (settings.user) {- const updatedUser = {- ...settings.user,- ...profileForm,- };- updateSettings({ user: updatedUser });- }-- toast({- title: "profile updated",- description: "your developer profile has been saved",- });- }}- >- save changes- </Button>- </div>- </div>- </div>- </>- )}</div></div>);diff --git a/openrewind/components/settings/ai-presets.tsx b/openrewind/components/settings/ai-presets.tsxindex 75012e6f9..0c6dec916 100644--- a/openrewind/components/settings/ai-presets.tsx+++ b/openrewind/components/settings/ai-presets.tsx@@ -839,38 +839,58 @@ export const AIPresets = () => {if (!settings.aiPresets?.length) {return (- <div className="w-full h-[400px] flex flex-col items-center justify-center space-y-4">- <Settings2 className="w-12 h-12 text-muted-foreground" />- <h2 className="text-xl font-medium text-muted-foreground">- no presets yet- </h2>- <p className="text-sm text-muted-foreground">- create your first ai preset to get started- </p>- <Button onClick={() => setCreatePresentDialog(true)}>- <Plus className="w-4 h-4 mr-2" />- create preset- </Button>+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ AI Settings+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Configure AI models, prompts, and processing preferences+ </p>+ </div>++ <div className="w-full h-[400px] flex flex-col items-center justify-center space-y-4">+ <Settings2 className="w-12 h-12 text-muted-foreground" />+ <h2 className="text-xl font-medium text-muted-foreground">+ No AI presets yet+ </h2>+ <p className="text-sm text-muted-foreground">+ Create your first AI preset to get started with intelligent features+ </p>+ <Button onClick={() => setCreatePresentDialog(true)}>+ <Plus className="w-4 h-4 mr-2" />+ Create Preset+ </Button>+ </div></div>);}return (- <div className="w-full space-y-6 py-4">+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ AI Settings+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Configure AI models, prompts, and processing preferences+ </p>+ </div>+<div className="flex items-center justify-between">- <h1 className="text-2xl font-bold">ai settings</h1>+ <div></div><Button onClick={() => setCreatePresentDialog(true)}><Plus className="w-4 h-4 mr-2" />- create preset+ Create Preset</Button></div>- <div className="w-full grid grid-cols-1 md:grid-cols-2 gap-4">+ <div className="w-full grid grid-cols-1 md:grid-cols-2 gap-6">{settings.aiPresets.map((preset) => {const isDefault = preset.defaultPreset;return (<Cardkey={preset.id}- className="p-4 relative group transition-all hover:shadow-md"+ className="p-6 relative group transition-all hover:shadow-lg border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800"><divclassName="flex justify-between items-start cursor-pointer"diff --git a/openrewind/components/settings/data-import-section.tsx b/openrewind/components/settings/data-import-section.tsxdeleted file mode 100644index 905a0f948..000000000--- a/openrewind/components/settings/data-import-section.tsx+++ /dev/null@@ -1,502 +0,0 @@-import React, { useState, useEffect } from "react";-import { Command, Trash2, Plus } from "lucide-react";-import { Button } from "../ui/button";-import { Input } from "../ui/input";-import { Command as TauriCommand } from "@tauri-apps/plugin-shell";-import { toast } from "../ui/use-toast";-import { open } from "@tauri-apps/plugin-dialog";-import { FolderOpen } from "lucide-react";-import { Card, CardContent } from "../ui/card";-import { Label } from "../ui/label";-import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,-} from "../ui/accordion";-import { writeTextFile, BaseDirectory, readDir } from "@tauri-apps/plugin-fs";-import { join } from "@tauri-apps/api/path";-import { appLocalDataDir } from "@tauri-apps/api/path";-import {- Tooltip,- TooltipContent,- TooltipProvider,- TooltipTrigger,-} from "../ui/tooltip";-import { AlertCircle } from "lucide-react";--interface VideoMetadata {- file_path: string;- metadata: {- name?: string;- creation_time?: string;- fps?: number;- device_name?: string;- };-}--export function DataImportSection() {- const [path, setPath] = useState("");- const [isIndexing, setIsIndexing] = useState(false);- const [detectedVideos, setDetectedVideos] = useState<string[]>([]);- const [metadataConfig, setMetadataConfig] = useState<VideoMetadata[]>([]);- const [isScanning, setIsScanning] = useState(false);- const [progress, setProgress] = useState<{- current: number;- total: number;- } | null>(null);- const [useEmbeddings, setUseEmbeddings] = useState(true);- const [ollamaAvailable, setOllamaAvailable] = useState<boolean | null>(null);-- // Scan for videos in the selected path- const scanForVideos = async () => {- if (!path.trim()) return;-- try {- console.log("starting video scan for path:", path);- setIsScanning(true);-- // recursively read directory- const entries = await readDir(path);- console.log("found directory entries:", entries);-- if (entries.length > 10) {- toast({- title: "too many files",- description: "please select a directory with 10 or fewer files",- variant: "destructive",- });- return;- }-- const videos = await Promise.all(entries.map((e) => join(path, e.name)));- console.log("filtered video files:", videos);- setDetectedVideos(videos);-- // initialize metadata config for each video- const newMetadataConfig = videos.map((file_path) => ({- file_path,- metadata: {- name: "",- creation_time: new Date().toISOString(),- fps: 30,- device_name: "",- },- }));- console.log("initialized metadata config:", newMetadataConfig);- setMetadataConfig(newMetadataConfig);-- if (videos.length === 0) {- toast({- title: "no videos found",- description:- "no supported video files found in the selected directory",- variant: "destructive",- });- } else {- toast({- title: "videos detected",- description: `found ${videos.length} video files`,- });- }- } catch (error: any) {- console.error("scan error:", error);- toast({- title: "scanning failed",- description: error.toString(),- variant: "destructive",- });- } finally {- setIsScanning(false);- }- };-- const handleMetadataChange = (- index: number,- field: string,- value: string | number- ) => {- console.log("metadata change:", { index, field, value });- setMetadataConfig((prev) => {- const updated = [...prev];- updated[index] = {- ...updated[index],- metadata: {- ...updated[index].metadata,- [field]: value,- },- };- console.log("updated metadata config:", updated[index]);- return updated;- });- };-- useEffect(() => {- if (path.trim()) {- scanForVideos();- }- }, [path]);-- const handleIndex = async () => {- if (!path.trim()) return;-- try {- console.log("starting indexing process for path:", path);- setIsIndexing(true);- setProgress(null);-- const configFileName = `metadata-override-${Date.now()}.json`;- const configData = { overrides: metadataConfig };- console.log("writing metadata config:", configData);- console.log(- "writing metadata config with paths:",- metadataConfig.map((m) => m.file_path)- );- await writeTextFile(configFileName, JSON.stringify(configData), {- baseDir: BaseDirectory.AppLocalData,- });-- const configPath = await join(await appLocalDataDir(), configFileName);- console.log("config file path:", configPath);-- const command = TauriCommand.sidecar("screenpipe", [- "add",- path.trim(),- "--metadata-override",- configPath,- "--output",- "json",- ...(ollamaAvailable && useEmbeddings ? ["--use-embedding"] : []),- ]);- console.log("executing command:", command);-- command.stdout.on("data", (line) => {- console.log("command output:", line);- if (line.includes("found")) {- const match = line.match(/found (\d+) video files/);- if (match) {- setProgress({ current: 0, total: parseInt(match[1]) });- }- }- if (line.includes("processing video:")) {- setProgress((prev) =>- prev ? { ...prev, current: prev.current + 1 } : null- );- }- });-- const output = await command.execute();- console.log("command execution result:", output);-- if (output.code === 0) {- toast({- title: "data imported",- description: "your data has been successfully imported",- });- } else {- throw new Error(output.stderr);- }- } catch (error: any) {- console.error("import error:", error);- toast({- title: "import failed",- description: error.toString(),- variant: "destructive",- });- } finally {- setIsIndexing(false);- setProgress(null);- }- };-- const handleSelectFolder = async () => {- try {- console.log("opening folder selector");- const selected = await open({- directory: true,- multiple: false,- });- console.log("selected folder:", selected);-- if (selected && typeof selected === "string") {- setPath(selected);- }- } catch (error: any) {- console.error("folder selection error:", error);- toast({- title: "folder selection failed",- description: error.toString(),- variant: "destructive",- });- }- };-- // Check Ollama availability- const checkOllama = async () => {- try {- const response = await fetch("http://localhost:11434/api/version");- setOllamaAvailable(response.ok);- console.log("ollama available:", response.ok);-- if (response.ok) {- // Check if model is available- const modelResponse = await fetch("http://localhost:11434/api/tags");- const models = await modelResponse.json();- console.log("ollama model available:", models);-- const hasModel = models.models?.some(- (m: any) => m.name.includes("nomic-embed-text")- );- setOllamaAvailable(hasModel);- }- } catch (e) {- console.error("ollama check error:", e);- setOllamaAvailable(false);- if (useEmbeddings) {- setUseEmbeddings(false);- }- }- };-- // Check Ollama status periodically- useEffect(() => {- checkOllama();- const interval = setInterval(checkOllama, 10000); // Check every 10s- return () => clearInterval(interval);- }, []);-- return (- <div className="w-full space-y-6 py-4">- <div>- <h1 className="text-2xl font-bold">data import</h1>- <p className="text-sm text-gray-500">- add your own video recordings (mp4, mov, avi) into screenpipe- </p>- </div>-- <div className="space-y-4">- <div className="flex gap-2">- <Input- placeholder="enter path to index (e.g., /path/to/files)"- value={path}- onChange={(e) => setPath(e.target.value)}- className="font-mono"- />- <Button- onClick={handleSelectFolder}- variant="outline"- className="whitespace-nowrap"- >- <FolderOpen className="h-4 w-4 mr-2" />- select folder- </Button>- </div>-- {/* Metadata Configuration Section */}- {detectedVideos.length > 0 && (- <Card className="mt-4">- <CardContent className="pt-6">- <h3 className="text-lg font-semibold mb-4">- configure video metadata- </h3>- <Accordion type="single" collapsible className="w-full">- {detectedVideos.map((video, index) => (- <AccordionItem key={video} value={`video-${index}`}>- <AccordionTrigger className="text-sm">- {video.split("/").pop()}- </AccordionTrigger>- <AccordionContent>- <div className="space-y-4 p-4">- <div className="grid gap-4">- <div className="space-y-2">- <Label>custom name</Label>- <Input- placeholder="enter a custom name for this video"- value={metadataConfig[index]?.metadata.name || ""}- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- onChange={(e) =>- handleMetadataChange(- index,- "name",- e.target.value- )- }- />- </div>- <div className="space-y-2">- <Label>device name</Label>- <Input- placeholder="enter device name"- value={- metadataConfig[index]?.metadata.device_name ||- ""- }- autoCorrect="off"- autoComplete="off"- autoCapitalize="off"- onChange={(e) =>- handleMetadataChange(- index,- "device_name",- e.target.value- )- }- />- </div>- <div className="space-y-2">- <Label>fps</Label>- <Input- type="number"- placeholder="enter fps (optional)"- value={metadataConfig[index]?.metadata.fps || ""}- onChange={(e) =>- handleMetadataChange(- index,- "fps",- parseFloat(e.target.value)- )- }- />- </div>- <div className="space-y-2">- <Label>creation time</Label>- <Input- type="datetime-local"- value={- metadataConfig[- index- ]?.metadata.creation_time?.split("Z")[0] || ""- }- onChange={(e) =>- handleMetadataChange(- index,- "creation_time",- new Date(e.target.value).toISOString()- )- }- />- </div>- </div>- </div>- </AccordionContent>- </AccordionItem>- ))}- </Accordion>- </CardContent>- </Card>- )}-- {detectedVideos.length > 0 && (- <div className="flex items-center gap-4">- <div className="flex items-center gap-2">- <Button onClick={handleIndex} disabled={isIndexing}>- <Command className="h-4 w-4 mr-2" />- {isIndexing ? "importing..." : "start import"}- </Button>-- <div className="flex flex-col gap-1 ml-2">- <div className="flex items-center gap-2">- <TooltipProvider>- <Tooltip>- <TooltipTrigger asChild>- <div className="flex items-center gap-2">- <input- type="checkbox"- id="embeddings-toggle"- checked={useEmbeddings}- onChange={(e) => setUseEmbeddings(e.target.checked)}- disabled={!ollamaAvailable}- className={`h-4 w-4 ${- !ollamaAvailable- ? "cursor-not-allowed opacity-50"- : ""- }`}- />- <Label- htmlFor="embeddings-toggle"- className={`text-sm ${- !ollamaAvailable- ? "cursor-not-allowed opacity-50"- : ""- }`}- >- generate embeddings- </Label>- {ollamaAvailable === false && (- <AlertCircle className="h-4 w-4 text-yellow-500" />- )}- </div>- </TooltipTrigger>- <TooltipContent side="top" className="max-w-[300px]">- {ollamaAvailable === false ? (- <div className="space-y-2">- <p>ollama is not running. to enable embeddings:</p>- <ol className="list-decimal list-inside space-y-1">- <li>- install ollama from{" "}- <a- href="https://ollama.ai"- target="_blank"- rel="noopener noreferrer"- className="underline"- >- ollama.ai- </a>- </li>- <li>start ollama</li>- <li>- run:{" "}- <code className="bg-secondary px-1 rounded">- ollama run nomic-embed-text- </code>- </li>- </ol>- </div>- ) : ollamaAvailable === true ? (- <p>ollama is running and ready for embeddings</p>- ) : (- <p>checking ollama availability...</p>- )}- </TooltipContent>- </Tooltip>- </TooltipProvider>- </div>- {useEmbeddings && ollamaAvailable && (- <p className="text-xs text-muted-foreground">- using ollama with nomic-embed-text model for embeddings- </p>- )}- </div>- </div>-- {/* Progress indicator */}- {isIndexing && (- <div className="flex-1 text-sm text-muted-foreground space-y-2">- <div className="flex items-center gap-2">- <div className="animate-spin h-4 w-4 border-2 border-primary border-t-transparent rounded-full" />- <span>- {progress- ? `processing ${progress.current}/${progress.total} videos...`- : "analyzing files..."}- </span>- </div>- {progress && (- <div className="h-1 bg-secondary rounded-full overflow-hidden">- <div- className="h-full bg-primary transition-all duration-300"- style={{- width: `${(progress.current / progress.total) * 100}%`,- }}- />- </div>- )}- </div>- )}- </div>- )}- </div>- </div>- );-}diff --git a/openrewind/components/settings/disk-usage-section.tsx b/openrewind/components/settings/disk-usage-section.tsxnew file mode 100644index 000000000..eabdc70d9--- /dev/null+++ b/openrewind/components/settings/disk-usage-section.tsx@@ -0,0 +1,164 @@+"use client";++import React from "react";+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../ui/card";+import { Button } from "../ui/button";+import { Separator } from "../ui/separator";+import { Badge } from "../ui/badge";+import { useDiskUsage } from "@/lib/hooks/use-disk-usage";+import { RefreshCw, HardDrive, Folder, Video, Mic, Database } from "lucide-react";+import { Skeleton } from "../ui/skeleton";++export function DiskUsageSection() {+ const { diskUsage, isLoading, error, refetch } = useDiskUsage();++ const handleRefresh = () => {+ refetch();+ };++ if (error) {+ return (+ <div className="space-y-6">+ <div>+ <h3 className="text-lg font-medium">Disk Usage</h3>+ <p className="text-sm text-muted-foreground">+ Monitor storage usage for your Screenpipe data+ </p>+ </div>+ <Card>+ <CardContent className="pt-6">+ <div className="text-center text-red-500">+ <p>Failed to load disk usage: {error}</p>+ <Button onClick={handleRefresh} variant="outline" className="mt-2">+ <RefreshCw className="h-4 w-4 mr-2" />+ Retry+ </Button>+ </div>+ </CardContent>+ </Card>+ </div>+ );+ }++ return (+ <div className="space-y-6">+ <div className="flex items-center justify-between">+ <div>+ <h3 className="text-lg font-medium">Disk Usage</h3>+ <p className="text-sm text-muted-foreground">+ Monitor storage usage for your Screenpipe data at ~/.screenpipe/data+ </p>+ </div>+ <Button+ onClick={handleRefresh}+ variant="outline"+ size="sm"+ disabled={isLoading}+ >+ <RefreshCw className={`h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}`} />+ Refresh+ </Button>+ </div>++ {/* Overview Cards */}+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4">+ <Card>+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">+ <CardTitle className="text-sm font-medium">Total Data Size</CardTitle>+ <Database className="h-4 w-4 text-muted-foreground" />+ </CardHeader>+ <CardContent>+ {isLoading ? (+ <Skeleton className="h-8 w-20" />+ ) : (+ <div className="text-2xl font-bold">{diskUsage?.total_data_size || "---"}</div>+ )}+ <p className="text-xs text-muted-foreground">+ All Screenpipe data+ </p>+ </CardContent>+ </Card>++ <Card>+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">+ <CardTitle className="text-sm font-medium">Cache Size</CardTitle>+ <Folder className="h-4 w-4 text-muted-foreground" />+ </CardHeader>+ <CardContent>+ {isLoading ? (+ <Skeleton className="h-8 w-20" />+ ) : (+ <div className="text-2xl font-bold">{diskUsage?.total_cache_size || "---"}</div>+ )}+ <p className="text-xs text-muted-foreground">+ Temporary files+ </p>+ </CardContent>+ </Card>++ <Card>+ <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">+ <CardTitle className="text-sm font-medium">Available Space</CardTitle>+ <HardDrive className="h-4 w-4 text-muted-foreground" />+ </CardHeader>+ <CardContent>+ {isLoading ? (+ <Skeleton className="h-8 w-20" />+ ) : (+ <div className="text-2xl font-bold text-green-600">{diskUsage?.avaiable_space || "---"}</div>+ )}+ <p className="text-xs text-muted-foreground">+ Free disk space+ </p>+ </CardContent>+ </Card>+ </div>++ {/* Media Breakdown */}+ <Card>+ <CardHeader>+ <CardTitle className="flex items-center gap-2">+ <Video className="h-5 w-5" />+ Media Files+ </CardTitle>+ <CardDescription>+ Breakdown of recorded media files+ </CardDescription>+ </CardHeader>+ <CardContent className="space-y-4">+ {isLoading ? (+ <div className="space-y-3">+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ <Skeleton className="h-4 w-full" />+ </div>+ ) : (+ <>+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <Video className="h-4 w-4 text-blue-500" />+ <span className="text-sm font-medium">Video Files</span>+ </div>+ <Badge variant="secondary">{diskUsage?.media.videos_size || "---"}</Badge>+ </div>+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <Mic className="h-4 w-4 text-green-500" />+ <span className="text-sm font-medium">Audio Files</span>+ </div>+ <Badge variant="secondary">{diskUsage?.media.audios_size || "---"}</Badge>+ </div>+ <Separator />+ <div className="flex items-center justify-between font-medium">+ <span>Total Media Size</span>+ <Badge>{diskUsage?.media.total_media_size || "---"}</Badge>+ </div>+ </>+ )}+ </CardContent>+ </Card>+++ </div>+ );+}\ No newline at end of filediff --git a/openrewind/components/settings/disk-usage.tsx b/openrewind/components/settings/disk-usage.tsxdeleted file mode 100644index 411a7ba10..000000000--- a/openrewind/components/settings/disk-usage.tsx+++ /dev/null@@ -1,229 +0,0 @@-"use client";-import React, { useEffect, useState } from "react";-import { Badge } from "@/components/ui/badge";-import { toast } from "@/components/ui/use-toast";-import { invoke } from "@tauri-apps/api/core";-import localforage from "localforage";-import { Skeleton } from "@/components/ui/skeleton";-import {- Accordion,- AccordionContent,- AccordionItem,- AccordionTrigger,-} from "@/components/ui/accordion";--interface DiskUsageData {- media: {- audios_size: string;- videos_size: string;- total_media_size: string;- };- pipes: {- pipes: [string, string][];- total_pipes_size: string;- };- total_data_size: string;- total_cache_size: string;- avaiable_space: string;-}--const BadgeItem = ({- label,- value,- description,-}: {- label: string;- value: string;- description?: string;-}) => (- <div className="flex flex-row items-center justify-between">- <div className="flex flex-col !float-left items-start">- <span className="font-semibold">{label}</span>- <span className="text-[14px] !font-normal text-muted-foreground">- {description}- </span>- </div>- <Badge- variant={"outline"}- className="mr-4 font-semibold min-w-[5.5rem] flex flex-row justify-center"- >- {value}- </Badge>- </div>-);--const Divider = () => (- <div className="flex my-2 justify-center">- <div className="h-[1px] w-[250px] rounded-full bg-gradient-to-l from-slate-500/30 to-transparent"></div>- <div className="h-[1px] w-[250px] rounded-full bg-gradient-to-r from-slate-500/30 to-transparent"></div>- </div>-);--export default function DiskUsage() {- const [diskUsage, setDiskUsage] = useState<DiskUsageData | null>(null);- const [loading, setLoading] = useState<boolean>(false);-- const getDisk = async () => {- setLoading(true);- try {- const result = await invoke<DiskUsageData>("get_disk_usage");- console.log("result", result);- setDiskUsage(result);- setLoading(false);- } catch (error) {- console.error("Failed to fetch disk usage:", error);- toast({- title: "error",- description: "failed to fetch disk usage, please try again!",- variant: "destructive",- });- }- };-- useEffect(() => {- getDisk();- }, []);-- return (- <div className="w-full space-y-6 py-4">- <h1 className="text-2xl font-bold">- disk usage- {loading && !diskUsage ? (- <span className="text-sm ml-2 !font-normal text-muted-foreground">- loading...- </span>- ) : (- ""- )}- </h1>- <div className="flex flex-col items-center justify-center space-y-4">- {loading && !diskUsage ? (- <div className="w-full space-y-4">- <Skeleton className="h-[80px] w-[90%] mx-auto" />- <Skeleton className="h-[80px] w-[90%] mx-auto" />- <Skeleton className="h-[200px] w-[90%] mx-auto" />- </div>- ) : (- ""- )}- {diskUsage && diskUsage.pipes && (- <Accordion- type="single"- collapsible- className="w-[90%] border rounded-lg"- >- <AccordionItem value="total-pipes-size">- <AccordionTrigger className="mx-4 h-[80px] hover:no-underline">- <div className="w-full flex items-center justify-between">- <div className="flex flex-col !float-left items-start">- <span className="font-semibold">disk used by pipes</span>- <span className="text-[14px] !font-normal text-muted-foreground">- total space used by installed pipes- </span>- </div>- <Badge- variant={"outline"}- className="mr-4 font-semibold min-w-[5.5rem] flex flex-row justify-center"- >- {diskUsage.pipes.total_pipes_size}- </Badge>- </div>- </AccordionTrigger>- <AccordionContent className="w-full">- {diskUsage.pipes.pipes.map(([name, size], index) => (- <div- key={index}- className="flex items-center justify-between px-1 py-1"- >- <span className="text-base ml-8">{name}</span>- <Badge- variant={"outline"}- className="mr-10 min-w-[5.5rem] flex flex-row justify-center"- >- {size}- </Badge>- </div>- ))}- </AccordionContent>- </AccordionItem>- </Accordion>- )}- {diskUsage && diskUsage.media && (- <Accordion- type="single"- collapsible- className="w-[90%] border rounded-lg"- >- <AccordionItem value="total-pipes-size">- <AccordionTrigger className="mx-4 h-[80px] hover:no-underline">- <div className="w-full flex items-center justify-between">- <div className="flex flex-col !float-left items-start">- <span className="font-semibold">total data captured</span>- <span className="text-[14px] !font-normal text-muted-foreground">- amount of data captured by screenpipe over the time- </span>- </div>- <Badge- variant={"outline"}- className="mr-4 font-semibold min-w-[5.5rem] flex flex-row justify-center"- >- {diskUsage.media.total_media_size}- </Badge>- </div>- </AccordionTrigger>- <AccordionContent className="w-full">- <div- key={"video"}- className="flex items-center justify-between px-1 py-1"- >- <span className="text-base ml-8">video data</span>- <Badge- variant={"outline"}- className="mr-10 min-w-[5.5rem] flex flex-row justify-center"- >- {diskUsage.media.videos_size}- </Badge>- </div>- <div- key={"audio"}- className="flex items-center justify-between px-1 py-1"- >- <span className="text-base ml-8">audio data</span>- <Badge- variant={"outline"}- className="mr-10 min-w-[5.5rem] flex flex-row justify-center "- >- {diskUsage.media.audios_size}- </Badge>- </div>- </AccordionContent>- </AccordionItem>- </Accordion>- )}- {diskUsage && diskUsage.total_data_size && diskUsage.avaiable_space && (- <div className="w-[90%] border rounded-lg p-8">- <div className="w-full space-y-6">- <BadgeItem- label="screenpipe cache size"- description="disk space used for models, frames..."- value={diskUsage.total_cache_size}- />- <Divider />- <BadgeItem- label="disk space used by screenpipe"- description="total disk space utilized by the screenpipe application"- value={diskUsage.total_data_size}- />- <Divider />- <BadgeItem- label="available disk space"- description="remaining free disk space on your device"- value={diskUsage.avaiable_space}- />- </div>- </div>- )}- </div>- </div>- );-}diff --git a/openrewind/components/settings/general-settings.tsx b/openrewind/components/settings/general-settings.tsxindex ce1f2db8f..faa64a76d 100644--- a/openrewind/components/settings/general-settings.tsx+++ b/openrewind/components/settings/general-settings.tsx@@ -3,6 +3,9 @@import React from "react";import { useSettings } from "@/lib/hooks/use-settings";import { Switch } from "@/components/ui/switch";+import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";+import { Separator } from "@/components/ui/separator";+import { Rocket } from "lucide-react";export default function GeneralSettings() {const { settings, updateSettings } = useSettings();@@ -12,40 +15,54 @@ export default function GeneralSettings() {};return (- <div className="w-full space-y-6 py-4">- <h1 className="text-2xl font-bold mb-4">general</h1>-- <div className="space-y-8">- <div className="flex items-center justify-between">- <div className="space-y-1">- <h4 className="font-medium">enable autostart</h4>- <p className="text-sm text-muted-foreground">- automatically launch screenpipe at startup- </p>- </div>- <Switch- id="auto-start-toggle"- checked={settings.autoStartEnabled}- onCheckedChange={(checked) =>- handleSettingsChange({ autoStartEnabled: checked })- }- />- </div>+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ General Settings+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Configure basic application preferences and behavior+ </p>+ </div>++ <div className="space-y-6">+ <Card className="border-slate-200 dark:border-slate-700 bg-white dark:bg-slate-800 shadow-sm">+ <CardContent className="p-6">+ <div className="flex items-center justify-between">+ <div className="flex items-start space-x-4">+ <div className="p-2 bg-blue-100 dark:bg-blue-900/30 rounded-lg">+ <Rocket className="h-5 w-5 text-blue-600 dark:text-blue-400" />+ </div>+ <div className="space-y-1 flex-1">+ <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">+ Auto-start Application+ </h3>+ <p className="text-sm text-slate-600 dark:text-slate-400 leading-relaxed">+ Automatically launch OpenRewind when your computer starts up.+ This ensures you never miss capturing important moments.+ </p>+ </div>+ </div>+ <Switch+ id="auto-start-toggle"+ checked={settings.autoStartEnabled}+ onCheckedChange={(checked) =>+ handleSettingsChange({ autoStartEnabled: checked })+ }+ className="ml-4"+ />+ </div>+ </CardContent>+ </Card>+++ </div>- <div className="flex items-center justify-between">- <div className="space-y-1">- <h4 className="font-medium">auto-update pipes</h4>- <p className="text-sm text-muted-foreground">- automatically update pipes when updates are available- </p>- </div>- <Switch- id="auto-update-toggle"- checked={settings.autoUpdatePipes}- onCheckedChange={(checked) =>- handleSettingsChange({ autoUpdatePipes: checked })- }- />+ <div className="pt-4">+ <div className="p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg">+ <p className="text-sm text-blue-800 dark:text-blue-200">+ 💡 <strong>Tip:</strong> Auto-start ensures continuous recording so you never miss capturing important moments.+ </p></div></div></div>diff --git a/openrewind/components/settings/recording-settings.tsx b/openrewind/components/settings/recording-settings.tsxindex c6df74d49..85c882e22 100644--- a/openrewind/components/settings/recording-settings.tsx+++ b/openrewind/components/settings/recording-settings.tsx@@ -692,8 +692,15 @@ export function RecordingSettings() {};return (- <div className="w-full space-y-6 py-4">- <h1 className="text-2xl font-bold mb-4">recording</h1>+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ Recording Settings+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Configure screen and audio recording preferences+ </p>+ </div>{settings.devMode || (!isUpdating && isDisabled) ? (<Alert><Terminal className="h-4 w-4" />diff --git a/openrewind/components/settings/shortcut-section.tsx b/openrewind/components/settings/shortcut-section.tsxindex 2ca00bd7b..97090ac86 100644--- a/openrewind/components/settings/shortcut-section.tsx+++ b/openrewind/components/settings/shortcut-section.tsx@@ -31,8 +31,15 @@ const ShortcutSection = () => {}, []);return (- <div className="w-full space-y-6 py-4">- <h1 className="text-2xl font-bold">shortcuts</h1>+ <div className="space-y-8">+ <div className="space-y-3">+ <h1 className="text-3xl font-bold tracking-tight text-slate-900 dark:text-slate-100">+ Shortcuts+ </h1>+ <p className="text-slate-600 dark:text-slate-400 text-lg">+ Configure keyboard shortcuts for quick access to features+ </p>+ </div><div className="space-y-6"><ShortcutRowdiff --git a/openrewind/components/splash-screen.tsx b/openrewind/components/splash-screen.tsxnew file mode 100644index 000000000..12a600e1f--- /dev/null+++ b/openrewind/components/splash-screen.tsx@@ -0,0 +1,97 @@+import React from "react";+import { motion } from "framer-motion";++const SplashScreen: React.FC = () => {+ return (+ <div className="flex items-center justify-center h-screen bg-background">+ <div className="flex flex-col items-center space-y-6">+ {/* Logo with subtle animation */}+ <motion.div+ initial={{ scale: 0.8, opacity: 0 }}+ animate={{ scale: 1, opacity: 1 }}+ transition={{+ duration: 0.8,+ ease: "easeOut"+ }}+ className="relative"+ >+ <motion.img+ src="/128x128.png"+ alt="OpenRewind Logo"+ className="w-24 h-24"+ animate={{+ scale: [1, 1.05, 1],+ }}+ transition={{+ duration: 2,+ repeat: Infinity,+ ease: "easeInOut"+ }}+ />++ {/* Subtle glow effect */}+ <motion.div+ className="absolute inset-0 rounded-full bg-gradient-to-r from-blue-500/20 to-purple-500/20 blur-xl"+ animate={{+ opacity: [0.3, 0.6, 0.3],+ }}+ transition={{+ duration: 2,+ repeat: Infinity,+ ease: "easeInOut"+ }}+ />+ </motion.div>++ {/* App name with gradient */}+ <motion.div+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{+ duration: 0.6,+ delay: 0.3,+ ease: "easeOut"+ }}+ className="text-center"+ >+ <h1 className="text-2xl font-bold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">+ OpenRewind+ </h1>+ <p className="text-sm text-muted-foreground mt-1">+ Your AI-powered digital memory+ </p>+ </motion.div>++ {/* Loading dots */}+ <motion.div+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ transition={{+ duration: 0.4,+ delay: 0.6+ }}+ className="flex space-x-1"+ >+ {[0, 1, 2].map((index) => (+ <motion.div+ key={index}+ className="w-2 h-2 bg-primary rounded-full"+ animate={{+ scale: [1, 1.2, 1],+ opacity: [0.5, 1, 0.5],+ }}+ transition={{+ duration: 1.5,+ repeat: Infinity,+ delay: index * 0.2,+ ease: "easeInOut"+ }}+ />+ ))}+ </motion.div>+ </div>+ </div>+ );+};++export default SplashScreen;\ No newline at end of filediff --git a/openrewind/lib/hooks/use-changelog-dialog.tsx b/openrewind/lib/hooks/use-changelog-dialog.tsxindex 099d5f304..8108455f3 100644--- a/openrewind/lib/hooks/use-changelog-dialog.tsx+++ b/openrewind/lib/hooks/use-changelog-dialog.tsx@@ -20,7 +20,7 @@ const ChangelogDialogContext = createContext<export const ChangelogDialogProvider: React.FC<{ children: ReactNode }> = ({children,}) => {- const [showChangelogDialog, setShowChangelogDialog] = useState(false);+ const [showChangelogDialog, setShowChangelogDialog] = useState(true);const version = useAppVersion();useEffect(() => {@@ -30,6 +30,8 @@ export const ChangelogDialogProvider: React.FC<{ children: ReactNode }> = ({if (version && (!versionSeen || versionSeen !== version)) {setShowChangelogDialog(true);await localforage.setItem("versionSeen", version);+ } else {+ setShowChangelogDialog(false);}};diff --git a/openrewind/lib/hooks/use-disk-usage.tsx b/openrewind/lib/hooks/use-disk-usage.tsxnew file mode 100644index 000000000..568556170--- /dev/null+++ b/openrewind/lib/hooks/use-disk-usage.tsx@@ -0,0 +1,54 @@+"use client";++import { useState, useEffect } from "react";+import { invoke } from "@tauri-apps/api/core";++export interface DiskUsedByPipes {+ pipes: [string, string][];+ total_pipes_size: string;+}++export interface DiskUsedByMedia {+ videos_size: string;+ audios_size: string;+ total_media_size: string;+}++export interface DiskUsage {+ pipes: DiskUsedByPipes;+ media: DiskUsedByMedia;+ total_data_size: string;+ total_cache_size: string;+ avaiable_space: string;+}++export function useDiskUsage() {+ const [diskUsage, setDiskUsage] = useState<DiskUsage | null>(null);+ const [isLoading, setIsLoading] = useState(true);+ const [error, setError] = useState<string | null>(null);++ const fetchDiskUsage = async () => {+ try {+ setIsLoading(true);+ setError(null);+ const result = await invoke<DiskUsage>("get_disk_usage");+ setDiskUsage(result);+ } catch (err) {+ console.error("Failed to fetch disk usage:", err);+ setError(err as string);+ } finally {+ setIsLoading(false);+ }+ };++ useEffect(() => {+ fetchDiskUsage();+ }, []);++ return {+ diskUsage,+ isLoading,+ error,+ refetch: fetchDiskUsage,+ };+}\ No newline at end of filediff --git a/openrewind/lib/hooks/use-health-check.tsx b/openrewind/lib/hooks/use-health-check.tsxindex e7fb157e6..4e36253ac 100644--- a/openrewind/lib/hooks/use-health-check.tsx+++ b/openrewind/lib/hooks/use-health-check.tsx@@ -52,77 +52,107 @@ export function useHealthCheck() {const retryIntervalRef = useRef<NodeJS.Timeout | null>(null);const fetchHealth = useCallback(async () => {+ // Clean up existing WebSocket connectionif (wsRef.current) {- wsRef.current.close();+ try {+ if (wsRef.current.readyState === WebSocket.OPEN ||+ wsRef.current.readyState === WebSocket.CONNECTING) {+ wsRef.current.close();+ }+ } catch (error) {+ console.warn("Error closing existing WebSocket:", error);+ }+ wsRef.current = null;}- const ws = new WebSocket("ws://127.0.0.1:3030/ws/health");- wsRef.current = ws;+ try {+ const ws = new WebSocket("ws://127.0.0.1:3030/ws/health");+ wsRef.current = ws;- ws.onopen = () => {- setIsLoading(false);- if (retryIntervalRef.current) {- clearInterval(retryIntervalRef.current);- retryIntervalRef.current = null;- }- };+ ws.onopen = () => {+ setIsServerDown(false);+ setIsLoading(false);+ if (retryIntervalRef.current) {+ clearInterval(retryIntervalRef.current);+ retryIntervalRef.current = null;+ }+ };- ws.onmessage = (event) => {- const data: HealthCheckResponse = JSON.parse(event.data);- if (isHealthChanged(healthRef.current, data)) {- setHealth(data);- healthRef.current = data;- }+ ws.onmessage = (event) => {+ try {+ const data: HealthCheckResponse = JSON.parse(event.data);+ if (isHealthChanged(healthRef.current, data)) {+ setHealth(data);+ healthRef.current = data;+ setIsServerDown(false);+ }- if (- data.status === "unhealthy" &&- previousHealthStatus.current === "healthy"- ) {- unhealthyTransitionsRef.current += 1;- }+ if (+ data.status === "unhealthy" &&+ previousHealthStatus.current === "healthy"+ ) {+ unhealthyTransitionsRef.current += 1;+ }- previousHealthStatus.current = data.status;- };+ previousHealthStatus.current = data.status;+ } catch (error) {+ console.error("Error parsing health data:", error);+ }+ };- ws.onerror = (event) => {- const error = event as ErrorEvent;- const errorHealth: HealthCheckResponse = {- status: "error",- status_code: 500,- last_frame_timestamp: null,- last_audio_timestamp: null,- last_ui_timestamp: null,- frame_status: "error",- audio_status: "error",- ui_status: "error",- message: error.message,+ ws.onerror = (event) => {+ console.warn("WebSocket error:", event);+ const errorHealth: HealthCheckResponse = {+ status: "error",+ status_code: 500,+ last_frame_timestamp: null,+ last_audio_timestamp: null,+ last_ui_timestamp: null,+ frame_status: "error",+ audio_status: "error",+ ui_status: "error",+ message: "Connection error",+ };+ setHealth(errorHealth);+ setIsServerDown(true);+ setIsLoading(false);++ // Start retry interval if not already running+ if (!retryIntervalRef.current) {+ retryIntervalRef.current = setInterval(fetchHealth, 3000);+ }};- setHealth(errorHealth);- setIsServerDown(true);- setIsLoading(false);- if (!retryIntervalRef.current) {- retryIntervalRef.current = setInterval(fetchHealth, 2000);- }- };- ws.onclose = () => {- const errorHealth: HealthCheckResponse = {- status: "error",- status_code: 500,- last_frame_timestamp: null,- last_audio_timestamp: null,- last_ui_timestamp: null,- frame_status: "error",- audio_status: "error",- ui_status: "error",- message: "WebSocket connection closed",+ ws.onclose = (event) => {+ console.log("WebSocket closed:", event.code, event.reason);+ const errorHealth: HealthCheckResponse = {+ status: "error",+ status_code: 500,+ last_frame_timestamp: null,+ last_audio_timestamp: null,+ last_ui_timestamp: null,+ frame_status: "error",+ audio_status: "error",+ ui_status: "error",+ message: "WebSocket connection closed",+ };+ setHealth(errorHealth);+ setIsServerDown(true);++ // Only start retry if this wasn't a manual close+ if (!retryIntervalRef.current && event.code !== 1000) {+ retryIntervalRef.current = setInterval(fetchHealth, 3000);+ }};- setHealth(errorHealth);+ } catch (error) {+ console.error("Error creating WebSocket:", error);setIsServerDown(true);+ setIsLoading(false);+if (!retryIntervalRef.current) {- retryIntervalRef.current = setInterval(fetchHealth, 2000);+ retryIntervalRef.current = setInterval(fetchHealth, 3000);}- };+ }}, []);const debouncedFetchHealth = useCallback(() => {@@ -140,11 +170,23 @@ export function useHealthCheck() {useEffect(() => {fetchHealth();return () => {+ // Clean up WebSocket connectionif (wsRef.current) {- wsRef.current.close();+ try {+ if (wsRef.current.readyState === WebSocket.OPEN ||+ wsRef.current.readyState === WebSocket.CONNECTING) {+ wsRef.current.close(1000, "Component unmounting");+ }+ } catch (error) {+ console.warn("Error closing WebSocket during cleanup:", error);+ }+ wsRef.current = null;}++ // Clear retry intervalif (retryIntervalRef.current) {clearInterval(retryIntervalRef.current);+ retryIntervalRef.current = null;}};}, [fetchHealth]);diff --git a/openrewind/lib/hooks/use-onboarding.tsx b/openrewind/lib/hooks/use-onboarding.tsxindex bf051c55b..03d6cf28a 100644--- a/openrewind/lib/hooks/use-onboarding.tsx+++ b/openrewind/lib/hooks/use-onboarding.tsx@@ -8,6 +8,7 @@ interface OnboardingState {showOnboarding: boolean;setShowOnboarding: (show: boolean) => void;initialized: boolean;+ setInitialized: (initialized: boolean) => void;}// Create the Zustand store@@ -16,29 +17,66 @@ export const useOnboardingStore = create<OnboardingState>((set) => ({initialized: false,setShowOnboarding: (show: boolean) => {set({ showOnboarding: show });- localforage.setItem("showOnboarding", show);+ // Only persist when explicitly setting to false (completed)+ if (!show) {+ localforage.setItem("onboarding_completed", true);+ }},+ setInitialized: (initialized: boolean) => set({ initialized }),}));// Initialize the store with persisted dataconst initializeOnboarding = async () => {+ const state = useOnboardingStore.getState();+// Only initialize once- if (useOnboardingStore.getState().initialized) {+ if (state.initialized) {return;}- const persistedValue = await localforage.getItem("showOnboarding");+ try {+ // Add timeout to prevent hanging on localforage operations+ const timeoutPromise = new Promise((_, reject) => {+ setTimeout(() => reject(new Error("Initialization timeout")), 1000);+ });++ const initPromise = (async () => {+ // Check if onboarding was completed before+ const onboardingCompleted = await localforage.getItem("onboarding_completed");++ // Check if this is a first-time user (no user preferences stored)+ const userPreferences = await localforage.getItem("user_preferences");++ // Show onboarding if:+ // 1. Onboarding was never completed AND+ // 2. No user preferences exist (first-time user)+ const shouldShowOnboarding = !onboardingCompleted && !userPreferences;++ return { onboardingCompleted, userPreferences, shouldShowOnboarding };+ })();++ const result = await Promise.race([+ initPromise,+ timeoutPromise+ ]) as { onboardingCompleted: any, userPreferences: any, shouldShowOnboarding: boolean };++ const { onboardingCompleted, userPreferences, shouldShowOnboarding } = result;- if (persistedValue === null || persistedValue === undefined) {- // First time user, show onboardinguseOnboardingStore.setState({- showOnboarding: true,+ showOnboarding: shouldShowOnboarding,initialized: true,});- } else {- // Returning user, respect the stored value++ console.log("Onboarding initialized:", {+ onboardingCompleted,+ userPreferences: !!userPreferences,+ shouldShowOnboarding+ });+ } catch (error) {+ console.error("Failed to initialize onboarding:", error);+ // Default to not showing onboarding on error to prevent getting stuckuseOnboardingStore.setState({- showOnboarding: persistedValue === true,+ showOnboarding: false,initialized: true,});}@@ -46,14 +84,33 @@ const initializeOnboarding = async () => {// Custom hook that combines store with initialization logicexport const useOnboarding = () => {- const { showOnboarding, setShowOnboarding } = useOnboardingStore();+ const { showOnboarding, setShowOnboarding, initialized } = useOnboardingStore();const { settings } = useSettings();useEffect(() => {- initializeOnboarding();- }, [settings]);+ // Initialize immediately when hook is first called, don't wait for settings+ if (!initialized) {+ // Start initialization immediately+ initializeOnboarding();++ // Also set a shorter fallback timeout for better UX+ const fallbackTimeout = setTimeout(() => {+ console.warn("Fallback initialization triggered after 2 seconds");+ useOnboardingStore.setState({+ showOnboarding: false,+ initialized: true,+ });+ }, 2000);++ return () => clearTimeout(fallbackTimeout);+ }+ }, [initialized]);- return { showOnboarding, setShowOnboarding };+ return {+ showOnboarding,+ setShowOnboarding,+ initialized+ };};// No longer need the OnboardingProvider componentdiff --git a/openrewind/lib/hooks/use-settings.tsx b/openrewind/lib/hooks/use-settings.tsxindex 2b165a7a4..9cbd6d551 100644--- a/openrewind/lib/hooks/use-settings.tsx+++ b/openrewind/lib/hooks/use-settings.tsx@@ -12,7 +12,7 @@ import {import { LazyStore, LazyStore as TauriStore } from "@tauri-apps/plugin-store";import { localDataDir } from "@tauri-apps/api/path";import { flattenObject, unflattenObject } from "../utils";-import { useEffect } from "react";+import { useEffect, useState } from "react";import posthog from "posthog-js";import localforage from "localforage";@@ -132,7 +132,6 @@ export type Settings = {useAllMonitors: boolean;aiPresets: AIPreset[];enableRealtimeVision: boolean;- autoUpdatePipes: boolean;};export const DEFAULT_PROMPT = `Rules:@@ -146,7 +145,7 @@ const DEFAULT_SETTINGS: Settings = {aiPresets: [],openaiApiKey: "",deepgramApiKey: "", // for now we hardcode our key (dw about using it, we have bunch of credits)- isLoading: true,+ isLoading: false,aiModel: "gpt-4o",installedPipes: [],userId: "",@@ -201,7 +200,6 @@ const DEFAULT_SETTINGS: Settings = {disableVision: false,useAllMonitors: false,enableRealtimeVision: true,- autoUpdatePipes: false, // Default to false for auto-updating pipes};const DEFAULT_IGNORED_WINDOWS_IN_ALL_OS = [@@ -245,6 +243,49 @@ export interface StoreModel {resetSetting: Action<StoreModel, keyof Settings>;}+// Validate and sanitize settings to prevent corruption+function validateSettings(settings: any): Settings {+ const defaultSettings = createDefaultSettingsObject();++ // Ensure all required fields exist with proper types+ const validatedSettings: Settings = {+ ...defaultSettings,+ ...settings,+ };++ // Validate specific fields that are critical+ if (!Array.isArray(validatedSettings.monitorIds)) {+ validatedSettings.monitorIds = defaultSettings.monitorIds;+ }++ if (!Array.isArray(validatedSettings.audioDevices)) {+ validatedSettings.audioDevices = defaultSettings.audioDevices;+ }++ if (!Array.isArray(validatedSettings.ignoredWindows)) {+ validatedSettings.ignoredWindows = defaultSettings.ignoredWindows;+ }++ if (!Array.isArray(validatedSettings.includedWindows)) {+ validatedSettings.includedWindows = defaultSettings.includedWindows;+ }++ if (!Array.isArray(validatedSettings.aiPresets)) {+ validatedSettings.aiPresets = defaultSettings.aiPresets;+ }++ // Validate numeric fields+ if (typeof validatedSettings.fps !== 'number' || validatedSettings.fps < 0) {+ validatedSettings.fps = defaultSettings.fps;+ }++ if (typeof validatedSettings.port !== 'number' || validatedSettings.port < 1000) {+ validatedSettings.port = defaultSettings.port;+ }++ return validatedSettings;+}+export function createDefaultSettingsObject(): Settings {let defaultSettings = { ...DEFAULT_SETTINGS };try {@@ -275,6 +316,16 @@ export function createDefaultSettingsObject(): Settings {// Create a singleton store instancelet storePromise: Promise<LazyStore> | null = null;+// Debounce mechanism for saving settings+let saveTimeout: NodeJS.Timeout | null = null;+const SAVE_DEBOUNCE_MS = 500;++// Track if settings have been loaded from storage at least once+let hasLoadedFromStorage = false;++// Helper function to check if settings are ready to use+export const areSettingsReady = () => hasLoadedFromStorage;+/*** @warning Do not change autoSave to true, it causes race conditions*/@@ -282,7 +333,7 @@ export const getStore = async () => {if (!storePromise) {storePromise = (async () => {const dir = await localDataDir();- const profilesStore = new TauriStore(`${dir}/screenpipe/profiles.bin`, {+ const profilesStore = new TauriStore(`${dir}/openrewind/profiles.bin`, {autoSave: false,});const activeProfile =@@ -292,7 +343,7 @@ export const getStore = async () => {? `store.bin`: `store-${activeProfile}.bin`;console.log("activeProfile", activeProfile, file);- return new TauriStore(`${dir}/screenpipe/${file}`, {+ return new TauriStore(`${dir}/openrewind/${file}`, {autoSave: false,});})();@@ -302,36 +353,80 @@ export const getStore = async () => {const tauriStorage: PersistStorage = {getItem: async (_key: string) => {- const tauriStore = await getStore();- const allKeys = await tauriStore.keys();- const values: Record<string, any> = {};+ try {+ const tauriStore = await getStore();+ const allKeys = await tauriStore.keys();+ const values: Record<string, any> = {};++ for (const k of allKeys) {+ try {+ values[k] = await tauriStore.get(k);+ } catch (error) {+ console.warn(`Failed to get key ${k}:`, error);+ // Continue with other keys if one fails+ }+ }- for (const k of allKeys) {- values[k] = await tauriStore.get(k);+ const settings = unflattenObject(values);++ // Validate and sanitize the loaded settings+ const validatedSettings = validateSettings(settings);++ // Mark that we've successfully loaded from storage+ hasLoadedFromStorage = true;++ return { settings: validatedSettings };+ } catch (error) {+ console.error("Failed to load settings, using defaults:", error);+ // Return default settings if loading fails completely+ return { settings: createDefaultSettingsObject() };}-- return { settings: unflattenObject(values) };},setItem: async (_key: string, value: any) => {const tauriStore = await getStore();- delete value.settings.customSettings;- const flattenedValue = flattenObject(value.settings);+ try {+ delete value.settings.customSettings;++ // Validate settings before saving+ const validatedSettings = validateSettings(value.settings);+ const flattenedValue = flattenObject(validatedSettings);++ // Get existing keys to know what to clean up+ const existingKeys = await tauriStore.keys();++ // Set new flattened values first+ for (const [key, val] of Object.entries(flattenedValue)) {+ if (!key || !key.length) continue;+ const defaultValue =+ key in DEFAULT_SETTINGS ? DEFAULT_SETTINGS[key as keyof Settings] : "";+ await tauriStore.set(key, val === undefined ? defaultValue : val);+ }- // Only delete keys that are present in the new settings- for (const key of Object.keys(flattenedValue)) {- await tauriStore.delete(key);- }+ // Only delete keys that are no longer in the new settings+ const newKeys = Object.keys(flattenedValue);+ for (const existingKey of existingKeys) {+ if (!newKeys.includes(existingKey)) {+ await tauriStore.delete(existingKey);+ }+ }- // Set new flattened values- for (const [key, val] of Object.entries(flattenedValue)) {- if (!key || !key.length) continue;- const defaultValue =- key in DEFAULT_SETTINGS ? DEFAULT_SETTINGS[key as keyof Settings] : "";- await tauriStore.set(key, val === undefined ? defaultValue : val);+ // Debounce the save operation to prevent race conditions+ if (saveTimeout) {+ clearTimeout(saveTimeout);+ }++ saveTimeout = setTimeout(async () => {+ try {+ await tauriStore.save();+ } catch (error) {+ console.error("Failed to save store:", error);+ }+ }, SAVE_DEBOUNCE_MS);+ } catch (error) {+ console.error("Failed to save settings:", error);+ // Don't throw to prevent breaking the app, but log the error}-- await tauriStore.save();},removeItem: async (_key: string) => {const tauriStore = await getStore();@@ -377,6 +472,64 @@ export function useSettings() {);const resetSetting = store.useStoreActions((actions) => actions.resetSetting);+ // Track if settings have been loaded from storage+ const [isSettingsLoaded, setIsSettingsLoaded] = useState(false);+ const [loadingError, setLoadingError] = useState<string | null>(null);++ // Initialize settings loading on mount+ useEffect(() => {+ const initializeSettings = async () => {+ try {+ // Add timeout to prevent hanging+ const timeoutPromise = new Promise((_, reject) => {+ setTimeout(() => reject(new Error("Settings loading timeout")), 5000);+ });++ const loadPromise = (async () => {+ // Force a reload from storage to ensure we have the latest settings+ const store = await getStore();+ const allKeys = await store.keys();++ if (allKeys.length > 0) {+ // Settings exist in storage, load them+ const values: Record<string, any> = {};+ for (const k of allKeys) {+ try {+ values[k] = await store.get(k);+ } catch (error) {+ console.warn(`Failed to get key ${k}:`, error);+ }+ }++ const loadedSettings = unflattenObject(values);+ const validatedSettings = validateSettings(loadedSettings);++ // Only update if the loaded settings are different from current+ if (JSON.stringify(validatedSettings) !== JSON.stringify(settings)) {+ setSettings(validatedSettings);+ }+ } else {+ console.log("No existing settings found, using defaults");+ }+ })();++ await Promise.race([loadPromise, timeoutPromise]);++ setIsSettingsLoaded(true);+ setLoadingError(null);+ } catch (error) {+ console.error("Failed to initialize settings:", error);+ setLoadingError(error instanceof Error ? error.message : "Unknown error");+ setIsSettingsLoaded(true); // Still mark as loaded to prevent infinite loading+ }+ };++ // Only initialize if not already loaded+ if (!isSettingsLoaded) {+ initializeSettings();+ }+ }, [isSettingsLoaded, setSettings]);+useEffect(() => {if (settings.user?.id) {posthog.identify(settings.user?.id, {@@ -489,5 +642,7 @@ export function useSettings() {loadUser,resetSetting,getDataDir,+ isSettingsLoaded,+ loadingError,};}diff --git a/openrewind/src-tauri/capabilities/main.json b/openrewind/src-tauri/capabilities/main.jsonindex 517f21103..f02b5a8eb 100644--- a/openrewind/src-tauri/capabilities/main.json+++ b/openrewind/src-tauri/capabilities/main.json@@ -112,7 +112,11 @@"requireLiteralLeadingDot": false},{- "path": "$HOME/.screenpipe/pipes/**",+ "path": "$HOME/.openrewind/**",+ "requireLiteralLeadingDot": false+ },+ {+ "path": "$RESOURCE/.openrewind/**","requireLiteralLeadingDot": false}]diff --git a/openrewind/src-tauri/gen/schemas/capabilities.json b/openrewind/src-tauri/gen/schemas/capabilities.jsonindex 7d66de201..075391b31 100644--- a/openrewind/src-tauri/gen/schemas/capabilities.json+++ b/openrewind/src-tauri/gen/schemas/capabilities.json@@ -1 +1 @@-{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:*"]},"local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","shell:allow-open","store:default","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default","opener:allow-open-url","core:window:default","core:window:allow-get-all-windows","core:window:allow-close",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default","fs:allow-write-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPLOCALDATA"},{"path":"$APPLOCALDATA/**"}]},"opener:default","opener:default"]}}\ No newline at end of file+{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","remote":{"urls":["http://localhost:*"]},"local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","shell:allow-open","store:default","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default","sentry:default","opener:allow-open-url","core:window:default","core:window:allow-get-all-windows","core:window:allow-close",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.openrewind/**","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.openrewind/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]},"deep-link:default","fs:allow-write-text-file",{"identifier":"fs:scope","allow":[{"path":"$APPLOCALDATA"},{"path":"$APPLOCALDATA/**"}]},"opener:default","opener:default"]}}\ No newline at end of filediff --git a/openrewind/src-tauri/src/main.rs b/openrewind/src-tauri/src/main.rsindex 8c4548699..ef8d4c267 100755--- a/openrewind/src-tauri/src/main.rs+++ b/openrewind/src-tauri/src/main.rs@@ -739,11 +739,6 @@ async fn main() {// Initialize default store values if emptyif store.is_empty() {store.set("analyticsEnabled".to_string(), Value::Bool(true));- store.set(- "config".to_string(),- serde_json::to_value(Config::default())?,- );- store.save()?;}// Ensure store is saved and manageddiff --git a/openrewind/src-tauri/tauri.conf.json b/openrewind/src-tauri/tauri.conf.jsonindex 7f78dd6e0..a83472141 100644--- a/openrewind/src-tauri/tauri.conf.json+++ b/openrewind/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "https://schema.tauri.app/config/2","productName": "openrewind",- "identifier": "screenpi.pe",+ "identifier": "screenpi.pe.openrewind","build": {"beforeDevCommand": "bun run dev","beforeBuildCommand": "bun run build",@@ -42,7 +42,7 @@"active": true,"dialog": true,"endpoints": [- "https://cdn.crabnebula.app/update/mediar/screenpipe/{{target}}-{{arch}}/{{current_version}}"+ "https://cdn.crabnebula.app/update/mediar/openrewind/{{target}}-{{arch}}/{{current_version}}"],"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIyQjQ2RkQzMUNBOUFDMTcKUldRWHJLa2MwMiswSWl3RlBGUW5zYUE0Zm0vNFFRRTltNUZZTUVxR2FxUDNtSWdUSHgyL3JNcmcK"},