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

refactor: move pipe sync toggle from Pipes header to Account (pro only)

Louis Beaumonta205385f8c4f
diff --git a/apps/screenpipe-app-tauri/components/settings/account-section.tsx b/apps/screenpipe-app-tauri/components/settings/account-section.tsx
index 09f94317f..35b957008 100644
--- a/apps/screenpipe-app-tauri/components/settings/account-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/account-section.tsx
@@ -11,11 +11,14 @@ import {
Sparkles,
Zap,
Shield,
+ RefreshCw,
} from "lucide-react";
import { toast } from "@/components/ui/use-toast";
import { open as openUrl } from "@tauri-apps/plugin-shell";
import { commands } from "@/lib/utils/tauri";
import { Card } from "../ui/card";
+import { Switch } from "@/components/ui/switch";
+import { Label } from "@/components/ui/label";
import { onOpenUrl } from "@tauri-apps/plugin-deep-link";
import { PricingToggle } from "./pricing-toggle";
import { ReferralCard } from "./referral-card";
@@ -25,6 +28,7 @@ import posthog from "posthog-js";
export function AccountSection() {
const { settings, updateSettings, loadUser } = useSettings();
const [isAnnual, setIsAnnual] = useState(true);
+ const [pipeSyncing, setPipeSyncing] = useState(false);
useEffect(() => {
if (!settings.user?.email) {
@@ -238,6 +242,60 @@ export function AccountSection() {
<span>✓</span> priority support
</div>
</div>
+
+ {/* Pipe sync */}
+ <div className="mt-4 pt-4 border-t border-border/50">
+ <div className="flex items-center justify-between">
+ <div>
+ <p className="text-sm font-medium">pipe sync across devices</p>
+ <p className="text-xs text-muted-foreground">
+ sync your pipes & configs to all devices linked to your account
+ </p>
+ </div>
+ <div className="flex items-center gap-3">
+ <div className="flex items-center gap-1.5">
+ <Switch
+ id="pipe-sync-toggle"
+ checked={!!settings.pipeSyncEnabled}
+ onCheckedChange={async (checked) => {
+ await updateSettings({ pipeSyncEnabled: checked });
+ toast({
+ title: checked ? "pipe sync enabled" : "pipe sync disabled",
+ description: checked
+ ? "pipes will sync across your devices"
+ : "pipes will no longer sync",
+ });
+ }}
+ />
+ <Label htmlFor="pipe-sync-toggle" className="text-xs text-muted-foreground cursor-pointer sr-only">
+ sync
+ </Label>
+ </div>
+ {settings.pipeSyncEnabled && (
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={pipeSyncing}
+ onClick={async () => {
+ setPipeSyncing(true);
+ try {
+ await fetch("http://localhost:3030/sync/pipes/pull", { method: "POST" });
+ await fetch("http://localhost:3030/sync/pipes/push", { method: "POST" });
+ toast({ title: "pipes synced" });
+ } catch (e: any) {
+ toast({ title: "sync failed", description: e.message, variant: "destructive" });
+ } finally {
+ setPipeSyncing(false);
+ }
+ }}
+ >
+ <RefreshCw className={`h-3 w-3 mr-1 ${pipeSyncing ? "animate-spin" : ""}`} />
+ sync now
+ </Button>
+ )}
+ </div>
+ </div>
+ </div>
</Card>
) : !settings.user?.token ? (
/* Not logged in: login-first layout */
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
index cf5a1be92..98fded613 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
@@ -362,7 +362,6 @@ export function PipesSection() {
const { settings, updateSettings } = useSettings();
const team = useTeam();
const { toast } = useToast();
- const [pipeSyncing, setPipeSyncing] = useState(false);
const isTeamAdmin = !!team.team && team.role === "admin";
const [sharingPipe, setSharingPipe] = useState<string | null>(null);
const [pipeFilter, setPipeFilter] = useState<"all" | "personal" | "team">("all");
@@ -719,51 +718,6 @@ export function PipesSection() {
<FolderOpen className="h-4 w-4 mr-1" />
open folder
</Button>
- {settings.user?.cloud_subscribed && (
- <>
- <div className="flex items-center gap-1.5 ml-2 pl-2 border-l">
- <Switch
- id="pipe-sync-toggle"
- checked={!!settings.pipeSyncEnabled}
- onCheckedChange={async (checked) => {
- await updateSettings({ pipeSyncEnabled: checked });
- toast({
- title: checked ? "pipe sync enabled" : "pipe sync disabled",
- description: checked
- ? "pipes will sync across your devices"
- : "pipes will no longer sync",
- });
- }}
- />
- <Label htmlFor="pipe-sync-toggle" className="text-xs text-muted-foreground cursor-pointer">
- sync
- </Label>
- </div>
- {settings.pipeSyncEnabled && (
- <Button
- variant="outline"
- size="sm"
- disabled={pipeSyncing}
- onClick={async () => {
- setPipeSyncing(true);
- try {
- await fetch("http://localhost:3030/sync/pipes/pull", { method: "POST" });
- await fetch("http://localhost:3030/sync/pipes/push", { method: "POST" });
- await fetchPipes();
- toast({ title: "pipes synced" });
- } catch (e: any) {
- toast({ title: "sync failed", description: e.message, variant: "destructive" });
- } finally {
- setPipeSyncing(false);
- }
- }}
- >
- <RefreshCw className={`h-3 w-3 mr-1 ${pipeSyncing ? "animate-spin" : ""}`} />
- sync now
- </Button>
- )}
- </>
- )}
</div>
</div>