import { useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { useMetadata } from '@/lib/hooks/useMetadata'; import { useUsers } from '@/features/auth'; import { Users, Database, HardDrive, Lock, ChevronRight } from 'lucide-react'; import { ConnectionSuccessBanner, StatsCard, PromptCard, PromptDialog } from '../components'; import { useMcpUsage } from '@/features/logs/hooks/useMcpUsage'; import { LogsDataGrid, type LogsColumnDef } from '@/features/logs/components/LogsDataGrid'; import { cn, formatTime } from '@/lib/utils/utils'; import { Button } from '@/components'; import { quickStartPrompts, type PromptTemplate } from '../prompts'; export default function DashboardPage() { const location = useLocation(); const navigate = useNavigate(); const [selectedPrompt, setSelectedPrompt] = useState(null); const [promptDialogOpen, setPromptDialogOpen] = useState(false); const { metadata, auth, tables, storage, isLoading } = useMetadata(); const { totalUsers } = useUsers(); const { records } = useMcpUsage(); const authCount = auth?.oauths.length ?? 0; const tableCount = tables?.length ?? 0; const showBanner = location.state?.showSuccessBanner === true; const mcpColumns: LogsColumnDef[] = [ { key: 'tool_name', name: 'MCP Call', width: '12fr', renderCell: ({ row }) => (

{String(row.tool_name ?? '')}

), }, { key: 'created_at', name: 'Time', width: 'minmax(200px, 1fr)', renderCell: ({ row }) => (

{formatTime(String(row.created_at ?? ''))}

), }, ]; const handleViewMoreClick = () => { void navigate('/dashboard/logs/MCP'); }; return (
{/* Connection Success Banner - Only shows once on first connection */} {showBanner && }

Dashboard

{/* Stats Section */}
{/* Quick Start Prompt Section */}

Quick Start Prompt

Paste the prompts below into your agent to quickly start building real apps.

{quickStartPrompts.map((prompt, index) => ( { setSelectedPrompt(prompt); setPromptDialogOpen(true); }} /> ))}
{/* Templates & Components Section */}

Explore Our Platform

InsForge gives you every backend feature you need. Use the whole platform or just the features you want.

{/* Sign-in Component Card */} {/* Database Templates Card */}
{/* MCP Call Records Section */}

MCP Call Records

No MCP call records found
} noPadding />
); }