'use client' import { useAuth } from '@thedaviddias/auth' import { Badge } from '@thedaviddias/design-system/badge' import { Button } from '@thedaviddias/design-system/button' import { AlertTriangle, CheckCircle, ExternalLink, Github } from 'lucide-react' import Link from 'next/link' import { useEffect, useState } from 'react' import { toast } from 'sonner' import { Card } from '@/components/ui/card' import { analytics } from '@/lib/analytics' export default function IntegrationsSettingsPage() { const { user } = useAuth() const [isDisconnecting, setIsDisconnecting] = useState(false) useEffect(() => { analytics.settingsPageView('integrations', 'settings') }, []) const hasGitHubAuth = user && (user.user_metadata?.github_username || user.user_metadata?.user_name) const githubUsername = user?.user_metadata?.user_name || user?.user_metadata?.github_username /** * Handles disconnecting the user's GitHub account */ const handleDisconnectGitHub = async () => { analytics.disconnectService('github', 'settings-integrations') if ( !confirm( 'Are you sure you want to disconnect your GitHub account? You will lose access to premium features.' ) ) { analytics.accountDeleteCancel('settings-integrations-disconnect') return } setIsDisconnecting(true) try { // Implementation would handle GitHub disconnection toast.info('GitHub disconnection not yet implemented') } catch (_error) { toast.error('Failed to disconnect GitHub account') } finally { setIsDisconnecting(false) } } return (

Integrations

Connect external services to enhance your experience

{/* GitHub Integration */}

GitHub

Connect your GitHub account for enhanced features

{hasGitHubAuth ? ( Connected ) : ( Not Connected )}
{hasGitHubAuth ? (
{/* Connected Account Info */}

GitHub Connected

Connected as @{githubUsername}

{/* Active Features */}

Active Features

Direct Project Submission
Create pull requests under your GitHub account
Active
Contributor Profile
Public profile with your GitHub contributions
Active {githubUsername && ( )}
Enhanced Authentication
Secure OAuth-based login
Active
{/* Account Management */}

Account Management

Disconnect GitHub
Remove GitHub integration and lose premium features
) : (
{/* Benefits */}

Benefits of Connecting GitHub

Submit projects directly through the platform
Get proper credit for your contributions
Showcase your contributions on your profile
Enhanced security with OAuth authentication
{/* Connect Button */}
)}
) }