Files
Autoparts-DB/dashboard/nav.min.js
consultoria-as 21959f1b37 FASE 7d: Lazy Loading + Minificación + Auto-serve minified
Cambios implementados:

1. Lazy loading de imágenes:
   - catalog.js: loading="lazy" decoding="async" en part cards y detail panel
   - inventory.js: lazy loading en imagen de detalle de item

2. Minificación de assets:
   - scripts/minify-assets.sh: minifica JS (terser) y CSS para POS y Dashboard
   - 25 archivos .min.js + 5 .min.css generados en pos/static/
   - 14 archivos .min.js + 8 .min.css generados en dashboard/

3. Nginx auto-serve minified:
   - try_files $1.min.js antes de servir .js original
   - try_files $1.min.css antes de servir .css original
   - Transparente para los templates HTML (cero cambios en HTML)

4. Cache warming script:
   - scripts/warm_vehicle_cache.py: pobla Redis con vehicle info por batches
   - Mitiga DISTINCT ON + 4 JOINs sobre 2B filas
   - Corre en background, procesa ~1.5M parts

Tests: 73/73 pasando
2026-04-27 08:34:24 +00:00

1 line
3.3 KiB
JavaScript

!function(){"use strict";var e=window.location.pathname;function t(t){var a=t.replace(/\/+$/,"")||"/",n=e.replace(/\/+$/,"")||"/";return a===n||(!("/"!==a&&"/index.html"!==a||"/"!==n&&"/index.html"!==n)||(!("/admin.html"!==a&&"/admin"!==a||"/admin.html"!==n&&"/admin"!==n)||(!("/diagramas"!==a&&"/diagrams.html"!==a||"/diagramas"!==n&&"/diagrams.html"!==n)||("/customer-landing.html"===a&&"/customer-landing.html"===n||("/captura"===a&&"/captura"===n||("/pos"===a&&"/pos"===n||("/cuentas"===a&&"/cuentas"===n||("/tienda"===a&&"/tienda"===n||("/bodega"===a&&"/bodega"===n||!("/demo"!==a&&"/demo.html"!==a||"/demo"!==n&&"/demo.html"!==n))))))))))}var a='<header id="shared-nav-header" style="background: rgba(18, 18, 26, 0.95);backdrop-filter: blur(20px);-webkit-backdrop-filter: blur(20px);border-bottom: 1px solid var(--border);padding: 1rem 2rem;position: fixed;top: 0; left: 0; right: 0;z-index: 1000;"><div style="max-width: 1600px;margin: 0 auto;display: flex;justify-content: space-between;align-items: center;gap: 2rem;"><a href="/" style="display: flex;align-items: center;gap: 0.75rem;text-decoration: none;flex-shrink: 0;"><div style="width: 42px; height: 42px;background: linear-gradient(135deg, var(--accent) 0%, #ff4500 100%);border-radius: 10px;display: flex; align-items: center; justify-content: center;font-size: 1.5rem;box-shadow: 0 4px 20px var(--accent-glow);">⚙️</div><span style="font-family: Orbitron, sans-serif;font-size: 1.3rem;font-weight: 700;background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;background-clip: text;">NEXUS AUTOPARTS</span></a><div id="shared-nav-extra" style="display: contents;"></div><nav id="shared-nav-links" style="display: flex;gap: 1.5rem;align-items: center;flex-shrink: 0;">'+[{label:"Demo",href:"/demo"},{label:"Tienda",href:"/tienda"},{label:"Catálogo",href:"/index.html"},{label:"Captura",href:"/captura"},{label:"POS",href:"/pos"},{label:"Cuentas",href:"/cuentas"},{label:"Bodega",href:"/bodega"},{label:"Admin",href:"/admin"}].map((function(e){var a="text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s;";return t(e.href)?a+=" color: var(--accent);":a+=" color: var(--text-secondary);",'<a href="'+e.href+'" style="'+a+'" onmouseover="this.style.color=\'var(--accent)\'" onmouseout="'+(t(e.href)?"":"this.style.color='var(--text-secondary)'")+'">'+e.label+"</a>"})).join("")+'</nav><div id="nav-auth" style="display:flex;align-items:center;gap:0.75rem;flex-shrink:0;"><span id="nav-user-name" style="color:var(--text-secondary);font-size:0.85rem;"></span><a id="nav-auth-btn" href="/login.html" style="text-decoration:none;font-size:0.85rem;font-weight:500;color:var(--bg);background:var(--accent);padding:0.4rem 1rem;border-radius:6px;transition:opacity 0.2s;">Iniciar Sesión</a></div></div></header>',n=document.getElementById("shared-nav");n&&(n.innerHTML=a);var r=localStorage.getItem("access_token");if(r)try{var i=JSON.parse(atob(r.split(".")[1])),o=document.getElementById("nav-user-name"),l=document.getElementById("nav-auth-btn");o&&i.business_name?o.textContent=i.business_name:o&&(o.textContent=i.role||""),l&&(l.textContent="Salir",l.href="#",l.onclick=function(e){e.preventDefault(),localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token"),window.location.href="/login.html"})}catch(e){}}();