From 148e87ee82a9633a946a69f70db4f893795e9d13 Mon Sep 17 00:00:00 2001 From: Sidhant0707 Date: Fri, 29 May 2026 22:34:56 +0530 Subject: [PATCH 1/2] fix: restore missing AiGate import in DoctorPanel --- components/analyze/DoctorPanel.tsx | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/components/analyze/DoctorPanel.tsx b/components/analyze/DoctorPanel.tsx index 4a9c756..b3c908f 100644 --- a/components/analyze/DoctorPanel.tsx +++ b/components/analyze/DoctorPanel.tsx @@ -1,33 +1,54 @@ "use client"; import { motion } from "framer-motion"; + import { Terminal, MessageSquare } from "lucide-react"; + import dynamic from "next/dynamic"; + import { ErrorBoundary } from "@/components/ui/ErrorBoundary"; + import { RepoData } from "@/lib/types/analyze"; + import SkeletonLoader from "@/components/analyze/SkeletonLoader"; +import AiGate from "@/components/analyze/AiGate"; + const DebugInterface = dynamic( () => import("@/components/debug/DebugInterface"), + { loading: () => , ssr: false }, ); interface DoctorPanelProps { data: RepoData; + source: string | null; + onOpenChat: () => void; + + aiGateState: "free" | "login-required" | "limit-reached" | null; } export default function DoctorPanel({ data, + source, + onOpenChat, + + aiGateState, }: DoctorPanelProps) { const repoUrl = source === "local" ? "Local.zip Codebase" : `https://github.com/${data.owner}/${data.repo}`; + const githubRepoUrl = + source === "local" + ? undefined + : `https://github.com/${data.owner}/${data.repo}`; + return ( {data.mermaidDiagram ? ( <> + {/* Wrap the AI panel in a relative container so AiGate + + can position itself absolutely over it */} +
+ + {/* Gate overlay — renders on top when active */} + + {(aiGateState === "login-required" || + aiGateState === "limit-reached") && ( + + )}
+ + Discuss this diagnosis in Copilot → @@ -62,6 +103,7 @@ export default function DoctorPanel({ ) : (
+

Diagnostic core offline.

From e6a45d2de9bdd43a0f161fc4b3247c46e14e29d7 Mon Sep 17 00:00:00 2001 From: Sidhant0707 Date: Fri, 29 May 2026 22:43:10 +0530 Subject: [PATCH 2/2] fix: restore accidentally deleted AiGate component --- components/analyze/AiGate.tsx | 134 ++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 components/analyze/AiGate.tsx diff --git a/components/analyze/AiGate.tsx b/components/analyze/AiGate.tsx new file mode 100644 index 0000000..5f8a321 --- /dev/null +++ b/components/analyze/AiGate.tsx @@ -0,0 +1,134 @@ +"use client"; + +import { motion } from "framer-motion"; +import { Zap, Sparkles } from "lucide-react"; +import { SiGithub } from "@icons-pack/react-simple-icons"; +import { createClient } from "@/lib/supabase-browser"; +import { useCallback } from "react"; +import { AI_FREE_LIMIT } from "@/lib/ai-usage"; + +interface AiGateProps { + state: "auth_required" | "limit_reached"; + repoUrl?: string; +} + +export default function AiGate({ state, repoUrl }: AiGateProps) { + const handleGitHubLogin = useCallback(async () => { + const supabase = createClient(); + await supabase.auth.signInWithOAuth({ + provider: "github", + options: { + scopes: "user:email", + redirectTo: `${window.location.origin}/analyze?repo=${encodeURIComponent(repoUrl ?? "")}`, + }, + }); + }, [repoUrl]); + + return ( + + {/* Blurred backdrop */} +
+ + {/* Card */} + + {state === "auth_required" ? ( + <> + {/* Icon */} +
+ +
+ + {/* Copy */} +
+

+ Unlock AI Insights +

+

+ Get {AI_FREE_LIMIT} free AI architectural analyses. Sign in with + GitHub — no credit card needed. +

+
+ + {/* Feature pills */} +
+ {[ + "Architecture Summary", + "Risk Detection", + "Code Health Score", + ].map((f) => ( + + {f} + + ))} +
+ + {/* CTA */} + + +

+ Free forever · No spam · Open source +

+ + ) : ( + <> + {/* Icon */} +
+ +
+ + {/* Copy */} +
+

+ You've used your {AI_FREE_LIMIT} free analyses +

+

+ Upgrade to Pro for unlimited AI insights, or plug in your own + Gemini API key to keep going for free. +

+
+ + {/* CTA — Pro (placeholder) */} + + + {/* CTA — Own key (placeholder) */} + + + )} +
+ + ); +}