"use client" import { useState, useEffect } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Separator } from "@/components/ui/separator" import { ChevronDown, ChevronRight, Code2, Monitor, Cpu, HardDrive, Globe, Clock, Zap } from "lucide-react" interface DebugPanelProps { className?: string } export default function DebugPanel({ className }: DebugPanelProps) { const [isOpen, setIsOpen] = useState(false) const [systemInfo, setSystemInfo] = useState({}) const [performanceMetrics, setPerformanceMetrics] = useState({}) useEffect(() => { // Gather system information const info = { userAgent: navigator.userAgent, platform: navigator.platform, language: navigator.language, cookiesEnabled: navigator.cookieEnabled, onlineStatus: navigator.onLine, screenResolution: `${screen.width}x${screen.height}`, colorDepth: screen.colorDepth, timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, currentTime: new Date().toISOString(), buildTime: new Date().toISOString(), // In a real app, this would be from build version: "1.0.0", // From package.json in real app } setSystemInfo(info) // Performance metrics (mock data for demo) const metrics = { loadTime: Math.round(performance.now()), memoryUsage: (performance as any).memory ? { used: Math.round((performance as any).memory.usedJSHeapSize / 1024 / 1024), total: Math.round((performance as any).memory.totalJSHeapSize / 1024 / 1024), limit: Math.round((performance as any).memory.jsHeapSizeLimit / 1024 / 1024) } : null, connection: (navigator as any).connection ? { effectiveType: (navigator as any).connection.effectiveType, downlink: (navigator as any).connection.downlink, rtt: (navigator as any).connection.rtt } : null } setPerformanceMetrics(metrics) }, []) if (!isOpen) { return (
) } return (
Developer Debug Panel
System information and performance metrics
{/* System Info Section */}
System Information
Platform: {systemInfo.platform}
Screen: {systemInfo.screenResolution}
Online: {systemInfo.onlineStatus ? "Connected" : "Offline"}
Timezone: {systemInfo.timezone}
{/* Performance Section */}
Performance
Page Load: {performanceMetrics.loadTime}ms
{performanceMetrics.memoryUsage && (
Memory: {performanceMetrics.memoryUsage.used}MB / {performanceMetrics.memoryUsage.total}MB
)} {performanceMetrics.connection && ( <>
Connection: {performanceMetrics.connection.effectiveType}
RTT: {performanceMetrics.connection.rtt}ms
)}
{/* App Info Section */}
Application
Version: {systemInfo.version}
Environment: Development
Framework: Next.js 15
{/* Quick Actions */}
Quick Actions
) }