Files
localesp/src/AppMovil.jsx
T
2026-05-20 13:55:15 +02:00

384 lines
23 KiB
React
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useState, useEffect, useCallback } from "react";
import { suscribirLocales, enviarPropuesta, obtenerPalabrasFiltradas, contienepalabrasProhibidas } from "./firebase.js";
const CATEGORIAS = {
"Restauración": { emoji:"🍽️", color:"#8B0000", bg:"#FFF0F0", text:"#8B0000", subcategorias:["Tapas y raciones","Paella y arroces","Pintxos","Asador / Carne a la brasa","Mariscos y pescados","Bocadillos y montaditos","Menú del día","Cocina vasca","Cocina catalana","Cocina andaluza","Cocina gallega","Cocina madrileña","Cocina mediterránea","Pizzería","Hamburguesería","Comida rápida","Cocina internacional","Cafetería / Desayunos","Heladería","Pastelería"] },
"Pequeño comercio": { emoji:"🛍️", color:"#1A5276", bg:"#EBF5FB", text:"#1A5276", subcategorias:["Alimentación / Ultramarinos","Frutería","Carnicería","Pescadería","Panadería","Farmacia","Papelería / Librería","Floristería","Joyería / Relojería","Zapatería","Ropa y moda","Juguetería","Ferretería","Bazar / Todo a 100","Estanco","Quiosco","Óptica","Ortopedia","Tienda de mascotas","Electrodomésticos"] },
"Peluquería y estética": { emoji:"✂️", color:"#76448A", bg:"#F5EEF8", text:"#76448A", subcategorias:["Peluquería señora","Peluquería caballero","Peluquería unisex","Barbería","Centro de estética","Uñas / Manicura","Depilación","Masajes y spa","Tatuajes y piercings","Centro de bronceado","Micropigmentación"] },
"Servicios del hogar": { emoji:"🔧", color:"#1E8449", bg:"#EAFAF1", text:"#1E8449", subcategorias:["Cerrajería","Fontanería / Plomería","Electricidad","Reformas y construcción","Pintura","Carpintería","Cristalería","Climatización / Aire acondicionado","Mudanzas","Limpieza","Jardinería","Instalación solar","Alarmas y seguridad","Reparación electrodomésticos"] },
"Otros": { emoji:"📌", color:"#784212", bg:"#FDF2E9", text:"#784212", subcategorias:["Taller mecánico","Lavado de coches","Academia / Clases","Gestoría / Asesoría","Inmobiliaria","Agencia de viajes","Fotografía","Informática / Reparación móviles","Copistería / Imprenta","Veterinaria","Gimnasio / Fitness","Centro médico / Clínica","Fisioterapia","Psicología","Lavandería","Tintorería","Otro"] },
};
const CATS = Object.keys(CATEGORIAS);
const PROVINCIAS = ["Álava","Albacete","Alicante","Almería","Asturias","Ávila","Badajoz","Barcelona","Burgos","Cáceres","Cádiz","Cantabria","Castellón","Ciudad Real","Córdoba","Cuenca","Gerona","Granada","Guadalajara","Guipúzcoa","Huelva","Huesca","Islas Baleares","Jaén","La Coruña","La Rioja","Las Palmas","León","Lérida","Lugo","Madrid","Málaga","Murcia","Navarra","Orense","Palencia","Pontevedra","Salamanca","Santa Cruz de Tenerife","Segovia","Sevilla","Soria","Tarragona","Teruel","Toledo","Valencia","Valladolid","Vizcaya","Zamora","Zaragoza"];
const COORDS = {"Álava":[42.85,-2.67],"Albacete":[38.99,-1.86],"Alicante":[38.35,-0.48],"Almería":[36.83,-2.46],"Asturias":[43.36,-5.86],"Ávila":[40.66,-4.68],"Badajoz":[38.88,-6.97],"Barcelona":[41.39,2.17],"Burgos":[42.34,-3.70],"Cáceres":[39.48,-6.37],"Cádiz":[36.53,-6.29],"Cantabria":[43.46,-3.81],"Castellón":[39.99,-0.05],"Ciudad Real":[38.98,-3.93],"Córdoba":[37.89,-4.78],"Cuenca":[40.07,-2.14],"Gerona":[41.98,2.82],"Granada":[37.18,-3.60],"Guadalajara":[40.63,-3.16],"Guipúzcoa":[43.32,-1.98],"Huelva":[37.26,-6.94],"Huesca":[42.14,-0.41],"Islas Baleares":[39.57,2.65],"Jaén":[37.78,-3.78],"La Coruña":[43.36,-8.41],"La Rioja":[42.46,-2.44],"Las Palmas":[28.12,-15.44],"León":[42.60,-5.57],"Lérida":[41.62,0.62],"Lugo":[43.01,-7.56],"Madrid":[40.42,-3.70],"Málaga":[36.72,-4.42],"Murcia":[37.99,-1.13],"Navarra":[42.82,-1.64],"Orense":[42.34,-7.86],"Palencia":[42.01,-4.53],"Pontevedra":[42.43,-8.65],"Salamanca":[40.97,-5.66],"Santa Cruz de Tenerife":[28.46,-16.25],"Segovia":[40.94,-4.11],"Sevilla":[37.39,-5.98],"Soria":[41.76,-2.46],"Tarragona":[41.12,1.24],"Teruel":[40.34,-1.11],"Toledo":[39.86,-4.03],"Valencia":[39.47,-0.38],"Valladolid":[41.65,-4.72],"Vizcaya":[43.26,-2.94],"Zamora":[41.50,-5.74],"Zaragoza":[41.65,-0.89]};
async function geocodificar(dir) {
try {
const q = encodeURIComponent(dir + ", España");
const r = await fetch(`https://nominatim.openstreetmap.org/search?q=${q}&format=json&limit=1&countrycodes=es`, { headers:{"Accept-Language":"es","User-Agent":"LocalesMovil/1.0"} });
const d = await r.json();
if (d?.length) return { lat: parseFloat(d[0].lat), lng: parseFloat(d[0].lon) };
} catch {}
return null;
}
function parsearGoogleMaps(url) {
try {
let m = url.match(/@(-?\d+\.\d+),(-?\d+\.\d+)/);
if (m) return { lat: parseFloat(m[1]), lng: parseFloat(m[2]) };
m = url.match(/!3d(-?\d+\.\d+)!4d(-?\d+\.\d+)/);
if (m) return { lat: parseFloat(m[1]), lng: parseFloat(m[2]) };
} catch {}
return null;
}
// ─── Estilos base móvil ───────────────────────────────────────────────────────
const S = {
screen: { minHeight:"100dvh", display:"flex", flexDirection:"column", background:"#F8F5F0", fontFamily:"'Georgia', serif" },
header: { background:"#8B0000", color:"white", padding:"14px 16px 10px", position:"sticky", top:0, zIndex:10 },
headerTitle: { margin:0, fontSize:20, fontWeight:700, letterSpacing:"-0.3px" },
headerSub: { margin:"2px 0 0", fontSize:12, opacity:0.75 },
body: { flex:1, overflowY:"auto", padding:"12px 14px 80px" },
navBar: { position:"fixed", bottom:0, left:0, right:0, background:"white", borderTop:"1px solid #E5DDD5", display:"flex", zIndex:10, padding:"4px 0" },
navBtn: (active) => ({ flex:1, display:"flex", flexDirection:"column", alignItems:"center", gap:3, padding:"6px 0", background:"none", border:"none", cursor:"pointer", color: active ? "#8B0000" : "#999", fontSize:10, fontWeight: active ? 700 : 400 }),
navIcon: (active) => ({ fontSize:22, lineHeight:1, color: active ? "#8B0000" : "#999" }),
card: { background:"white", borderRadius:12, padding:"14px 16px", marginBottom:10, border:"1px solid #EEE8E0" },
badge: (cat) => { const c = CATEGORIAS[cat]; return { background: c?.bg||"#eee", color: c?.text||"#555", fontSize:11, padding:"3px 9px", borderRadius:20, fontWeight:500, display:"inline-block" }; },
input: { width:"100%", boxSizing:"border-box", padding:"11px 13px", borderRadius:10, border:"1px solid #DDD7CF", background:"white", fontSize:15, outline:"none", fontFamily:"inherit" },
label: { fontSize:12, color:"#888", display:"block", marginBottom:5, fontWeight:600, textTransform:"uppercase", letterSpacing:"0.4px" },
btn: (primary) => ({ width:"100%", padding:"13px", borderRadius:10, border:"none", cursor:"pointer", fontSize:15, fontWeight:700, background: primary ? "#8B0000" : "#F0EBE5", color: primary ? "white" : "#666", fontFamily:"inherit" }),
stars: (n) => "★".repeat(n)+"☆".repeat(5-n),
};
// ─── Pantalla: Lista ──────────────────────────────────────────────────────────
function PantallaLista({ locales, onDelete, onBuscar, busqueda, filtroCat, setFiltroCat }) {
const filtrados = locales.filter(l => {
const q = busqueda.toLowerCase();
return (!q || l.nombre.toLowerCase().includes(q) || (l.direccion||"").toLowerCase().includes(q) || l.provincia.toLowerCase().includes(q))
&& (!filtroCat || l.categoria === filtroCat);
});
return (
<>
<div style={{ marginBottom:12 }}>
<input style={S.input} placeholder="🔍 Buscar nombre, ciudad..." value={busqueda} onChange={e => onBuscar(e.target.value)} />
</div>
{/* Chips categoría */}
<div style={{ display:"flex", gap:6, overflowX:"auto", paddingBottom:8, marginBottom:10, scrollbarWidth:"none" }}>
<button onClick={() => setFiltroCat("")} style={{ ...S.badge("Restauración"), background: !filtroCat?"#8B0000":"#EEE8E0", color: !filtroCat?"white":"#777", flexShrink:0, cursor:"pointer", border:"none", fontFamily:"inherit" }}>Todos</button>
{CATS.map(c => (
<button key={c} onClick={() => setFiltroCat(filtroCat===c?"":c)}
style={{ ...S.badge(c), flexShrink:0, cursor:"pointer", border: filtroCat===c?"1.5px solid "+CATEGORIAS[c].color:"1px solid transparent", fontFamily:"inherit" }}>
{CATEGORIAS[c].emoji} {c}
</button>
))}
</div>
{filtrados.length === 0 ? (
<div style={{ textAlign:"center", padding:"3rem 1rem", color:"#AAA" }}>
<div style={{ fontSize:48, marginBottom:12 }}>🏘️</div>
<p style={{ margin:0, fontSize:15, color:"#888" }}>{locales.length===0 ? "¡Sé el primero en añadir un local!" : "Sin resultados"}</p>
</div>
) : filtrados.map(local => (
<div key={local.id} style={S.card}>
<div style={{ display:"flex", justifyContent:"space-between", alignItems:"flex-start", marginBottom:8 }}>
<div style={{ flex:1 }}>
<p style={{ margin:0, fontWeight:700, fontSize:16, color:"#1A1A1A" }}>{local.nombre}</p>
<p style={{ margin:"2px 0 0", fontSize:13, color:"#888" }}>📍 {local.provincia}</p>
</div>
<button onClick={() => onDelete(local.id)} style={{ background:"none", border:"none", color:"#CCC", fontSize:18, cursor:"pointer", padding:"0 0 0 8px" }}>✕</button>
</div>
<div style={{ display:"flex", flexWrap:"wrap", gap:5, marginBottom:8 }}>
<span style={S.badge(local.categoria)}>{CATEGORIAS[local.categoria]?.emoji} {local.categoria}</span>
{local.subcategoria && <span style={{ fontSize:11, color:"#888", padding:"3px 8px", background:"#F5F5F5", borderRadius:20 }}>{local.subcategoria}</span>}
</div>
{local.direccion && <p style={{ margin:"0 0 6px", fontSize:13, color:"#666" }}>{local.direccion}</p>}
<div style={{ display:"flex", justifyContent:"space-between", alignItems:"center" }}>
<span style={{ color:"#D4AF37", fontSize:18, letterSpacing:1 }}>{S.stars(local.puntuacion)}</span>
{(local.direccion || local.enlaceGoogleMaps) && (
<a href={local.enlaceGoogleMaps || `https://www.google.com/maps/search/${encodeURIComponent(local.nombre+" "+local.direccion)}`}
target="_blank" rel="noopener noreferrer"
style={{ fontSize:12, color:"#1A73E8", textDecoration:"none", background:"#E8F0FE", padding:"4px 10px", borderRadius:8, fontWeight:600 }}>
Maps ↗
</a>
)}
</div>
{local.descripcion && <p style={{ margin:"8px 0 0", fontSize:13, color:"#666", fontStyle:"italic" }}>"{local.descripcion}"</p>}
</div>
))}
</>
);
}
// ─── Pantalla: Añadir ─────────────────────────────────────────────────────────
function PantallaAnadir({ onGuardar }) {
const [form, setForm] = useState({ nombre:"", provincia:"", categoria:"", subcategoria:"", direccion:"", enlaceGoogleMaps:"", puntuacion:0, descripcion:"" });
const [modoUbic, setModoUbic] = useState("direccion");
const [geocodif, setGeocodif] = useState(null);
const [guardando, setGuardando] = useState(false);
const [ok, setOk] = useState(false);
const valido = form.nombre && form.provincia && form.categoria && form.puntuacion > 0 && (form.direccion || form.enlaceGoogleMaps);
const guardar = async () => {
if (!valido) return;
setGuardando(true);
let lat, lng;
if (modoUbic === "direccion" && form.direccion) {
const geo = await geocodificar(form.direccion);
if (geo) { lat = geo.lat; lng = geo.lng; }
} else if (form.enlaceGoogleMaps) {
const c = parsearGoogleMaps(form.enlaceGoogleMaps);
if (c) { lat = c.lat; lng = c.lng; }
}
if (!lat) {
const fb = COORDS[form.provincia] || [40.4,-3.7];
lat = fb[0] + (Math.random()-0.5)*0.04;
lng = fb[1] + (Math.random()-0.5)*0.04;
}
await onGuardar({ ...form, lat, lng, id: Date.now().toString(), fecha: new Date().toISOString() });
setOk(true);
setGuardando(false);
setTimeout(() => {
setOk(false);
setForm({ nombre:"", provincia:"", categoria:"", subcategoria:"", direccion:"", enlaceGoogleMaps:"", puntuacion:0, descripcion:"" });
setGeocodif(null);
}, 1500);
};
if (ok) return (
<div style={{ display:"flex", flexDirection:"column", alignItems:"center", justifyContent:"center", minHeight:"60vh", gap:16 }}>
<div style={{ fontSize:64 }}>✅</div>
<p style={{ fontSize:18, fontWeight:700, color:"#1E8449", margin:0 }}>¡Local añadido!</p>
<p style={{ fontSize:14, color:"#888", margin:0 }}>Sincronizando con la web...</p>
</div>
);
return (
<div style={{ paddingBottom:20 }}>
<div style={{ marginBottom:16 }}>
<label style={S.label}>Nombre del local *</label>
<input style={S.input} placeholder="Bar El Olivo, Clínica San José..." value={form.nombre} onChange={e => setForm(f=>({...f,nombre:e.target.value}))} />
</div>
<div style={{ marginBottom:16 }}>
<label style={S.label}>Provincia *</label>
<select style={S.input} value={form.provincia} onChange={e => setForm(f=>({...f,provincia:e.target.value}))}>
<option value="">Selecciona...</option>
{PROVINCIAS.map(p => <option key={p} value={p}>{p}</option>)}
</select>
</div>
<div style={{ marginBottom:16 }}>
<label style={S.label}>Categoría *</label>
<select style={S.input} value={form.categoria} onChange={e => setForm(f=>({...f,categoria:e.target.value,subcategoria:""}))}>
<option value="">Selecciona...</option>
{CATS.map(c => <option key={c} value={c}>{CATEGORIAS[c].emoji} {c}</option>)}
</select>
</div>
{form.categoria && (
<div style={{ marginBottom:16 }}>
<label style={S.label}>Tipo específico</label>
<select style={S.input} value={form.subcategoria} onChange={e => setForm(f=>({...f,subcategoria:e.target.value}))}>
<option value="">Selecciona...</option>
{CATEGORIAS[form.categoria].subcategorias.map(s => <option key={s} value={s}>{s}</option>)}
</select>
</div>
)}
{/* Ubicación */}
<div style={{ marginBottom:16 }}>
<label style={S.label}>Ubicación *</label>
<div style={{ display:"flex", border:"1px solid #DDD7CF", borderRadius:10, overflow:"hidden", marginBottom:8 }}>
{[{id:"direccion",label:"📍 Dirección"},{id:"enlace",label:"🔗 Google Maps"}].map(opt => (
<button key={opt.id} onClick={() => { setModoUbic(opt.id); setForm(f=>({...f,direccion:"",enlaceGoogleMaps:""})); setGeocodif(null); }}
style={{ flex:1, padding:"10px 6px", border:"none", background: modoUbic===opt.id?"#F0EBE5":"white", fontSize:13, cursor:"pointer", fontWeight: modoUbic===opt.id?700:400, color: modoUbic===opt.id?"#8B0000":"#666", fontFamily:"inherit" }}>
{opt.label}
</button>
))}
</div>
{modoUbic === "direccion" ? (
<input style={S.input} placeholder="Calle Mayor 5, Madrid..." value={form.direccion}
onChange={e => { setForm(f=>({...f,direccion:e.target.value})); setGeocodif(null); }} />
) : (
<input style={S.input} placeholder="Pega el enlace de Google Maps..." value={form.enlaceGoogleMaps}
onChange={e => {
const val = e.target.value;
setForm(f=>({...f,enlaceGoogleMaps:val}));
const c = parsearGoogleMaps(val);
setGeocodif(c ? "✅ Coordenadas detectadas" : val ? "⚠️ No se detectaron coordenadas" : null);
}} />
)}
{geocodif && <p style={{ fontSize:12, color:geocodif.startsWith("✅")?"#1E8449":"#784212", margin:"6px 0 0" }}>{geocodif}</p>}
</div>
{/* Puntuación */}
<div style={{ marginBottom:16 }}>
<label style={S.label}>Puntuación *</label>
<div style={{ display:"flex", gap:8 }}>
{[1,2,3,4,5].map(n => (
<button key={n} onClick={() => setForm(f=>({...f,puntuacion:n}))}
style={{ fontSize:32, background:"none", border:"none", cursor:"pointer", color: n<=form.puntuacion?"#D4AF37":"#DDD", padding:0 }}>★</button>
))}
</div>
</div>
<div style={{ marginBottom:24 }}>
<label style={S.label}>Descripción (opcional)</label>
<textarea style={{ ...S.input, minHeight:80, resize:"vertical" }} placeholder="Horarios, especialidades, qué lo hace especial..."
value={form.descripcion} onChange={e => setForm(f=>({...f,descripcion:e.target.value}))} />
</div>
<button onClick={guardar} disabled={!valido||guardando} style={{ ...S.btn(true), opacity: valido?1:0.4 }}>
{guardando ? "Enviando..." : "📨 Enviar propuesta"}
</button>
</div>
);
}
// ─── Pantalla: Estadísticas ───────────────────────────────────────────────────
function PantallaStats({ locales }) {
const media = locales.length ? (locales.reduce((s,l)=>s+l.puntuacion,0)/locales.length).toFixed(1) : "—";
const provincias = [...new Set(locales.map(l=>l.provincia))].length;
const porCat = CATS.map(c => ({ cat:c, n: locales.filter(l=>l.categoria===c).length })).filter(x=>x.n>0).sort((a,b)=>b.n-a.n);
const top5 = [...locales].sort((a,b)=>b.puntuacion-a.puntuacion).slice(0,5);
return (
<>
<div style={{ display:"grid", gridTemplateColumns:"1fr 1fr", gap:10, marginBottom:14 }}>
{[{v:locales.length,l:"Locales"},{v:provincias,l:"Provincias"},{v:media,l:"Media ★"},{v:porCat.length,l:"Categorías"}].map(s=>(
<div key={s.l} style={{ background:"white", borderRadius:12, padding:"14px 16px", border:"1px solid #EEE8E0", textAlign:"center" }}>
<p style={{ margin:0, fontSize:11, color:"#AAA", textTransform:"uppercase", letterSpacing:"0.5px", fontWeight:600 }}>{s.l}</p>
<p style={{ margin:"6px 0 0", fontSize:28, fontWeight:700, color:"#1A1A1A" }}>{s.v}</p>
</div>
))}
</div>
{porCat.length > 0 && (
<div style={S.card}>
<p style={{ margin:"0 0 12px", fontWeight:700, fontSize:14, color:"#555", textTransform:"uppercase", letterSpacing:"0.4px" }}>Por categoría</p>
{porCat.map(({cat,n}) => {
const pct = Math.round((n/locales.length)*100);
return (
<div key={cat} style={{ marginBottom:10 }}>
<div style={{ display:"flex", justifyContent:"space-between", marginBottom:4 }}>
<span style={{ fontSize:14 }}>{CATEGORIAS[cat].emoji} {cat}</span>
<span style={{ fontSize:13, fontWeight:700, color:CATEGORIAS[cat].color }}>{n}</span>
</div>
<div style={{ background:"#F0EBE5", borderRadius:4, height:6, overflow:"hidden" }}>
<div style={{ height:"100%", background:CATEGORIAS[cat].color, width:pct+"%", borderRadius:4 }} />
</div>
</div>
);
})}
</div>
)}
{top5.length > 0 && (
<div style={S.card}>
<p style={{ margin:"0 0 12px", fontWeight:700, fontSize:14, color:"#555", textTransform:"uppercase", letterSpacing:"0.4px" }}>Top valorados</p>
{top5.map((l,i) => (
<div key={l.id} style={{ display:"flex", alignItems:"center", gap:10, marginBottom:10 }}>
<span style={{ fontSize:18, fontWeight:700, color:"#D4AF37", minWidth:24 }}>#{i+1}</span>
<div style={{ flex:1 }}>
<p style={{ margin:0, fontSize:14, fontWeight:600 }}>{l.nombre}</p>
<p style={{ margin:0, fontSize:12, color:"#888" }}>{l.provincia}</p>
</div>
<span style={{ color:"#D4AF37", fontSize:14 }}>{"★".repeat(l.puntuacion)}</span>
</div>
))}
</div>
)}
<p style={{ textAlign:"center", fontSize:12, color:"#BBB", marginTop:16 }}>
Datos sincronizados con la versión web
</p>
</>
);
}
// ─── App principal ────────────────────────────────────────────────────────────
export default function AppMovil() {
const [tab, setTab] = useState("lista");
const [locales, setLocales] = useState([]);
const [loading, setLoading] = useState(true);
const [busqueda, setBusqueda] = useState("");
const [filtroCat, setFiltroCat] = useState("");
const [palabrasProhibidas, setPalabrasProhibidas] = useState([]);
const cargar = useCallback(() => {}, []); // Firestore ya escucha en tiempo real
useEffect(() => {
setLoading(true);
const unsub = suscribirLocales(
(lista) => { setLocales(lista); setLoading(false); },
() => { setLocales([]); setLoading(false); }
);
return () => unsub();
}, []);
useEffect(() => { obtenerPalabrasFiltradas().then(p => setPalabrasProhibidas(p)); }, []);
const addLocal = async (local) => {
// Comprobar filtro de palabras
const texto = [local.nombre, local.descripcion||"", local.direccion||""].join(" ");
if (contienepalabrasProhibidas(texto, palabrasProhibidas)) {
alert("Tu propuesta contiene palabras no permitidas. Por favor, revísala.");
return;
}
try { await enviarPropuesta(local); } catch(e) { console.error(e); }
};
const delLocal = null; // Solo el admin puede eliminar locales
const TABS = [
{ id:"lista", icon:"🗂️", label:"Lista" },
{ id:"anadir", icon:"➕", label:"Añadir" },
{ id:"stats", icon:"📊", label:"Stats" },
];
return (
<div style={S.screen}>
{/* Header */}
<div style={S.header}>
<div style={{ display:"flex", alignItems:"center", gap:10 }}>
<span style={{ fontSize:26 }}>🇪🇸</span>
<div>
<h1 style={S.headerTitle}>Locales Españoles</h1>
<p style={S.headerSub}>{loading ? "Cargando..." : `${locales.length} ${locales.length===1?"local":"locales"} · sincronizado`}</p>
</div>
<button onClick={cargar} style={{ marginLeft:"auto", background:"rgba(255,255,255,0.2)", border:"none", borderRadius:8, padding:"6px 10px", color:"white", cursor:"pointer", fontSize:18 }}>↻</button>
</div>
</div>
{/* Contenido */}
<div style={S.body}>
{loading ? (
<div style={{ textAlign:"center", padding:"4rem 1rem", color:"#AAA" }}>
<p style={{ fontSize:32, margin:"0 0 12px" }}>⏳</p>
<p style={{ margin:0, fontSize:15 }}>Sincronizando con la web...</p>
</div>
) : tab === "lista" ? (
<PantallaLista locales={locales} onDelete={null} onBuscar={setBusqueda} busqueda={busqueda} filtroCat={filtroCat} setFiltroCat={setFiltroCat} />
) : tab === "anadir" ? (
<PantallaAnadir onGuardar={async (local) => { await addLocal(local); setTab("lista"); }} />
) : (
<PantallaStats locales={locales} />
)}
</div>
{/* Nav bar inferior */}
<nav style={S.navBar}>
{TABS.map(t => (
<button key={t.id} onClick={() => setTab(t.id)} style={S.navBtn(tab===t.id)}>
<span style={S.navIcon(tab===t.id)}>{t.icon}</span>
{t.label}
</button>
))}
</nav>
</div>
);
}