/* ============================================================ BAN YARO — Willkommensseite ============================================================ */ window.Page_welcome = (() => { let _container = null; let _appState = null; async function init(container, appState) { _container = container; _appState = appState; _render(); } function refresh() { _render(); } function onDogChange() {} // ---------------------------------------------------------- // FEATURES — Icon, Titel, Beschreibung, Zielseite // ---------------------------------------------------------- const FEATURES = [ { icon: 'book-open', label: 'Tagebuch', page: 'diary' }, { icon: 'first-aid', label: 'Gesundheit', page: 'health' }, { icon: 'map-trifold', label: 'Karte', page: 'map' }, { icon: 'path', label: 'Routen', page: 'routes' }, { icon: 'target', label: 'Training', page: 'uebungen' }, { icon: 'warning-octagon', label: 'Giftköder', page: 'poison' }, { icon: 'users', label: 'Freunde', page: 'friends' }, { icon: 'chat-circle-dots', label: 'Nachrichten', page: 'chat' }, { icon: 'paw-print', label: 'Gassi-Treffen', page: 'walks' }, { icon: 'house-line', label: 'Sitting', page: 'sitting' }, { icon: 'push-pin', label: 'Forum', page: 'forum' }, { icon: 'books', label: 'Rassen-Wiki', page: 'wiki' }, { icon: 'calendar-dots', label: 'Events', page: 'events' }, { icon: 'bell', label: 'Neuigkeiten', page: 'notifications' }, { icon: 'handshake', label: 'Knigge', page: 'knigge' }, { icon: 'magnifying-glass', label: 'Vermisste', page: 'lost' }, ]; // ---------------------------------------------------------- // RENDER // ---------------------------------------------------------- function _render() { const isInstalled = window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true; const user = _appState?.user; _container.innerHTML = `
Ban Yaro

Ban Yaro

${user ? `Schön, dass du wieder da bist${user.name ? ', ' + UI.escape(user.name) + '' : ''}! 🐾` : 'Die Community für Hundebesitzer — Tagebuch, Gesundheit, Karte und mehr.'}

${!user ? `
` : ''}

Was Ban Yaro kann

${FEATURES.map(f => ` `).join('')}
${!isInstalled ? `
App installieren
${_installHTML()}
` : ''}
`; _injectStyles(); _bindEvents(); _pulseMenuBtn(); } // ---------------------------------------------------------- // STYLES (einmalig injizieren) // ---------------------------------------------------------- function _injectStyles() { if (document.getElementById('wc-styles')) return; const s = document.createElement('style'); s.id = 'wc-styles'; s.textContent = ` /* Hero */ .wc-hero { background: linear-gradient(160deg, var(--c-primary-subtle) 0%, var(--c-bg) 70%); text-align: center; padding: var(--space-8) var(--space-4) var(--space-6); border-bottom: 1px solid var(--c-border-light); } .wc-hero-icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 8px 28px rgba(0,0,0,0.15); display: block; margin: 0 auto var(--space-4); } .wc-hero-title { font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--c-text); margin: 0 0 var(--space-2); } .wc-hero-sub { font-size: var(--text-base); color: var(--c-text-secondary); margin: 0; line-height: 1.6; max-width: 420px; margin: 0 auto; } .wc-hero-cta { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; margin-top: var(--space-5); } /* Section title */ .wc-section-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--c-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 var(--space-4); } /* Feature Grid */ .wc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); } .wc-tile { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-2); background: var(--c-surface); border: 1px solid var(--c-border-light); border-radius: var(--radius-lg); cursor: pointer; transition: background var(--transition-fast), transform 0.1s; } .wc-tile:hover { background: var(--c-surface-2); } .wc-tile:active { transform: scale(0.96); } .wc-tile-icon { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--c-primary-subtle); display: flex; align-items: center; justify-content: center; } .wc-tile-icon .ph-icon { width: 22px; height: 22px; color: var(--c-primary); } .wc-tile-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--c-text); text-align: center; line-height: 1.3; } /* Install card */ .wc-install-card { margin-bottom: var(--space-5); } .wc-install-header { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); font-size: var(--text-xs); font-weight: 600; color: var(--c-text-secondary); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--c-border); } .wc-install-header .ph-icon { width: 14px; height: 14px; } /* Footer */ .wc-footer { text-align: center; font-size: var(--text-xs); color: var(--c-text-muted); margin: 0; } /* Desktop: 8-spaltig */ @media (min-width: 1024px) { .wc-grid { grid-template-columns: repeat(8, 1fr); } } /* Pulse animation */ @keyframes wc-pulse { 0%,100% { transform: scale(1); box-shadow: none; } 50% { transform: scale(1.25); box-shadow: 0 0 0 6px var(--c-primary-subtle); } } .wc-pulsing { animation: wc-pulse 0.6s ease-in-out 3; border-radius: var(--radius-md); } `; document.head.appendChild(s); } // ---------------------------------------------------------- // INSTALLATIONS-ANLEITUNG // ---------------------------------------------------------- function _installHTML() { const ua = navigator.userAgent; const isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream; const isSafari = /^((?!chrome|android).)*safari/i.test(ua); const isAndroid = /android/i.test(ua); const hasPrompt = !!App.getInstallPrompt(); if ((isAndroid || hasPrompt) && hasPrompt) { return `

Kein App Store nötig — direkt installieren.

`; } if (isIOS && isSafari) { return `

Auf iPhone/iPad installieren:

${_steps([ ['1', 'Teilen-Symbol in Safari tippen'], ['2', '„Zum Home-Bildschirm" wählen'], ['3', 'Rechts oben „Hinzufügen" tippen'], ])}

Nur in Safari verfügbar, nicht in anderen Browsern.

`; } return `

In Chrome oder Edge installieren:

${_steps([ ['1', 'Seite in Chrome oder Edge öffnen'], ['2', 'Installations-Symbol in der Adressleiste klicken'], ['3', 'Bestätigen — fertig!'], ])}`; } function _steps(list) { return `
    ${list.map(([num, text]) => `
  1. ${num}
    ${text}
  2. `).join('')}
`; } // ---------------------------------------------------------- // EVENTS // ---------------------------------------------------------- function _bindEvents() { _container.querySelector('#install-android-btn')?.addEventListener('click', async () => { const prompt = App.getInstallPrompt(); if (!prompt) return; prompt.prompt(); const { outcome } = await prompt.userChoice; if (outcome === 'accepted') { UI.toast.success('Ban Yaro wird installiert!'); _render(); } }); _container.querySelector('#welcome-register-btn')?.addEventListener('click', () => App.navigate('settings')); _container.querySelector('#welcome-login-btn')?.addEventListener('click', () => App.navigate('settings')); _container.querySelectorAll('[data-nav]').forEach(btn => { btn.addEventListener('click', () => App.navigate(btn.dataset.nav)); }); } function _pulseMenuBtn() { const btn = document.getElementById('header-menu-btn'); if (!btn) return; setTimeout(() => { btn.classList.add('wc-pulsing'); btn.addEventListener('animationend', () => btn.classList.remove('wc-pulsing'), { once: true }); }, 800); } return { init, refresh, onDogChange }; })();