refactor: remove the billing tier model (P0.1)
The community edition has no monetization (ADR-0001). Remove the tier model (packages/shared/src/tiers.ts), the requireTier middleware and every tier gate, GET/PATCH /api/tier and the trial start, and the Stripe integration, which depends on the tier model. Personal features a tier used to limit are open to everyone: unlimited workspaces and connectors, every embedding provider including LiteLLM, per-workspace costs, Approvals. The workspace session cap is one constant (100). Team and enterprise surfaces are hidden instead of unlocked (team dock zone, Settings Team/Enterprise/Plan tabs, workspace Team tab); cloud sync reports unavailable, as it did for free users. The sidecar ignores the tier keys in config.json but does not delete them: both editions may still share ~/.waggle. Web billing UI is deleted: plan cards, upgrade and trial modals, payment success route, the KVARK sales block, tier 403 handling.
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
* Owns: BootScreen gate (FR #23 sequencing ported from the retired
|
||||
* pages/Index.tsx), the §3.3 window-state migration boot (one-shot, before the
|
||||
* first canvas render), onboarding takeover (§1.2 — wizard renders INSTEAD of
|
||||
* nav+canvas), left nav (same getDockForTier/filterByBillingTier data the dock
|
||||
* consumed, §1.3), StatusBar, global overlays (the old Desktop.tsx mount block
|
||||
* relocated), the `waggle:open-app` shim (§2.3), the keep-alive ChatHost
|
||||
* nav+canvas), left nav (same getDockForTier data the dock consumed, §1.3),
|
||||
* StatusBar, global overlays (the old Desktop.tsx mount block relocated),
|
||||
* the `waggle:open-app` shim (§2.3), the keep-alive ChatHost
|
||||
* (§4.2), and `<Outlet/>` as the single canvas.
|
||||
*
|
||||
* Stage C (the flip): this IS the live shell — App.tsx mounts it as the `/`
|
||||
@@ -23,7 +23,6 @@ import StatusBar from './StatusBar';
|
||||
import RouteTransition from './RouteTransition';
|
||||
import Sidebar, { type SidebarNavItem } from './Sidebar';
|
||||
import AppErrorBoundary from './ErrorBoundary';
|
||||
import UpgradeModal from './overlays/UpgradeModal';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { stashDeepLink } from '@/lib/app-deeplink';
|
||||
import { writeLoginBriefingDismissed, writeLoginBriefingLastDismissedAt, readLoginBriefingDismissed, readSkipBriefingParam } from '@/lib/login-briefing';
|
||||
@@ -33,8 +32,7 @@ import { resolveReturningUserOnboarding, isOnboardingStatusKnownSync } from '@/h
|
||||
import { shouldShowCoachMarks, readOnboardedThisSession, readForceTour, clearForceTour } from '@/lib/coach-marks-gate';
|
||||
import { matchNavRoute, queryString, routeFor, routeForSearchResult } from '@/lib/routes';
|
||||
import { bootWindowStateMigration, indexLandingRoute } from '@/lib/window-state-migration';
|
||||
import { getDockForTier, BILLING_TIER_ORDER, type AppId, type DockEntry } from '@/lib/dock-tiers';
|
||||
import { TIER_LABELS } from '@waggle/shared';
|
||||
import { getDockForTier, type AppId, type DockEntry } from '@/lib/dock-tiers';
|
||||
import { buildCommandCatalog, type CatalogCommand } from '@/lib/command-catalog';
|
||||
import { ShellProvider, useShell } from '@/providers/ShellContext';
|
||||
import { seedChat, useChatWidgetState } from '@/hooks/useChatWidgetState';
|
||||
@@ -58,7 +56,6 @@ const OnboardingWizard = lazy(() => import('./overlays/OnboardingWizard'));
|
||||
const OnboardingTooltips = lazy(() => import('./overlays/OnboardingTooltips'));
|
||||
const LoginBriefing = lazy(() => import('./overlays/LoginBriefing'));
|
||||
const ContextRail = lazy(() => import('./overlays/ContextRail'));
|
||||
const TrialExpiredModal = lazy(() => import('./overlays/TrialExpiredModal'));
|
||||
|
||||
const deferredShellElement = (element: ReactNode) => (
|
||||
<Suspense fallback={null}>{element}</Suspense>
|
||||
@@ -74,7 +71,7 @@ const deferredShellElement = (element: ReactNode) => (
|
||||
*/
|
||||
const WORKSPACE_TAB_LABELS: Record<string, string> = {
|
||||
overview: 'Overview', chat: 'Chat', memory: 'Memory',
|
||||
artifacts: 'Artifacts', files: 'Files', team: 'Team', tasks: 'Tasks',
|
||||
artifacts: 'Artifacts', files: 'Files', tasks: 'Tasks',
|
||||
};
|
||||
|
||||
/** Flatten zone-parents so nav active-state/title lookups see every app entry. */
|
||||
@@ -124,7 +121,7 @@ const ShellLayout = () => {
|
||||
workspaces, activeWorkspace, activeWorkspaceId,
|
||||
selectWorkspace, createWorkspace, patchWorkspace, refreshWorkspaces, workspacesError,
|
||||
workspacesLoading,
|
||||
currentTier, billingTier, trialInfo, refreshTier, showTrialExpired, setShowTrialExpired,
|
||||
currentTier,
|
||||
notifications, unreadCount, markRead, markAllRead,
|
||||
onboardingState, updateOnboarding, completeOnboarding,
|
||||
offline, agentStatus,
|
||||
@@ -197,9 +194,6 @@ const ShellLayout = () => {
|
||||
// call can race the session-token attach and 401 → name:null. Falls back to
|
||||
// "Account" in the row when unconfigured.
|
||||
const [userName, setUserName] = useState<string | null>(null);
|
||||
// F5: the UpgradeModal self-opens on a window event, so the shell can't see
|
||||
// its open state without this. Feeds `anyModalOpen` so coach-marks hide under it.
|
||||
const [upgradeOpen, setUpgradeOpen] = useState(false);
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const loadIdentity = () => {
|
||||
@@ -299,10 +293,7 @@ const ShellLayout = () => {
|
||||
// Onboarding completion handlers (relocated from Desktop.tsx:290-313).
|
||||
const handleOnboardingComplete = useCallback((_serverBaseUrl: string) => {
|
||||
completeOnboarding();
|
||||
// Atomic start. 409 (trial already started) is fine — refresh state
|
||||
// either way so the StatusBar countdown picks up the existing timestamp.
|
||||
adapter.startTrial().then(refreshTier).catch(refreshTier);
|
||||
}, [completeOnboarding, refreshTier]);
|
||||
}, [completeOnboarding]);
|
||||
|
||||
const handleOnboardingFinish = useCallback((workspaceId: string, workspaceName: string, firstMessage?: string, personaId?: string) => {
|
||||
selectWorkspace(workspaceId);
|
||||
@@ -332,7 +323,7 @@ const ShellLayout = () => {
|
||||
// everything else lives one keystroke away in ⌘K. The StatusBar breadcrumb
|
||||
// still derives from the full dock route table — every route is now reachable
|
||||
// via ⌘K regardless of tier, so the label map must cover them all.
|
||||
const labelEntries = useMemo(() => flattenAppEntries(getDockForTier('power', billingTier)), [billingTier]);
|
||||
const labelEntries = useMemo(() => flattenAppEntries(getDockForTier('power')), []);
|
||||
const activeRoute = useMemo(
|
||||
() => matchNavRoute(location.pathname, labelEntries.map(e => e.route).filter((r): r is string => !!r)),
|
||||
[location.pathname, labelEntries],
|
||||
@@ -385,7 +376,6 @@ const ShellLayout = () => {
|
||||
// Agents & tasks badge surfaces unacknowledged coordination signals for now;
|
||||
// PR3 refines it to the real pending-approvals/tasks count.
|
||||
const isPro = currentTier === 'power' || currentTier === 'admin';
|
||||
const billingRank = BILLING_TIER_ORDER[billingTier] ?? 0;
|
||||
const spine: SidebarNavItem[] = useMemo(() => [
|
||||
{ key: 'home', label: 'Home', icon: Home, to: '/home', match: ['/home'] },
|
||||
// Chat resolves to the active workspace's chat tab; with no real workspace,
|
||||
@@ -407,27 +397,17 @@ const ShellLayout = () => {
|
||||
], [effectiveActiveWorkspaceId, navigateToActiveChat, waggleUnacknowledged]);
|
||||
const pinned: SidebarNavItem[] = useMemo(() => {
|
||||
if (!isPro) return [];
|
||||
const items: SidebarNavItem[] = [
|
||||
return [
|
||||
{ key: 'swarm', label: 'Agent swarm', icon: Network, to: '/waggle-dance', match: ['/waggle-dance'] },
|
||||
{ key: 'connectors', label: 'Connectors', icon: Plug, to: '/connectors', match: ['/connectors'] },
|
||||
{ key: 'approvals', label: 'Approvals', icon: Shield, to: '/approvals', match: ['/approvals'] },
|
||||
];
|
||||
// Approvals is a TEAMS-tier surface (parity with dock-tiers minBillingTier).
|
||||
if (billingRank >= BILLING_TIER_ORDER.TEAMS) items.push({ key: 'approvals', label: 'Approvals', icon: Shield, to: '/approvals', match: ['/approvals'] });
|
||||
return items;
|
||||
}, [isPro, billingRank]);
|
||||
|
||||
// Plan label for the user row (e.g. "Trial · 9d", "Solo", "Team").
|
||||
const tierLabel = useMemo(() => {
|
||||
if (billingTier === 'TRIAL' || (trialInfo.trialDaysRemaining > 0 && !trialInfo.trialExpired)) {
|
||||
return trialInfo.trialDaysRemaining > 0 ? `Trial · ${trialInfo.trialDaysRemaining}d` : 'Trial';
|
||||
}
|
||||
return TIER_LABELS[billingTier];
|
||||
}, [billingTier, trialInfo.trialDaysRemaining, trialInfo.trialExpired]);
|
||||
}, [isPro]);
|
||||
|
||||
// ⌘K curated catalog (Jump to / Do / Power tools + Pro "Pinned") → real routes.
|
||||
const commandCatalog = useMemo(
|
||||
() => buildCommandCatalog({ chatHref: routeFor('chat', { activeWorkspaceId: effectiveActiveWorkspaceId }), isPro, billingRank }),
|
||||
[effectiveActiveWorkspaceId, isPro, billingRank],
|
||||
() => buildCommandCatalog({ chatHref: routeFor('chat', { activeWorkspaceId: effectiveActiveWorkspaceId }), isPro }),
|
||||
[effectiveActiveWorkspaceId, isPro],
|
||||
);
|
||||
const handleCatalogSelect = useCallback((cmd: CatalogCommand) => {
|
||||
if (cmd.action === 'spawn') { ov.setShowSpawnAgent(true); return; }
|
||||
@@ -455,12 +435,11 @@ const ShellLayout = () => {
|
||||
}
|
||||
|
||||
// F5: any shell overlay open ⇒ suppress the coach-mark carousel (hide-but-keep
|
||||
// tour state, per OnboardingTooltips' `suppressed` contract). Includes the
|
||||
// event-driven UpgradeModal (via upgradeOpen) and the trial paywall.
|
||||
// tour state, per OnboardingTooltips' `suppressed` contract).
|
||||
const anyModalOpen =
|
||||
ov.showGlobalSearch || ov.showCreateWorkspace || ov.showPersonaSwitcher ||
|
||||
ov.showWorkspaceSwitcher || ov.showNotifications || ov.showKeyboardHelp ||
|
||||
ov.showSpawnAgent || showTrialExpired || upgradeOpen;
|
||||
ov.showSpawnAgent;
|
||||
|
||||
return (
|
||||
<div className="relative w-screen h-screen overflow-hidden select-none">
|
||||
@@ -475,7 +454,6 @@ const ShellLayout = () => {
|
||||
model={effectiveActiveWorkspace?.model ?? (agentStatus.model !== 'unknown' ? agentStatus.model : undefined)}
|
||||
tokensUsed={agentStatus.tokensUsed} costUsd={agentStatus.costUsd} offline={offline}
|
||||
unreadNotifications={unreadCount}
|
||||
trialDaysRemaining={trialInfo.trialDaysRemaining} trialExpired={trialInfo.trialExpired}
|
||||
onSearchClick={() => ov.setShowGlobalSearch(true)} onNotificationClick={ov.toggleNotifications} />
|
||||
|
||||
<div className="absolute inset-x-0 top-8 bottom-0 flex">
|
||||
@@ -489,7 +467,6 @@ const ShellLayout = () => {
|
||||
onOpenCommand={() => ov.setShowGlobalSearch(true)}
|
||||
onSpawnAgent={() => ov.setShowSpawnAgent(true)}
|
||||
userName={userName}
|
||||
tierLabel={tierLabel}
|
||||
/>
|
||||
|
||||
{/* Single canvas (§2.1 rule 1). Route wrappers bring their own
|
||||
@@ -616,38 +593,6 @@ const ShellLayout = () => {
|
||||
{contextRailTarget && deferredShellElement(
|
||||
<ContextRail target={contextRailTarget} onClose={() => setContextRailTarget(null)} />
|
||||
)}
|
||||
|
||||
<UpgradeModal
|
||||
onOpenChange={setUpgradeOpen}
|
||||
onStartTrial={() => {
|
||||
adapter.startTrial().then(refreshTier).catch(refreshTier);
|
||||
}}
|
||||
onUpgrade={(tier) => {
|
||||
// PR7a: navigate to hosted Stripe Checkout (the URL was previously
|
||||
// discarded — a dead happy path). Same-tab assign rather than a deferred
|
||||
// window.open: the open happens after an awaited round-trip, outside the
|
||||
// user-gesture window, so a popup blocker / Tauri WebView could swallow it.
|
||||
// Hosted Checkout redirects back to /payment-success on completion.
|
||||
adapter.createCheckoutSession(tier)
|
||||
.then(({ url }) => { if (url) window.location.assign(url); })
|
||||
.catch(() => { navigate('/settings?tab=billing'); });
|
||||
}}
|
||||
/>
|
||||
|
||||
{showTrialExpired && deferredShellElement(
|
||||
<TrialExpiredModal
|
||||
open
|
||||
onDismiss={() => setShowTrialExpired(false)}
|
||||
onUpgrade={(tier) => {
|
||||
setShowTrialExpired(false);
|
||||
// PR7a: same-tab navigate to hosted Checkout (avoids the deferred-popup
|
||||
// blocker; redirects back to /payment-success). Plan-tab fallback on failure.
|
||||
adapter.createCheckoutSession(tier)
|
||||
.then(({ url }) => { if (url) window.location.assign(url); })
|
||||
.catch(() => { navigate('/settings?tab=billing'); });
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* EmbeddingRoutingCard — pick the memory embedding provider (steal #10).
|
||||
*
|
||||
* Sits under ModelPilotCard in Settings › Models. Mirrors ModelPilotCard's Hive DS
|
||||
* styling and key-gating pattern. The picker offers `auto` + the tier-allowed
|
||||
* providers; voyage/openai are disabled when their vault key is missing. A live
|
||||
* styling and key-gating pattern. The picker offers `auto` + every selectable
|
||||
* provider; voyage/openai are disabled when their vault key is missing. A live
|
||||
* badge shows what is actually running; a Reprobe button re-runs the probe (useful
|
||||
* after installing Ollama or adding a key). Because the live embedder is fixed at
|
||||
* boot, an explicit switch shows a "restart to apply" hint honestly.
|
||||
@@ -13,14 +13,11 @@ import { useState, useEffect, useCallback } from 'react';
|
||||
import { Boxes, RotateCw, Info, AlertTriangle } from 'lucide-react';
|
||||
import { adapter, AdapterHttpError, type EmbeddingRoutingStatus } from '@/lib/adapter';
|
||||
import type { Provider } from '@/hooks/useProviders';
|
||||
import { TIER_CAPABILITIES, type Tier } from '@waggle/shared';
|
||||
import { HintTooltip } from '@/components/ui/hint-tooltip';
|
||||
|
||||
interface EmbeddingRoutingCardProps {
|
||||
/** For voyage/openai key-gating (mirrors ModelPilotCard). */
|
||||
providers: Provider[];
|
||||
/** Gates which providers the tier may select. */
|
||||
tier: Tier;
|
||||
}
|
||||
|
||||
/** Display order for the picker; 'mock' is never user-selectable. */
|
||||
@@ -36,7 +33,7 @@ const PROVIDER_LABELS: Record<string, string> = {
|
||||
mock: 'Mock (no semantics)',
|
||||
};
|
||||
|
||||
const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) => {
|
||||
const EmbeddingRoutingCard = ({ providers }: EmbeddingRoutingCardProps) => {
|
||||
const [status, setStatus] = useState<EmbeddingRoutingStatus | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -56,10 +53,6 @@ const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) =>
|
||||
|
||||
useEffect(() => { void load(); }, [load]);
|
||||
|
||||
// Tier-allowed providers (+ always 'auto'), in display order, minus 'mock'.
|
||||
const allowed = new Set(TIER_CAPABILITIES[tier].embeddingProviders as readonly string[]);
|
||||
const options = PROVIDER_ORDER.filter(p => p === 'auto' || (p !== ('mock' as string) && allowed.has(p)));
|
||||
|
||||
/** True when a cloud provider's key is missing (disable + hint). */
|
||||
const keyMissing = (id: string): boolean => {
|
||||
if (id === 'openai') {
|
||||
@@ -182,7 +175,7 @@ const EmbeddingRoutingCard = ({ providers, tier }: EmbeddingRoutingCardProps) =>
|
||||
onChange={(e) => void handleChange(e.target.value)}
|
||||
className="w-full bg-muted/50 border border-border/30 rounded-lg px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary/30 disabled:opacity-50"
|
||||
>
|
||||
{options.map(p => {
|
||||
{PROVIDER_ORDER.map(p => {
|
||||
const missing = keyMissing(p);
|
||||
return (
|
||||
<option key={p} value={p} disabled={missing}>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { Lock, ArrowUpRight } from 'lucide-react';
|
||||
|
||||
interface LockedFeatureProps {
|
||||
featureName: string;
|
||||
upgradePrompt: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
const LockedFeature = ({ featureName, upgradePrompt, children }: LockedFeatureProps) => (
|
||||
<div className="relative h-full">
|
||||
{children && (
|
||||
<div className="h-full opacity-20 pointer-events-none select-none blur-[1px]">
|
||||
{children}
|
||||
</div>
|
||||
)}
|
||||
<div className="absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center">
|
||||
<div className="w-12 h-12 rounded-full bg-muted/50 flex items-center justify-center">
|
||||
<Lock className="w-5 h-5 text-muted-foreground" />
|
||||
</div>
|
||||
<p className="text-sm font-display font-medium text-foreground">{featureName}</p>
|
||||
<p className="text-xs text-muted-foreground max-w-xs">{upgradePrompt}</p>
|
||||
<button className="flex items-center gap-1.5 mt-1 px-4 py-2 text-xs font-medium rounded-lg bg-primary/20 text-honey hover:bg-primary/30 transition-colors">
|
||||
<ArrowUpRight className="w-3.5 h-3.5" />
|
||||
View Plans
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
export default LockedFeature;
|
||||
@@ -43,7 +43,6 @@ interface SidebarProps {
|
||||
onOpenCommand: () => void;
|
||||
onSpawnAgent: () => void;
|
||||
userName: string | null;
|
||||
tierLabel: string;
|
||||
}
|
||||
|
||||
function initialOf(name: string | null, fallback: string): string {
|
||||
@@ -59,7 +58,6 @@ const Sidebar = ({
|
||||
onOpenCommand,
|
||||
onSpawnAgent,
|
||||
userName,
|
||||
tierLabel,
|
||||
}: SidebarProps) => {
|
||||
const navigate = useNavigate();
|
||||
const { pathname } = useLocation();
|
||||
@@ -207,9 +205,6 @@ const Sidebar = ({
|
||||
<span className="block truncate text-[13px] font-semibold">
|
||||
{userName ?? "Account"}
|
||||
</span>
|
||||
{/* Lane F2: --text-dim measured 4.47:1 on --bg-2 (nav) in light — sub-AA.
|
||||
--text-tertiary clears it (4.77:1 light / 6.31:1 dark). */}
|
||||
<span className="font-mono text-[10.5px] text-[var(--text-tertiary)]">{tierLabel}</span>
|
||||
</span>
|
||||
</button>
|
||||
</HintTooltip>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { WifiOff, Search, Bell, Brain } from "lucide-react";
|
||||
import waggleLogoDark from "@/assets/waggle-logo.jpeg";
|
||||
import waggleLogoLight from "@/assets/waggle-logo.png";
|
||||
@@ -25,15 +24,12 @@ interface StatusBarProps {
|
||||
costUsd?: number;
|
||||
offline?: boolean;
|
||||
unreadNotifications?: number;
|
||||
trialDaysRemaining?: number;
|
||||
trialExpired?: boolean;
|
||||
onSearchClick?: () => void;
|
||||
onNotificationClick?: () => void;
|
||||
}
|
||||
|
||||
const StatusBar = ({ workspaceName, focusedWindowLabel, model, tokensUsed, costUsd, offline, unreadNotifications = 0, trialDaysRemaining: trialDays, trialExpired, onSearchClick, onNotificationClick }: StatusBarProps) => {
|
||||
const StatusBar = ({ workspaceName, focusedWindowLabel, model, tokensUsed, costUsd, offline, unreadNotifications = 0, onSearchClick, onNotificationClick }: StatusBarProps) => {
|
||||
const [time, setTime] = useState(new Date());
|
||||
const navigate = useNavigate();
|
||||
const isLight = useIsLightTheme();
|
||||
const waggleLogo = isLight ? waggleLogoLight : waggleLogoDark;
|
||||
// M-20 / UX-5: token + cost are developer-facing signal. Hidden by
|
||||
@@ -203,24 +199,6 @@ const StatusBar = ({ workspaceName, focusedWindowLabel, model, tokensUsed, costU
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 lg:gap-4 shrink-0">
|
||||
{trialDays !== undefined && trialDays > 0 && (
|
||||
<span className={`text-[10px] font-display font-semibold px-2 py-0.5 rounded-full whitespace-nowrap ${trialDays <= 3 ? 'bg-destructive/20 text-destructive' : 'bg-primary/15 text-honey'}`}>
|
||||
Trial: {trialDays}d left
|
||||
</span>
|
||||
)}
|
||||
{trialExpired && (
|
||||
/* R9 Lane D: the amber pill "screamed" on every screen for a benign
|
||||
steady state (you're on the free Solo plan). Demoted to a quiet
|
||||
neutral text-chip — still a button that routes to plans. */
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => navigate('/settings?tab=billing')}
|
||||
className="text-[10px] font-display px-1.5 py-0.5 rounded-md text-muted-foreground whitespace-nowrap transition-colors hover:text-honey"
|
||||
title="You're on the free Solo plan (your trial ended). See plans."
|
||||
>
|
||||
Solo plan
|
||||
</button>
|
||||
)}
|
||||
<HintTooltip content="Search (Ctrl+K)">
|
||||
<button
|
||||
onClick={onSearchClick}
|
||||
|
||||
@@ -23,8 +23,6 @@ import InstallAuditPanel from './extend/InstallAuditPanel';
|
||||
* - Test = C37 PREVIEW-ONLY (injected prompt + parsed metadata, no LLM call).
|
||||
* - Install = the per-source dispatcher (starter | pack | marketplace) —
|
||||
* capability packs no longer mis-route through the starter installer.
|
||||
* - The PRO tier gate stays load-bearing: 403 → 'waggle:tier-insufficient'
|
||||
* → UpgradeModal.
|
||||
*/
|
||||
|
||||
const trustBadges: Record<string, { color: string; icon: React.ElementType }> = {
|
||||
@@ -200,9 +198,8 @@ const CapabilitiesApp = () => {
|
||||
|
||||
/**
|
||||
* §D2 — run the run-and-grade audit for ONE skill (scoped POST = a few LLM
|
||||
* calls), then reload so a freshly-minted "verified" badge appears. A 403
|
||||
* (non-PRO tier) throws AdapterHttpError and is routed to the UpgradeModal by
|
||||
* the fetch chokepoint; any other failure surfaces in the result panel.
|
||||
* calls), then reload so a freshly-minted "verified" badge appears. A
|
||||
* failure surfaces in the result panel.
|
||||
*/
|
||||
const handleVerifySkill = async (skillName: string) => {
|
||||
setVerifying(skillName);
|
||||
@@ -222,23 +219,6 @@ const CapabilitiesApp = () => {
|
||||
finally { setVerifying(null); }
|
||||
};
|
||||
|
||||
// Shared 403→UpgradeModal routing. Other errors fall through to the caller
|
||||
// so they can show a toast or inline state without duplicating tier logic.
|
||||
const handleInstallError = (err: unknown, packName: string): boolean => {
|
||||
const e = err as { status?: number; message?: string; body?: { required?: string; actual?: string } };
|
||||
if (e.status === 403) {
|
||||
window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', {
|
||||
detail: {
|
||||
required: e.body?.required ?? 'TEAMS',
|
||||
actual: e.body?.actual ?? 'FREE',
|
||||
message: `Installing "${packName}" needs the Team plan or an active trial.`,
|
||||
},
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/** Per-source install dispatcher (3A): starter-pack ids install via the
|
||||
* starter route, capability-pack ids via the pack route. A pack install
|
||||
* with per-skill failures comes back 422 — surfaced inline, not swallowed. */
|
||||
@@ -254,9 +234,7 @@ const CapabilitiesApp = () => {
|
||||
// invisible until the window is reopened.
|
||||
load();
|
||||
} catch (err) {
|
||||
if (!handleInstallError(err, packId)) {
|
||||
setInstallError(err instanceof Error ? err.message : `Failed to install "${packId}"`);
|
||||
}
|
||||
setInstallError(err instanceof Error ? err.message : `Failed to install "${packId}"`);
|
||||
} finally { setInstalling(null); }
|
||||
};
|
||||
|
||||
@@ -639,7 +617,6 @@ const CapabilitiesApp = () => {
|
||||
// skill on disk even when the user Escapes/Cancels instead of
|
||||
// pressing Done — the Hub must reflect the file that now exists.
|
||||
onCancel={() => { setShowCreate(false); load(); }}
|
||||
onTierError={handleInstallError}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
* C21 test with the live/static mode label, C19 scope editor, revoke with
|
||||
* a scope-and-consequence confirm). Logs = honest coming-soon (no route).
|
||||
* - Catalog: the static registry grid (McpCatalog) wired to the real
|
||||
* installer — PRO+ (B5; 403 routes through the UpgradeModal) and the
|
||||
* SecurityGate "risk approval required" path renders the ApprovalModal
|
||||
* (HIGH findings can be force-overridden; CRITICAL never).
|
||||
* - Custom: register an arbitrary stdio server (PRO+ server-side).
|
||||
* installer — the SecurityGate "risk approval required" path renders the
|
||||
* ApprovalModal (HIGH findings can be force-overridden; CRITICAL never).
|
||||
* - Custom: register an arbitrary stdio server.
|
||||
* - Remote Registry: C20 deferred — static catalog pointers only, the
|
||||
* runtime is stdio-only in v1.
|
||||
*
|
||||
@@ -156,7 +155,7 @@ const MCPHubApp = ({ personaId }: MCPHubAppProps = {}) => {
|
||||
// instead of being wiped by an unmount.
|
||||
const initialLoading = loading && items.length === 0;
|
||||
|
||||
/** B5 PRO+ install via the marketplace installer; `force` = approved HIGH
|
||||
/** Install via the marketplace installer; `force` = approved HIGH
|
||||
* override. The block that actually fires lives INSIDE installer.install()
|
||||
* and is only overridable via `forceInsecure` (the audited override path);
|
||||
* `force` alone just means "reinstall" — retrying with it loops the
|
||||
@@ -168,7 +167,6 @@ const MCPHubApp = ({ personaId }: MCPHubAppProps = {}) => {
|
||||
const res = await adapter.installMcp(id, force ? { force: true, forceInsecure: true } : undefined) as {
|
||||
installed?: boolean; server?: string; status?: string; startError?: string;
|
||||
requiresApproval?: boolean; error?: string; message?: string;
|
||||
required?: string; actual?: string;
|
||||
// Installer-level 422 blocks nest the scan; route-level 403 blocks
|
||||
// are top-level { blocked, severity, message } with NO scanResult.
|
||||
blocked?: boolean; severity?: string;
|
||||
@@ -185,19 +183,6 @@ const MCPHubApp = ({ personaId }: MCPHubAppProps = {}) => {
|
||||
await load();
|
||||
return;
|
||||
}
|
||||
if (res.error === 'TIER_INSUFFICIENT') {
|
||||
// The adapter's global 403 handler routes this through the
|
||||
// UpgradeModal; the explicit dispatch keeps the house pattern (and
|
||||
// the unit-testable contract) — the event is idempotent.
|
||||
window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', {
|
||||
detail: {
|
||||
required: res.required ?? 'TEAMS',
|
||||
actual: res.actual ?? 'FREE',
|
||||
message: `Installing MCP servers needs the Team plan or an active trial.`,
|
||||
},
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (res.requiresApproval) {
|
||||
// Cover BOTH block envelopes: installer-level (scanResult.overall_severity)
|
||||
// and route-level (top-level severity) — a route-level CRITICAL must
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* Add / Connect / Enable through the shared install store, so installing in
|
||||
* ANY view reflects in ALL (the count bar + inline chat). Security is
|
||||
* preserved server-side — a SecurityGate block surfaces as a destructive
|
||||
* toast, tier routes to Upgrade — and the destructive Remove direction keeps
|
||||
* its ApprovalModal consequence dialog. The Audit tab is the C18 shared feed.
|
||||
* toast — and the destructive Remove direction keeps its ApprovalModal
|
||||
* consequence dialog. The Audit tab is the C18 shared feed.
|
||||
*/
|
||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { Store, Loader2, Package, Sparkles } from 'lucide-react';
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/**
|
||||
* PaymentSuccessApp — warm-Hive PR7a Billing (design screen 14 "Success" state).
|
||||
*
|
||||
* The post-Stripe-Checkout landing (`/payment-success?session_id=…`, set by
|
||||
* `checkout.ts:42`). `useBilling` auto-detects `?session_id=` on mount and calls
|
||||
* POST /api/stripe/sync (payment-gated) → flips the tier. This screen renders the
|
||||
* confirmation OFF THE SYNCED TIER only.
|
||||
*
|
||||
* No-fabrication (recon 04 §3 / plan F5): the design's receipt block (receipt #,
|
||||
* "Trial ends Jun 28", "Then $19/mo", "Emailed →") has NO data source — `/sync`
|
||||
* returns only `{ tier, customerId }`. Those rows are GATED OFF here; we never invent
|
||||
* a charge amount, a trial-end date, or a receipt link.
|
||||
*/
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Check, Loader2, AlertCircle } from 'lucide-react';
|
||||
import { useBilling } from '@/hooks/useBilling';
|
||||
|
||||
const TIER_HEADLINE: Record<string, string> = {
|
||||
// PRO retained for legacy checkout sessions that predate the Solo/Team split.
|
||||
PRO: 'Legacy Pro',
|
||||
TEAMS: 'Team',
|
||||
ENTERPRISE: 'Enterprise',
|
||||
};
|
||||
|
||||
export default function PaymentSuccessApp() {
|
||||
const navigate = useNavigate();
|
||||
const billing = useBilling();
|
||||
const isPaid = billing.tier === 'PRO' || billing.tier === 'TEAMS' || billing.tier === 'ENTERPRISE';
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-auto">
|
||||
<div className="max-w-[520px] mx-auto px-8 py-[70px] text-center">
|
||||
{/* Syncing — the real payment confirmation is in flight */}
|
||||
{billing.syncing ? (
|
||||
<div className="flex flex-col items-center gap-4" data-testid="payment-success-syncing">
|
||||
<Loader2 className="w-9 h-9 animate-spin text-honey" />
|
||||
<p className="text-[15px] text-[var(--text-2)]">Confirming your payment…</p>
|
||||
</div>
|
||||
) : billing.error ? (
|
||||
/* Honest failure — never fake a success (F10/F5) */
|
||||
<div className="flex flex-col items-center gap-4" data-testid="payment-success-error">
|
||||
<div className="w-[78px] h-[78px] rounded-full grid place-items-center bg-destructive/10 border border-destructive/30">
|
||||
<AlertCircle className="w-9 h-9 text-destructive" strokeWidth={2.2} />
|
||||
</div>
|
||||
<h1 className="text-[24px] font-[650] tracking-[-0.02em] text-foreground">We couldn’t confirm the payment</h1>
|
||||
<p className="text-[14px] text-[var(--text-muted)] max-w-[42ch]">{billing.error}</p>
|
||||
<button
|
||||
onClick={() => navigate('/settings?tab=billing')}
|
||||
className="mt-2 px-[22px] py-3 rounded-[11px] text-[14.5px] font-[650] bg-[var(--surface)] text-[var(--text-2)] border border-[var(--line-strong)] hover:border-[var(--honey-line)] hover:text-honey transition-colors"
|
||||
>
|
||||
Back to plans
|
||||
</button>
|
||||
</div>
|
||||
) : isPaid ? (
|
||||
/* Confirmation off the SYNCED tier — no receipt rows (F5) */
|
||||
<>
|
||||
<div className="w-[78px] h-[78px] rounded-full mx-auto mb-6 grid place-items-center bg-[var(--healthy-wash)] border border-[color:color-mix(in_srgb,var(--healthy)_40%,transparent)]">
|
||||
<Check className="w-9 h-9 text-[var(--healthy)]" strokeWidth={2.2} />
|
||||
</div>
|
||||
<h1 className="text-[28px] font-[650] tracking-[-0.02em] mb-3 text-foreground">
|
||||
You’re <span className="text-honey">{TIER_HEADLINE[billing.tier] ?? billing.tier}.</span>
|
||||
</h1>
|
||||
<p className="text-[15px] text-[var(--text-2)] leading-relaxed mx-auto mb-7 max-w-[42ch]">
|
||||
Your hive just leveled up — <b className="text-foreground">shared team memory, cross-device sync, and governance</b> are live.
|
||||
</p>
|
||||
<div className="inline-flex gap-2.5">
|
||||
<button
|
||||
onClick={() => navigate('/home')}
|
||||
className="px-[22px] py-3 rounded-[11px] text-[14.5px] font-[650] bg-primary text-primary-foreground hover:bg-[var(--honey-bright)] transition-colors"
|
||||
>
|
||||
Start using {TIER_HEADLINE[billing.tier] ?? billing.tier} →
|
||||
</button>
|
||||
<button
|
||||
onClick={() => navigate('/settings?tab=billing')}
|
||||
className="px-[22px] py-3 rounded-[11px] text-[14.5px] font-[650] bg-[var(--surface)] text-[var(--text-2)] border border-[var(--line-strong)] hover:border-[var(--honey-line)] hover:text-honey transition-colors"
|
||||
>
|
||||
Manage billing
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
/* Synced but not on a paid tier (cancelled / unpaid) — honest, no fake success */
|
||||
<div className="flex flex-col items-center gap-4" data-testid="payment-success-unpaid">
|
||||
<h1 className="text-[24px] font-[650] tracking-[-0.02em] text-foreground">Nothing to confirm</h1>
|
||||
<p className="text-[14px] text-[var(--text-muted)] max-w-[42ch]">
|
||||
We didn’t detect a completed checkout. If you just paid, give it a moment and refresh.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => navigate('/settings?tab=billing')}
|
||||
className="mt-2 px-[22px] py-3 rounded-[11px] text-[14.5px] font-[650] bg-[var(--surface)] text-[var(--text-2)] border border-[var(--line-strong)] hover:border-[var(--honey-line)] hover:text-honey transition-colors"
|
||||
>
|
||||
Back to plans
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import {
|
||||
Cpu, Shield, Palette, Save, Loader2, Users, Database,
|
||||
Download, Upload, Link2, Building, Wrench, DollarSign, Key, Lock, BarChart3, Trash2,
|
||||
Cpu, Shield, Palette, Save, Loader2, Database,
|
||||
Download, Upload, Wrench, DollarSign, Key, Lock, BarChart3, Trash2,
|
||||
RotateCcw, GraduationCap, HelpCircle, AlertTriangle, MessageCircle,
|
||||
} from 'lucide-react';
|
||||
import PlanCards from '@/components/os/billing/PlanCards';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { useBilling } from '@/hooks/useBilling';
|
||||
import { parseTier, tierSatisfies, TIER_LABELS, type Tier } from '@waggle/shared';
|
||||
import LockedFeature from '@/components/os/LockedFeature';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { HintTooltip } from '@/components/ui/hint-tooltip';
|
||||
@@ -35,13 +31,12 @@ import { ModelGate } from '@/components/os/model-gate/ModelGate';
|
||||
import EraseDataDialog from '@/components/os/overlays/EraseDataDialog';
|
||||
import TelegramDigestCard from '@/components/os/settings/TelegramDigestCard';
|
||||
import ChannelsSettings from '@/components/os/settings/ChannelsSettings';
|
||||
import CoverageCompassCard from '@/components/os/settings/CoverageCompassCard';
|
||||
import BrowserCompanionSettings from '@/components/os/settings/BrowserCompanionSettings';
|
||||
import { AVAILABLE_SHAPES, useSelectedShape, type PromptShape } from '@/lib/shape-selection';
|
||||
import { SectionLabel } from '@/components/os/warm';
|
||||
import { ApprovalModal, type ApprovalRequest } from '@/components/ui/approval-modal';
|
||||
|
||||
type SettingsTab = 'general' | 'models' | 'billing' | 'permissions' | 'channels' | 'team' | 'backup' | 'enterprise' | 'advanced';
|
||||
type SettingsTab = 'general' | 'models' | 'permissions' | 'channels' | 'backup' | 'advanced';
|
||||
type SettingsApproval =
|
||||
| { kind: 'clear-telemetry' }
|
||||
| { kind: 'restore-backup'; file: File };
|
||||
@@ -50,12 +45,9 @@ type BackupStatus = { tone: 'success' | 'error'; message: string };
|
||||
const tabs: { id: SettingsTab; label: string; icon: React.ElementType }[] = [
|
||||
{ id: 'general', label: 'General', icon: Palette },
|
||||
{ id: 'models', label: 'Models', icon: Cpu },
|
||||
{ id: 'billing', label: 'Plan', icon: DollarSign },
|
||||
{ id: 'permissions', label: 'Permissions', icon: Shield },
|
||||
{ id: 'channels', label: 'Channels', icon: MessageCircle },
|
||||
{ id: 'team', label: 'Team', icon: Users },
|
||||
{ id: 'backup', label: 'Backup', icon: Database },
|
||||
{ id: 'enterprise', label: 'Enterprise', icon: Building },
|
||||
{ id: 'advanced', label: 'Advanced', icon: Wrench },
|
||||
];
|
||||
|
||||
@@ -118,13 +110,11 @@ const SettingsApp = () => {
|
||||
}
|
||||
}, [activeTab]);
|
||||
|
||||
// PR7a/D12: `?tab=` deep-link reader. Upgrade entry points route to
|
||||
// `/settings?tab=billing`; this also fixes the pre-existing `?tab=backup`
|
||||
// deep-link (routes.ts:52) that opened Models because there was no reader.
|
||||
// Snaps to a KNOWN tab, respecting the tier filter (e.g. an Essential user
|
||||
// deep-linked to `advanced` falls back to general, never a half-shipped tab).
|
||||
// PR7a/D12: `?tab=` deep-link reader. This also fixes the pre-existing
|
||||
// `?tab=backup` deep-link (routes.ts:52) that opened Models because there was
|
||||
// no reader. Snaps to a KNOWN tab, respecting the tier filter (e.g. an Essential
|
||||
// user deep-linked to `advanced` falls back to general, never a half-shipped tab).
|
||||
const [searchParams] = useSearchParams();
|
||||
const checkoutCancelled = searchParams.get('checkout') === 'cancelled';
|
||||
useEffect(() => {
|
||||
const tabParam = searchParams.get('tab');
|
||||
if (!tabParam || !tabs.some(t => t.id === tabParam)) return;
|
||||
@@ -135,20 +125,6 @@ const SettingsApp = () => {
|
||||
const { toast } = useToast();
|
||||
const [showWizardReplayConfirm, setShowWizardReplayConfirm] = useState(false);
|
||||
|
||||
// Billing
|
||||
const billing = useBilling();
|
||||
|
||||
// Tier gating — canonical resolution off the billing tier (never null: a
|
||||
// legacy/unknown value falls back to Solo/FREE, never locking a user out).
|
||||
const tier: Tier = parseTier(billing.tier) ?? 'FREE';
|
||||
const isTeamLocked = !tierSatisfies(tier, 'TEAMS');
|
||||
const isEnterpriseLocked = !tierSatisfies(tier, 'ENTERPRISE');
|
||||
|
||||
const LOCKED_TABS: Partial<Record<SettingsTab, { feature: string; label: string; prompt: string }>> = {
|
||||
...(isTeamLocked ? { team: { feature: 'team', label: 'Team Management', prompt: 'Upgrade to Team for shared workspaces and governance' } } : {}),
|
||||
...(isEnterpriseLocked ? { enterprise: { feature: 'enterprise', label: 'Enterprise Features', prompt: 'Enterprise feature — contact sales for audit trail, compliance, and governance' } } : {}),
|
||||
};
|
||||
|
||||
// P4: permissions state. `defaultAutonomy` replaces the old yoloMode
|
||||
// binary — it's the inherited level new chat windows start at. Per-window
|
||||
// overrides in Chat's AutonomyPicker always beat this.
|
||||
@@ -161,16 +137,6 @@ const SettingsApp = () => {
|
||||
// focus-visible, testable confirm row.
|
||||
const [pendingYolo, setPendingYolo] = useState(false);
|
||||
|
||||
// Team state
|
||||
const [teamUrl, setTeamUrl] = useState('');
|
||||
const [teamToken, setTeamToken] = useState('');
|
||||
const [teamConnected, setTeamConnected] = useState(false);
|
||||
const [teamConnecting, setTeamConnecting] = useState(false);
|
||||
|
||||
// KVARK state
|
||||
const [kvarkUrl, setKvarkUrl] = useState('');
|
||||
const [kvarkToken, setKvarkToken] = useState('');
|
||||
|
||||
// M2-7: Telemetry state
|
||||
const [telemetryEnabled, setTelemetryEnabled] = useState(false);
|
||||
// Phase 4.1: GDPR Art. 17 erasure flow. Visible at all tiers — erasure
|
||||
@@ -198,7 +164,7 @@ const SettingsApp = () => {
|
||||
|
||||
// Load settings
|
||||
useEffect(() => {
|
||||
adapter.getSettings().then((s: { defaultModel?: string; model?: string; dailyBudget?: number; tier?: string; fallbackModel?: string; budgetModel?: string; budgetThreshold?: number }) => {
|
||||
adapter.getSettings().then((s: { defaultModel?: string; model?: string; dailyBudget?: number; fallbackModel?: string; budgetModel?: string; budgetThreshold?: number }) => {
|
||||
setDefaultModel(s.defaultModel ?? s.model ?? '');
|
||||
setFallbackModel(s.fallbackModel ?? null);
|
||||
setBudgetModel(s.budgetModel ?? null);
|
||||
@@ -213,11 +179,9 @@ const SettingsApp = () => {
|
||||
setExternalGates(p.externalGates);
|
||||
}).catch(() => {});
|
||||
|
||||
adapter.getTeamStatus().then(s => setTeamConnected(s.connected)).catch(() => {});
|
||||
|
||||
// M2-7: Load telemetry status. P7/D15 B5: this was the ONE loader missing a
|
||||
// .catch — a getTelemetryStatus rejection became an unhandled promise
|
||||
// rejection (its three siblings above all swallow). Match the local pattern.
|
||||
// rejection (its siblings above all swallow). Match the local pattern.
|
||||
adapter.getTelemetryStatus().then(s => {
|
||||
setTelemetryEnabled(s.enabled);
|
||||
setTelemetryCount(s.totalEvents);
|
||||
@@ -347,7 +311,6 @@ const SettingsApp = () => {
|
||||
<div className="w-full shrink-0 border-b border-border/50 sm:w-36 sm:border-b-0 sm:border-r flex flex-col">
|
||||
<div className="grid grid-cols-3 gap-1 p-2 sm:block sm:flex-1 sm:space-y-0.5" role="tablist" aria-label="Settings sections">
|
||||
{visibleTabs.map(tab => {
|
||||
const locked = LOCKED_TABS[tab.id];
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
@@ -368,7 +331,6 @@ const SettingsApp = () => {
|
||||
>
|
||||
<tab.icon className="h-3.5 w-3.5 shrink-0" />
|
||||
<span className="min-w-0 truncate">{tab.label}</span>
|
||||
{locked && <Lock className="ml-auto h-3 w-3 shrink-0 text-muted-foreground/50" />}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -429,33 +391,13 @@ const SettingsApp = () => {
|
||||
<div className="space-y-5">
|
||||
<h3 className="text-sm font-display font-semibold text-foreground">General</h3>
|
||||
|
||||
{/* Tier. P1b D3-4: single-sourced from the resolved billing state
|
||||
(was a separate getSettings-fed copy that defaulted to 'FREE'
|
||||
on failure and could disagree with the Billing tab). Unresolved
|
||||
renders a neutral placeholder, never 'FREE plan' as fact. */}
|
||||
<div className="p-3 rounded-xl bg-secondary/30 border border-border/30">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-xs font-display font-medium text-foreground">Tier</p>
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
{billing.tierResolved ? `${TIER_LABELS[tier]} plan` : 'Confirming plan…'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="px-2 py-0.5 rounded-full text-[11px] font-display bg-primary/20 text-honey">
|
||||
{billing.tierResolved ? TIER_LABELS[tier] : '…'}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* PR5 D10 — local-first reassurance + the dock/plan distinction. The
|
||||
disclosure selector that used to live here is now the "Show"
|
||||
control in the settings content header (R10; D6/Wave P); QW-5's
|
||||
"dock tier ≠ billing plan" note is preserved here so the
|
||||
distinction isn't lost. */}
|
||||
{/* PR5 D10 — local-first reassurance. The disclosure selector that
|
||||
used to live here is now the "Show" control in the settings
|
||||
content header (R10; D6/Wave P). */}
|
||||
<div className="p-3 rounded-xl bg-secondary/30 border border-border/30">
|
||||
<p className="text-xs font-display font-medium text-foreground mb-1">Local-first</p>
|
||||
<p className="text-[11px] text-muted-foreground leading-relaxed">
|
||||
Waggle runs on your machine — your memory and data stay local, always. The <strong className="text-foreground">Show</strong> control (top-right of Settings) sets how much of the app and these settings you see; it’s independent of your Solo/Team plan, and every app stays reachable via Ctrl+K.
|
||||
Waggle runs on your machine — your memory and data stay local, always. The <strong className="text-foreground">Show</strong> control (top-right of Settings) sets how much of the app and these settings you see; every app stays reachable via Ctrl+K.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -594,7 +536,7 @@ const SettingsApp = () => {
|
||||
}}
|
||||
/>
|
||||
|
||||
<EmbeddingRoutingCard providers={providers} tier={tier} />
|
||||
<EmbeddingRoutingCard providers={providers} />
|
||||
|
||||
<SectionLabel>Model Configuration</SectionLabel>
|
||||
|
||||
@@ -680,150 +622,6 @@ const SettingsApp = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ═══ BILLING (PR7a — screen 14, themed over the REAL useBilling→Stripe flow) ═══ */}
|
||||
{activeTab === 'billing' && (
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h3 className="text-sm font-display font-semibold text-foreground">Plan & Subscription</h3>
|
||||
{/* §14 load-bearing positioning copy — honestly satisfiable under the
|
||||
ratified Option A (BYO-key + flat subscription): Teams unlock
|
||||
scale, never feature-count paywalls on memory. */}
|
||||
<p className="text-[11px] text-[var(--text-muted)] mt-1">
|
||||
Memory is free forever. You only pay for scale — no feature-count games.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* F4 from the 2026-05-28 addictiveness audit — visible value-prop
|
||||
framing so users see they're replacing 7-ish subscription tools,
|
||||
not adding an 8th. */}
|
||||
{checkoutCancelled && (
|
||||
<div className="flex items-start gap-3 rounded-[14px] border border-[var(--line-soft)] bg-[var(--surface-2)] p-4">
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-honey" aria-hidden="true" />
|
||||
<div>
|
||||
<p className="text-[13px] font-display font-semibold text-foreground">Checkout was cancelled</p>
|
||||
<p className="mt-1 text-[11px] leading-relaxed text-[var(--text-muted)]">
|
||||
No charge was made. You can review the Team plan here or keep using Solo.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<CoverageCompassCard />
|
||||
|
||||
{/* Current tier badge. F7: while the tier is unresolved (boot race /
|
||||
sidecar down) render an explicit unresolved state — NEVER the
|
||||
default 'FREE' as fact. */}
|
||||
{!billing.tierResolved ? (
|
||||
<div className="p-4 rounded-[14px] bg-[var(--surface-2)] border border-[var(--line-soft)]" data-testid="billing-tier-unresolved">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-xs font-display font-medium text-foreground">Current Plan</p>
|
||||
<p className="text-[11px] text-[var(--text-muted)] mt-0.5">
|
||||
{billing.error ? 'Couldn’t reach the server to confirm your plan — retrying automatically.' : 'Confirming your plan…'}
|
||||
</p>
|
||||
</div>
|
||||
<span className="px-3 py-1 rounded-full text-xs font-display font-semibold bg-muted text-muted-foreground">…</span>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-4 rounded-[14px] bg-[var(--surface)] border border-[var(--line-soft)]">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<p className="text-xs font-display font-medium text-foreground">Current Plan</p>
|
||||
<p className="text-[11px] text-[var(--text-muted)] mt-0.5">
|
||||
{billing.tier === 'FREE' && 'Solo — every individual feature, free forever'}
|
||||
{billing.tier === 'TRIAL' && 'Trial — 15 days of Team features, then Solo'}
|
||||
{billing.tier === 'TEAMS' && '$49/mo per seat — shared workspaces, WaggleDance, governance'}
|
||||
{billing.tier === 'ENTERPRISE' && 'Enterprise — KVARK sovereign deployment'}
|
||||
</p>
|
||||
</div>
|
||||
<span className={`px-3 py-1 rounded-full text-xs font-display font-semibold ${
|
||||
billing.tier === 'FREE' ? 'bg-muted text-muted-foreground' :
|
||||
billing.tier === 'TRIAL' ? 'bg-[var(--honey-wash)] text-honey' :
|
||||
billing.tier === 'TEAMS' ? 'bg-[var(--intel-wash)] text-[var(--intel)]' :
|
||||
'bg-[var(--work-wash)] text-[var(--work)]'
|
||||
}`}>
|
||||
{TIER_LABELS[tier]}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Error display (F8 — honest, e.g. STRIPE_NOT_CONFIGURED 503; never a fake subscribe) */}
|
||||
{billing.error && (
|
||||
<div className="p-3 rounded-lg bg-destructive/10 border border-destructive/20">
|
||||
<p className="text-[11px] text-destructive">{billing.error}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Syncing indicator */}
|
||||
{billing.syncing && (
|
||||
<div className="flex items-center gap-2 p-3 rounded-lg bg-primary/10 border border-primary/20">
|
||||
<Loader2 className="w-3 h-3 animate-spin text-honey" />
|
||||
<p className="text-[11px] text-honey">Confirming your payment...</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Plans grid — tiers that still have an upgrade path (FREE/TRIAL, plus legacy PRO).
|
||||
Choosing a plan hands off to hosted Stripe Checkout (D5); the
|
||||
Monthly/Annual toggle resolves the REAL annual price (D8/F9), not
|
||||
a cosmetic client discount. Only on a RESOLVED tier (F7). */}
|
||||
{billing.tierResolved && (billing.tier === 'FREE' || billing.tier === 'TRIAL' || billing.tier === 'PRO') && (
|
||||
<PlanCards
|
||||
currentTier={billing.tier}
|
||||
onChoose={(tier, period) => billing.startCheckout(tier, period)}
|
||||
disabled={!billing.checkoutAvailable}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Manage — paid tiers. Hosted Stripe Customer Portal launchpad (D6).
|
||||
The mock's invoice list / "VISA ···4242" / next-charge date are
|
||||
GATED OFF (F2/F3/F4) — there is no data source; the Portal is the
|
||||
real surface for payment method, invoices, plan change, cancel. */}
|
||||
{billing.tierResolved && (billing.tier === 'PRO' || billing.tier === 'TEAMS') && (
|
||||
<div className="p-5 rounded-[18px] bg-[var(--surface)] border border-[var(--honey-line)]">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<p className="text-[15px] font-display font-semibold text-foreground">Waggle {billing.tier === 'PRO' ? 'Pro (legacy)' : 'Team'}</p>
|
||||
<p className="text-[12px] text-[var(--text-muted)] mt-0.5">Subscription managed securely via Stripe.</p>
|
||||
</div>
|
||||
<span className="text-[11.5px] font-[650] text-honey bg-[var(--honey-wash)] border border-[var(--honey-line)] px-3 py-1.5 rounded-full whitespace-nowrap">● Active</span>
|
||||
</div>
|
||||
<div className="mt-4 pt-4 border-t border-[var(--line-soft)]">
|
||||
<button
|
||||
onClick={() => billing.openPortal()}
|
||||
className="flex items-center gap-1.5 px-3.5 py-2 text-[13px] font-[650] rounded-[10px] bg-[var(--surface-2)] text-[var(--text-2)] border border-[var(--line-strong)] hover:border-[var(--honey-line)] hover:text-honey transition-colors"
|
||||
>
|
||||
<DollarSign className="w-3.5 h-3.5" />
|
||||
Manage subscription
|
||||
</button>
|
||||
<p className="text-[11px] text-[var(--text-muted)] mt-2">
|
||||
Update payment method, view invoices, switch to annual, or cancel — all via the Stripe customer portal.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Enterprise CTA — the KVARK funnel. Only on a RESOLVED tier (F7). */}
|
||||
{billing.tierResolved && billing.tier !== 'ENTERPRISE' && (
|
||||
<div className="p-4 rounded-[14px] bg-[var(--work-wash)] border border-[var(--line-soft)]">
|
||||
<p className="text-xs font-display font-medium text-[var(--work)]">Enterprise</p>
|
||||
<p className="text-[11px] text-[var(--text-muted)] mt-1">
|
||||
Need sovereign deployment, audit trail, and KVARK integration?
|
||||
</p>
|
||||
<a
|
||||
href="https://www.kvark.ai"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-block mt-2 text-[11px] text-[var(--work)] hover:text-honey underline"
|
||||
>
|
||||
Contact sales at kvark.ai
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ═══ PERMISSIONS ═══ */}
|
||||
{activeTab === 'permissions' && (
|
||||
<div className="space-y-4">
|
||||
@@ -949,56 +747,6 @@ const SettingsApp = () => {
|
||||
{/* ═══ CHANNELS ═══ */}
|
||||
{activeTab === 'channels' && <ChannelsSettings />}
|
||||
|
||||
{/* ═══ TEAM ═══ */}
|
||||
{activeTab === 'team' && LOCKED_TABS.team && (
|
||||
<LockedFeature featureName={LOCKED_TABS.team.label} upgradePrompt={LOCKED_TABS.team.prompt} />
|
||||
)}
|
||||
{activeTab === 'team' && !LOCKED_TABS.team && (
|
||||
<div className="space-y-4">
|
||||
<h3 className="text-sm font-display font-semibold text-foreground">Team Server</h3>
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-2 mb-2">
|
||||
<div className={`w-2 h-2 rounded-full ${teamConnected ? 'bg-emerald-400' : 'bg-muted-foreground'}`} />
|
||||
<span className="text-xs text-muted-foreground">{teamConnected ? 'Connected' : 'Disconnected'}</span>
|
||||
</div>
|
||||
{!teamConnected && (
|
||||
<div className="p-2 rounded-lg bg-amber-500/10 border border-amber-500/20">
|
||||
<p className="text-[11px] text-amber-400">Connecting to a team server will share workspace data. Ensure you trust the server.</p>
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
<label htmlFor="settings-team-url" className="text-xs text-muted-foreground block mb-1">Team Server URL</label>
|
||||
<Input id="settings-team-url" name="teamServerUrl" type="url" autoComplete="url" spellCheck={false} value={teamUrl} onChange={e => setTeamUrl(e.target.value)} placeholder="https://team.waggle.ai"
|
||||
className="w-full bg-muted/50 h-auto py-1.5" />
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="settings-team-token" className="text-xs text-muted-foreground block mb-1">Auth Token</label>
|
||||
<Input id="settings-team-token" name="teamAuthToken" type="password" autoComplete="current-password" spellCheck={false} value={teamToken} onChange={e => setTeamToken(e.target.value)}
|
||||
className="w-full bg-muted/50 h-auto py-1.5" />
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{!teamConnected ? (
|
||||
<button onClick={async () => {
|
||||
setTeamConnecting(true);
|
||||
try { await adapter.teamConnect(teamUrl, teamToken); setTeamConnected(true); } catch { /* ignore */ }
|
||||
finally { setTeamConnecting(false); }
|
||||
}} disabled={teamConnecting || !teamUrl}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg bg-primary text-primary-foreground hover:bg-primary/80 disabled:opacity-50 transition-colors">
|
||||
{teamConnecting ? <Loader2 className="w-3 h-3 animate-spin" /> : <Link2 className="w-3 h-3" />} Connect
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={async () => {
|
||||
try { await adapter.teamDisconnect(); setTeamConnected(false); } catch { /* ignore */ }
|
||||
}}
|
||||
className="flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg bg-destructive text-foreground hover:bg-destructive/80 transition-colors">
|
||||
Disconnect
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ═══ BACKUP ═══ */}
|
||||
{activeTab === 'backup' && (
|
||||
<div className="space-y-4">
|
||||
@@ -1070,33 +818,6 @@ const SettingsApp = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ═══ ENTERPRISE ═══ */}
|
||||
{activeTab === 'enterprise' && LOCKED_TABS.enterprise && (
|
||||
<LockedFeature featureName={LOCKED_TABS.enterprise.label} upgradePrompt={LOCKED_TABS.enterprise.prompt} />
|
||||
)}
|
||||
{activeTab === 'enterprise' && !LOCKED_TABS.enterprise && (
|
||||
<div className="space-y-4">
|
||||
<h3 className="text-sm font-display font-semibold text-foreground">Enterprise (KVARK)</h3>
|
||||
<p className="text-xs text-muted-foreground">Connect to KVARK for enterprise document retrieval, compliance, and governance features.</p>
|
||||
<div className="space-y-3">
|
||||
<div>
|
||||
<label htmlFor="settings-kvark-url" className="text-xs text-muted-foreground block mb-1">KVARK Server URL</label>
|
||||
<Input id="settings-kvark-url" name="kvarkServerUrl" type="url" autoComplete="url" spellCheck={false} value={kvarkUrl} onChange={e => setKvarkUrl(e.target.value)} placeholder="https://kvark.company.com"
|
||||
className="w-full bg-muted/50 h-auto py-1.5" />
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="settings-kvark-token" className="text-xs text-muted-foreground block mb-1">API Token</label>
|
||||
<Input id="settings-kvark-token" name="kvarkApiToken" type="password" autoComplete="current-password" spellCheck={false} value={kvarkToken} onChange={e => setKvarkToken(e.target.value)}
|
||||
className="w-full bg-muted/50 h-auto py-1.5" />
|
||||
</div>
|
||||
<button disabled className="flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg bg-secondary text-muted-foreground opacity-50 cursor-not-allowed">
|
||||
<Building className="w-3 h-3" /> Test Connection
|
||||
</button>
|
||||
<p className="text-[11px] text-muted-foreground">Requires Enterprise tier. Contact sales for access.</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ═══ ADVANCED ═══ */}
|
||||
{activeTab === 'advanced' && (
|
||||
<div className="space-y-4">
|
||||
|
||||
@@ -49,16 +49,16 @@ const TelemetryApp = () => {
|
||||
|
||||
const load = useCallback(async () => {
|
||||
try {
|
||||
// /api/cost/summary is free for all tiers (P22) and carries byModel + budget.
|
||||
// /api/cost/by-workspace is TEAMS-gated; tolerate its absence (object OR []).
|
||||
// /api/cost/summary carries byModel + budget; /api/cost/by-workspace the
|
||||
// per-workspace split. Tolerate a by-workspace failure (object OR []).
|
||||
const [summaryRes, costRes, statsRes] = await Promise.all([
|
||||
adapter.fetch('/api/cost/summary').then(r => r.json()).catch(() => null),
|
||||
adapter.fetch('/api/cost/by-workspace').then(r => r.json()).catch(() => null),
|
||||
adapter.fetch('/api/events/stats').then(r => r.json()).catch(() => ({})),
|
||||
]);
|
||||
|
||||
// by-workspace returns { workspaces, totalCost } (TEAMS) — older callers
|
||||
// expected a bare array; accept both, default to empty when gated off.
|
||||
// by-workspace returns { workspaces, totalCost } — older callers
|
||||
// expected a bare array; accept both, default to empty on failure.
|
||||
const wsRows: Array<Record<string, unknown>> = Array.isArray(costRes)
|
||||
? costRes
|
||||
: Array.isArray(costRes?.workspaces) ? costRes.workspaces : [];
|
||||
@@ -267,7 +267,7 @@ const TelemetryApp = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* By workspace (TEAMS) */}
|
||||
{/* By workspace */}
|
||||
{data.byWorkspace.length > 0 && (
|
||||
<div>
|
||||
<h2 className="text-[11px] font-display font-semibold text-[var(--text-muted)] uppercase tracking-wide mb-2">By workspace</h2>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* └──────────────────────────────────────┴───────────────────────┘
|
||||
*
|
||||
* Reuse: consumes adapter.getWorkspaceState / getWorkspaceContext /
|
||||
* getWorkspaceActivity / getTeamMembers (the Phase-1 contract surface) and
|
||||
* getWorkspaceActivity (the Phase-1 contract surface) and
|
||||
* useRoomState for the live agents-running indicator. Other tabs (Chat,
|
||||
* Memory, Timeline, Settings, Research, Artifacts) are integrator-embedded;
|
||||
* this shell owns the header, tab routing, Overview canvas, and right panel.
|
||||
@@ -34,14 +34,12 @@ import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
||||
import { motion, useReducedMotion } from 'framer-motion';
|
||||
import {
|
||||
LayoutGrid, MessageSquare, FileBox, Brain,
|
||||
Users, WifiOff, ShieldAlert, ChevronRight,
|
||||
WifiOff, ShieldAlert, ChevronRight,
|
||||
FileText, SearchX, RefreshCw,
|
||||
} from 'lucide-react';
|
||||
import { tierSatisfies, TIER_LABELS } from '@waggle/shared';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { SPRING } from '@/lib/motion/tokens';
|
||||
import { workspaceHeroAvatarId, workspaceHeroNameId, heroMorphEnabled } from '@/lib/motion/hero-morph';
|
||||
import { useShell } from '@/providers/ShellContext';
|
||||
import { useRoomState } from '@/hooks/useRoomState';
|
||||
import { useRevalidateOnError } from '@/hooks/useRevalidateOnError';
|
||||
import MemoryCenterTab from './memory/MemoryCenterTab';
|
||||
@@ -60,13 +58,13 @@ import type {
|
||||
// The 8 PRD §12.2 tabs (Settings included). The shell renders Overview
|
||||
// itself; the other tabs are embedded by the integrator (Chat / Memory /
|
||||
// Timeline / Settings have hosts; Research / Artifacts are interim panels).
|
||||
// Warm-Hive (SCREENS §03): the calm 6-tab bar. `tasks` stays a valid id (so
|
||||
// Warm-Hive (SCREENS §03): the calm 5-tab bar. `tasks` stays a valid id (so
|
||||
// /workspaces/:id/tasks still deep-links the full TasksTab + the Overview "Up
|
||||
// next" card can route to it) but is NOT shown in the bar — Research / Timeline
|
||||
// / Settings are dropped (their URLs fall back to Overview, see WorkspaceRoute).
|
||||
export type WorkspaceTabId =
|
||||
| 'overview' | 'chat' | 'memory' | 'artifacts'
|
||||
| 'files' | 'team' | 'tasks';
|
||||
| 'files' | 'tasks';
|
||||
|
||||
interface WorkspaceTabDef {
|
||||
id: WorkspaceTabId;
|
||||
@@ -80,17 +78,8 @@ const TABS: readonly WorkspaceTabDef[] = [
|
||||
{ id: 'memory', label: 'Memory', icon: Brain },
|
||||
{ id: 'artifacts', label: 'Artifacts', icon: FileBox },
|
||||
{ id: 'files', label: 'Files', icon: FileText },
|
||||
{ id: 'team', label: 'Team', icon: Users },
|
||||
] as const;
|
||||
|
||||
// ── Member view-model (from adapter.getTeamMembers) ──────────────────────
|
||||
interface WorkspaceMember {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
interface WorkspaceDesktopAppProps {
|
||||
workspaceId: string;
|
||||
workspaceName: string;
|
||||
@@ -121,13 +110,6 @@ interface WorkspaceDesktopAppProps {
|
||||
|
||||
// ── Small presentational helpers ─────────────────────────────────────────
|
||||
|
||||
function initialsOf(name: string): string {
|
||||
const parts = name.trim().split(/\s+/).filter(Boolean);
|
||||
if (parts.length === 0) return '?';
|
||||
if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
|
||||
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
||||
}
|
||||
|
||||
function relativeTime(iso?: string): string {
|
||||
if (!iso) return '';
|
||||
const t = Date.parse(iso);
|
||||
@@ -268,31 +250,12 @@ function UpNextCard({ state, onOpenTab }: { state: WorkspaceStateView | null; on
|
||||
);
|
||||
}
|
||||
|
||||
function TeamCard({ members }: { members: WorkspaceMember[] }) {
|
||||
if (members.length === 0) return null;
|
||||
return (
|
||||
<div className="rounded-[18px] border border-[var(--line-soft)] bg-card p-4">
|
||||
<SectionLabel className="mb-3">Team</SectionLabel>
|
||||
<ul className="space-y-2.5">
|
||||
{members.slice(0, 6).map((m) => (
|
||||
<li key={m.id} className="flex items-center gap-2.5 text-[13px]">
|
||||
<span className="grid h-7 w-7 shrink-0 place-items-center rounded-full bg-[var(--surface-3)] font-mono text-[11px] text-[var(--text-2)]">{initialsOf(m.name)}</span>
|
||||
<span className="flex-1 truncate text-[var(--text)]">{m.name}</span>
|
||||
{m.status && <span className="font-mono text-[11px] capitalize text-[var(--text-dim)]">{m.status}</span>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function OverviewTab({
|
||||
ctx, state, artifacts, members, agentsRunning, onOpenTab,
|
||||
ctx, state, artifacts, agentsRunning, onOpenTab,
|
||||
}: {
|
||||
ctx: WorkspaceContext | null;
|
||||
state: WorkspaceStateView | null;
|
||||
artifacts: ArtifactRow[];
|
||||
members: WorkspaceMember[];
|
||||
agentsRunning: number;
|
||||
onOpenTab: (tab: WorkspaceTabId) => void;
|
||||
}) {
|
||||
@@ -313,7 +276,6 @@ function OverviewTab({
|
||||
<div className="space-y-4">
|
||||
<StatusCard ctx={ctx} agentsRunning={agentsRunning} />
|
||||
<UpNextCard state={state} onOpenTab={onOpenTab} />
|
||||
<TeamCard members={members} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -358,7 +320,6 @@ const WorkspaceDesktopApp = ({
|
||||
const [ctx, setCtx] = useState<WorkspaceContext | null>(null);
|
||||
const [state, setState] = useState<WorkspaceStateView | null>(null);
|
||||
const [activity, setActivity] = useState<WorkspaceActivityEvent[]>([]);
|
||||
const [members, setMembers] = useState<WorkspaceMember[]>([]);
|
||||
const [artifacts, setArtifacts] = useState<ArtifactRow[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
// Distinguish a hard fetch failure (offline) from a permission denial and
|
||||
@@ -374,12 +335,6 @@ const WorkspaceDesktopApp = ({
|
||||
const retry = useCallback(() => setReloadKey((k) => k + 1), []);
|
||||
useRevalidateOnError(errorKind === 'offline', retry);
|
||||
|
||||
// Team tab tier gate: Solo users see the upsell, Team users the real roster.
|
||||
// `?? 'FREE'` keeps existing useShell test mocks (which don't stub billingTier)
|
||||
// green and fail-closed to the upsell.
|
||||
const { billingTier, tierResolved } = useShell();
|
||||
const isTeam = tierSatisfies(billingTier ?? 'FREE', 'TEAMS');
|
||||
|
||||
// Live agents-running indicator for THIS workspace (reuse Room SSE state).
|
||||
const { workspaceMap } = useRoomState();
|
||||
const agentsRunning = useMemo(
|
||||
@@ -460,7 +415,7 @@ const WorkspaceDesktopApp = ({
|
||||
return;
|
||||
}
|
||||
|
||||
// State / activity / members / artifacts are best-effort — each one
|
||||
// State / activity / artifacts are best-effort — each one
|
||||
// empties gracefully without taking down the screen.
|
||||
try {
|
||||
const s = await adapter.getWorkspaceState(workspaceId);
|
||||
@@ -472,14 +427,6 @@ const WorkspaceDesktopApp = ({
|
||||
if (!cancelled) setActivity(Array.isArray(a?.events) ? a.events : []);
|
||||
} catch { if (!cancelled) setActivity([]); }
|
||||
|
||||
// getTeamMembers() returns the GLOBAL team roster, not a per-workspace
|
||||
// membership list — the UI is labelled "Team members" accordingly.
|
||||
// TODO(Phase 5/S10): workspace-scoped members endpoint.
|
||||
try {
|
||||
const m = await adapter.getTeamMembers();
|
||||
if (!cancelled) setMembers(Array.isArray(m) ? m : []);
|
||||
} catch { if (!cancelled) setMembers([]); }
|
||||
|
||||
// Interim "artifacts" = the workspace file registry (S05 owns the real
|
||||
// Artifact entity; until then we surface files/documents read-only).
|
||||
try {
|
||||
@@ -521,7 +468,6 @@ const WorkspaceDesktopApp = ({
|
||||
: tab.id === 'memory' ? ctx?.stats?.memoryCount
|
||||
: tab.id === 'artifacts' ? (artifacts.length || undefined)
|
||||
: tab.id === 'files' ? ctx?.stats?.fileCount
|
||||
: tab.id === 'team' ? (members.length || undefined)
|
||||
: undefined;
|
||||
return (
|
||||
<button
|
||||
@@ -792,7 +738,6 @@ const WorkspaceDesktopApp = ({
|
||||
ctx={ctx}
|
||||
state={state}
|
||||
artifacts={artifacts}
|
||||
members={members}
|
||||
agentsRunning={agentsRunning}
|
||||
onOpenTab={setActiveTab}
|
||||
/>
|
||||
@@ -920,50 +865,6 @@ const WorkspaceDesktopApp = ({
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Team — Solo users see a Team-tier upsell; Team users the roster.
|
||||
While the tier is unresolved, render the neutral roster so a real
|
||||
Team user never flashes the upsell during the getTier round-trip. */}
|
||||
{activeTab === 'team' && (
|
||||
<div className="h-full overflow-auto p-5" data-testid="ws-team-tab">
|
||||
{tierResolved && !isTeam ? (
|
||||
<div className="flex h-full flex-col items-center justify-center text-center p-8" data-testid="ws-team-upsell">
|
||||
<Users className="mb-3 h-10 w-10 text-violet-400/60" />
|
||||
<p className="text-sm font-display text-foreground">Invite your team</p>
|
||||
<p className="mt-1 max-w-sm text-[11px] text-muted-foreground">
|
||||
Shared memory, WaggleDance multi-agent coordination, and governance —
|
||||
turn this workspace into a shared surface for your whole team.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', {
|
||||
detail: {
|
||||
required: 'TEAMS',
|
||||
actual: billingTier ?? 'FREE',
|
||||
message: 'Team plan required for shared workspaces and collaboration.',
|
||||
},
|
||||
}))}
|
||||
className="mt-4 rounded-xl border border-violet-400/20 bg-violet-400/10 px-4 py-2 text-xs text-violet-300 transition-colors hover:bg-violet-400/20"
|
||||
data-testid="ws-team-upgrade"
|
||||
>
|
||||
Upgrade to {TIER_LABELS.TEAMS} — $49/seat
|
||||
</button>
|
||||
</div>
|
||||
) : members.length === 0 ? (
|
||||
<TabPlaceholder icon={Users} title="Just you for now" body="Team members with access to this workspace will appear here." />
|
||||
) : (
|
||||
<ul className="space-y-2">
|
||||
{members.map(m => (
|
||||
<li key={m.id} className="flex items-center gap-3 rounded-[14px] border border-[var(--line-soft)] bg-card px-4 py-3">
|
||||
<span className="grid h-8 w-8 shrink-0 place-items-center rounded-full bg-[var(--surface-3)] font-mono text-[12px] text-[var(--text-2)]">{initialsOf(m.name)}</span>
|
||||
<span className="flex-1 truncate text-[14px] text-[var(--text)]">{m.name}</span>
|
||||
{m.status && <span className="shrink-0 font-mono text-[11px] capitalize text-[var(--text-dim)]">{m.status}</span>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* AddCustomMcpForm — the S08 Custom tab (UX-Refactor Phase 4B). Registers an
|
||||
* arbitrary stdio MCP server via POST /api/mcps (tier-gated server-side, B5):
|
||||
* arbitrary stdio MCP server via POST /api/mcps:
|
||||
* `{ name, command, args[], env{}, workspaceId? }`. 400 (validation /
|
||||
* injection-scan) and 409 (duplicate) render inline; the tier 403 routes
|
||||
* through the global UpgradeModal handler.
|
||||
* injection-scan) and 409 (duplicate) render inline.
|
||||
*/
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Loader2, Plus } from 'lucide-react';
|
||||
@@ -62,7 +61,7 @@ const AddCustomMcpForm = ({ onAdded }: AddCustomMcpFormProps) => {
|
||||
if (res.id) {
|
||||
setName(''); setCommand(''); setArgsText(''); setEnvText(''); setWorkspaceId('');
|
||||
onAdded(res.id);
|
||||
} else if (res.error && res.error !== 'TIER_INSUFFICIENT') {
|
||||
} else if (res.error) {
|
||||
// 400 validation / injection-scan rejection or 409 duplicate.
|
||||
setError(res.error);
|
||||
}
|
||||
@@ -78,8 +77,7 @@ const AddCustomMcpForm = ({ onAdded }: AddCustomMcpFormProps) => {
|
||||
<div>
|
||||
<h3 className="text-sm font-display font-semibold text-foreground">Add a custom MCP server</h3>
|
||||
<p className="text-[11px] text-muted-foreground">
|
||||
Registers a local stdio server (command + args). Teams governance can manage shared use;
|
||||
Solo can run local servers on this device.
|
||||
Registers a local stdio server (command + args) that runs on this device.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@ import { adapter } from '@/lib/adapter';
|
||||
interface SkillBuilderProps {
|
||||
onCreated: (name: string) => void;
|
||||
onCancel: () => void;
|
||||
/** Shared 403→UpgradeModal routing (server gate may land later). */
|
||||
onTierError: (err: unknown, name: string) => boolean;
|
||||
}
|
||||
|
||||
/** Backend SKILL_FAMILIES 7-set (skills.ts) — NOT the narrower SkillPack union. */
|
||||
@@ -57,7 +55,7 @@ export function appendIoSections(content: string, inputs: string[], outputs: str
|
||||
return `${content.trimEnd()}\n${section('Inputs', inputs)}${section('Outputs', outputs)}`;
|
||||
}
|
||||
|
||||
const SkillBuilder = ({ onCreated, onCancel, onTierError }: SkillBuilderProps) => {
|
||||
const SkillBuilder = ({ onCreated, onCancel }: SkillBuilderProps) => {
|
||||
const [step, setStep] = useState(0);
|
||||
// Identity
|
||||
const [name, setName] = useState('');
|
||||
@@ -138,9 +136,7 @@ const SkillBuilder = ({ onCreated, onCancel, onTierError }: SkillBuilderProps) =
|
||||
}
|
||||
onCreated(skillName);
|
||||
} catch (err) {
|
||||
if (!onTierError(err, skillName)) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create skill');
|
||||
}
|
||||
setError(err instanceof Error ? err.message : 'Failed to create skill');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
import { SignIn, SignUp } from '@clerk/clerk-react';
|
||||
import EnterpriseCTA from './EnterpriseCTA';
|
||||
|
||||
type Mode = 'signin' | 'signup';
|
||||
|
||||
@@ -49,8 +48,6 @@ export default function ClerkAuthForm() {
|
||||
{mode === 'signin' ? 'Create an account' : 'Sign in'}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<EnterpriseCTA />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* EnterpriseCTA — PR7b Auth (design §2d, D15). The SSO/enterprise panel as a custom
|
||||
* "Talk to sales → KVARK/Teams" CTA. NOT a live SAML/SCIM form: those are
|
||||
* Teams/KVARK/Clerk-Enterprise features, so rendering a working-looking SAML form would
|
||||
* be a fabrication (F11 / recon 03 §5.5). This is the KVARK funnel.
|
||||
*/
|
||||
export default function EnterpriseCTA() {
|
||||
return (
|
||||
<div className="mt-6 pt-5 border-t border-[var(--line-soft)] text-center">
|
||||
<p className="text-[12px] leading-relaxed text-[var(--text-muted)]">
|
||||
SAML, SCIM provisioning, and audit logs are available on{' '}
|
||||
<b className="text-foreground">Teams</b> and <b className="text-foreground">KVARK</b>.
|
||||
</p>
|
||||
<a
|
||||
href="https://www.kvark.ai"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-block mt-1.5 text-[12.5px] font-[650] text-honey hover:text-[var(--honey-bright)] transition-colors"
|
||||
>
|
||||
Talk to sales →
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
/**
|
||||
* PlanCards — warm-Hive PR7a Billing (design screen 14 "Plans" state).
|
||||
*
|
||||
* The 2-card Plans grid (Solo · free / Team · most-popular) + the Monthly|Annual
|
||||
* −20% cycle toggle, themed to the warm tokens (PR1). Prices are DISPLAY COPY from
|
||||
* `tiers.ts` (D10) — the *charged* amount is whatever Stripe renders on the hosted
|
||||
* Checkout page; this UI never asserts the real charge. Choosing a plan hands off to
|
||||
* hosted Stripe Checkout via `onChoose` (D5) — no in-app card capture.
|
||||
*
|
||||
* The toggle resolves a real `billingPeriod` that threads to the annual Stripe price
|
||||
* (D8/F9) — it is NOT a cosmetic `× 0.8` client number.
|
||||
*/
|
||||
import { useState } from 'react';
|
||||
import { Check } from 'lucide-react';
|
||||
|
||||
type CheckoutTier = 'TEAMS';
|
||||
type BillingPeriod = 'monthly' | 'annual';
|
||||
|
||||
interface PlanDef {
|
||||
/** Canonical tier id this card maps to (FREE has no checkout). */
|
||||
tier: 'FREE' | CheckoutTier;
|
||||
name: string;
|
||||
priceMonthly: string;
|
||||
priceAnnual: string;
|
||||
unitMonthly: string;
|
||||
unitAnnual: string;
|
||||
tagline: string;
|
||||
features: readonly string[];
|
||||
popular?: boolean;
|
||||
}
|
||||
|
||||
/** Display copy only (D10) — mirrors `billing.html` + `tiers.ts` doc prices. */
|
||||
const PLANS: readonly PlanDef[] = [
|
||||
{
|
||||
tier: 'FREE',
|
||||
name: 'Solo',
|
||||
priceMonthly: '$0',
|
||||
priceAnnual: '$0',
|
||||
unitMonthly: '/ forever',
|
||||
unitAnnual: '/ forever',
|
||||
tagline: 'Everything one person needs — free, forever.',
|
||||
features: ['Personal memory graph', 'Unlimited workspaces & connectors', 'Marketplace skills & connectors', 'Self-evolving skills', 'All major LLMs + local'],
|
||||
},
|
||||
{
|
||||
tier: 'TEAMS',
|
||||
name: 'Team',
|
||||
priceMonthly: '$49',
|
||||
priceAnnual: '$39',
|
||||
unitMonthly: '/ seat / mo',
|
||||
unitAnnual: '/ seat · yearly',
|
||||
tagline: 'Shared memory without losing privacy.',
|
||||
features: ['Everything in Solo', 'Sync across devices', 'Shared team memory', 'WaggleDance multi-agent', 'SSO & role-based access'],
|
||||
popular: true,
|
||||
},
|
||||
];
|
||||
|
||||
/** Upgrade ordering. TRIAL collapses to the Solo (FREE) entry-point for the "current"
|
||||
* marker; a legacy PRO value maps to 0 so it reads as the Solo tier. */
|
||||
const RANK: Record<string, number> = { FREE: 0, TRIAL: 0, PRO: 0, TEAMS: 1, ENTERPRISE: 2 };
|
||||
|
||||
interface PlanCardsProps {
|
||||
/** Resolved current tier (caller must only render this on a resolved tier — F7). */
|
||||
currentTier: string;
|
||||
/** Hand off to hosted Stripe Checkout for an upgrade. */
|
||||
onChoose: (tier: CheckoutTier, period: BillingPeriod) => void;
|
||||
/** Stripe not configured (503) — render CTAs as a disabled honest state (F8). */
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export default function PlanCards({ currentTier, onChoose, disabled = false }: PlanCardsProps) {
|
||||
const [period, setPeriod] = useState<BillingPeriod>('monthly');
|
||||
const currentRank = RANK[currentTier] ?? 0;
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Monthly | Annual −20% cycle toggle */}
|
||||
<div className="flex justify-center">
|
||||
<div
|
||||
className="inline-flex p-1 gap-[3px] rounded-[11px] bg-[var(--surface-2)] border border-[var(--line-soft)]"
|
||||
role="group"
|
||||
aria-label="Billing cycle"
|
||||
>
|
||||
{(['monthly', 'annual'] as const).map((p) => (
|
||||
<button
|
||||
key={p}
|
||||
type="button"
|
||||
aria-pressed={period === p}
|
||||
onClick={() => setPeriod(p)}
|
||||
className={`px-4 py-2 rounded-lg text-[13px] font-semibold transition-colors ${
|
||||
period === p ? 'bg-primary text-primary-foreground' : 'text-[var(--text-muted)] hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
{p === 'monthly' ? 'Monthly' : 'Annual'}
|
||||
{p === 'annual' && (
|
||||
<span className={`ml-1.5 text-[10.5px] ${period === 'annual' ? 'text-primary-foreground' : 'text-[var(--healthy)]'}`}>
|
||||
−20%
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 2-card plans grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 items-stretch">
|
||||
{PLANS.map((plan) => {
|
||||
const planRank = RANK[plan.tier];
|
||||
// A TRIAL user is not on the Free plan — the honest "Trial — everything
|
||||
// unlocked" badge lives above the grid, so no card claims to be "current".
|
||||
const isCurrent = planRank === currentRank && currentTier !== 'TRIAL';
|
||||
const isUpgrade = planRank > currentRank && plan.tier !== 'FREE';
|
||||
const price = period === 'annual' ? plan.priceAnnual : plan.priceMonthly;
|
||||
const unit = period === 'annual' ? plan.unitAnnual : plan.unitMonthly;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={plan.tier}
|
||||
// Honey glow via inline style (the BenchmarkApp pattern): Tailwind v4's
|
||||
// arbitrary `shadow-[var(--shadow-honey)]` resolves to box-shadow:none
|
||||
// here (live-verified), so the focal card sets the shadow var inline.
|
||||
style={plan.popular ? { boxShadow: 'var(--shadow-honey)' } : undefined}
|
||||
className={`relative flex flex-col p-6 rounded-[18px] border bg-[var(--surface)] ${
|
||||
plan.popular
|
||||
? 'border-[var(--honey-line)]'
|
||||
: isCurrent
|
||||
? 'border-[var(--work)]'
|
||||
: 'border-[var(--line-soft)]'
|
||||
}`}
|
||||
>
|
||||
{plan.popular && (
|
||||
<span className="absolute -top-[11px] left-6 text-[11px] font-bold uppercase tracking-[0.04em] text-primary-foreground bg-primary px-[11px] py-1 rounded-full">
|
||||
Most popular
|
||||
</span>
|
||||
)}
|
||||
{isCurrent && (
|
||||
<span className="absolute -top-[11px] right-6 text-[11px] font-bold uppercase text-primary-foreground bg-[var(--work)] px-[11px] py-1 rounded-full">
|
||||
Current
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="text-[15px] font-semibold text-[var(--text-2)]">{plan.name}</div>
|
||||
<div className="text-[38px] font-[750] tracking-[-0.03em] mt-3 mb-0.5 text-foreground">
|
||||
{price}
|
||||
<small className="text-[15px] font-medium text-[var(--text-muted)] tracking-normal"> {unit}</small>
|
||||
</div>
|
||||
<div className="text-[13px] text-[var(--text-muted)] mb-5 min-h-[36px]">{plan.tagline}</div>
|
||||
|
||||
<ul className="list-none m-0 mb-6 p-0 grid gap-2.5 flex-1">
|
||||
{plan.features.map((f) => (
|
||||
<li key={f} className="text-[13px] text-[var(--text-2)] grid grid-cols-[17px_1fr] gap-2 leading-snug">
|
||||
<Check className="w-3.5 h-3.5 mt-0.5 text-[var(--healthy)]" strokeWidth={2.4} />
|
||||
<span>{f}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{isUpgrade ? (
|
||||
<button
|
||||
onClick={() => onChoose(plan.tier as CheckoutTier, period)}
|
||||
disabled={disabled}
|
||||
className={`py-2.5 rounded-[10px] text-[14px] font-[650] text-center border transition-colors disabled:opacity-50 disabled:cursor-not-allowed ${
|
||||
plan.popular
|
||||
? 'bg-primary text-primary-foreground border-transparent hover:bg-[var(--honey-bright)]'
|
||||
: 'bg-[var(--surface-2)] text-[var(--text-2)] border-[var(--line-strong)] hover:border-[var(--honey-line)] hover:text-honey'
|
||||
}`}
|
||||
>
|
||||
{disabled ? 'Unavailable' : `Choose ${plan.name}`}
|
||||
</button>
|
||||
) : (
|
||||
<div className="py-2.5 rounded-[10px] text-[14px] font-[650] text-center border border-[var(--line-soft)] bg-transparent text-[var(--text-dim)] cursor-default">
|
||||
{isCurrent ? 'Your plan' : 'Included'}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -505,9 +505,6 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata
|
||||
if (res.ok) {
|
||||
toast({ title: 'Done', description: action.label });
|
||||
onClose();
|
||||
} else if (res.status === 403) {
|
||||
// The global adapter handler already raised the UpgradeModal — just close.
|
||||
onClose();
|
||||
} else {
|
||||
toast({ title: 'Action failed', description: action.label, variant: 'destructive' });
|
||||
}
|
||||
@@ -521,13 +518,6 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata
|
||||
|
||||
// ── Tier 1: dispatch a resolved intent onto the existing execution paths. ──
|
||||
const handleResolvedAction = useCallback((res: InterpretResult) => {
|
||||
if (res.kind === 'tier_gated') {
|
||||
window.dispatchEvent(new CustomEvent('waggle:tier-insufficient', {
|
||||
detail: { required: res.requiredTier, actual: res.actualTier, message: res.message },
|
||||
}));
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
if (res.kind !== 'action' || !res.action) return;
|
||||
const action = res.action;
|
||||
if (action.navigate) {
|
||||
@@ -636,7 +626,7 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata
|
||||
|
||||
{/* ── Tier 1: Ask Waggle (NL intent) — sits above Tier 0 results,
|
||||
never replacing them. Renders interpreting / resolved action /
|
||||
clarify / upgrade / decline. ── */}
|
||||
clarify / decline. ── */}
|
||||
{(interpreting || interpret) && (
|
||||
<CommandGroup
|
||||
heading={
|
||||
@@ -656,27 +646,6 @@ const CommandCenter = ({ open, onClose, onNavigate, onExecute, workspaceId, cata
|
||||
<ResultRow result={actionToResult(interpret.action)} onSelect={() => handleResolvedAction(interpret)} />
|
||||
)}
|
||||
|
||||
{!interpreting && interpret?.kind === 'tier_gated' && (
|
||||
<CommandItem
|
||||
value="__intent_tier__"
|
||||
onSelect={() => handleResolvedAction(interpret)}
|
||||
className="flex items-center gap-3 rounded-lg px-3 py-2 text-sm aria-selected:bg-[var(--honey-glow,rgba(229,160,0,0.08))]"
|
||||
>
|
||||
<Sparkles className="h-4 w-4 shrink-0" style={{ color: 'var(--honey-500)' }} />
|
||||
<div className="min-w-0 flex-1 text-left">
|
||||
<span className="block truncate font-display" style={{ color: 'var(--hive-100)' }}>
|
||||
Upgrade to {interpret.requiredTier} to do this
|
||||
</span>
|
||||
<span className="block truncate text-xs" style={{ color: 'var(--hive-400)' }}>
|
||||
{interpret.capability}
|
||||
</span>
|
||||
</div>
|
||||
<span className="shrink-0 rounded-full px-1.5 py-0.5 text-[10px]" style={{ backgroundColor: 'rgba(167,139,250,0.15)', color: '#a78bfa' }}>
|
||||
{interpret.requiredTier}
|
||||
</span>
|
||||
</CommandItem>
|
||||
)}
|
||||
|
||||
{!interpreting && interpret?.kind === 'clarify' && (
|
||||
<div className="px-3 py-2" data-testid="intent-clarify">
|
||||
<p className="mb-2 text-sm" style={{ color: 'var(--hive-100)' }}>{interpret.question}</p>
|
||||
|
||||
@@ -13,13 +13,10 @@ import { PERSONAS } from '@/lib/personas';
|
||||
import { motion, AnimatePresence, useDragControls } from 'framer-motion';
|
||||
import { adapter } from '@/lib/adapter';
|
||||
import { useWorkspaces } from '@/hooks/useWorkspaces';
|
||||
import { useShell } from '@/providers/ShellContext';
|
||||
import { canCreateWorkspaceAtTier } from '@/lib/workspace-limit';
|
||||
import LockedFeature from '@/components/os/LockedFeature';
|
||||
import { buildBreadcrumbs } from '@/lib/browse-breadcrumbs';
|
||||
import { useFocusTrap } from '@/hooks/useFocusTrap';
|
||||
import type { StorageType, WorkspaceTemplate, TemplateCategory } from '@/lib/types';
|
||||
import { TIER_CAPABILITIES, type ConnectorDefinition } from '@waggle/shared';
|
||||
import type { ConnectorDefinition } from '@waggle/shared';
|
||||
|
||||
/** Use native OS folder picker when running inside Tauri, falls back to custom browse modal. */
|
||||
async function pickFolderNative(): Promise<string | null> {
|
||||
@@ -729,12 +726,6 @@ function TemplateCreatorModal({ open, onClose, onCreated, availableConnectors, e
|
||||
|
||||
const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialogProps) => {
|
||||
const { workspaces } = useWorkspaces();
|
||||
const { billingTier } = useShell();
|
||||
// Gate off the SAME canonical rule the server enforces (tiers.ts
|
||||
// workspaceLimit), not the retired onboarding-complexity flag that blocked
|
||||
// Solo at workspace #2 while the backend would have allowed unlimited. Client
|
||||
// and server now agree by construction.
|
||||
const canCreateWorkspace = canCreateWorkspaceAtTier(billingTier, workspaces.length);
|
||||
|
||||
const [name, setName] = useState('');
|
||||
const [group, setGroup] = useState('Personal');
|
||||
@@ -856,28 +847,6 @@ const CreateWorkspaceDialog = ({ open, onClose, onCreate }: CreateWorkspaceDialo
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
if (!canCreateWorkspace) {
|
||||
return (
|
||||
<AnimatePresence>
|
||||
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}
|
||||
className="fixed inset-0 z-[100] flex items-center justify-center" onClick={onClose}>
|
||||
<div className="absolute inset-0 bg-black/50 backdrop-blur-sm" />
|
||||
<motion.div initial={{ opacity: 0, scale: 0.95 }} animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.95 }}
|
||||
className="relative w-full max-w-sm glass-strong rounded-2xl shadow-2xl overflow-hidden"
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<div className="p-6">
|
||||
{/* The gate now matches the server (tiers.ts workspaceLimit), so
|
||||
the count is finally safe to quote: this paywall only fires once
|
||||
a FREE user has actually reached the limit. */}
|
||||
<LockedFeature featureName="Multiple Workspaces" upgradePrompt={`Upgrade for unlimited workspaces. The Free plan includes ${TIER_CAPABILITIES.FREE.workspaceLimit}.`} />
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
|
||||
const virtualPath = defaultVirtualPath(name);
|
||||
|
||||
// Non-blocking dup-name warning: two "Research Hub"s are indistinguishable in
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { Crown, Users, Check, X, ArrowRight } from 'lucide-react';
|
||||
import { useFocusTrap } from '@/hooks/useFocusTrap';
|
||||
|
||||
interface TrialExpiredModalProps {
|
||||
open: boolean;
|
||||
onDismiss: () => void;
|
||||
onUpgrade: (tier: 'TEAMS') => void;
|
||||
}
|
||||
|
||||
// Solo (free) keeps every personal capability — the trial only ever gated the
|
||||
// collaboration/governance layer, so those are the only things "lost".
|
||||
const KEEP_FEATURES = [
|
||||
'Memory & Harvest — unlimited, forever',
|
||||
'Unlimited workspaces & connectors',
|
||||
'Marketplace skills & connectors',
|
||||
'Self-evolving skills',
|
||||
'All built-in agents',
|
||||
'PDF & advanced exports',
|
||||
];
|
||||
|
||||
const LOSE_FEATURES = [
|
||||
'Shared team workspaces',
|
||||
'Sync across devices',
|
||||
'Team skill library',
|
||||
'Team governance & audit',
|
||||
'SSO & role-based access',
|
||||
];
|
||||
|
||||
export default function TrialExpiredModal({ open, onDismiss, onUpgrade }: TrialExpiredModalProps) {
|
||||
// A11y (WCAG 2.1.1/2.4.3): Escape closes, Tab is trapped, focus moves in on
|
||||
// open and restores on close. Replaces the prior Escape-only handler.
|
||||
const dialogRef = useFocusTrap<HTMLDivElement>(open, onDismiss);
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
className="fixed inset-0 z-[210] flex items-center justify-center"
|
||||
>
|
||||
<div className="absolute inset-0 bg-black/60 backdrop-blur-sm" aria-hidden="true" />
|
||||
<motion.div
|
||||
ref={dialogRef}
|
||||
initial={{ opacity: 0, scale: 0.95, y: 16 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.95, y: 16 }}
|
||||
transition={{ type: 'spring', damping: 25, stiffness: 300 }}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="trial-expired-title"
|
||||
tabIndex={-1}
|
||||
className="relative w-full max-w-lg glass-strong rounded-2xl shadow-2xl overflow-hidden focus:outline-none"
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onDismiss}
|
||||
aria-label="Close trial expired dialog"
|
||||
className="absolute top-4 right-4 p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
|
||||
<div className="p-6 pb-2 text-center">
|
||||
<div className="inline-flex p-3 rounded-2xl bg-primary/10 mb-4">
|
||||
<Crown className="w-8 h-8 text-honey" />
|
||||
</div>
|
||||
<h2 id="trial-expired-title" className="text-xl font-display font-bold text-foreground">
|
||||
Your 15-day trial has ended
|
||||
</h2>
|
||||
<p className="text-sm text-muted-foreground mt-2">
|
||||
Upgrade to Team to keep the collaboration features you've been using, or continue free with Solo.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="px-6 py-4 grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<h3 className="text-xs font-display font-semibold text-[var(--text-2)] uppercase tracking-wider mb-2">
|
||||
You keep
|
||||
</h3>
|
||||
<ul className="space-y-1.5">
|
||||
{KEEP_FEATURES.map(f => (
|
||||
<li key={f} className="flex items-start gap-2 text-[13px] text-foreground">
|
||||
<Check className="w-3.5 h-3.5 text-[var(--healthy)] mt-0.5 shrink-0" />
|
||||
{f}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-xs font-display font-semibold text-[var(--text-2)] uppercase tracking-wider mb-2">
|
||||
You lose
|
||||
</h3>
|
||||
<ul className="space-y-1.5">
|
||||
{LOSE_FEATURES.map(f => (
|
||||
<li key={f} className="flex items-start gap-2 text-[13px] text-muted-foreground">
|
||||
<X className="w-3.5 h-3.5 text-[var(--risk)] mt-0.5 shrink-0" />
|
||||
{f}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-6 pb-6 pt-2 space-y-2">
|
||||
<button
|
||||
onClick={() => onUpgrade('TEAMS')}
|
||||
className="w-full flex items-center justify-center gap-2 px-4 py-3 rounded-xl bg-primary text-primary-foreground font-display text-sm font-semibold hover:bg-primary/90 transition-colors"
|
||||
>
|
||||
<Users className="w-4 h-4" />
|
||||
Upgrade to Team — $49/seat/mo
|
||||
<ArrowRight className="w-4 h-4" />
|
||||
</button>
|
||||
<button
|
||||
onClick={onDismiss}
|
||||
className="w-full px-4 py-2 text-center text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
Continue free with Solo
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { Zap, X, Check, Users } from 'lucide-react';
|
||||
import { TIER_CAPABILITIES } from '@waggle/shared';
|
||||
import { useFocusTrap } from '@/hooks/useFocusTrap';
|
||||
|
||||
interface TierEvent {
|
||||
required: string;
|
||||
actual: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
type CapKey = keyof typeof TIER_CAPABILITIES.FREE;
|
||||
|
||||
// Trimmed to the caps that DIFFER between Solo (free) and Team — an honest
|
||||
// "what Team adds" comparison, not a full feature dump (decision 11). Every
|
||||
// personal capability is already free on Solo, so it doesn't belong here.
|
||||
const FEATURE_ROWS: Array<{ label: string; key: CapKey; format: (v: unknown) => string }> = [
|
||||
{ label: 'Shared Workspaces', key: 'sharedWorkspaces', format: v => v ? 'Yes' : '—' },
|
||||
{ label: 'Team Members', key: 'teamMembersLimit', format: v => (v as number) === -1 ? 'Unlimited' : String(v) },
|
||||
{ label: 'Sync Across Devices', key: 'cloudSync', format: v => v ? 'Yes' : '—' },
|
||||
{ label: 'Team Skill Library', key: 'teamSkillLibrary', format: v => v ? 'Yes' : '—' },
|
||||
{ label: 'Team Governance', key: 'adminPanel', format: v => v ? 'Yes' : '—' },
|
||||
{ label: 'Audit Log', key: 'auditLog', format: v => {
|
||||
if (v === 'none') return '—';
|
||||
return String(v).charAt(0).toUpperCase() + String(v).slice(1);
|
||||
}},
|
||||
];
|
||||
|
||||
function CellValue({ value, isBool }: { value: string; isBool: boolean }) {
|
||||
if (value === 'Yes' && isBool) return <Check className="w-4 h-4 text-honey mx-auto" />;
|
||||
if (value === '—') return <span className="text-muted-foreground/40">—</span>;
|
||||
return <span className="text-foreground">{value}</span>;
|
||||
}
|
||||
|
||||
interface UpgradeModalProps {
|
||||
onStartTrial?: () => void;
|
||||
onUpgrade?: (tier: 'TEAMS') => void;
|
||||
/** F5: report open/close so the shell can suppress coach-marks while this
|
||||
* event-driven modal (invisible to AppShell otherwise) is up. */
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export default function UpgradeModal({ onStartTrial, onUpgrade, onOpenChange }: UpgradeModalProps) {
|
||||
const [event, setEvent] = useState<TierEvent | null>(null);
|
||||
|
||||
const handleTierInsufficient = useCallback((e: Event) => {
|
||||
setEvent((e as CustomEvent<TierEvent>).detail);
|
||||
onOpenChange?.(true);
|
||||
}, [onOpenChange]);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('waggle:tier-insufficient', handleTierInsufficient);
|
||||
return () => window.removeEventListener('waggle:tier-insufficient', handleTierInsufficient);
|
||||
}, [handleTierInsufficient]);
|
||||
|
||||
const close = useCallback(() => { setEvent(null); onOpenChange?.(false); }, [onOpenChange]);
|
||||
|
||||
// A11y (WCAG 2.1.1/2.4.3): Escape closes, Tab is trapped within the dialog,
|
||||
// focus moves in on open and restores on close. Replaces the prior hand-rolled
|
||||
// Escape-only handler (no trap, no focus restore).
|
||||
const dialogRef = useFocusTrap<HTMLDivElement>(!!event, close);
|
||||
|
||||
const free = TIER_CAPABILITIES.FREE;
|
||||
const teams = TIER_CAPABILITIES.TEAMS;
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{event && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
className="fixed inset-0 z-[200] flex items-center justify-center"
|
||||
onClick={close}
|
||||
>
|
||||
<div className="absolute inset-0 bg-black/50 backdrop-blur-sm" aria-hidden="true" />
|
||||
<motion.div
|
||||
ref={dialogRef}
|
||||
initial={{ opacity: 0, scale: 0.95, y: 10 }}
|
||||
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||
exit={{ opacity: 0, scale: 0.95, y: 10 }}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="upgrade-modal-title"
|
||||
tabIndex={-1}
|
||||
className="relative w-full max-w-2xl glass-strong rounded-2xl shadow-2xl overflow-hidden focus:outline-none"
|
||||
onClick={e => e.stopPropagation()}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={close}
|
||||
aria-label="Close upgrade dialog"
|
||||
className="absolute top-4 right-4 p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
</button>
|
||||
|
||||
<div className="p-6 pb-4">
|
||||
<div className="flex items-center gap-3 mb-1">
|
||||
<div className="p-2 rounded-xl bg-primary/10">
|
||||
<Zap className="w-5 h-5 text-honey" />
|
||||
</div>
|
||||
<h2 id="upgrade-modal-title" className="text-lg font-display font-bold text-foreground">
|
||||
Upgrade to unlock this feature
|
||||
</h2>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground mt-2">
|
||||
{event.message}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="px-6 pb-4">
|
||||
<div className="rounded-xl border border-border/50 overflow-hidden">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b border-border/50">
|
||||
<th className="text-left p-3 text-muted-foreground font-medium">Feature</th>
|
||||
<th className="text-center p-3 text-foreground font-medium w-28">Solo</th>
|
||||
<th className="text-center p-3 font-medium w-28">
|
||||
<span className="text-foreground flex items-center justify-center gap-1">
|
||||
<Users className="w-3.5 h-3.5" /> Team
|
||||
</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{FEATURE_ROWS.map(row => {
|
||||
const freeVal = row.format(free[row.key]);
|
||||
const teamsVal = row.format(teams[row.key]);
|
||||
const isBool = typeof free[row.key] === 'boolean';
|
||||
return (
|
||||
<tr key={row.key} className="border-b border-border/30 last:border-0">
|
||||
<td className="p-3 text-foreground">{row.label}</td>
|
||||
<td className="p-3 text-center text-muted-foreground"><CellValue value={freeVal} isBool={isBool} /></td>
|
||||
<td className="p-3 text-center"><CellValue value={teamsVal} isBool={isBool} /></td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
{/* Memory row — always free, hardcoded as marketing highlight */}
|
||||
<tr className="border-b border-border/30 last:border-0">
|
||||
<td className="p-3 text-foreground">Memory & Harvest</td>
|
||||
<td className="p-3 text-center text-muted-foreground">Unlimited</td>
|
||||
<td className="p-3 text-center"><span className="text-foreground">Unlimited</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="px-6 pb-6 flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => { onStartTrial?.(); close(); }}
|
||||
className="flex-1 px-4 py-2.5 rounded-xl border border-primary/30 text-honey font-display text-sm font-semibold hover:bg-primary/10 transition-colors"
|
||||
>
|
||||
Start 15-day Team trial
|
||||
</button>
|
||||
<button
|
||||
onClick={() => { onUpgrade?.('TEAMS'); close(); }}
|
||||
className="flex-1 px-4 py-2.5 rounded-xl bg-primary text-primary-foreground font-display text-sm font-semibold hover:bg-primary/90 transition-colors"
|
||||
>
|
||||
Upgrade to Team — $49/seat
|
||||
</button>
|
||||
</div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
@@ -135,11 +135,10 @@ export function getPersonasForTemplate(templateId: string): readonly OnboardingP
|
||||
];
|
||||
}
|
||||
|
||||
// QW-5: display labels renamed to avoid collision with billing tiers
|
||||
// (billing uses "Pro $19/mo", "Teams $49/seat"). Dock tiers describe how
|
||||
// many icons appear — they are UI layout, not billing. Internal enum
|
||||
// values ('simple' / 'professional' / 'power') stay the same so stored
|
||||
// user preferences keep working without migration.
|
||||
// QW-5: display labels for the dock tiers. Dock tiers describe how many
|
||||
// icons appear — they are UI layout. Internal enum values ('simple' /
|
||||
// 'professional' / 'power') stay the same so stored user preferences keep
|
||||
// working without migration.
|
||||
export const TIER_OPTIONS: readonly TierOption[] = [
|
||||
{
|
||||
id: 'simple' as UserTier,
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import CoverageCompassCard from './CoverageCompassCard';
|
||||
|
||||
describe('CoverageCompassCard', () => {
|
||||
it('does not claim Browser Companion coverage before native entry points are proven', () => {
|
||||
render(<CoverageCompassCard />);
|
||||
|
||||
const partialRows = screen.getAllByTestId('coverage-compass-row-partial');
|
||||
const browserRow = partialRows.find((row) => row.textContent?.includes('Browser AI extensions'));
|
||||
|
||||
expect(browserRow).toBeDefined();
|
||||
expect(browserRow).toHaveTextContent(/native toolbar\/context menu pending/i);
|
||||
});
|
||||
});
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* Coverage compass card — Settings → Billing.
|
||||
*
|
||||
* F4 polish from the 2026-05-28 addictiveness audit. Answers the
|
||||
* "what am I getting for what I pay?" question that personas P3 (Sarah,
|
||||
* marketing), P4 (Imran, consultant), and P7 (Anya, writer) all hit
|
||||
* when comparing Waggle to their current ChatGPT Plus / Notion AI /
|
||||
* Gamma stack.
|
||||
*
|
||||
* Items split into three groups: COVERED (Waggle does this), PARTIAL
|
||||
* (Waggle has the substrate but the UX isn't first-class yet), and
|
||||
* NOT YET (out of scope for now). Honest categorisation matters — if
|
||||
* we mark something COVERED that the user opens another tool for,
|
||||
* trust evaporates fast.
|
||||
*/
|
||||
|
||||
import { Check, CircleDashed, X } from 'lucide-react';
|
||||
|
||||
type Coverage = 'covered' | 'partial' | 'not-yet';
|
||||
|
||||
interface CompetingTool {
|
||||
name: string;
|
||||
category: string;
|
||||
coverage: Coverage;
|
||||
via?: string; // how Waggle covers it (short noun phrase)
|
||||
}
|
||||
|
||||
const TOOLS: CompetingTool[] = [
|
||||
{ name: 'ChatGPT / Claude.ai', category: 'general AI chat', coverage: 'covered', via: 'Chat app + persona switcher' },
|
||||
{ name: 'Mem.ai / Heyday', category: 'personal memory', coverage: 'covered', via: 'FrameStore + Knowledge Graph + Harvest' },
|
||||
{ name: 'Browser AI extensions', category: 'save-to-memory from web', coverage: 'partial', via: 'Companion popup + capture flow; native toolbar/context menu pending' },
|
||||
{ name: 'Notion AI', category: 'notes + AI in notes', coverage: 'covered', via: 'Memory app + Wiki compiler' },
|
||||
{ name: 'Granola / Otter.ai', category: 'meeting transcripts', coverage: 'partial', via: 'Voice app + transcript ingest (no native recording yet)' },
|
||||
{ name: 'Gamma / Beautiful.ai', category: 'AI-generated decks', coverage: 'partial', via: 'pptx / presentation-design skills (no native deck editor)' },
|
||||
{ name: 'Telegram bot for cron updates', category: 'outbound digests', coverage: 'covered', via: 'Scheduled Jobs → Telegram channel' },
|
||||
{ name: 'Zapier / n8n', category: 'workflow automation', coverage: 'partial', via: 'Scheduled Jobs + Skills marketplace (limited triggers)' },
|
||||
{ name: 'Excel Copilot', category: 'spreadsheet AI', coverage: 'not-yet', via: 'xlsx skill exists; native editor planned' },
|
||||
{ name: 'GitHub Copilot / Cursor', category: 'in-editor coding', coverage: 'not-yet', via: 'intentional — use Claude Code for coding, Waggle for everything else' },
|
||||
];
|
||||
|
||||
const ICONS: Record<Coverage, { Icon: typeof Check; className: string; label: string }> = {
|
||||
'covered': { Icon: Check, className: 'text-emerald-400', label: 'Covered' },
|
||||
'partial': { Icon: CircleDashed, className: 'text-amber-400', label: 'Partial' },
|
||||
'not-yet': { Icon: X, className: 'text-muted-foreground/60', label: 'Not yet' },
|
||||
};
|
||||
|
||||
const CoverageCompassCard = () => {
|
||||
const counts = TOOLS.reduce<Record<Coverage, number>>(
|
||||
(acc, t) => ({ ...acc, [t.coverage]: (acc[t.coverage] ?? 0) + 1 }),
|
||||
{ 'covered': 0, 'partial': 0, 'not-yet': 0 },
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="p-4 rounded-xl bg-secondary/30 border border-border/30 space-y-3"
|
||||
data-testid="coverage-compass-card"
|
||||
>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className="min-w-0">
|
||||
<p className="text-xs font-display font-medium text-foreground">What Waggle replaces</p>
|
||||
<p className="text-[11px] text-muted-foreground mt-0.5">
|
||||
Honest scoring — only items that genuinely don't need another tool open are marked covered.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 shrink-0 text-[10px] font-display">
|
||||
<span className="inline-flex items-center gap-1 text-emerald-400">
|
||||
<Check className="w-2.5 h-2.5" />{counts['covered']}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1 text-amber-400">
|
||||
<CircleDashed className="w-2.5 h-2.5" />{counts['partial']}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1 text-muted-foreground/60">
|
||||
<X className="w-2.5 h-2.5" />{counts['not-yet']}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul className="space-y-1.5" role="list">
|
||||
{TOOLS.map(tool => {
|
||||
const { Icon, className, label } = ICONS[tool.coverage];
|
||||
return (
|
||||
<li
|
||||
key={tool.name}
|
||||
className="flex items-start gap-2.5 text-[11px]"
|
||||
data-testid={`coverage-compass-row-${tool.coverage}`}
|
||||
>
|
||||
<Icon className={`w-3 h-3 mt-0.5 shrink-0 ${className}`} aria-label={label} />
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="text-foreground">
|
||||
{tool.name}
|
||||
<span className="text-muted-foreground"> · {tool.category}</span>
|
||||
</p>
|
||||
{tool.via && (
|
||||
<p className="text-[10px] text-muted-foreground/80 mt-0.5">via {tool.via}</p>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CoverageCompassCard;
|
||||
Reference in New Issue
Block a user