Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: add update button

Louis Beaumont885a74e6d035
diff --git a/screenpipe-app-tauri/components/pipe-store.tsx b/screenpipe-app-tauri/components/pipe-store.tsx
index ca90d555b..4e99681b6 100644
--- a/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/screenpipe-app-tauri/components/pipe-store.tsx
@@ -727,6 +727,68 @@ const PipeStore: React.FC = () => {
window.location.reload(); // dirty hack
};
+ const handleUpdatePipe = async (pipe: Pipe) => {
+ try {
+ posthog.capture("update_pipe", {
+ pipe_id: pipe.id,
+ });
+
+ // Create initial toast with progress bar
+ const t = toast({
+ title: "updating pipe",
+ description: (
+ <div className="space-y-2">
+ <Progress value={0} className="h-1" />
+ <p className="text-xs">deleting old version...</p>
+ </div>
+ ),
+ duration: 100000,
+ });
+
+ // First delete the pipe
+ await handleDeletePipe(pipe);
+
+ // Then download the new version
+ if (pipe.source) {
+ t.update({
+ id: t.id,
+ title: "updating pipe",
+ description: (
+ <div className="space-y-2">
+ <Progress value={50} className="h-1" />
+ <p className="text-xs">downloading new version...</p>
+ </div>
+ ),
+ duration: 100000,
+ });
+
+ await handleDownloadPipe(pipe.source);
+ }
+
+ t.update({
+ id: t.id,
+ title: "pipe updated",
+ description: (
+ <div className="space-y-2">
+ <Progress value={100} className="h-1" />
+ <p className="text-xs">completed successfully</p>
+ </div>
+ ),
+ duration: 2000,
+ });
+
+ // Refresh the pipe list
+ await fetchInstalledPipes();
+ } catch (error) {
+ console.error("failed to update pipe:", error);
+ toast({
+ title: "error updating pipe",
+ description: "please try again or check the logs for more information.",
+ variant: "destructive",
+ });
+ }
+ };
+
const renderPipeDetails = () => {
if (!selectedPipe) return null;
@@ -793,6 +855,26 @@ const PipeStore: React.FC = () => {
<LogFileButton className="text-xs" />
+ {selectedPipe.source?.startsWith("http") && (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ onClick={() => handleUpdatePipe(selectedPipe)}
+ variant="outline"
+ size="icon"
+ className="h-8 w-8"
+ >
+ <RefreshCw className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>update pipe</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ )}
+
{selectedPipe.source?.startsWith("http") && (
<TooltipProvider>
<Tooltip>
@@ -813,6 +895,27 @@ const PipeStore: React.FC = () => {
</TooltipProvider>
)}
+ {!selectedPipe.source?.startsWith("https://") && (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ onClick={() =>
+ handleRefreshFromDisk(selectedPipe)
+ }
+ variant="outline"
+ size="icon"
+ className="h-8 w-8"
+ >
+ <RefreshCw className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>refresh the code from your local disk</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ )}
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@@ -830,30 +933,6 @@ const PipeStore: React.FC = () => {
</TooltipContent>
</Tooltip>
</TooltipProvider>
-
- <div className="space-y-2">
- {!selectedPipe.source?.startsWith("https://") && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- onClick={() =>
- handleRefreshFromDisk(selectedPipe)
- }
- variant="outline"
- size="icon"
- className="h-8 w-8"
- >
- <RefreshCw className="h-4 w-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <p>refresh the code from your local disk</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )}
- </div>
</div>
{corePipes.find((cp) => cp.id === selectedPipe.id)?.paid && (
@@ -1055,7 +1134,7 @@ const PipeStore: React.FC = () => {
toast({
title: "purchase failed",
description: error.message,
- variant: "destructive",
+ variant: "destructive",
});
return false;
}
@@ -1080,11 +1159,10 @@ const PipeStore: React.FC = () => {
});
return true;
-
} catch (error) {
console.error("purchase failed:", error);
toast({
- title: "purchase failed",
+ title: "purchase failed",
description: "please try again or contact support",
variant: "destructive",
});