App y Dashboard appdashboardsaasfoodtrackingmapdeliveryanimationsvg
Food Order Map
Seguimiento en vivo del pedido: mapa animado con repartidor avanzando por la ruta, tiempo estimado, línea de fases, tarjeta del rider y resumen del ticket.
Vista Previa en Vivo
Llega en 18 min
Pedido BF-4821 · 21:02
¡Hola, Lucía! Tu pedido está en marcha
- Pedido recibido La cocina lo ha aceptado
- En cocina Plancha encendida
- En camino Samira va hacia ti
- Entregado ¡Que aproveche!
Demo: el pedido avanza en tiempo acelerado.
Tu pedido · 32,80 €
- 2× Doble Smash Lavapiés25,80 €
- 2× Limonada de hierbabuena7,00 €
Entrega en C/ Argumosa 14, 3.º B
Uso
Copia y pega este código directamente en tu página de Astro:
astro
---
import { FoodOrderMap } from 'astro-component-kit/app';
---
<FoodOrderMap tracking={foodTracking} durationSec={60} /> ---
import { FoodOrderMap } from 'astro-component-kit/app';
---
<FoodOrderMap tracking={foodTracking} durationSec={60} /> Ejemplos en contexto
Código real del kit: cómo se usa esta pieza dentro de plantillas, secciones y otros componentes.
FoodTrackingPage.astro astro
<FoodOrderMap tracking={data.tracking} dishes={data.dishes} durationSec={60} /> <FoodOrderMap tracking={data.tracking} dishes={data.dishes} durationSec={60} /> Se usa en
Instalación Manual
Si no estás usando el paquete npm, crea un archivo nuevo y pega el siguiente código: src/components/lib/FoodOrderMap.astro:
astro
---
/**
* FoodOrderMap — Live order tracking on an illustrated city map. The route draws itself from the
* kitchen to the door, the rider marker drives along the streets (turning at each corner), the ETA
* counts down and the status steps advance: received → cooking → on the way → delivered, ending
* with a sticker burst and a quick rating. Runs as an accelerated demo you can pause, speed up or
* restart; feed it real progress with the `progress` attribute.
*
* @param {typeof foodTracking} tracking - Order id, address, rider, lines, map points and route.
* @param {FoodDish[]} dishes - Used to name and price the order lines.
* @param {number} durationSec - Length of the demo from order to door (seconds). Default 60.
* @param {boolean} autoplay - Start the demo on load (paused with reduced motion). Default true.
* @param {string} variant - 'split' (map + panel side by side) | 'stacked'. Default 'split'.
* @param {string} size - 'md' | 'lg' map height. Default 'md'.
* @param {string} class - Extra class for the root.
*
* Accessibility: the map is an <svg role="img"> whose label is updated with the rider's progress;
* the status list marks the current step with aria-current; phase changes are announced in a
* polite live region; controls are buttons with aria-pressed; the rating uses native radios.
* prefers-reduced-motion disables autoplay, transitions and the sticker burst.
*/
import type { HTMLAttributes } from 'astro/types';
import '../templates/food-delivery/food-theme.css';
import { foodTracking, foodDishes, type FoodDish } from '../templates/food-delivery/data';
interface OwnProps {
tracking?: typeof foodTracking;
dishes?: FoodDish[];
durationSec?: number;
autoplay?: boolean;
variant?: 'split' | 'stacked';
size?: 'md' | 'lg';
}
type Props = OwnProps & Omit<HTMLAttributes<'section'>, keyof OwnProps | 'class'> & { class?: string };
const {
tracking = foodTracking,
dishes = foodDishes,
durationSec = 60,
autoplay = true,
variant = 'split',
size = 'md',
class: classAttr,
...rest
} = Astro.props;
const eur = (n: number) => n.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
const lines = tracking.lines.map((l) => {
const d = dishes.find((x) => x.id === l.dishId);
return { qty: l.qty, name: d?.name ?? l.dishId, total: (d?.price ?? 0) * l.qty };
});
const total = lines.reduce((s, l) => s + l.total, 0);
const routeD = tracking.route.map((p, i) => `${i ? 'L' : 'M'}${p[0]} ${p[1]}`).join(' ');
const steps = [
{ key: 'recibido', label: 'Pedido recibido', hint: 'La cocina lo ha aceptado' },
{ key: 'cocina', label: 'En cocina', hint: 'Plancha encendida' },
{ key: 'camino', label: 'En camino', hint: `${tracking.rider.name} va hacia ti` },
{ key: 'entregado', label: 'Entregado', hint: '¡Que aproveche!' },
];
const blocks = [
[4, 4, 10, 18], [24, 4, 14, 14], [48, 4, 12, 14], [70, 4, 26, 14],
[24, 30, 14, 10], [48, 30, 12, 10], [70, 30, 26, 22],
[4, 50, 10, 20], [24, 50, 14, 6], [48, 50, 12, 6],
[4, 84, 32, 12], [48, 66, 12, 30], [70, 62, 8, 12], [70, 84, 6, 12], [88, 62, 8, 12],
];
const vehicleLabel = { bici: 'bici eléctrica', moto: 'moto eléctrica', patinete: 'patinete' }[tracking.rider.vehicle];
const telHref = `tel:${tracking.rider.phone.replace(/\s+/g, '')}`;
---
<section
class:list={['bf-ui', 'bf-track', `bf-track--${variant}`, `bf-track--${size}`, classAttr]}
aria-labelledby="bf-track-h"
data-bf-track
data-duration={durationSec}
data-autoplay={autoplay ? 'true' : 'false'}
data-eta={tracking.etaMin}
data-rider={tracking.rider.name}
{...rest}
>
<div class="bf-track__mapwrap">
<svg class="bf-track__map" viewBox="0 0 100 100" role="img" aria-label="Mapa del reparto" data-map>
<rect width="100" height="100" class="m-ground" />
<path d="M0 92 C 20 86, 30 98, 50 90 S 80 84, 100 92 V100 H0z" class="m-river" />
<rect x="4" y="26" width="10" height="16" rx="2" class="m-park" />
<g class="m-trees"><circle cx="7" cy="31" r="2" /><circle cx="11" cy="36" r="2" /><circle cx="7" cy="39" r="1.6" /></g>
{blocks.map((b) => <rect x={b[0]} y={b[1]} width={b[2]} height={b[3]} rx="2" class="m-block" />)}
<path d={routeD} class="m-route-bg" />
<path d={routeD} class="m-route" data-route pathLength="1" />
<g class="m-pin m-pin--kitchen" transform={`translate(${tracking.kitchen.x} ${tracking.kitchen.y})`}>
<circle r="5" /><path d="M-2 -1.5h4M-2 0.5h4M-1 -3v6" />
</g>
<g class="m-pin m-pin--home" transform={`translate(${tracking.home.x} ${tracking.home.y})`}>
<circle r="9" class="m-pulse" /><circle r="5" /><path d="M-2.5 1.5v-2l2.5-2 2.5 2v2z" />
</g>
<g class="m-rider" data-marker transform={`translate(${tracking.kitchen.x} ${tracking.kitchen.y})`}>
<g data-marker-rot>
<circle r="4.6" class="m-rider-bg" />
<path d="M-2.4 0h4.8M0.6 -2l2 2-2 2" class="m-rider-arrow" />
</g>
</g>
</svg>
<div class="bf-track__burst" aria-hidden="true" data-burst></div>
<div class="bf-track__eta">
<span class="bf-track__eta-label">Llega en</span>
<strong data-eta-out>{tracking.etaMin} min</strong>
</div>
</div>
<div class="bf-track__panel">
<header class="bf-track__head">
<p class="bf-track__kicker">Pedido <span data-order>{tracking.orderId}</span> · {tracking.placedAt}</p>
<h1 id="bf-track-h" class="bf-track__title" data-title>¡Hola, {tracking.customer}! Tu pedido está en marcha</h1>
</header>
<ol class="bf-track__steps" data-steps>
{steps.map((s, i) => (
<li class="bf-track__step" data-step={i} aria-current={i === 0 ? 'step' : undefined}>
<span class="bf-track__dot" aria-hidden="true"></span>
<span class="bf-track__label">{s.label}</span>
<span class="bf-track__hint">{s.hint}</span>
</li>
))}
</ol>
<div class="bf-track__rider">
<span class="bf-track__avatar" aria-hidden="true">{tracking.rider.name.charAt(0)}</span>
<div class="bf-track__rider-info">
<strong>{tracking.rider.name}</strong>
<span>{vehicleLabel} · ★ {tracking.rider.rating.toLocaleString('es-ES')}</span>
</div>
<a class="bf-track__call" href={telHref} aria-label={`Llamar a ${tracking.rider.name}`}>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2" /></svg>
</a>
</div>
<div class="bf-track__controls" role="group" aria-label="Controles de la demostración">
<button type="button" class="bf-track__ctl" data-play aria-pressed="false">Pausar</button>
<button type="button" class="bf-track__ctl" data-fast aria-pressed="false">Velocidad ×4</button>
<button type="button" class="bf-track__ctl" data-reset>Reiniciar</button>
</div>
<p class="bf-track__demo">Demo: el pedido avanza en tiempo acelerado.</p>
<details class="bf-track__receipt">
<summary>Tu pedido · {eur(total)} €</summary>
<ul role="list">
{lines.map((l) => <li><span>{l.qty}× {l.name}</span><span>{eur(l.total)} €</span></li>)}
</ul>
<p>Entrega en <strong>{tracking.address}</strong></p>
</details>
<form class="bf-track__rate" data-rate hidden>
<fieldset>
<legend>¿Qué tal ha ido?</legend>
<div class="bf-track__stars">
{[5, 4, 3, 2, 1].map((n) => (
<>
<input type="radio" id={`bf-rate-${n}`} name="rate" value={n} />
<label for={`bf-rate-${n}`} title={`${n} estrellas`}><span class="bf-sr">{n} estrellas</span>★</label>
</>
))}
</div>
</fieldset>
<p class="bf-track__thanks" data-thanks></p>
</form>
<p class="bf-sr" role="status" aria-live="polite" data-live></p>
</div>
</section>
<script>
function initFoodTrack() {
document.querySelectorAll<HTMLElement>('[data-bf-track]').forEach((root) => {
if (root.dataset.bound) return;
root.dataset.bound = 'true';
const $ = <T extends Element = HTMLElement>(s: string) => root.querySelector<T>(s)!;
const route = $<SVGPathElement>('[data-route]');
const marker = $<SVGGElement>('[data-marker]');
const rot = $<SVGGElement>('[data-marker-rot]');
const map = $<SVGSVGElement>('[data-map]');
const steps = [...root.querySelectorAll<HTMLElement>('[data-step]')];
const live = $('[data-live]');
const etaOut = $('[data-eta-out]');
const playBtn = $<HTMLButtonElement>('[data-play]');
const fastBtn = $<HTMLButtonElement>('[data-fast]');
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const duration = Number(root.dataset.duration || 60) * 1000;
const eta = Number(root.dataset.eta || 18);
const rider = root.dataset.rider || 'El rider';
const len = route.getTotalLength();
const phaseText = ['Pedido recibido por la cocina.', 'Tu pedido se está cocinando.', `${rider} ha recogido tu pedido y va hacia ti.`, '¡Pedido entregado! Que aproveche.'];
const id = new URLSearchParams(location.search).get('pedido');
if (id) $('[data-order]').textContent = id;
let p = 0;
let playing = false;
let speed = 1;
let last = 0;
let phase = -1;
const phaseOf = (x: number) => (x >= 1 ? 3 : x >= 0.42 ? 2 : x >= 0.12 ? 1 : 0);
const draw = () => {
const drive = Math.min(1, Math.max(0, (p - 0.42) / 0.58));
route.style.strokeDashoffset = String(1 - drive);
const pt = route.getPointAtLength(drive * len);
const ahead = route.getPointAtLength(Math.min(len, drive * len + 0.8));
const ang = (Math.atan2(ahead.y - pt.y, ahead.x - pt.x) * 180) / Math.PI;
marker.setAttribute('transform', `translate(${pt.x.toFixed(2)} ${pt.y.toFixed(2)})`);
if (drive < 1) rot.setAttribute('transform', `rotate(${ang.toFixed(1)})`);
const left = Math.max(0, Math.ceil(eta * (1 - p)));
etaOut.textContent = p >= 1 ? '¡Ya está!' : `${left} min`;
map.setAttribute('aria-label', p >= 1 ? 'Mapa del reparto: pedido entregado' : drive ? `Mapa del reparto: ${rider} ha recorrido el ${Math.round(drive * 100)} % del camino` : 'Mapa del reparto: el pedido aún está en la cocina');
const ph = phaseOf(p);
if (ph !== phase) {
phase = ph;
root.dataset.phase = String(ph);
steps.forEach((s, i) => {
s.toggleAttribute('data-done', i < ph || ph === 3);
if (i === ph) s.setAttribute('aria-current', 'step');
else s.removeAttribute('aria-current');
});
live.textContent = phaseText[ph];
if (ph === 3) done();
}
};
const done = () => {
setPlaying(false);
$('[data-rate]').hidden = false;
$('[data-title]').textContent = '¡Entregado! Que aproveche';
if (reduce) return;
const burst = $('[data-burst]');
burst.innerHTML = '';
const colors = ['var(--bf-tomato)', 'var(--bf-mustard)', 'var(--bf-mint)', 'var(--bf-sky)'];
for (let i = 0; i < 18; i++) {
const s = document.createElement('i');
const a = (i / 18) * Math.PI * 2;
s.style.setProperty('--x', `${Math.cos(a) * (90 + Math.random() * 60)}px`);
s.style.setProperty('--y', `${Math.sin(a) * (90 + Math.random() * 60)}px`);
s.style.background = colors[i % 4];
burst.append(s);
}
burst.classList.remove('is-on');
void burst.offsetWidth;
burst.classList.add('is-on');
};
const tick = (t: number) => {
if (!playing) return;
const dt = last ? t - last : 0;
last = t;
p = Math.min(1, p + (dt / duration) * speed);
draw();
if (p < 1) requestAnimationFrame(tick);
};
const setPlaying = (on: boolean) => {
playing = on && p < 1;
playBtn.textContent = playing ? 'Pausar' : p >= 1 ? 'Terminado' : 'Reanudar';
playBtn.setAttribute('aria-pressed', String(!playing));
if (playing) {
last = 0;
requestAnimationFrame(tick);
}
};
playBtn.addEventListener('click', () => setPlaying(!playing));
fastBtn.addEventListener('click', () => {
speed = speed === 1 ? 4 : 1;
fastBtn.setAttribute('aria-pressed', String(speed === 4));
});
$('[data-reset]').addEventListener('click', () => {
p = 0;
phase = -1;
$('[data-rate]').hidden = true;
$('[data-title]').textContent = 'Tu pedido está en marcha';
draw();
setPlaying(true);
});
$('[data-rate]').addEventListener('change', (e) => {
const v = (e.target as HTMLInputElement).value;
$('[data-thanks]').textContent = `¡Gracias! Has valorado el pedido con ${v} ${v === '1' ? 'estrella' : 'estrellas'}.`;
});
// External progress (0–1), e.g. from your own websocket.
new MutationObserver(() => {
const v = Number(root.getAttribute('progress'));
if (!Number.isNaN(v)) {
p = Math.min(1, Math.max(0, v));
draw();
}
}).observe(root, { attributes: true, attributeFilter: ['progress'] });
draw();
setPlaying(root.dataset.autoplay === 'true' && !reduce);
});
}
initFoodTrack();
document.addEventListener('astro:page-load', initFoodTrack);
</script>
<style>
.bf-track {
position: relative;
display: grid;
gap: var(--sp-5, 1.25rem);
color: var(--bf-ink);
font-family: var(--bf-font-body);
}
@media (min-width: 900px) {
.bf-track--split {
grid-template-columns: 1.35fr 1fr;
align-items: start;
}
}
.bf-track__mapwrap {
position: relative;
border: 3px solid var(--bf-outline);
border-radius: 28px;
overflow: hidden;
box-shadow: var(--bf-shadow-lg);
background: var(--bf-paper);
}
.bf-track__map {
display: block;
width: 100%;
height: auto;
aspect-ratio: 1;
max-height: 70vh;
}
.bf-track--lg .bf-track__map {
max-height: 82vh;
}
.bf-track__map .m-ground { fill: var(--bf-bg-2); }
.bf-track__map .m-block { fill: var(--bf-paper); stroke: var(--bf-line); stroke-width: 0.4; }
.bf-track__map .m-park { fill: var(--bf-mint-soft); stroke: var(--bf-mint); stroke-width: 0.4; }
.bf-track__map .m-trees { fill: var(--bf-mint); }
.bf-track__map .m-river { fill: var(--bf-sky-soft); }
.bf-track__map .m-route-bg { fill: none; stroke: var(--bf-ink-3); stroke-width: 1.2; stroke-dasharray: 1.6 1.6; stroke-linecap: round; opacity: 0.6; }
.bf-track__map .m-route { fill: none; stroke: var(--bf-tomato); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.bf-track__map .m-pin circle { fill: var(--bf-mustard); stroke: var(--bf-outline); stroke-width: 0.9; }
.bf-track__map .m-pin path { fill: none; stroke: var(--bf-outline); stroke-width: 0.8; stroke-linecap: round; }
.bf-track__map .m-pin--home circle { fill: var(--bf-mint); }
.bf-track__map .m-pin--home path { fill: var(--bf-paper); }
.bf-track__map .m-pin--home .m-pulse { fill: var(--bf-mint); stroke: none; opacity: 0.3; transform-box: fill-box; transform-origin: center; animation: bf-track-pulse 1.6s ease-out infinite; }
.bf-track__map .m-rider-bg { fill: var(--bf-ink); stroke: var(--bf-paper); stroke-width: 1; }
.bf-track__map .m-rider-arrow { fill: none; stroke: var(--bf-mustard); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.bf-track[data-phase='1'] .m-pin--kitchen circle {
animation: bf-track-cook 0.6s ease-in-out infinite alternate;
transform-box: fill-box;
transform-origin: center;
}
.bf-track__eta {
position: absolute;
top: var(--sp-3, 0.75rem);
left: var(--sp-3, 0.75rem);
display: grid;
padding: 8px 14px;
border: 3px solid var(--bf-outline);
border-radius: 16px;
background: var(--bf-mustard);
color: var(--bf-on-mustard);
box-shadow: 3px 3px 0 var(--bf-outline);
transform: rotate(-3deg);
}
.bf-track__eta-label {
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.bf-track__eta strong {
font-family: var(--bf-font-display);
font-size: clamp(1.6rem, 5vw, 2.4rem);
line-height: 1;
}
.bf-track__burst {
position: absolute;
inset: 0;
pointer-events: none;
}
.bf-track__burst :global(i) {
position: absolute;
left: 80%;
top: 78%;
width: 14px;
height: 14px;
border: 2px solid var(--bf-outline);
border-radius: 4px;
opacity: 0;
}
.bf-track__burst.is-on :global(i) {
animation: bf-track-burst 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.bf-track__panel {
position: relative;
display: grid;
gap: var(--sp-4, 1rem);
padding: var(--sp-5, 1.25rem);
border: 3px solid var(--bf-outline);
border-radius: 28px;
background: var(--bf-paper);
box-shadow: var(--bf-shadow);
}
.bf-track__kicker {
margin: 0;
color: var(--bf-ink-3);
font-weight: 700;
font-size: 0.9rem;
}
.bf-track__title {
margin: 4px 0 0;
font-family: var(--bf-font-display);
font-size: clamp(1.5rem, 4vw, 2rem);
font-weight: 800;
line-height: 1.1;
}
.bf-track__steps {
position: relative;
display: grid;
gap: 2px;
margin: 0;
padding: 0;
list-style: none;
}
.bf-track__step {
position: relative;
display: grid;
grid-template-columns: 28px 1fr;
column-gap: 12px;
padding: 8px 0;
color: var(--bf-ink-3);
}
.bf-track__step::before {
content: '';
position: absolute;
left: 12px;
top: 30px;
bottom: -8px;
width: 4px;
border-radius: 4px;
background: var(--bf-line);
}
.bf-track__step:last-child::before {
display: none;
}
.bf-track__step[data-done]::before {
background: var(--bf-mint);
}
.bf-track__dot {
grid-row: span 2;
width: 28px;
height: 28px;
border: 3px solid var(--bf-line);
border-radius: 50%;
background: var(--bf-paper);
transition: background 0.3s ease, transform 0.4s var(--bf-ease-pop);
}
.bf-track__step[data-done] .bf-track__dot {
border-color: var(--bf-outline);
background: var(--bf-mint);
}
.bf-track__step[aria-current='step'] {
color: var(--bf-ink);
}
.bf-track__step[aria-current='step'] .bf-track__dot {
border-color: var(--bf-outline);
background: var(--bf-tomato);
transform: scale(1.15);
box-shadow: 0 0 0 6px var(--bf-pink-soft);
}
.bf-track__label {
font-weight: 800;
}
.bf-track__hint {
font-size: 0.88rem;
}
.bf-track__rider {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
border: 2px solid var(--bf-outline);
border-radius: 18px;
background: var(--bf-bg);
}
.bf-track__avatar {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border: 2px solid var(--bf-outline);
border-radius: 50%;
background: var(--bf-mustard);
color: var(--bf-on-mustard);
font-family: var(--bf-font-display);
font-weight: 800;
font-size: 1.3rem;
}
.bf-track__rider-info {
flex: 1;
min-width: 0;
display: grid;
}
.bf-track__rider-info span {
color: var(--bf-ink-2);
font-size: 0.88rem;
}
.bf-track__call {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border: 2px solid var(--bf-outline);
border-radius: 50%;
background: var(--bf-mint);
color: var(--bf-paper);
}
.bf-track__controls {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.bf-track__ctl {
min-height: 44px;
padding: 0 1rem;
border: 2px solid var(--bf-outline);
border-radius: 999px;
background: var(--bf-paper);
color: var(--bf-ink);
font: inherit;
font-weight: 700;
cursor: pointer;
}
.bf-track__ctl[data-fast][aria-pressed='true'] {
background: var(--bf-mustard);
color: var(--bf-on-mustard);
}
.bf-track__ctl:focus-visible,
.bf-track__call:focus-visible,
.bf-track__receipt summary:focus-visible,
.bf-track__stars input:focus-visible + label {
outline: 3px solid var(--bf-sky);
outline-offset: 2px;
}
.bf-track__demo {
margin: -6px 0 0;
color: var(--bf-ink-3);
font-size: 0.82rem;
}
.bf-track__receipt {
border-top: 2px dashed var(--bf-line);
padding-top: var(--sp-3, 0.75rem);
}
.bf-track__receipt summary {
display: flex;
align-items: center;
min-height: 44px;
font-weight: 800;
cursor: pointer;
}
.bf-track__receipt ul {
display: grid;
gap: 6px;
margin: 6px 0;
padding: 0;
list-style: none;
}
.bf-track__receipt li {
display: flex;
justify-content: space-between;
gap: 12px;
color: var(--bf-ink-2);
}
.bf-track__receipt p {
margin: 8px 0 0;
color: var(--bf-ink-2);
font-size: 0.92rem;
}
.bf-track__rate fieldset {
margin: 0;
padding: var(--sp-3, 0.75rem);
border: 3px solid var(--bf-outline);
border-radius: 18px;
background: var(--bf-mint-soft);
}
.bf-track__rate legend {
padding: 0 6px;
font-family: var(--bf-font-display);
font-weight: 800;
font-size: 1.2rem;
}
.bf-track__stars {
display: flex;
flex-direction: row-reverse;
justify-content: flex-end;
gap: 4px;
}
.bf-track__stars input {
position: absolute;
opacity: 0;
width: 1px;
height: 1px;
}
.bf-track__stars label {
display: grid;
place-items: center;
width: 44px;
height: 44px;
color: var(--bf-ink-3);
font-size: 2rem;
cursor: pointer;
transition: transform 0.2s var(--bf-ease-pop), color 0.2s ease;
}
.bf-track__stars label:hover,
.bf-track__stars label:hover ~ label,
.bf-track__stars input:checked ~ label {
color: var(--bf-warn);
transform: scale(1.15);
}
.bf-track__thanks {
margin: 8px 0 0;
font-weight: 700;
}
@keyframes bf-track-pulse { from { transform: scale(0.6); opacity: 0.5; } to { transform: scale(1.8); opacity: 0; } }
@keyframes bf-track-cook { to { transform: scale(1.25); } }
@keyframes bf-track-burst {
0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(0.4); }
100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(540deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.bf-track *,
.bf-track__map * {
animation: none !important;
transition: none !important;
}
}
</style> ---
/**
* FoodOrderMap — Live order tracking on an illustrated city map. The route draws itself from the
* kitchen to the door, the rider marker drives along the streets (turning at each corner), the ETA
* counts down and the status steps advance: received → cooking → on the way → delivered, ending
* with a sticker burst and a quick rating. Runs as an accelerated demo you can pause, speed up or
* restart; feed it real progress with the `progress` attribute.
*
* @param {typeof foodTracking} tracking - Order id, address, rider, lines, map points and route.
* @param {FoodDish[]} dishes - Used to name and price the order lines.
* @param {number} durationSec - Length of the demo from order to door (seconds). Default 60.
* @param {boolean} autoplay - Start the demo on load (paused with reduced motion). Default true.
* @param {string} variant - 'split' (map + panel side by side) | 'stacked'. Default 'split'.
* @param {string} size - 'md' | 'lg' map height. Default 'md'.
* @param {string} class - Extra class for the root.
*
* Accessibility: the map is an <svg role="img"> whose label is updated with the rider's progress;
* the status list marks the current step with aria-current; phase changes are announced in a
* polite live region; controls are buttons with aria-pressed; the rating uses native radios.
* prefers-reduced-motion disables autoplay, transitions and the sticker burst.
*/
import type { HTMLAttributes } from 'astro/types';
import '../templates/food-delivery/food-theme.css';
import { foodTracking, foodDishes, type FoodDish } from '../templates/food-delivery/data';
interface OwnProps {
tracking?: typeof foodTracking;
dishes?: FoodDish[];
durationSec?: number;
autoplay?: boolean;
variant?: 'split' | 'stacked';
size?: 'md' | 'lg';
}
type Props = OwnProps & Omit<HTMLAttributes<'section'>, keyof OwnProps | 'class'> & { class?: string };
const {
tracking = foodTracking,
dishes = foodDishes,
durationSec = 60,
autoplay = true,
variant = 'split',
size = 'md',
class: classAttr,
...rest
} = Astro.props;
const eur = (n: number) => n.toLocaleString('es-ES', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
const lines = tracking.lines.map((l) => {
const d = dishes.find((x) => x.id === l.dishId);
return { qty: l.qty, name: d?.name ?? l.dishId, total: (d?.price ?? 0) * l.qty };
});
const total = lines.reduce((s, l) => s + l.total, 0);
const routeD = tracking.route.map((p, i) => `${i ? 'L' : 'M'}${p[0]} ${p[1]}`).join(' ');
const steps = [
{ key: 'recibido', label: 'Pedido recibido', hint: 'La cocina lo ha aceptado' },
{ key: 'cocina', label: 'En cocina', hint: 'Plancha encendida' },
{ key: 'camino', label: 'En camino', hint: `${tracking.rider.name} va hacia ti` },
{ key: 'entregado', label: 'Entregado', hint: '¡Que aproveche!' },
];
const blocks = [
[4, 4, 10, 18], [24, 4, 14, 14], [48, 4, 12, 14], [70, 4, 26, 14],
[24, 30, 14, 10], [48, 30, 12, 10], [70, 30, 26, 22],
[4, 50, 10, 20], [24, 50, 14, 6], [48, 50, 12, 6],
[4, 84, 32, 12], [48, 66, 12, 30], [70, 62, 8, 12], [70, 84, 6, 12], [88, 62, 8, 12],
];
const vehicleLabel = { bici: 'bici eléctrica', moto: 'moto eléctrica', patinete: 'patinete' }[tracking.rider.vehicle];
const telHref = `tel:${tracking.rider.phone.replace(/\s+/g, '')}`;
---
<section
class:list={['bf-ui', 'bf-track', `bf-track--${variant}`, `bf-track--${size}`, classAttr]}
aria-labelledby="bf-track-h"
data-bf-track
data-duration={durationSec}
data-autoplay={autoplay ? 'true' : 'false'}
data-eta={tracking.etaMin}
data-rider={tracking.rider.name}
{...rest}
>
<div class="bf-track__mapwrap">
<svg class="bf-track__map" viewBox="0 0 100 100" role="img" aria-label="Mapa del reparto" data-map>
<rect width="100" height="100" class="m-ground" />
<path d="M0 92 C 20 86, 30 98, 50 90 S 80 84, 100 92 V100 H0z" class="m-river" />
<rect x="4" y="26" width="10" height="16" rx="2" class="m-park" />
<g class="m-trees"><circle cx="7" cy="31" r="2" /><circle cx="11" cy="36" r="2" /><circle cx="7" cy="39" r="1.6" /></g>
{blocks.map((b) => <rect x={b[0]} y={b[1]} width={b[2]} height={b[3]} rx="2" class="m-block" />)}
<path d={routeD} class="m-route-bg" />
<path d={routeD} class="m-route" data-route pathLength="1" />
<g class="m-pin m-pin--kitchen" transform={`translate(${tracking.kitchen.x} ${tracking.kitchen.y})`}>
<circle r="5" /><path d="M-2 -1.5h4M-2 0.5h4M-1 -3v6" />
</g>
<g class="m-pin m-pin--home" transform={`translate(${tracking.home.x} ${tracking.home.y})`}>
<circle r="9" class="m-pulse" /><circle r="5" /><path d="M-2.5 1.5v-2l2.5-2 2.5 2v2z" />
</g>
<g class="m-rider" data-marker transform={`translate(${tracking.kitchen.x} ${tracking.kitchen.y})`}>
<g data-marker-rot>
<circle r="4.6" class="m-rider-bg" />
<path d="M-2.4 0h4.8M0.6 -2l2 2-2 2" class="m-rider-arrow" />
</g>
</g>
</svg>
<div class="bf-track__burst" aria-hidden="true" data-burst></div>
<div class="bf-track__eta">
<span class="bf-track__eta-label">Llega en</span>
<strong data-eta-out>{tracking.etaMin} min</strong>
</div>
</div>
<div class="bf-track__panel">
<header class="bf-track__head">
<p class="bf-track__kicker">Pedido <span data-order>{tracking.orderId}</span> · {tracking.placedAt}</p>
<h1 id="bf-track-h" class="bf-track__title" data-title>¡Hola, {tracking.customer}! Tu pedido está en marcha</h1>
</header>
<ol class="bf-track__steps" data-steps>
{steps.map((s, i) => (
<li class="bf-track__step" data-step={i} aria-current={i === 0 ? 'step' : undefined}>
<span class="bf-track__dot" aria-hidden="true"></span>
<span class="bf-track__label">{s.label}</span>
<span class="bf-track__hint">{s.hint}</span>
</li>
))}
</ol>
<div class="bf-track__rider">
<span class="bf-track__avatar" aria-hidden="true">{tracking.rider.name.charAt(0)}</span>
<div class="bf-track__rider-info">
<strong>{tracking.rider.name}</strong>
<span>{vehicleLabel} · ★ {tracking.rider.rating.toLocaleString('es-ES')}</span>
</div>
<a class="bf-track__call" href={telHref} aria-label={`Llamar a ${tracking.rider.name}`}>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2" /></svg>
</a>
</div>
<div class="bf-track__controls" role="group" aria-label="Controles de la demostración">
<button type="button" class="bf-track__ctl" data-play aria-pressed="false">Pausar</button>
<button type="button" class="bf-track__ctl" data-fast aria-pressed="false">Velocidad ×4</button>
<button type="button" class="bf-track__ctl" data-reset>Reiniciar</button>
</div>
<p class="bf-track__demo">Demo: el pedido avanza en tiempo acelerado.</p>
<details class="bf-track__receipt">
<summary>Tu pedido · {eur(total)} €</summary>
<ul role="list">
{lines.map((l) => <li><span>{l.qty}× {l.name}</span><span>{eur(l.total)} €</span></li>)}
</ul>
<p>Entrega en <strong>{tracking.address}</strong></p>
</details>
<form class="bf-track__rate" data-rate hidden>
<fieldset>
<legend>¿Qué tal ha ido?</legend>
<div class="bf-track__stars">
{[5, 4, 3, 2, 1].map((n) => (
<>
<input type="radio" id={`bf-rate-${n}`} name="rate" value={n} />
<label for={`bf-rate-${n}`} title={`${n} estrellas`}><span class="bf-sr">{n} estrellas</span>★</label>
</>
))}
</div>
</fieldset>
<p class="bf-track__thanks" data-thanks></p>
</form>
<p class="bf-sr" role="status" aria-live="polite" data-live></p>
</div>
</section>
<script>
function initFoodTrack() {
document.querySelectorAll<HTMLElement>('[data-bf-track]').forEach((root) => {
if (root.dataset.bound) return;
root.dataset.bound = 'true';
const $ = <T extends Element = HTMLElement>(s: string) => root.querySelector<T>(s)!;
const route = $<SVGPathElement>('[data-route]');
const marker = $<SVGGElement>('[data-marker]');
const rot = $<SVGGElement>('[data-marker-rot]');
const map = $<SVGSVGElement>('[data-map]');
const steps = [...root.querySelectorAll<HTMLElement>('[data-step]')];
const live = $('[data-live]');
const etaOut = $('[data-eta-out]');
const playBtn = $<HTMLButtonElement>('[data-play]');
const fastBtn = $<HTMLButtonElement>('[data-fast]');
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const duration = Number(root.dataset.duration || 60) * 1000;
const eta = Number(root.dataset.eta || 18);
const rider = root.dataset.rider || 'El rider';
const len = route.getTotalLength();
const phaseText = ['Pedido recibido por la cocina.', 'Tu pedido se está cocinando.', `${rider} ha recogido tu pedido y va hacia ti.`, '¡Pedido entregado! Que aproveche.'];
const id = new URLSearchParams(location.search).get('pedido');
if (id) $('[data-order]').textContent = id;
let p = 0;
let playing = false;
let speed = 1;
let last = 0;
let phase = -1;
const phaseOf = (x: number) => (x >= 1 ? 3 : x >= 0.42 ? 2 : x >= 0.12 ? 1 : 0);
const draw = () => {
const drive = Math.min(1, Math.max(0, (p - 0.42) / 0.58));
route.style.strokeDashoffset = String(1 - drive);
const pt = route.getPointAtLength(drive * len);
const ahead = route.getPointAtLength(Math.min(len, drive * len + 0.8));
const ang = (Math.atan2(ahead.y - pt.y, ahead.x - pt.x) * 180) / Math.PI;
marker.setAttribute('transform', `translate(${pt.x.toFixed(2)} ${pt.y.toFixed(2)})`);
if (drive < 1) rot.setAttribute('transform', `rotate(${ang.toFixed(1)})`);
const left = Math.max(0, Math.ceil(eta * (1 - p)));
etaOut.textContent = p >= 1 ? '¡Ya está!' : `${left} min`;
map.setAttribute('aria-label', p >= 1 ? 'Mapa del reparto: pedido entregado' : drive ? `Mapa del reparto: ${rider} ha recorrido el ${Math.round(drive * 100)} % del camino` : 'Mapa del reparto: el pedido aún está en la cocina');
const ph = phaseOf(p);
if (ph !== phase) {
phase = ph;
root.dataset.phase = String(ph);
steps.forEach((s, i) => {
s.toggleAttribute('data-done', i < ph || ph === 3);
if (i === ph) s.setAttribute('aria-current', 'step');
else s.removeAttribute('aria-current');
});
live.textContent = phaseText[ph];
if (ph === 3) done();
}
};
const done = () => {
setPlaying(false);
$('[data-rate]').hidden = false;
$('[data-title]').textContent = '¡Entregado! Que aproveche';
if (reduce) return;
const burst = $('[data-burst]');
burst.innerHTML = '';
const colors = ['var(--bf-tomato)', 'var(--bf-mustard)', 'var(--bf-mint)', 'var(--bf-sky)'];
for (let i = 0; i < 18; i++) {
const s = document.createElement('i');
const a = (i / 18) * Math.PI * 2;
s.style.setProperty('--x', `${Math.cos(a) * (90 + Math.random() * 60)}px`);
s.style.setProperty('--y', `${Math.sin(a) * (90 + Math.random() * 60)}px`);
s.style.background = colors[i % 4];
burst.append(s);
}
burst.classList.remove('is-on');
void burst.offsetWidth;
burst.classList.add('is-on');
};
const tick = (t: number) => {
if (!playing) return;
const dt = last ? t - last : 0;
last = t;
p = Math.min(1, p + (dt / duration) * speed);
draw();
if (p < 1) requestAnimationFrame(tick);
};
const setPlaying = (on: boolean) => {
playing = on && p < 1;
playBtn.textContent = playing ? 'Pausar' : p >= 1 ? 'Terminado' : 'Reanudar';
playBtn.setAttribute('aria-pressed', String(!playing));
if (playing) {
last = 0;
requestAnimationFrame(tick);
}
};
playBtn.addEventListener('click', () => setPlaying(!playing));
fastBtn.addEventListener('click', () => {
speed = speed === 1 ? 4 : 1;
fastBtn.setAttribute('aria-pressed', String(speed === 4));
});
$('[data-reset]').addEventListener('click', () => {
p = 0;
phase = -1;
$('[data-rate]').hidden = true;
$('[data-title]').textContent = 'Tu pedido está en marcha';
draw();
setPlaying(true);
});
$('[data-rate]').addEventListener('change', (e) => {
const v = (e.target as HTMLInputElement).value;
$('[data-thanks]').textContent = `¡Gracias! Has valorado el pedido con ${v} ${v === '1' ? 'estrella' : 'estrellas'}.`;
});
// External progress (0–1), e.g. from your own websocket.
new MutationObserver(() => {
const v = Number(root.getAttribute('progress'));
if (!Number.isNaN(v)) {
p = Math.min(1, Math.max(0, v));
draw();
}
}).observe(root, { attributes: true, attributeFilter: ['progress'] });
draw();
setPlaying(root.dataset.autoplay === 'true' && !reduce);
});
}
initFoodTrack();
document.addEventListener('astro:page-load', initFoodTrack);
</script>
<style>
.bf-track {
position: relative;
display: grid;
gap: var(--sp-5, 1.25rem);
color: var(--bf-ink);
font-family: var(--bf-font-body);
}
@media (min-width: 900px) {
.bf-track--split {
grid-template-columns: 1.35fr 1fr;
align-items: start;
}
}
.bf-track__mapwrap {
position: relative;
border: 3px solid var(--bf-outline);
border-radius: 28px;
overflow: hidden;
box-shadow: var(--bf-shadow-lg);
background: var(--bf-paper);
}
.bf-track__map {
display: block;
width: 100%;
height: auto;
aspect-ratio: 1;
max-height: 70vh;
}
.bf-track--lg .bf-track__map {
max-height: 82vh;
}
.bf-track__map .m-ground { fill: var(--bf-bg-2); }
.bf-track__map .m-block { fill: var(--bf-paper); stroke: var(--bf-line); stroke-width: 0.4; }
.bf-track__map .m-park { fill: var(--bf-mint-soft); stroke: var(--bf-mint); stroke-width: 0.4; }
.bf-track__map .m-trees { fill: var(--bf-mint); }
.bf-track__map .m-river { fill: var(--bf-sky-soft); }
.bf-track__map .m-route-bg { fill: none; stroke: var(--bf-ink-3); stroke-width: 1.2; stroke-dasharray: 1.6 1.6; stroke-linecap: round; opacity: 0.6; }
.bf-track__map .m-route { fill: none; stroke: var(--bf-tomato); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.bf-track__map .m-pin circle { fill: var(--bf-mustard); stroke: var(--bf-outline); stroke-width: 0.9; }
.bf-track__map .m-pin path { fill: none; stroke: var(--bf-outline); stroke-width: 0.8; stroke-linecap: round; }
.bf-track__map .m-pin--home circle { fill: var(--bf-mint); }
.bf-track__map .m-pin--home path { fill: var(--bf-paper); }
.bf-track__map .m-pin--home .m-pulse { fill: var(--bf-mint); stroke: none; opacity: 0.3; transform-box: fill-box; transform-origin: center; animation: bf-track-pulse 1.6s ease-out infinite; }
.bf-track__map .m-rider-bg { fill: var(--bf-ink); stroke: var(--bf-paper); stroke-width: 1; }
.bf-track__map .m-rider-arrow { fill: none; stroke: var(--bf-mustard); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.bf-track[data-phase='1'] .m-pin--kitchen circle {
animation: bf-track-cook 0.6s ease-in-out infinite alternate;
transform-box: fill-box;
transform-origin: center;
}
.bf-track__eta {
position: absolute;
top: var(--sp-3, 0.75rem);
left: var(--sp-3, 0.75rem);
display: grid;
padding: 8px 14px;
border: 3px solid var(--bf-outline);
border-radius: 16px;
background: var(--bf-mustard);
color: var(--bf-on-mustard);
box-shadow: 3px 3px 0 var(--bf-outline);
transform: rotate(-3deg);
}
.bf-track__eta-label {
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.bf-track__eta strong {
font-family: var(--bf-font-display);
font-size: clamp(1.6rem, 5vw, 2.4rem);
line-height: 1;
}
.bf-track__burst {
position: absolute;
inset: 0;
pointer-events: none;
}
.bf-track__burst :global(i) {
position: absolute;
left: 80%;
top: 78%;
width: 14px;
height: 14px;
border: 2px solid var(--bf-outline);
border-radius: 4px;
opacity: 0;
}
.bf-track__burst.is-on :global(i) {
animation: bf-track-burst 1.1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.bf-track__panel {
position: relative;
display: grid;
gap: var(--sp-4, 1rem);
padding: var(--sp-5, 1.25rem);
border: 3px solid var(--bf-outline);
border-radius: 28px;
background: var(--bf-paper);
box-shadow: var(--bf-shadow);
}
.bf-track__kicker {
margin: 0;
color: var(--bf-ink-3);
font-weight: 700;
font-size: 0.9rem;
}
.bf-track__title {
margin: 4px 0 0;
font-family: var(--bf-font-display);
font-size: clamp(1.5rem, 4vw, 2rem);
font-weight: 800;
line-height: 1.1;
}
.bf-track__steps {
position: relative;
display: grid;
gap: 2px;
margin: 0;
padding: 0;
list-style: none;
}
.bf-track__step {
position: relative;
display: grid;
grid-template-columns: 28px 1fr;
column-gap: 12px;
padding: 8px 0;
color: var(--bf-ink-3);
}
.bf-track__step::before {
content: '';
position: absolute;
left: 12px;
top: 30px;
bottom: -8px;
width: 4px;
border-radius: 4px;
background: var(--bf-line);
}
.bf-track__step:last-child::before {
display: none;
}
.bf-track__step[data-done]::before {
background: var(--bf-mint);
}
.bf-track__dot {
grid-row: span 2;
width: 28px;
height: 28px;
border: 3px solid var(--bf-line);
border-radius: 50%;
background: var(--bf-paper);
transition: background 0.3s ease, transform 0.4s var(--bf-ease-pop);
}
.bf-track__step[data-done] .bf-track__dot {
border-color: var(--bf-outline);
background: var(--bf-mint);
}
.bf-track__step[aria-current='step'] {
color: var(--bf-ink);
}
.bf-track__step[aria-current='step'] .bf-track__dot {
border-color: var(--bf-outline);
background: var(--bf-tomato);
transform: scale(1.15);
box-shadow: 0 0 0 6px var(--bf-pink-soft);
}
.bf-track__label {
font-weight: 800;
}
.bf-track__hint {
font-size: 0.88rem;
}
.bf-track__rider {
display: flex;
align-items: center;
gap: 12px;
padding: 10px;
border: 2px solid var(--bf-outline);
border-radius: 18px;
background: var(--bf-bg);
}
.bf-track__avatar {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border: 2px solid var(--bf-outline);
border-radius: 50%;
background: var(--bf-mustard);
color: var(--bf-on-mustard);
font-family: var(--bf-font-display);
font-weight: 800;
font-size: 1.3rem;
}
.bf-track__rider-info {
flex: 1;
min-width: 0;
display: grid;
}
.bf-track__rider-info span {
color: var(--bf-ink-2);
font-size: 0.88rem;
}
.bf-track__call {
display: grid;
place-items: center;
width: 48px;
height: 48px;
border: 2px solid var(--bf-outline);
border-radius: 50%;
background: var(--bf-mint);
color: var(--bf-paper);
}
.bf-track__controls {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.bf-track__ctl {
min-height: 44px;
padding: 0 1rem;
border: 2px solid var(--bf-outline);
border-radius: 999px;
background: var(--bf-paper);
color: var(--bf-ink);
font: inherit;
font-weight: 700;
cursor: pointer;
}
.bf-track__ctl[data-fast][aria-pressed='true'] {
background: var(--bf-mustard);
color: var(--bf-on-mustard);
}
.bf-track__ctl:focus-visible,
.bf-track__call:focus-visible,
.bf-track__receipt summary:focus-visible,
.bf-track__stars input:focus-visible + label {
outline: 3px solid var(--bf-sky);
outline-offset: 2px;
}
.bf-track__demo {
margin: -6px 0 0;
color: var(--bf-ink-3);
font-size: 0.82rem;
}
.bf-track__receipt {
border-top: 2px dashed var(--bf-line);
padding-top: var(--sp-3, 0.75rem);
}
.bf-track__receipt summary {
display: flex;
align-items: center;
min-height: 44px;
font-weight: 800;
cursor: pointer;
}
.bf-track__receipt ul {
display: grid;
gap: 6px;
margin: 6px 0;
padding: 0;
list-style: none;
}
.bf-track__receipt li {
display: flex;
justify-content: space-between;
gap: 12px;
color: var(--bf-ink-2);
}
.bf-track__receipt p {
margin: 8px 0 0;
color: var(--bf-ink-2);
font-size: 0.92rem;
}
.bf-track__rate fieldset {
margin: 0;
padding: var(--sp-3, 0.75rem);
border: 3px solid var(--bf-outline);
border-radius: 18px;
background: var(--bf-mint-soft);
}
.bf-track__rate legend {
padding: 0 6px;
font-family: var(--bf-font-display);
font-weight: 800;
font-size: 1.2rem;
}
.bf-track__stars {
display: flex;
flex-direction: row-reverse;
justify-content: flex-end;
gap: 4px;
}
.bf-track__stars input {
position: absolute;
opacity: 0;
width: 1px;
height: 1px;
}
.bf-track__stars label {
display: grid;
place-items: center;
width: 44px;
height: 44px;
color: var(--bf-ink-3);
font-size: 2rem;
cursor: pointer;
transition: transform 0.2s var(--bf-ease-pop), color 0.2s ease;
}
.bf-track__stars label:hover,
.bf-track__stars label:hover ~ label,
.bf-track__stars input:checked ~ label {
color: var(--bf-warn);
transform: scale(1.15);
}
.bf-track__thanks {
margin: 8px 0 0;
font-weight: 700;
}
@keyframes bf-track-pulse { from { transform: scale(0.6); opacity: 0.5; } to { transform: scale(1.8); opacity: 0; } }
@keyframes bf-track-cook { to { transform: scale(1.25); } }
@keyframes bf-track-burst {
0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(0.4); }
100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(540deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.bf-track *,
.bf-track__map * {
animation: none !important;
transition: none !important;
}
}
</style>
Información Rápida
- Categoría
- App y Dashboard
- Nombre de archivo
FoodOrderMap.astro- Dependencias
- Ninguna — Astro nativo + CSS puro
- Etiquetas
- appdashboardsaasfoodtrackingmapdeliveryanimationsvg