diff --git a/src/components/SupabaseIntegration.tsx b/src/components/SupabaseIntegration.tsx new file mode 100644 index 0000000..c68af0e --- /dev/null +++ b/src/components/SupabaseIntegration.tsx @@ -0,0 +1,64 @@ +import { useState } from "react"; +import { Button } from "@/components/ui/button"; +// We might need a Supabase icon here, but for now, let's use a generic one or text. +// import { Supabase } from "lucide-react"; // Placeholder +import { DatabaseZap } from "lucide-react"; // Using DatabaseZap as a placeholder +import { useSettings } from "@/hooks/useSettings"; +import { showSuccess, showError } from "@/lib/toast"; + +export function SupabaseIntegration() { + const { settings, updateSettings } = useSettings(); + const [isDisconnecting, setIsDisconnecting] = useState(false); + + const handleDisconnectFromSupabase = async () => { + setIsDisconnecting(true); + try { + // Clear the entire supabase object in settings + const result = await updateSettings({ + supabase: undefined, + }); + if (result) { + showSuccess("Successfully disconnected from Supabase"); + } else { + showError("Failed to disconnect from Supabase"); + } + } catch (err: any) { + showError( + err.message || "An error occurred while disconnecting from Supabase" + ); + } finally { + setIsDisconnecting(false); + } + }; + + // Check if there's any Supabase accessToken to determine connection status + const isConnected = !!settings?.supabase?.accessToken; + + if (!isConnected) { + return null; + } + + return ( +
+
+

+ Supabase Integration +

+

+ Your account is connected to Supabase. +

+
+ + +
+ ); +} diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index 1eae295..3163137 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -12,6 +12,7 @@ import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import { useRouter } from "@tanstack/react-router"; import { GitHubIntegration } from "@/components/GitHubIntegration"; +import { SupabaseIntegration } from "@/components/SupabaseIntegration"; export default function SettingsPage() { const { theme, setTheme } = useTheme(); @@ -142,6 +143,7 @@ export default function SettingsPage() {
+