Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(ssh): reusable Pro upgrade dialog + gate helper

enesb6d32d33e12a
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index f191abdd6..80156f07b 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -52,6 +52,7 @@ import { ShortcutsPanel } from '../components/ShortcutsPanel'
import { UpdateCard } from '../components/UpdateCard'
import { AnnouncementBanner } from '../components/AnnouncementBanner'
import { ConfirmDialog } from '../components/ConfirmDialog'
+import { UpgradeDialog } from '../components/UpgradeDialog'
import { NotifyConsentDialog } from '../components/NotifyConsentDialog'
import { ExplorerPanel } from '../components/ExplorerPanel'
import { UsageIndicator } from '../components/UsageIndicator'
@@ -1820,6 +1821,8 @@ export function Canvas() {
/>
)}
+ <UpgradeDialog />
+
{consentOpen && (
<NotifyConsentDialog
onEnable={() => {
diff --git a/src/renderer/components/UpgradeDialog.tsx b/src/renderer/components/UpgradeDialog.tsx
new file mode 100644
index 000000000..181883d17
--- /dev/null
+++ b/src/renderer/components/UpgradeDialog.tsx
@@ -0,0 +1,34 @@
+import { createPortal } from 'react-dom'
+import { useEntitlement } from '../state/entitlement'
+import { useUpgradeGate } from '../state/upgradeGate'
+
+/**
+ * Pro upgrade prompt shown when a free user triggers a gated feature. Closes automatically
+ * once an active entitlement arrives (entitlement onChange flips isPremium).
+ */
+export function UpgradeDialog() {
+ const { open, feature, hide } = useUpgradeGate()
+ const isPremium = useEntitlement((s) => s.isPremium)
+ const upgrade = useEntitlement((s) => s.upgrade)
+ if (!open || isPremium) return null
+ return createPortal(
+ <div className="confirm-overlay" onClick={hide}>
+ <div className="confirm" onClick={(e) => e.stopPropagation()}>
+ <p className="confirm__msg">{feature} is a Pro feature</p>
+ <p className="confirm__msg">
+ Unlock remote SSH terminals and other Pro features. Complete your purchase in the
+ browser — Pro unlocks here automatically.
+ </p>
+ <div className="confirm__actions">
+ <button className="confirm__btn" onClick={hide}>
+ Maybe later
+ </button>
+ <button className="confirm__btn primary" autoFocus onClick={() => void upgrade()}>
+ Upgrade to Pro — $29/mo
+ </button>
+ </div>
+ </div>
+ </div>,
+ document.body
+ )
+}
diff --git a/src/renderer/state/upgradeGate.ts b/src/renderer/state/upgradeGate.ts
new file mode 100644
index 000000000..fe31da7cc
--- /dev/null
+++ b/src/renderer/state/upgradeGate.ts
@@ -0,0 +1,26 @@
+import { create } from 'zustand'
+import { useEntitlement } from './entitlement'
+
+interface UpgradeGateState {
+ open: boolean
+ feature: string
+ show(feature: string): void
+ hide(): void
+}
+
+export const useUpgradeGate = create<UpgradeGateState>((set) => ({
+ open: false,
+ feature: '',
+ show(feature) {
+ set({ open: true, feature })
+ },
+ hide() {
+ set({ open: false })
+ }
+}))
+
+/** Run `run` when the user is Pro; otherwise open the upgrade dialog for `feature`. */
+export function requireProOr(feature: string, run: () => void): void {
+ if (useEntitlement.getState().isPremium) run()
+ else useUpgradeGate.getState().show(feature)
+}