YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(gcal): pro-gate Google Calendar connect + surface needs-attention
Louis Beaumont19f4892e1eee
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/calendar-connect-dialog.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/calendar-connect-dialog.tsxindex 0a61018c9..8a4e39828 100644--- a/apps/screenpipe-app-tauri/components/meeting-notes/calendar-connect-dialog.tsx+++ b/apps/screenpipe-app-tauri/components/meeting-notes/calendar-connect-dialog.tsx@@ -9,6 +9,7 @@ import {Check,Link2,Loader2,+ Lock,Monitor,Plus,} from "lucide-react";@@ -22,7 +23,8 @@ import {import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { commands, type IcsCalendarEntry } from "@/lib/utils/tauri";-import { getStore, saveAndEncrypt } from "@/lib/hooks/use-settings";+import { getStore, saveAndEncrypt, useSettings } from "@/lib/hooks/use-settings";+import { openUrl } from "@tauri-apps/plugin-opener";import { cn } from "@/lib/utils";export type CalendarProviderId = "native" | "google" | "ics";@@ -297,6 +299,8 @@ function GoogleCalendarConnect({onConnected: () => void | Promise<void>;onClose: () => void;}) {+ const { settings } = useSettings();+ const isPro = !!settings.user?.cloud_subscribed;const [busy, setBusy] = useState(false);const [statusText, setStatusText] = useState<string | null>(null);@@ -308,6 +312,13 @@ function GoogleCalendarConnect({if (result.status === "ok" && result.data.connected) {await onConnected();onClose();+ } else if (result.status === "error") {+ const msg = String(result.error ?? "");+ setStatusText(+ msg.toLowerCase().includes("pro subscription")+ ? "OAuth integrations require Pro. Upgrade to connect."+ : msg || "Google Calendar was not connected.",+ );} else {setStatusText("Google Calendar was not connected.");}@@ -324,18 +335,32 @@ function GoogleCalendarConnect({Connect your Google Calendar directly. ScreenPipe uses read-only accessfor meeting detection and note metadata.</p>- <Button onClick={connect} disabled={busy} className="w-full rounded-none">- {busy ? (- <Loader2 className="mr-2 h-3.5 w-3.5 animate-spin" />- ) : (- <CalendarProviderIcon- provider="google"- isMac={false}- className="mr-2 h-3.5 w-3.5"- />- )}- connect google calendar- </Button>+ {!isPro ? (+ <div className="flex flex-col gap-1.5">+ <Button disabled className="w-full gap-2 rounded-none opacity-60">+ <Lock className="h-3.5 w-3.5" />pro required+ </Button>+ <button+ onClick={() => openUrl("https://screenpi.pe/onboarding")}+ className="text-xs text-muted-foreground hover:text-foreground underline self-start"+ >+ upgrade to pro to connect+ </button>+ </div>+ ) : (+ <Button onClick={connect} disabled={busy} className="w-full rounded-none">+ {busy ? (+ <Loader2 className="mr-2 h-3.5 w-3.5 animate-spin" />+ ) : (+ <CalendarProviderIcon+ provider="google"+ isMac={false}+ className="mr-2 h-3.5 w-3.5"+ />+ )}+ connect google calendar+ </Button>+ )}{statusText && (<p className="text-xs text-muted-foreground">{statusText}</p>)}diff --git a/apps/screenpipe-app-tauri/components/settings/google-calendar-card.tsx b/apps/screenpipe-app-tauri/components/settings/google-calendar-card.tsxindex 228399421..686f0fb66 100644--- a/apps/screenpipe-app-tauri/components/settings/google-calendar-card.tsx+++ b/apps/screenpipe-app-tauri/components/settings/google-calendar-card.tsx@@ -7,17 +7,22 @@ import React, { useState, useEffect, useCallback } from "react";import { Card, CardContent } from "@/components/ui/card";import { Button } from "@/components/ui/button";import {+ AlertTriangle,Loader2,+ Lock,Plus,RefreshCw,Users,LogOut,} from "lucide-react";import { commands } from "@/lib/utils/tauri";-import { notifyConnectionsUpdated } from "@/lib/connections-events";-import posthog from "posthog-js";-import { localFetch } from "@/lib/api";-import { GoogleOAuthUnverifiedAppHint } from "./google-oauth-unverified-app-hint";+import { useSettings } from "@/lib/hooks/use-settings";+import { notifyConnectionsUpdated } from "@/lib/connections-events";+import { openUrl } from "@tauri-apps/plugin-opener";+import { toast } from "@/components/ui/use-toast";+import posthog from "posthog-js";+import { localFetch } from "@/lib/api";+import { GoogleOAuthUnverifiedAppHint } from "./google-oauth-unverified-app-hint";interface CalendarEventItem {id: string;@@ -38,7 +43,10 @@ interface CalendarAccount {}export function GoogleCalendarCard({ onConnected, onDisconnected }: { onConnected?: () => void; onDisconnected?: () => void } = {}) {+ const { settings } = useSettings();+ const isPro = !!settings.user?.cloud_subscribed;const [accounts, setAccounts] = useState<CalendarAccount[]>([]);+ const [needsAttention, setNeedsAttention] = useState(false);const [isConnecting, setIsConnecting] = useState(false);const [upcomingEvents, setUpcomingEvents] = useState<CalendarEventItem[]>([]);const [isLoadingEvents, setIsLoadingEvents] = useState(false);@@ -55,18 +63,24 @@ export function GoogleCalendarCard({ onConnected, onDisconnected }: { onConnectedisplayName: i.display_name ?? null,})));+ setNeedsAttention(false);return;}const status = await commands.oauthStatus("google-calendar", null);if (status.status === "ok" && status.data.connected) {setAccounts([{ instance: null, displayName: status.data.display_name ?? null }]);+ setNeedsAttention(false);} else {setAccounts([]);+ // Token row exists but can't be read — usually a keychain ACL mismatch+ // after a bundle id switch. Surface it instead of treating as fresh disconnect.+ setNeedsAttention(status.status === "ok" && !!status.data.needs_attention);}} catch (e) {console.error("failed to fetch google calendar status:", e);setAccounts([]);+ setNeedsAttention(false);}}, []);@@ -151,9 +165,24 @@ export function GoogleCalendarCard({ onConnected, onDisconnected }: { onConnecteawait fetchStatus();notifyConnectionsUpdated();onConnected?.();+ } else if (res.status === "error") {+ const msg = String(res.error ?? "");+ const isProGate = msg.toLowerCase().includes("pro subscription");+ toast({+ title: isProGate ? "pro required" : "google calendar connect failed",+ description: isProGate+ ? "OAuth integrations need Pro. Upgrade to connect Google Calendar."+ : msg || "Unknown error",+ variant: "destructive",+ });}} catch (e) {console.error("google calendar oauth failed:", e);+ toast({+ title: "google calendar connect failed",+ description: String(e),+ variant: "destructive",+ });}setIsConnecting(false);};@@ -215,25 +244,48 @@ export function GoogleCalendarCard({ onConnected, onDisconnected }: { onConnecte{!connected ? (<div className="space-y-2">- <Button- variant="outline"- size="sm"- onClick={handleConnect}- disabled={isConnecting}- className="text-xs"- >- {isConnecting ? (- <Loader2 className="h-3 w-3 mr-1.5 animate-spin" />- ) : (- <img src="/google-calendar-icon.svg" alt="" className="h-3 w-3 mr-1.5" />- )}- {isConnecting- ? "Waiting for Google..."- : "Connect Google Calendar"}- </Button>- <GoogleOAuthUnverifiedAppHint />- </div>- ) : (+ {needsAttention && (+ <div className="flex items-start gap-1.5 text-xs text-destructive bg-destructive/10 border border-destructive/20 rounded px-2 py-1.5">+ <AlertTriangle className="h-3 w-3 shrink-0 mt-0.5" />+ <span>+ A previous connection exists but its token can't be read on this+ build (usually a keychain mismatch). Reconnect to fix.+ </span>+ </div>+ )}+ {!isPro ? (+ <div className="flex flex-col gap-1.5">+ <Button disabled size="sm" className="gap-1.5 h-7 text-xs opacity-60">+ <Lock className="h-3 w-3" />pro required+ </Button>+ <button+ onClick={() => openUrl("https://screenpi.pe/onboarding")}+ className="text-[10px] text-muted-foreground hover:text-foreground underline self-start"+ >+ upgrade to pro to connect+ </button>+ </div>+ ) : (+ <Button+ variant="outline"+ size="sm"+ onClick={handleConnect}+ disabled={isConnecting}+ className="text-xs"+ >+ {isConnecting ? (+ <Loader2 className="h-3 w-3 mr-1.5 animate-spin" />+ ) : (+ <img src="/google-calendar-icon.svg" alt="" className="h-3 w-3 mr-1.5" />+ )}+ {isConnecting+ ? "Waiting for Google..."+ : "Connect Google Calendar"}+ </Button>+ )}+ <GoogleOAuthUnverifiedAppHint />+ </div>+ ) : (<div className="space-y-3">{accounts.length > 0 && (<div className="space-y-2">@@ -264,22 +316,22 @@ export function GoogleCalendarCard({ onConnected, onDisconnected }: { onConnecte</div>)}- <Button- variant="ghost"- size="sm"- onClick={handleConnect}+ <Button+ variant="ghost"+ size="sm"+ onClick={handleConnect}disabled={isConnecting}className="text-xs h-7 px-2"- >- {isConnecting ? (- <Loader2 className="h-3 w-3 mr-1.5 animate-spin" />+ >+ {isConnecting ? (+ <Loader2 className="h-3 w-3 mr-1.5 animate-spin" />) : (<Plus className="h-3 w-3 mr-1.5" />- )}- {isConnecting ? "Waiting for Google..." : "Add another account"}- </Button>- </div>- )}+ )}+ {isConnecting ? "Waiting for Google..." : "Add another account"}+ </Button>+ </div>+ )}</div></div>