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(pipes): collapse pipes-page chrome into single toolbar

Louis Beaumont8ef458d67fb6
diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsx
index 6d1868c8a..5783e9265 100644
--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx
+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx
@@ -64,17 +64,6 @@ import remarkGfm from "remark-gfm";
import posthog from "posthog-js";
import { PipesSection } from "@/components/settings/pipes-section";
import { ChatPrefillData } from "@/lib/chat-utils";
-import {
- IntegrationIcon,
- IntegrationInfo,
-} from "@/components/settings/connections-section";
-import { useHardcodedTiles } from "@/lib/hooks/use-hardcoded-tiles";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
- TooltipProvider,
-} from "@/components/ui/tooltip";
// --- Types ---
interface StorePipe {
@@ -237,107 +226,6 @@ function normalizePipe(raw: any): any {
};
}
-// --- Main Unified Component ---
-
-function ConnectionsStrip() {
- const [integrations, setIntegrations] = useState<IntegrationInfo[]>([]);
- const hardcodedTiles = useHardcodedTiles();
-
- useEffect(() => {
- const cacheKey = "connections/list";
- const cached = apiCache.get<IntegrationInfo[]>(cacheKey);
- if (cached) {
- setIntegrations(cached.filter((i) => i.id !== "owned-default"));
- return;
- }
- localFetch("/connections")
- .then((r) => r.json())
- .then((data) => {
- const list: IntegrationInfo[] = data.data || [];
- apiCache.set(cacheKey, list, 30_000);
- setIntegrations(list.filter((i) => i.id !== "owned-default"));
- })
- .catch(() => {});
- }, []);
-
- // Merge: for tiles in both backend and hardcoded, use backend's connected state
- // but hardcoded's name/icon (which are OS-specific, e.g. windows-calendar vs apple-calendar).
- // For tiles only in hardcoded (cursor, claude, etc.), append them directly.
- const hardcodedMap = new Map(hardcodedTiles.map((h) => [h.id, h]));
- const mergedBackend: IntegrationInfo[] = integrations.map((i) => {
- const h = hardcodedMap.get(i.id);
- if (!h) return i;
- // Use OS-correct name/icon from hardcoded; AND the connected states so an
- // explicit user disconnect (e.g. calendarUserDisconnected in store) overrides
- // the backend's "OS calendar is accessible" true.
- return { ...i, name: h.name, icon: h.icon, connected: i.connected && h.connected };
- });
- const backendIds = new Set(integrations.map((i) => i.id));
- const extraTiles: IntegrationInfo[] = hardcodedTiles
- .filter((h) => !backendIds.has(h.id))
- .map((h) => ({ ...h, fields: [], is_oauth: false, category: "", description: "" }));
- const allIntegrations = [...mergedBackend, ...extraTiles];
-
- if (allIntegrations.length === 0) return null;
-
- const connected = allIntegrations.filter((i) => i.connected);
- const disconnected = allIntegrations.filter((i) => !i.connected);
- const sorted = [...connected, ...disconnected];
-
- const openConnections = () => {
- window.dispatchEvent(
- new CustomEvent("open-settings", {
- detail: { section: "connections" },
- })
- );
- };
-
- return (
- <TooltipProvider delayDuration={200}>
- <div className="flex items-center gap-2 mb-6">
- <div className="flex-1 overflow-x-auto scrollbar-hide">
- <div className="flex items-center gap-1.5 py-1">
- {sorted.map((integration) => (
- <Tooltip key={integration.id}>
- <TooltipTrigger asChild>
- <button
- onClick={() => {
- sessionStorage.setItem("openConnection", integration.id);
- openConnections();
- }}
- className={cn(
- "relative flex items-center justify-center w-8 h-8 shrink-0 border rounded transition-colors",
- integration.connected
- ? "border-foreground/20 hover:border-foreground/40"
- : "border-dashed border-muted-foreground/20 opacity-40 hover:opacity-70"
- )}
- >
- <IntegrationIcon icon={integration.icon} />
- {integration.connected && (
- <div className="absolute -bottom-0.5 -right-0.5 w-2 h-2 rounded-full bg-foreground" />
- )}
- </button>
- </TooltipTrigger>
- <TooltipContent side="bottom" className="text-xs">
- {integration.name}
- {integration.connected ? " · connected" : " · not set up"}
- </TooltipContent>
- </Tooltip>
- ))}
- </div>
- </div>
- <button
- onClick={openConnections}
- className="shrink-0 flex items-center gap-1.5 px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors"
- title="manage connections"
- >
- <Plug className="w-3 h-3" />
- </button>
- </div>
- </TooltipProvider>
- );
-}
-
export function PipeStoreView() {
// Track installed pipe count to auto-switch to Discover for new users
const [installedCount, setInstalledCount] = useState<number | null>(null);
@@ -390,9 +278,6 @@ export function PipeStoreView() {
return (
<div className="space-y-4">
- {/* Connections strip */}
- <ConnectionsStrip />
-
{/* Tab bar */}
<div className="flex items-center gap-6 border-b border-border pb-0 mb-6">
{tabs.map(({ key, label }) => (
diff --git a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
index 4d0c2edb8..9f6b38dba 100644
--- a/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/pipes-section.tsx
@@ -1426,145 +1426,9 @@ export function PipesSection() {
return (
<div className="space-y-4" data-testid="section-pipes">
- <div className="space-y-3">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- {/* Device selector dropdown — always visible */}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm" className="gap-1.5 h-7 text-xs">
- <Monitor className="h-3 w-3" />
- {selectedDevice
- ? devices.find((d) => d.address === selectedDevice)?.label || selectedDevice
- : "this device"}
- <ChevronDown className="h-3 w-3 opacity-50" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem
- onClick={() => { setSelectedDevice(null); setLoading(true); }}
- className={cn("gap-2", !selectedDevice && "font-medium")}
- >
- <Monitor className="h-3.5 w-3.5" />
- <span className="flex-1">this device</span>
- <span className="h-2 w-2 rounded-full bg-green-500 shrink-0" />
- {!selectedDevice && <Check className="h-3.5 w-3.5 ml-1" />}
- </DropdownMenuItem>
- {devices.map((d) => (
- <DropdownMenuItem
- key={d.address}
- onClick={() => { setSelectedDevice(d.address); if (d.status !== "offline") setLoading(true); }}
- className={cn("gap-2", selectedDevice === d.address && "font-medium")}
- >
- <Monitor className="h-3.5 w-3.5" />
- <span className="flex-1">{d.label}</span>
- <span className={cn(
- "h-2 w-2 rounded-full shrink-0",
- d.status === "online" ? "bg-green-500" : d.status === "loading" ? "bg-yellow-500 animate-pulse" : "bg-muted-foreground/40"
- )} />
- {selectedDevice === d.address && <Check className="h-3.5 w-3.5 ml-1" />}
- </DropdownMenuItem>
- ))}
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onSelect={(e) => {
- e.preventDefault();
- if (discovering) return;
- setDiscoverResult(null);
- if (discoverResultTimer.current) clearTimeout(discoverResultTimer.current);
- discoverDevices().then((count) => {
- setDiscoverResult(count);
- discoverResultTimer.current = setTimeout(() => setDiscoverResult(null), 4_000);
- });
- }}
- disabled={discovering}
- >
- <ScanSearch className={cn("h-3.5 w-3.5 mr-2", discovering && "animate-spin")} />
- {discovering
- ? "scanning..."
- : discoverResult === null
- ? "discover devices"
- : discoverResult === 0
- ? "no new devices found"
- : `found ${discoverResult} device${discoverResult > 1 ? "s" : ""}`}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- <Button variant="outline" size="icon" className={`h-7 w-7 ${refreshing ? "pointer-events-none opacity-70" : ""}`} onClick={async () => {
- if (refreshing) return;
- setRefreshing(true);
- await Promise.all([
- fetchPipes(),
- new Promise((r) => setTimeout(r, 2000)),
- ]);
- setRefreshing(false);
- }}>
- {refreshing ? <Loader2 className="h-3.5 w-3.5 animate-spin text-muted-foreground" /> : <RefreshCw className="h-3.5 w-3.5" />}
- </Button>
- </div>
- </div>
- <p className="text-sm text-muted-foreground">
- {pipeTypeFilter === "scheduled"
- ? "scheduled agents that run on your screen data"
- : pipeTypeFilter === "triggered"
- ? "pipes triggered by events like meetings or other pipes"
- : "pipes you trigger manually"}
- {" · "}
- <a
- href="https://docs.screenpi.pe/pipes"
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1 underline underline-offset-2 hover:text-foreground transition-colors"
- >
- docs
- <ExternalLink className="h-3 w-3" />
- </a>
- </p>
- </div>
-
- {/* Scheduled / Triggered / Manual sub-tabs */}
- <div className="flex items-center gap-4 border-b border-border">
- {(["scheduled", "triggered", "manual"] as const).map((tab) => {
- const count = tabCounts[tab];
- return (
- <button
- key={tab}
- onClick={() => setPipeTypeFilter(tab)}
- className={cn(
- "pb-2 text-sm transition-colors duration-150 border-b-2 -mb-px capitalize",
- pipeTypeFilter === tab
- ? "border-foreground text-foreground font-medium"
- : "border-transparent text-muted-foreground hover:text-foreground"
- )}
- >
- {tab} ({count})
- </button>
- );
- })}
- {/* Favorites filter — pushed right; composes with the type tabs. */}
- <button
- onClick={() => pipeFavorites.setShowOnly(!pipeFavorites.showOnly)}
- className={cn(
- "pb-2 text-sm transition-colors duration-150 border-b-2 -mb-px inline-flex items-center gap-1 ml-auto",
- pipeFavorites.showOnly
- ? "border-foreground text-foreground font-medium"
- : "border-transparent text-muted-foreground hover:text-foreground"
- )}
- title={pipeFavorites.showOnly ? "show all pipes" : "show only starred pipes"}
- >
- <Star
- className={cn(
- "h-3.5 w-3.5",
- pipeFavorites.showOnly && "fill-foreground"
- )}
- />
- favorites ({pipeFavorites.favorites.size})
- </button>
- </div>
-
- {/* Search + filter chips */}
- <div className="space-y-2">
- <div className="relative">
+ {/* Single toolbar: search + type filter + favorites + refresh */}
+ <div className="flex items-center gap-2">
+ <div className="relative flex-1">
<Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground" />
<Input
placeholder="search pipes..."
@@ -1575,13 +1439,59 @@ export function PipesSection() {
autoCorrect="off"
/>
</div>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="sm" className="gap-1.5 h-8 text-xs capitalize">
+ {pipeTypeFilter} ({tabCounts[pipeTypeFilter]})
+ <ChevronDown className="h-3 w-3 opacity-50" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {(["scheduled", "triggered", "manual"] as const).map((tab) => (
+ <DropdownMenuItem
+ key={tab}
+ onClick={() => setPipeTypeFilter(tab)}
+ className={cn("capitalize gap-2", pipeTypeFilter === tab && "font-medium")}
+ >
+ <span className="flex-1">{tab}</span>
+ <span className="text-muted-foreground text-xs">{tabCounts[tab]}</span>
+ {pipeTypeFilter === tab && <Check className="h-3.5 w-3.5 ml-1" />}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <Button
+ variant="outline"
+ size="icon"
+ className="h-8 w-8"
+ onClick={() => pipeFavorites.setShowOnly(!pipeFavorites.showOnly)}
+ title={pipeFavorites.showOnly ? "show all pipes" : "show only starred pipes"}
+ >
+ <Star
+ className={cn(
+ "h-3.5 w-3.5",
+ pipeFavorites.showOnly && "fill-foreground"
+ )}
+ />
+ </Button>
+ <Button variant="outline" size="icon" className={`h-8 w-8 ${refreshing ? "pointer-events-none opacity-70" : ""}`} onClick={async () => {
+ if (refreshing) return;
+ setRefreshing(true);
+ await Promise.all([
+ fetchPipes(),
+ new Promise((r) => setTimeout(r, 2000)),
+ ]);
+ setRefreshing(false);
+ }}>
+ {refreshing ? <Loader2 className="h-3.5 w-3.5 animate-spin text-muted-foreground" /> : <RefreshCw className="h-3.5 w-3.5" />}
+ </Button>
</div>
- {/* All | Personal | Shared with team tabs */}
- {team.team && (
+ {/* Team filter — only when there are actually team-shared pipes */}
+ {team.team && sharedPipeNames.size > 0 && (
<div className="flex items-center gap-4 border-b border-border">
{(["all", "personal", "team"] as const).map((tab) => {
- const label = tab === "all" ? "All" : tab === "personal" ? "Personal" : "Shared with team";
+ const label = tab === "all" ? "all" : tab === "personal" ? "personal" : "shared with team";
const count = tab === "all" ? pipes.length : tab === "team"
? pipes.filter((p) => sharedPipeNames.has(p.config.name)).length
: pipes.filter((p) => !sharedPipeNames.has(p.config.name)).length;