Feature/Fix: Routen-Navi, Badge-Klick-Fix, Forum-Edit, Chat-Unread-Refresh
- Routen: Navi-Button öffnet Apple Maps/Google Maps mit Start/Ziel-GPS - Routen: Teilen-Button nutzt navigator.share() mit Fallback auf Clipboard - Routen: Icon 'share' → 'arrow-square-out' (war nicht im Sprite) - Nav-Badge: pointer-events:none → Badge blockiert keine Klicks mehr - visibilitychange: Badges + Chat-Liste sofort refresh bei App-Rückkehr - Forum: eigene Threads und Antworten bearbeiten (PATCH /threads/content, PATCH /posts) - SW by-v238, APP_VER 215
This commit is contained in:
parent
289158b2cd
commit
7a25ccae90
8 changed files with 169 additions and 11 deletions
|
|
@ -742,7 +742,8 @@ window.Page_routes = (() => {
|
|||
<div style="display:flex;gap:var(--space-2);width:100%;flex-wrap:wrap">
|
||||
<div style="display:flex;gap:var(--space-2);flex:1">
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-gpx" title="GPX herunterladen">${UI.icon('download-simple')} GPX</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-share" title="Route teilen">${UI.icon('share')}</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-share" title="Route teilen">${UI.icon('arrow-square-out')} Teilen</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-navi" title="Mit Navi öffnen">${UI.icon('map-pin')} Navi</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-send-friend" title="An Freund senden">${UI.icon('chat-circle-dots')}</button>
|
||||
${isOwn ? `
|
||||
<button type="button" class="btn btn-secondary btn-sm" id="rd-vis">
|
||||
|
|
@ -768,19 +769,30 @@ window.Page_routes = (() => {
|
|||
document.getElementById('rd-gpx')?.addEventListener('click', () => _downloadGpxDirect(route));
|
||||
|
||||
// Teilen-Button
|
||||
document.getElementById('rd-share')?.addEventListener('click', () => {
|
||||
document.getElementById('rd-share')?.addEventListener('click', async () => {
|
||||
const shareUrl = location.origin + '/#routes?id=' + route.id;
|
||||
const text = `${route.name} — ${(route.distanz_km||0).toFixed(1)} km`;
|
||||
if (navigator.share) {
|
||||
navigator.share({ title: route.name, url: shareUrl }).catch(() => {});
|
||||
navigator.share({ title: route.name, text, url: shareUrl }).catch(() => {});
|
||||
} else {
|
||||
navigator.clipboard.writeText(shareUrl).then(() => {
|
||||
UI.toast.success('Link kopiert!');
|
||||
}).catch(() => {
|
||||
UI.toast.error('Link konnte nicht kopiert werden.');
|
||||
});
|
||||
await navigator.clipboard.writeText(shareUrl);
|
||||
UI.toast.info('Link kopiert!');
|
||||
}
|
||||
});
|
||||
|
||||
// Navi-Button
|
||||
document.getElementById('rd-navi')?.addEventListener('click', () => {
|
||||
const track = route.gps_track || [];
|
||||
if (track.length < 2) { UI.toast.warning('Keine GPS-Daten vorhanden.'); return; }
|
||||
const start = track[0];
|
||||
const end = track[track.length - 1];
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||
const url = isIOS
|
||||
? `maps://maps.apple.com/?saddr=${start.lat},${start.lon}&daddr=${end.lat},${end.lon}&dirflg=w`
|
||||
: `https://www.google.com/maps/dir/?api=1&origin=${start.lat},${start.lon}&destination=${end.lat},${end.lon}&travelmode=walking`;
|
||||
window.open(url, '_blank');
|
||||
});
|
||||
|
||||
// An Freund senden
|
||||
document.getElementById('rd-send-friend')?.addEventListener('click', () => _openSendToFriendModal(route));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue