Launch a mobile parity sentinel: render diffs, blocked resources, parity score, and…
- User
Launch a mobile parity sentinel: render diffs, blocked resources, parity score, and regression alerts.
Assistant
The user wants me to create a "Mobile Parity Sentinel" - a tool for monitoring and comparing mobile vs desktop web performance/parity. This should include:
- Render diffs - Visual comparison between mobile and desktop rendering
- Blocked resources - Resources that are blocked or missing on mobile
- Parity score - A score showing how similar mobile is to desktop
- Regression alerts - Alerts when parity degrades
Let me create a visually striking, functional dashboard that simulates this mobile parity monitoring system. I'll use:
- A dark, technical/industrial aesthetic (fitting for a dev tool)
- Real-looking data and metrics
- Interactive elements (tabs, filters, detail views)
- Canvas or CSS-based visual diff representations
- Animated alerts and status indicators
Design decisions:
- Font: JetBrains Mono for technical feel + Space Grotesk for headings
- Color scheme: Dark with cyan/teal accent (monitoring/terminal vibe), red for alerts, green for good scores
- Layout: Dashboard with sidebar navigation, main content area with cards
- Interactions: Tab switching, alert dismissal, hover details, simulated scan functionality
Let me build this properly with all the features.
Mobile Parity Sentinel
A monitoring dashboard for tracking mobile vs desktop rendering parity, blocked resources, and regression detection.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Mobile Parity Sentinel</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap" rel="stylesheet"> <style> :root { --bg: #0a0e14; --bg-elevated: #121820; --card: #161d27; --border: #1e2a3a; --fg: #e6edf3; --muted: #6b7d93; --accent: #00d9c0; --accent-dim: rgba(0, 217, 192, 0.15); --danger: #ff4757; --warning: #ffa502; --success: #2ed573; } * { box-sizing: border-box; } body { font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; } .font-mono { font-family: 'JetBrains Mono', monospace; } /* Background pattern */ .bg-grid { background-image: linear-gradient(rgba(0, 217, 192, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 217, 192, 0.03) 1px, transparent 1px); background-size: 40px 40px; } /* Glow effects */ .glow-accent { box-shadow: 0 0 30px rgba(0, 217, 192, 0.2), 0 0 60px rgba(0, 217, 192, 0.1); } .glow-danger { box-shadow: 0 0 20px rgba(255, 71, 87, 0.3); } /* Scan line animation */ @keyframes scanline { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } } .scan-effect::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 30%; background: linear-gradient(transparent, rgba(0, 217, 192, 0.1), transparent); animation: scanline 3s ease-in-out infinite; pointer-events: none; } /* Pulse animation */ @keyframes pulse-ring { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } } .pulse-ring::before { content: ''; position: absolute; inset: -4px; border: 2px solid var(--accent); border-radius: inherit; animation: pulse-ring 2s ease-out infinite; } /* Stagger entrance */ @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .animate-in { animation: slideUp 0.5s ease-out forwards; opacity: 0; } .delay-1 { animation-delay: 0.1s; } .delay-2 { animation-delay: 0.2s; } .delay-3 { animation-delay: 0.3s; } .delay-4 { animation-delay: 0.4s; } .delay-5 { animation-delay: 0.5s; } /* Progress bar */ .score-bar { background: linear-gradient(90deg, var(--danger) 0%, var(--warning) 50%, var(--success) 100%); } /* Diff visualization */ .diff-overlay { background: repeating-linear-gradient( 45deg, transparent, transparent 2px, rgba(255, 71, 87, 0.3) 2px, rgba(255, 71, 87, 0.3) 4px ); } /* Scrollbar */ ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: var(--bg); } ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; } /* Tab active state */ .tab-active { color: var(--accent); border-color: var(--accent); } /* Alert shake */ @keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } } .alert-critical:hover { animation: shake 0.3s ease-in-out; } @media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } } </style> </head> <body class="bg-grid"> <!-- Header --> <header class="border-b border-[--border] bg-[--bg-elevated]/80 backdrop-blur-sm sticky top-0 z-50"> <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> <div class="flex items-center justify-between h-16"> <div class="flex items-center gap-3"> <div class="w-10 h-10 rounded-lg bg-[--accent-dim] flex items-center justify-center relative"> <svg class="w-6 h-6 text-[--accent]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/> </svg> </div> <div> <h1 class="text-lg font-bold tracking-tight">Parity Sentinel</h1> <p class="text-xs text-[--muted] font-mono">v2.4.1 / monitoring active</p> </div> </div> <div class="flex items-center gap-4"> <div class="hidden sm:flex items-center gap-2 px-3 py-1.5 rounded-full bg-[--card] border border-[--border]"> <span class="w-2 h-2 rounded-full bg-[--success] animate-pulse"></span> <span class="text-sm text-[--muted]">12 pages tracked</span> </div> <button id="scanBtn" class="flex items-center gap-2 px-4 py-2 bg-[--accent] text-[--bg] rounded-lg font-medium text-sm hover:opacity-90 transition-opacity focus:outline-none focus:ring-2 focus:ring-[--accent] focus:ring-offset-2 focus:ring-offset-[--bg]"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/> </svg> Run Scan </button> </div> </div> </div> </header> <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"> <!-- Stats Overview --> <div class="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-8"> <div class="animate-in delay-1 bg-[--card] border border-[--border] rounded-xl p-5"> <div class="flex items-center justify-between mb-3"> <span class="text-[--muted] text-sm">Overall Parity</span> <svg class="w-5 h-5 text-[--accent]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/> </svg> </div> <div class="text-3xl font-bold text-[--accent] font-mono" id="overallScore">87.4%</div> <div class="text-xs text-[--success] mt-1 flex items-center gap-1"> <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18"/> </svg> +2.3% from last week </div> </div> <div class="animate-in delay-2 bg-[--card] border border-[--border] rounded-xl p-5"> <div class="flex items-center justify-between mb-3"> <span class="text-[--muted] text-sm">Blocked Resources</span> <svg class="w-5 h-5 text-[--warning]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/> </svg> </div> <div class="text-3xl font-bold text-[--warning] font-mono" id="blockedCount">23</div> <div class="text-xs text-[--muted] mt-1">Across all pages</div> </div> <div class="animate-in delay-3 bg-[--card] border border-[--border] rounded-xl p-5"> <div class="flex items-center justify-between mb-3"> <span class="text-[--muted] text-sm">Render Diffs</span> <svg class="w-5 h-5 text-[--danger]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/> </svg> </div> <div class="text-3xl font-bold text-[--fg] font-mono">8</div> <div class="text-xs text-[--danger] mt-1">3 critical</div> </div> <div class="animate-in delay-4 bg-[--card] border border-[--border] rounded-xl p-5"> <div class="flex items-center justify-between mb-3"> <span class="text-[--muted] text-sm">Regressions</span> <svg class="w-5 h-5 text-[--danger]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/> </svg> </div> <div class="text-3xl font-bold text-[--danger] font-mono">4</div> <div class="text-xs text-[--muted] mt-1">2 new this week</div> </div> </div> <!-- Tabs --> <div class="animate-in delay-5 border-b border-[--border] mb-6"> <nav class="flex gap-6" role="tablist"> <button class="tab-btn tab-active pb-3 text-sm font-medium border-b-2 border-transparent transition-colors" data-tab="diffs" role="tab" aria-selected="true"> Render Diffs </button> <button class="tab-btn pb-3 text-sm font-medium text-[--muted] border-b-2 border-transparent hover:text-[--fg] transition-colors" data-tab="blocked" role="tab" aria-selected="false"> Blocked Resources </button> <button class="tab-btn pb-3 text-sm font-medium text-[--muted] border-b-2 border-transparent hover:text-[--fg] transition-colors" data-tab="alerts" role="tab" aria-selected="false"> Regression Alerts </button> <button class="tab-btn pb-3 text-sm font-medium text-[--muted] border-b-2 border-transparent hover:text-[--fg] transition-colors" data-tab="pages" role="tab" aria-selected="false"> Page Scores </button> </nav> </div> <!-- Tab Content --> <div id="tabContent"> <!-- Render Diffs Panel --> <div id="panel-diffs" class="tab-panel"> <div class="grid lg:grid-cols-3 gap-6"> <!-- Diff Viewer --> <div class="lg:col-span-2 bg-[--card] border border-[--border] rounded-xl overflow-hidden"> <div class="p-4 border-b border-[--border] flex items-center justify-between"> <div> <h3 class="font-medium">Visual Comparison</h3> <p class="text-xs text-[--muted] mt-0.5">Desktop vs Mobile rendering</p> </div> <select id="pageSelect" class="bg-[--bg] border border-[--border] rounded-lg px-3 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-[--accent]"> <option value="0">Homepage</option> <option value="1">Product Listing</option> <option value="2">Checkout Flow</option> <option value="3">Account Dashboard</option> </select> </div> <div class="p-4"> <div class="grid grid-cols-2 gap-4 mb-4"> <div> <div class="text-xs text-[--muted] mb-2 flex items-center gap-2"> <span class="w-2 h-2 rounded-full bg-[--accent]"></span> Desktop </div> <div class="relative aspect-[4/3] bg-[--bg] rounded-lg overflow-hidden scan-effect" id="desktopPreview"> <canvas id="desktopCanvas" class="w-full h-full"></canvas> </div> </div> <div> <div class="text-xs text-[--muted] mb-2 flex items-center gap-2"> <span class="w-2 h-2 rounded-full bg-[--warning]"></span> Mobile </div> <div class="relative aspect-[4/3] bg-[--bg] rounded-lg overflow-hidden" id="mobilePreview"> <canvas id="mobileCanvas" class="w-full h-full"></canvas> <div class="diff-overlay absolute inset-0 opacity-50" id="diffOverlay"></div> </div> </div> </div> <div class="flex items-center justify-between p-3 bg-[--bg] rounded-lg"> <div class="flex items-center gap-4"> <div class="flex items-center gap-2"> <div class="w-4 h-4 rounded bg-[--success]/30 border border-[--success]"></div> <span class="text-xs text-[--muted]">Match</span> </div> <div class="flex items-center gap-2"> <div class="w-4 h-4 rounded diff-overlay"></div> <span class="text-xs text-[--muted]">Difference</span> </div> </div> <div class="text-sm font-mono"> <span class="text-[--muted]">Diff Score:</span> <span class="text-[--warning] ml-2" id="diffScore">12.4%</span> </div> </div> </div> </div> <!-- Diff Details --> <div class="bg-[--card] border border-[--border] rounded-xl overflow-hidden"> <div class="p-4 border-b border-[--border]"> <h3 class="font-medium">Detected Differences</h3> </div> <div class="p-4 space-y-3 max-h-[400px] overflow-y-auto" id="diffList"> <!-- Populated by JS --> </div> </div> </div> </div> <!-- Blocked Resources Panel --> <div id="panel-blocked" class="tab-panel hidden"> <div class="bg-[--card] border border-[--border] rounded-xl overflow-hidden"> <div class="p-4 border-b border-[--border] flex items-center justify-between"> <div> <h3 class="font-medium">Blocked Resources Analysis</h3> <p class="text-xs text-[--muted] mt-0.5">Resources blocked on mobile but available on desktop</p> </div> <div class="flex items-center gap-2"> <button class="filter-btn px-3 py-1 text-xs rounded-full bg-[--accent] text-[--bg]" data-filter="all">All</button> <button class="filter-btn px-3 py-1 text-xs rounded-full bg-[--bg] text-[--muted] hover:text-[--fg]" data-filter="scripts">Scripts</button> <button class="filter-btn px-3 py-1 text-xs rounded-full bg-[--bg] text-[--muted] hover:text-[--fg]" data-filter="styles">Styles</button> <button class="filter-btn px-3 py-1 text-xs rounded-full bg-[--bg] text-[--muted] hover:text-[--fg]" data-filter="fonts">Fonts</button> </div> </div> <div class="overflow-x-auto"> <table class="w-full"> <thead class="bg-[--bg]"> <tr> <th class="text-left text-xs text-[--muted] font-medium px-4 py-3">Resource</th> <th class="text-left text-xs text-[--muted] font-medium px-4 py-3">Type</th> <th class="text-left text-xs text-[--muted] font-medium px-4 py-3">Impact</th> <th class="text-left text-xs text-[--muted] font-medium px-4 py-3">Page</th> <th class="text-left text-xs text-[--muted] font-medium px-4 py-3">Status</th> </tr> </thead> <tbody id="resourcesTable"> <!-- Populated by JS --> </tbody> </table> </div> </div> </div> <!-- Regression Alerts Panel --> <div id="panel-alerts" class="tab-panel hidden"> <div class="space-y-4" id="alertsList"> <!-- Populated by JS --> </div> </div> <!-- Page Scores Panel --> <div id="panel-pages" class="tab-panel hidden"> <div class="grid md:grid-cols-2 gap-4" id="pagesList"> <!-- Populated by JS --> </div> </div> </div> </main> <!-- Toast Container --> <div id="toastContainer" class="fixed bottom-6 right-6 space-y-3 z-50"></div> <script> // Data const pagesData = [ { name: 'Homepage', url: '/', score: 92.1, blocked: 3, diffs: 2, lastScan: '2 min ago', trend: 'up' }, { name: 'Product Listing', url: '/products', score: 78.4, blocked: 8, diffs: 5, lastScan: '5 min ago', trend: 'down' }, { name: 'Checkout Flow', url: '/checkout', score: 85.6, blocked: 4, diffs: 1, lastScan: '8 min ago', trend: 'stable' }, { name: 'Account Dashboard', url: '/account', score: 71.2, blocked: 6, diffs: 4, lastScan: '12 min ago', trend: 'down' }, { name: 'Search Results', url: '/search', score: 89.3, blocked: 2, diffs: 2, lastScan: '15 min ago', trend: 'up' }, { name: 'Blog Section', url: '/blog', score: 94.8, blocked: 1, diffs: 0, lastScan: '20 min ago', trend: 'stable' } ]; const diffData = [ [ { type: 'layout', desc: 'Hero section height mismatch', severity: 'high', x: 10, y: 5, w: 80, h: 20 }, { type: 'font', desc: 'Heading font not loading', severity: 'medium', x: 15, y: 8, w: 40, h: 8 }, { type: 'spacing', desc: 'Navigation padding differs', severity: 'low', x: 0, y: 0, w: 100, h: 10 } ], [ { type: 'layout', desc: 'Product grid collapsed to single column', severity: 'critical', x: 5, y: 20, w: 90, h: 50 }, { type: 'image', desc: 'Product images not optimized', severity: 'medium', x: 10, y: 25, w: 30, h: 25 }, { type: 'font', desc: 'Price font-size incorrect', severity: 'low', x: 10, y: 55, w: 20, h: 5 }, { type: 'interaction', desc: 'Filter panel not expandable', severity: 'high', x: 0, y: 15, w: 100, h: 60 }, { type: 'spacing', desc: 'Card margins inconsistent', severity: 'medium', x: 5, y: 22, w: 90, h: 45 } ], [ { type: 'interaction', desc: 'Form validation messages hidden', severity: 'critical', x: 20, y: 40, w: 60, h: 30 }, { type: 'layout', desc: 'Payment options overflow', severity: 'high', x: 10, y: 60, w: 80, h: 15 } ], [ { type: 'layout', desc: 'Sidebar not collapsible', severity: 'critical', x: 0, y: 10, w: 30, h: 80 }, { type: 'font', desc: 'Data table text truncated', severity: 'high', x: 35, y: 30, w: 60, h: 40 }, { type: 'interaction', desc: 'Dropdown menus clipped', severity: 'high', x: 35, y: 15, w: 30, h: 10 }, { type: 'spacing', desc: 'Chart legend overlapping', severity: 'medium', x: 35, y: 75, w: 60, h: 15 } ] ]; const blockedResources = [ { name: 'analytics.min.js', type: 'scripts', impact: 'medium', page: 'Homepage', reason: 'Blocked by CSP' }, { name: 'webfont-loader.js', type: 'scripts', impact: 'high', page: 'Product Listing', reason: 'Network timeout' }, { name: 'hero-video.mp4', type: 'media', impact: 'high', page: 'Homepage', reason: 'Auto-play blocked' }, { name: 'Inter-Bold.woff2', type: 'fonts', impact: 'medium', page: 'Checkout', reason: 'CORS error' }, { name: 'datepicker.css', type: 'styles', impact: 'low', page: 'Checkout', reason: 'Unused resource' }, { name: 'tracking-pixel.gif', type: 'media', impact: 'low', page: 'All pages', reason: 'Ad blocker' }, { name: 'recaptcha.js', type: 'scripts', impact: 'critical', page: 'Checkout', reason: 'Blocked by firewall' }, { name: 'product-gallery.css', type: 'styles', impact: 'high', page: 'Product Listing', reason: '404 error' }, { name: 'icons.woff', type: 'fonts', impact: 'high', page: 'Account', reason: 'Font-face missing' }, { name: 'chat-widget.js', type: 'scripts', impact: 'medium', page: 'All pages', reason: 'Delayed load' } ]; const regressionAlerts = [ { id: 1, severity: 'critical', title: 'Checkout form validation broken on iOS 17', description: 'Form validation messages are being clipped on iOS 17 devices due to viewport calculation changes.', page: 'Checkout Flow', detected: '2 hours ago', commit: 'a3f2b1c', status: 'new' }, { id: 2, severity: 'high', title: 'Product grid layout regression', description: 'Grid changed from 3-column to single-column on screens 375-414px wide after CSS refactor.', page: 'Product Listing', detected: '5 hours ago', commit: 'd8e4f2a', status: 'investigating' }, { id: 3, severity: 'medium', title: 'Font loading delay increased', description: 'Custom font FOUT duration increased from 200ms to 800ms after CDN migration.', page: 'All pages', detected: '1 day ago', commit: 'b7c3d5e', status: 'acknowledged' }, { id: 4, severity: 'high', title: 'Account sidebar not collapsible', description: 'Hamburger menu toggle no longer functional on mobile after JS bundle split.', page: 'Account Dashboard', detected: '2 days ago', commit: 'f1a2b3c', status: 'fixed' } ]; // DOM Elements - Initialize after DOM is ready let tabBtns, tabPanels, pageSelect, desktopCanvas, mobileCanvas; let diffList, resourcesTable, alertsList, pagesList, filterBtns; let toastContainer, scanBtn; // State let currentPage = 0; let currentFilter = 'all'; // Initialize when DOM is ready document.addEventListener('DOMContentLoaded', function() { // Get DOM elements tabBtns = document.querySelectorAll('.tab-btn'); tabPanels = document.querySelectorAll('.tab-panel'); pageSelect = document.getElementById('pageSelect'); desktopCanvas = document.getElementById('desktopCanvas'); mobileCanvas = document.getElementById('mobileCanvas'); diffList = document.getElementById('diffList'); resourcesTable = document.getElementById('resourcesTable'); alertsList = document.getElementById('alertsList'); pagesList = document.getElementById('pagesList'); filterBtns = document.querySelectorAll('.filter-btn'); toastContainer = document.getElementById('toastContainer'); scanBtn = document.getElementById('scanBtn'); // Initialize initTabs(); initCanvases(); initDiffList(); initResourcesTable(); initAlertsList(); initPagesList(); initFilters(); initScanButton(); initPageSelect(); }); // Tab Navigation function initTabs() { tabBtns.forEach(btn => { btn.addEventListener('click', () => { const tabId = btn.dataset.tab; tabBtns.forEach(b => { b.classList.remove('tab-active'); b.classList.add('text-[--muted]'); b.setAttribute('aria-selected', 'false'); }); btn.classList.add('tab-active'); btn.classList.remove('text-[--muted]'); btn.setAttribute('aria-selected', 'true'); tabPanels.forEach(panel => { panel.classList.add('hidden'); }); document.getElementById(`panel-${tabId}`).classList.remove('hidden'); }); }); } // Canvas Rendering function initCanvases() { renderPreviews(currentPage); } function renderPreviews(pageIndex) { renderDesktopCanvas(pageIndex); renderMobileCanvas(pageIndex); } function renderDesktopCanvas(pageIndex) { const canvas = desktopCanvas; const ctx = canvas.getContext('2d'); const dpr = window.devicePixelRatio || 1; const rect = canvas.getBoundingClientRect(); canvas.width = Math.max(1, rect.width * dpr); canvas.height = Math.max(1, rect.height * dpr); ctx.scale(dpr, dpr); const w = rect.width; const h = rect.height; // Background ctx.fillStyle = '#1a1f2e'; ctx.fillRect(0, 0, w, h); // Header ctx.fillStyle = '#2d3748'; ctx.fillRect(0, 0, w, h * 0.08); // Nav items ctx.fillStyle = '#4a5568'; for (let i = 0; i < 4; i++) { ctx.fillRect(w * 0.1 + i * w * 0.15, h * 0.03, w * 0.1, h * 0.02); } // Hero section const heroGrad = ctx.createLinearGradient(0, h * 0.08, 0, h * 0.35); heroGrad.addColorStop(0, '#1e3a5f'); heroGrad.addColorStop(1, '#0d1f33'); ctx.fillStyle = heroGrad; ctx.fillRect(0, h * 0.08, w, h * 0.27); // Hero text placeholder ctx.fillStyle = '#e2e8f0'; ctx.fillRect(w * 0.1, h * 0.15, w * 0.4, h * 0.04); ctx.fillRect(w * 0.1, h * 0.21, w * 0.3, h * 0.02); // CTA button ctx.fillStyle = '#00d9c0'; ctx.fillRect(w * 0.1, h * 0.27, w * 0.15, h * 0.04); // Content grid ctx.fillStyle = '#2d3748'; for (let i = 0; i < 3; i++) { const row = Math.floor(i / 3); const col = i % 3; ctx.fillRect(w * 0.05 + col * w * 0.32, h * 0.4 + row * h * 0.18, w * 0.3, h * 0.15); } // More grid items for (let i = 0; i < 3; i++) { ctx.fillStyle = '#374151'; ctx.fillRect(w * 0.05 + i * w * 0.32, h * 0.6, w * 0.3, h * 0.15); } // Footer ctx.fillStyle = '#1f2937'; ctx.fillRect(0, h * 0.85, w, h * 0.15); } function renderMobileCanvas(pageIndex) { const canvas = mobileCanvas; const ctx = canvas.getContext('2d'); const dpr = window.devicePixelRatio || 1; const rect = canvas.getBoundingClientRect(); canvas.width = Math.max(1, rect.width * dpr); canvas.height = Math.max(1, rect.height * dpr); ctx.scale(dpr, dpr); const w = rect.width; const h = rect.height; // Background ctx.fillStyle = '#1a1f2e'; ctx.fillRect(0, 0, w, h); // Mobile header ctx.fillStyle = '#2d3748'; ctx.fillRect(0, 0, w, h * 0.1); // Hamburger menu ctx.fillStyle = '#4a5568'; ctx.fillRect(w * 0.05, h * 0.04, w * 0.06, h * 0.015); ctx.fillRect(w * 0.05, h * 0.055, w * 0.06, h * 0.015); ctx.fillRect(w * 0.05, h * 0.07, w * 0.06, h * 0.015); // Hero (taller on mobile) const heroGrad = ctx.createLinearGradient(0, h * 0.1, 0, h * 0.45); heroGrad.addColorStop(0, '#1e3a5f'); heroGrad.addColorStop(1, '#0d1f33'); ctx.fillStyle = heroGrad; ctx.fillRect(0, h * 0.1, w, h * 0.35); // Hero text ctx.fillStyle = '#e2e8f0'; ctx.fillRect(w * 0.1, h * 0.2, w * 0.8, h * 0.04); ctx.fillRect(w * 0.1, h * 0.27, w * 0.6, h * 0.02); // CTA (full width) ctx.fillStyle = '#00d9c0'; ctx.fillRect(w * 0.1, h * 0.35, w * 0.8, h * 0.05); // Single column grid ctx.fillStyle = '#2d3748'; for (let i = 0; i < 4; i++) { ctx.fillRect(w * 0.05, h * 0.5 + i * h * 0.12, w * 0.9, h * 0.1); } // Footer ctx.fillStyle = '#1f2937'; ctx.fillRect(0, h * 0.92, w, h * 0.08); // Draw diff regions const diffs = diffData[currentPage]; diffs.forEach(diff => { ctx.strokeStyle = diff.severity === 'critical' ? '#ff4757' : diff.severity === 'high' ? '#ffa502' : '#00d9c0'; ctx.lineWidth = 2; ctx.setLineDash([4, 4]); const dx = Math.max(0, diff.x) / 100 * w; const dy = Math.max(0, diff.y) / 100 * h; const dw = Math.max(1, Math.min(diff.w, 100)) / 100 * w; const dh = Math.max(1, Math.min(diff.h, 100)) / 100 * h; ctx.strokeRect(dx, dy, dw, dh); }); ctx.setLineDash([]); } // Diff List function initDiffList() { renderDiffList(currentPage); } function renderDiffList(pageIndex) { const diffs = diffData[pageIndex]; diffList.innerHTML = diffs.map((diff, i) => ` <div class="p-3 bg-[--bg] rounded-lg border-l-2 ${getSeverityBorder(diff.severity)} hover:bg-[--bg-elevated] transition-colors cursor-pointer" data-diff="${i}"> <div class="flex items-center justify-between mb-1"> <span class="text-xs font-mono uppercase ${getSeverityColor(diff.severity)}">${diff.severity}</span> <span class="text-xs text-[--muted]">${diff.type}</span> </div> <p class="text-sm">${diff.desc}</p> </div> `).join(''); } function getSeverityColor(severity) { const colors = { critical: 'text-[--danger]', high: 'text-[--warning]', medium: 'text-[--accent]', low: 'text-[--muted]' }; return colors[severity] || 'text-[--muted]'; } function getSeverityBorder(severity) { const borders = { critical: 'border-[--danger]', high: 'border-[--warning]', medium: 'border-[--accent]', low: 'border-[--border]' }; return borders[severity] || 'border-[--border]'; } // Resources Table function initResourcesTable() { renderResourcesTable('all'); } function renderResourcesTable(filter) { const filtered = filter === 'all' ? blockedResources : blockedResources.filter(r => r.type === filter); resourcesTable.innerHTML = filtered.map(res => ` <tr class="border-b border-[--border] hover:bg-[--bg] transition-colors"> <td class="px-4 py-3"> <div class="flex items-center gap-2"> <svg class="w-4 h-4 ${getTypeColor(res.type)}" fill="none" stroke="currentColor" viewBox="0 0 24 24"> ${getTypeIcon(res.type)} </svg> <span class="font-mono text-sm">${res.name}</span> </div> </td> <td class="px-4 py-3"> <span class="text-xs px-2 py-1 rounded bg-[--bg] text-[--muted]">${res.type}</span> </td> <td class="px-4 py-3"> <span class="text-xs px-2 py-1 rounded ${getImpactStyle(res.impact)}">${res.impact}</span> </td> <td class="px-4 py-3 text-sm text-[--muted]">${res.page}</td> <td class="px-4 py-3 text-sm text-[--warning]">${res.reason}</td> </tr> `).join(''); } function getTypeColor(type) { const colors = { scripts: 'text-[--accent]', styles: 'text-purple-400', fonts: 'text-[--warning]', media: 'text-pink-400' }; return colors[type] || 'text-[--muted]'; } function getTypeIcon(type) { const icons = { scripts: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/>', styles: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"/>', fonts: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3 18.129"/>', media: '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>' }; return icons[type] || ''; } function getImpactStyle(impact) { const styles = { critical: 'bg-[--danger]/20 text-[--danger]', high: 'bg-[--warning]/20 text-[--warning]', medium: 'bg-[--accent]/20 text-[--accent]', low: 'bg-[--muted]/20 text-[--muted]' }; return styles[impact] || ''; } // Alerts List function initAlertsList() { renderAlertsList(); } function renderAlertsList() { alertsList.innerHTML = regressionAlerts.map(alert => ` <div class="bg-[--card] border ${alert.status === 'new' ? 'border-[--danger] glow-danger' : 'border-[--border]'} rounded-xl p-5 alert-critical" data-alert="${alert.id}"> <div class="flex items-start justify-between gap-4"> <div class="flex-1"> <div class="flex items-center gap-3 mb-2"> <span class="px-2 py-0.5 text-xs font-medium rounded ${getSeverityStyle(alert.severity)}">${alert.severity.toUpperCase()}</span> <span class="px-2 py-0.5 text-xs rounded ${getStatusStyle(alert.status)}">${alert.status}</span> <span class="text-xs text-[--muted]">${alert.detected}</span> </div> <h4 class="font-medium mb-1">${alert.title}</h4> <p class="text-sm text-[--muted] mb-3">${alert.description}</p> <div class="flex items-center gap-4 text-xs"> <span class="text-[--muted]">Page: <span class="text-[--fg]">${alert.page}</span></span> <span class="text-[--muted]">Commit: <code class="font-mono text-[--accent]">${alert.commit}</code></span> </div> </div> <div class="flex flex-col gap-2"> ${alert.status !== 'fixed' ? ` <button class="px-3 py-1.5 text-xs bg-[--accent] text-[--bg] rounded-lg hover:opacity-90 transition-opacity" onclick="resolveAlert(${alert.id})"> Mark Resolved </button> <button class="px-3 py-1.5 text-xs bg-[--bg] text-[--muted] rounded-lg hover:text-[--fg] transition-colors" onclick="dismissAlert(${alert.id})"> Dismiss </button> ` : ` <span class="px-3 py-1.5 text-xs bg-[--success]/20 text-[--success] rounded-lg text-center"> Resolved </span> `} </div> </div> </div> `).join(''); } function getSeverityStyle(severity) { const styles = { critical: 'bg-[--danger] text-white', high: 'bg-[--warning] text-black', medium: 'bg-[--accent]/30 text-[--accent]', low: 'bg-[--muted]/30 text-[--muted]' }; return styles[severity] || ''; } function getStatusStyle(status) { const styles = { new: 'bg-[--danger]/20 text-[--danger]', investigating: 'bg-[--warning]/20 text-[--warning]', acknowledged: 'bg-[--accent]/20 text-[--accent]', fixed: 'bg-[--success]/20 text-[--success]' }; return styles[status] || ''; } function resolveAlert(id) { const alert = regressionAlerts.find(a => a.id === id); if (alert) { alert.status = 'fixed'; renderAlertsList(); showToast('Alert marked as resolved', 'success'); } } function dismissAlert(id) { const card = document.querySelector(`[data-alert="${id}"]`); if (card) { card.style.opacity = '0'; card.style.transform = 'translateX(100px)'; card.style.transition = 'all 0.3s ease'; setTimeout(() => { const index = regressionAlerts.findIndex(a => a.id === id); if (index > -1) { regressionAlerts.splice(index, 1); renderAlertsList(); } }, 300); } } // Pages List function initPagesList() { renderPagesList(); } function renderPagesList() { pagesList.innerHTML = pagesData.map((page, i) => ` <div class="bg-[--card] border border-[--border] rounded-xl p-5 hover:border-[--accent]/50 transition-colors cursor-pointer" onclick="selectPage(${i})"> <div class="flex items-start justify-between mb-4"> <div> <h4 class="font-medium">${page.name}</h4> <p class="text-xs text-[--muted] font-mono mt-1">${page.url}</p> </div> <div class="flex items-center gap-1"> ${getTrendIcon(page.trend)} </div> </div> <div class="mb-4"> <div class="flex items-center justify-between text-sm mb-2"> <span class="text-[--muted]">Parity Score</span> <span class="font-mono font-bold ${getScoreColor(page.score)}">${page.score}%</span> </div> <div class="h-2 bg-[--bg] rounded-full overflow-hidden"> <div class="h-full score-bar rounded-full transition-all duration-500" style="width: ${page.score}%"></div> </div> </div> <div class="flex items-center justify-between text-xs text-[--muted]"> <div class="flex items-center gap-3"> <span class="flex items-center gap-1"> <svg class="w-3 h-3 text-[--warning]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/> </svg> ${page.blocked} blocked </span> <span class="flex items-center gap-1"> <svg class="w-3 h-3 text-[--danger]" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/> </svg> ${page.diffs} diffs </span> </div> <span>Last scan: ${page.lastScan}</span> </div> </div> `).join(''); } function getTrendIcon(trend) { const icons = { up: '<svg class="w-5 h-5 text-[--success]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"/></svg>', down: '<svg class="w-5 h-5 text-[--danger]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 17h8m0 0v-8m0 8l-8-8-4 4-6-6"/></svg>', stable: '<svg class="w-5 h-5 text-[--muted]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14"/></svg>' }; return icons[trend] || ''; } function getScoreColor(score) { if (score >= 90) return 'text-[--success]'; if (score >= 75) return 'text-[--accent]'; if (score >= 60) return 'text-[--warning]'; return 'text-[--danger]'; } function selectPage(index) { currentPage = index; pageSelect.value = index; renderPreviews(index); renderDiffList(index); updateDiffScore(index); // Switch to diffs tab document.querySelector('[data-tab="diffs"]').click(); } // Filters function initFilters() { filterBtns.forEach(btn => { btn.addEventListener('click', () => { filterBtns.forEach(b => { b.classList.remove('bg-[--accent]', 'text-[--bg]'); b.classList.add('bg-[--bg]', 'text-[--muted]'); }); btn.classList.remove('bg-[--bg]', 'text-[--muted]'); btn.classList.add('bg-[--accent]', 'text-[--bg]'); currentFilter = btn.dataset.filter; renderResourcesTable(currentFilter); }); }); } // Page Select function initPageSelect() { pageSelect.addEventListener('change', (e) => { currentPage = parseInt(e.target.value); renderPreviews(currentPage); renderDiffList(currentPage); updateDiffScore(currentPage); }); } function updateDiffScore(pageIndex) { const diffs = diffData[pageIndex]; const avgSeverity = diffs.reduce((acc, d) => { const weights = { critical: 40, high: 20, medium: 10, low: 2 }; return acc + (weights[d.severity] || 0); }, 0); const score = Math.min(100, avgSeverity / diffs.length * 1.5).toFixed(1); document.getElementById('diffScore').textContent = `${score}%`; } // Scan Button function initScanButton() { scanBtn.addEventListener('click', () => { scanBtn.disabled = true; scanBtn.innerHTML = ` <svg class="w-4 h-4 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/> </svg> Scanning... `; // Simulate scan setTimeout(() => { // Update scores randomly pagesData.forEach(page => { const change = (Math.random() - 0.5) * 4; page.score = Math.min(100, Math.max(0, page.score + change)).toFixed(1); }); // Update overall score const avgScore = (pagesData.reduce((acc, p) => acc + parseFloat(p.score), 0) / pagesData.length).toFixed(1); document.getElementById('overallScore').textContent = `${avgScore}%`; // Re-render renderPagesList(); scanBtn.disabled = false; scanBtn.innerHTML = ` <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/> </svg> Run Scan `; showToast('Scan complete! All pages updated.', 'success'); }, 2000); }); } // Toast notifications function showToast(message, type = 'info') { const toast = document.createElement('div'); toast.className = `px-4 py-3 rounded-lg flex items-center gap-3 transform translate-x-full transition-transform duration-300 ${ type === 'success' ? 'bg-[--success] text-black' : type === 'error' ? 'bg-[--danger] text-white' : 'bg-[--card] border border-[--border]' }`; toast.innerHTML = ` <svg class="w-5 h-5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"> ${type === 'success' ? '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>' : '<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>'} </svg> <span class="text-sm font-medium">${message}</span> `; toastContainer.appendChild(toast); requestAnimationFrame(() => { toast.classList.remove('translate-x-full'); }); setTimeout(() => { toast.classList.add('translate-x-full'); setTimeout(() => toast.remove(), 300); }, 3000); } // Window resize handler let resizeTimeout; window.addEventListener('resize', () => { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(() => { renderPreviews(currentPage); }, 250); }); </script> </body> </html>Features Implemented
1. Render Diffs
- Side-by-side canvas visualization of desktop vs mobile rendering
- Animated scan line effect on desktop preview
- Diff regions highlighted with severity-coded dashed borders
- Detailed diff list with severity, type, and description
2. Blocked Resources
- Filterable table (All, Scripts, Styles, Fonts)
- Impact severity indicators (critical, high, medium, low)
- Resource type icons and reason for blocking
- Page association for each blocked resource
3. Parity Score
- Overall parity score with trend indicator
- Per-page parity scores with color-coded progress bars
- Gradient score bar (red → yellow → green)
- Real-time updates on scan
4. Regression Alerts
- Severity-coded alerts (critical, high, medium)
- Status tracking (new, investigating, acknowledged, fixed)
- Commit hash reference for each regression
- Actions: Mark Resolved, Dismiss
- Animated dismiss functionality
Design Highlights
- Dark technical aesthetic with cyan accent and grid background
- JetBrains Mono for code/data, Space Grotesk for UI
- Meaningful interactions: Tab navigation, page selection, filtering, scan simulation
- Staggered entrance animations with reduced-motion support
- Canvas-based visualizations for desktop/mobile previews