UX: Route-Detail Pills text-only, keine Icons, Farben nach Bedeutung
This commit is contained in:
parent
f00084deb8
commit
167c8018bb
3 changed files with 33 additions and 17 deletions
|
|
@ -30,9 +30,14 @@ window.Page_routes = (() => {
|
|||
|
||||
// Mini-Karten auf den Route-Cards
|
||||
let _miniMaps = new Map(); // routeId → L.map
|
||||
const DIFFICULTY_LABEL = { leicht: '🟢 Leicht', mittel: '🟡 Mittel', anspruchsvoll: '🔴 Anspruchsvoll' };
|
||||
const TERRAIN_LABEL = { wald: '🌲 Wald', asphalt: '🛣️ Asphalt', wiese: '🌿 Wiese', mix: '🔀 Mix' };
|
||||
const DIFFICULTY_LABEL = { leicht: 'Leicht', mittel: 'Mittel', anspruchsvoll: 'Anspruchsvoll' };
|
||||
const TERRAIN_LABEL = { wald: 'Wald', asphalt: 'Asphalt', wiese: 'Wiese', mix: 'Mix' };
|
||||
const HUNDE_LABEL = { eingeschränkt: '🐾', gut: '🐾🐾', sehr_gut: '🐾🐾🐾', premium: '🐾🐾🐾🐾' };
|
||||
const HUNDE_TEXT = { eingeschränkt: 'Eingeschränkt', gut: 'Hundefreundlich',
|
||||
sehr_gut: 'Sehr hundefreundlich', premium: 'Hundefreundlich' };
|
||||
const DIFF_COLOR = { leicht: 'background:#dcfce7;color:#15803d',
|
||||
mittel: 'background:#fef9c3;color:#92400e',
|
||||
anspruchsvoll: 'background:#fee2e2;color:#991b1b' };
|
||||
|
||||
// POI-Typen entlang der Route — nur relevante/interessante Orte
|
||||
const NEARBY_TYPES = [
|
||||
|
|
@ -718,21 +723,18 @@ window.Page_routes = (() => {
|
|||
margin-bottom:var(--space-3);background:var(--c-surface-2)"></div>
|
||||
${photoGallery}
|
||||
<div style="display:flex;flex-wrap:wrap;gap:var(--space-2);margin:var(--space-3) 0">
|
||||
${route.distanz_km ? `<span class="rk-badge rk-badge--info">${UI.icon('map-trifold')} ${route.distanz_km.toFixed(2)} km</span>` : ''}
|
||||
${route.dauer_min ? `<span class="rk-badge rk-badge--info">${UI.icon('timer')} ${_fmtDur(route.dauer_min)}</span>` : ''}
|
||||
${route.schwierigkeit ? `<span class="rk-badge rk-badge--${route.schwierigkeit}">${DIFFICULTY_LABEL[route.schwierigkeit]||route.schwierigkeit}</span>` : ''}
|
||||
${route.untergrund ? `<span class="rk-badge">${TERRAIN_LABEL[route.untergrund]||route.untergrund}</span>` : ''}
|
||||
${paws ? `<span class="rk-badge rk-badge--dog" title="Hundetauglichkeit">${paws}</span>` : ''}
|
||||
${route.schatten ? `<span class="rk-badge">${UI.icon('tree')} Schatten</span>` : ''}
|
||||
${route.leine_empfohlen ? `<span class="rk-badge">${UI.icon('link')} Leine empfohlen</span>` : ''}
|
||||
${route.distanz_km ? `<span class="rk-pill rk-pill--neutral">${route.distanz_km.toFixed(2)} km</span>` : ''}
|
||||
${route.dauer_min ? `<span class="rk-pill rk-pill--neutral">${_fmtDur(route.dauer_min)}</span>` : ''}
|
||||
${route.schwierigkeit ? `<span class="rk-pill" style="${DIFF_COLOR[route.schwierigkeit]||''}">${DIFFICULTY_LABEL[route.schwierigkeit]||route.schwierigkeit}</span>` : ''}
|
||||
${route.hunde_tauglichkeit ? `<span class="rk-pill rk-pill--dog">${HUNDE_TEXT[route.hunde_tauglichkeit]||route.hunde_tauglichkeit}</span>` : ''}
|
||||
${isOwn
|
||||
? `<button type="button" id="rd-vis-pill"
|
||||
class="rk-badge ${route.is_public ? 'rk-badge--public' : 'rk-badge--private'}"
|
||||
class="rk-pill ${route.is_public ? 'rk-pill--public' : 'rk-pill--private'}"
|
||||
style="border:none;cursor:pointer;font:inherit"
|
||||
title="${route.is_public ? 'Auf Privat setzen' : 'Auf Öffentlich setzen'}">
|
||||
${route.is_public ? UI.icon('lock-open')+' Öffentlich' : UI.icon('lock')+' Privat'}
|
||||
${route.is_public ? 'Öffentlich' : 'Privat'}
|
||||
</button>`
|
||||
: (!route.is_public ? `<span class="rk-badge rk-badge--private">${UI.icon('lock')} Privat</span>` : '')
|
||||
: (!route.is_public ? `<span class="rk-pill rk-pill--private">Privat</span>` : `<span class="rk-pill rk-pill--public">Öffentlich</span>`)
|
||||
}
|
||||
</div>
|
||||
${route.beschreibung ? `<p style="color:var(--c-text-secondary);margin-bottom:var(--space-3)">${UI.escape(route.beschreibung)}</p>` : ''}
|
||||
|
|
@ -823,10 +825,9 @@ window.Page_routes = (() => {
|
|||
await API.routes.update(route.id, { is_public: !route.is_public });
|
||||
route.is_public = !route.is_public;
|
||||
if (pill) {
|
||||
pill.className = `rk-badge ${route.is_public ? 'rk-badge--public' : 'rk-badge--private'}`;
|
||||
pill.style.cssText = 'border:none;cursor:pointer;font:inherit';
|
||||
pill.innerHTML = route.is_public ? UI.icon('lock-open')+' Öffentlich' : UI.icon('lock')+' Privat';
|
||||
pill.title = route.is_public ? 'Auf Privat setzen' : 'Auf Öffentlich setzen';
|
||||
pill.className = `rk-pill ${route.is_public ? 'rk-pill--public' : 'rk-pill--private'}`;
|
||||
pill.innerHTML = route.is_public ? 'Öffentlich' : 'Privat';
|
||||
pill.title = route.is_public ? 'Auf Privat setzen' : 'Auf Öffentlich setzen';
|
||||
}
|
||||
const r = _data.find(x => x.id === route.id);
|
||||
if (r) r.is_public = route.is_public;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue