{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "web-performance-page-shadcnui", "type": "registry:component", "title": "Web Performance Page", "description": "Real-time analysis of web vitals and performance metrics", "registryDependencies": [ "button" ], "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/web-performance/web-performance-page.tsx", "content": "\"use client\";\n\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { motion, type Variants } from \"framer-motion\";\nimport {\n Activity,\n AlertCircle,\n CheckCircle2,\n Code2,\n Download,\n FileCode,\n FileImage,\n FileType,\n Layout,\n Lightbulb,\n Smartphone,\n Zap,\n} from \"lucide-react\";\n\n// ============================================================================\n// TYPES & INTERFACES\n// ============================================================================\n\ninterface WebVitalCardProps {\n label: string;\n value: string | number;\n unit?: string;\n description: string;\n status: \"good\" | \"needs-improvement\" | \"poor\";\n icon: React.ReactNode;\n}\n\ninterface ResourceItem {\n name: string;\n type: \"js\" | \"css\" | \"image\" | \"font\" | \"other\";\n size: string;\n time: string;\n}\n\n// ============================================================================\n// ANIMATION VARIANTS\n// ============================================================================\n\nconst containerVariants: Variants = {\n hidden: { opacity: 0 },\n visible: {\n opacity: 1,\n transition: {\n staggerChildren: 0.1,\n delayChildren: 0.2,\n },\n },\n};\n\nconst itemVariants: Variants = {\n hidden: { opacity: 0, y: 20 },\n visible: {\n opacity: 1,\n y: 0,\n transition: { duration: 0.4 },\n },\n};\n\n// ============================================================================\n// COMPONENTS\n// ============================================================================\n\nfunction PerformanceHeader() {\n return (\n \n
\n
\n \n \n Audit Complete\n \n\n

\n Web Performance\n

\n

\n Real-time analysis of your application's Core Web Vitals,\n resource loading, and overall performance score.\n

\n
\n\n
\n \n \n \n \n
\n
\n \n );\n}\n\nfunction WebVitalCard({\n label,\n value,\n unit,\n description,\n status,\n icon,\n}: WebVitalCardProps) {\n const statusColors = {\n good: \"text-emerald-500 bg-emerald-500/10 border-emerald-500/20\",\n \"needs-improvement\": \"text-amber-500 bg-amber-500/10 border-amber-500/20\",\n poor: \"text-red-500 bg-red-500/10 border-red-500/20\",\n };\n\n const StatusIcon =\n status === \"good\"\n ? CheckCircle2\n : status === \"needs-improvement\"\n ? AlertCircle\n : AlertCircle;\n\n return (\n \n
\n\n
\n
\n {icon}\n
\n \n \n {status.replace(\"-\", \" \")}\n
\n
\n\n
\n

{label}

\n
\n \n {value}\n \n {unit && (\n \n {unit}\n \n )}\n
\n
\n\n

\n {description}\n

\n \n );\n}\n\nfunction PerformanceScore() {\n const score = 92;\n const radius = 80;\n const circumference = 2 * Math.PI * radius;\n const strokeDashoffset = circumference - (score / 100) * circumference;\n\n return (\n \n
\n {/* Background Circle */}\n \n \n {/* Progress Circle */}\n \n \n
\n \n {score}\n \n \n Score\n \n
\n
\n\n

\n Excellent Performance\n

\n

\n Your page is optimized and delivering a great user experience.\n

\n \n );\n}\n\nfunction ResourceBreakdown() {\n const resources: ResourceItem[] = [\n { name: \"main-app.js\", type: \"js\", size: \"142 KB\", time: \"45ms\" },\n { name: \"styles.css\", type: \"css\", size: \"24 KB\", time: \"12ms\" },\n { name: \"hero-image.webp\", type: \"image\", size: \"86 KB\", time: \"120ms\" },\n { name: \"inter-font.woff2\", type: \"font\", size: \"32 KB\", time: \"25ms\" },\n { name: \"analytics.js\", type: \"js\", size: \"15 KB\", time: \"30ms\" },\n ];\n\n const getIcon = (type: ResourceItem[\"type\"]) => {\n switch (type) {\n case \"js\":\n return ;\n case \"css\":\n return ;\n case \"image\":\n return ;\n case \"font\":\n return ;\n default:\n return ;\n }\n };\n\n return (\n \n
\n

\n Resource Breakdown\n

\n \n 5 Requests\n \n
\n\n
\n {resources.map((resource, index) => (\n \n
\n
\n {getIcon(resource.type)}\n
\n
\n

\n {resource.name}\n

\n

\n {resource.type}\n

\n
\n
\n
\n

\n {resource.time}\n

\n

{resource.size}

\n
\n
\n ))}\n \n \n );\n}\n\nfunction PerformanceTips() {\n const tips = [\n {\n title: \"Optimize LCP\",\n icon: ,\n items: [\n \"Use Next.js Image component for optimized image loading\",\n \"Implement lazy loading for images below the fold\",\n \"Minimize render-blocking resources (CSS/JS)\",\n \"Use modern image formats (WebP, AVIF)\",\n ],\n },\n {\n title: \"Improve FID/INP\",\n icon: ,\n items: [\n \"Break up long tasks with setTimeout or requestIdleCallback\",\n \"Use code splitting to reduce JavaScript bundle size\",\n \"Implement React.lazy() for component lazy loading\",\n \"Optimize event handlers and avoid heavy computations\",\n ],\n },\n {\n title: \"Reduce CLS\",\n icon: ,\n items: [\n \"Set explicit width and height on images and videos\",\n \"Reserve space for ads and embeds\",\n \"Avoid inserting content above existing content\",\n \"Use transform animations instead of layout changes\",\n ],\n },\n {\n title: \"Optimize Resources\",\n icon: ,\n items: [\n \"Enable Brotli/Gzip compression\",\n \"Implement HTTP/2 or HTTP/3\",\n \"Use CDN for static assets\",\n \"Enable browser caching with proper headers\",\n ],\n },\n ];\n\n return (\n \n
\n \n

\n Performance Optimization Tips\n

\n
\n\n
\n {tips.map((tip, index) => (\n \n
\n
\n {tip.icon}\n
\n

{tip.title}

\n
\n
    \n {tip.items.map((item, i) => (\n \n \n {item}\n \n ))}\n
\n
\n ))}\n \n \n );\n}\n\n// ============================================================================\n// MAIN PAGE COMPONENT\n// ============================================================================\n\nexport function WebPerformancePage() {\n return (\n
\n {/* Glassmorphism background blobs */}\n
\n
\n
\n
\n
\n\n
\n
\n \n\n \n {/* Web Vitals Grid */}\n
\n }\n />\n }\n />\n }\n />\n }\n />\n
\n\n {/* Detailed Stats Row */}\n
\n \n \n
\n\n {/* Performance Tips */}\n \n \n
\n
\n
\n );\n}\n", "type": "registry:component", "target": "components/uitripled/web-performance-page-shadcnui.tsx" } ] }