import { useParams } from 'common' import { Logs } from 'icons' import { BookOpen } from 'lucide-react' import { useTheme } from 'next-themes' import Link from 'next/link' import { useEffect, useState } from 'react' import { AiIconAnimation, Button, Card, CardContent, CardHeader, CardTitle } from 'ui' import { Image } from 'ui-patterns/Image' import { PageSection, PageSectionContent, PageSectionMeta, PageSectionSummary, PageSectionTitle, } from 'ui-patterns/PageSection' import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { BASE_PATH, DOCS_URL } from '@/lib/constants' import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state' import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state' export const OverviewLearnMore = () => { const [isMounted, setIsMounted] = useState(false) const { ref } = useParams() const aiSnap = useAiAssistantStateSnapshot() const { openSidebar } = useSidebarManagerSnapshot() const { resolvedTheme } = useTheme() useEffect(() => { setIsMounted(true) }, []) const isLight = resolvedTheme === 'light' const LearnMoreCards = [ { label: 'Docs', title: 'Auth docs', description: 'Read more on Briven auth, managing users and more.', image: isLight ? `${BASE_PATH}/img/auth-overview/auth-overview-docs-light.jpg` : `${BASE_PATH}/img/auth-overview/auth-overview-docs.jpg`, actions: [ { label: 'Docs', href: `${DOCS_URL}/guides/auth`, icon: , }, ], }, { label: 'Assistant', title: 'Explain auth errors', description: 'Our Assistant can help you debug and fix authentication errors.', image: isLight ? `${BASE_PATH}/img/auth-overview/auth-overview-assistant-light.jpg` : `${BASE_PATH}/img/auth-overview/auth-overview-assistant.jpg`, actions: [ { label: 'Ask Assistant', onClick: () => { openSidebar(SIDEBAR_KEYS.AI_ASSISTANT) aiSnap.newChat({ name: 'Auth Help', initialInput: 'Look at my logs related to Briven Auth and help me debug the recent errors.', suggestions: { title: 'I can help you with authentication issues. Here are some common problems:', prompts: [ { label: 'Login Issues', description: 'Why are users unable to log in to my app?', }, { label: 'JWT Problems', description: 'Help me understand and fix JWT token issues', }, { label: 'RLS Policies', description: 'Explain my Row Level Security policies and fix issues', }, { label: 'Provider Setup', description: 'Help me configure OAuth providers correctly', }, ], }, }) }, icon: , }, ], }, { label: 'Logs', title: 'Dive into the logs', description: 'Auth logs provide a deeper view into your auth requests.', image: isLight ? `${BASE_PATH}/img/auth-overview/auth-overview-logs-light.jpg` : `${BASE_PATH}/img/auth-overview/auth-overview-logs.jpg`, actions: [ { label: 'Go to logs', href: `/project/${ref}/logs/auth-logs`, icon: , }, ], }, ] if (!isMounted) return null return ( Learn more {LearnMoreCards.map((card) => ( {card.label} {card.title} {card.description} {card.actions.map((action) => { if ('href' in action) { return ( {action.label} ) } else { return ( {action.label} ) } })} ))} ) }
{card.description}