Firebase-Integration für Multi-Device-Zugriff

- Firebase SDK hinzugefügt (Firestore & Auth)
- config.js mit Firebase-Konfigurationstemplate
- Google Sign-In für Benutzerauthentifizierung
- Daten werden jetzt in Firestore gespeichert (pro Benutzer)
- Echtzeit-Updates auf allen Geräten
- Datenstruktur: users/{uid}/teaTypes und users/{uid}/consumption
- Anleitung in config.js für die Einrichtung

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
wralto-user-1
2026-11-21 21:34:26 +01:00
parent ca2ec1ce9e
commit 83e6dcbdc9
4 changed files with 553 additions and 205 deletions

View File

@ -5,6 +5,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TeeTracker</title>
<link rel="stylesheet" href="styles.css">
<!-- Firebase SDK -->
<script src="https://www.gstatic.com/firebasejs/10.7.1/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore-compat.js"></script>
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
@ -15,6 +19,19 @@
</header>
<main class="main-content">
<!-- Firebase Login Section -->
<section id="auth-section" class="auth-section hidden">
<div class="auth-card">
<h2>🔐 Anmeldung</h2>
<p>Melden Sie sich an, um Ihre Daten auf allen Geraeten zu synchronisieren.</p>
<button id="googleSignIn" class="btn btn-primary google-btn">
<span class="google-icon">G</span> Mit Google anmelden
</button>
<button id="signOut" class="btn btn-secondary hidden">Abmelden</button>
<div id="auth-status" class="auth-status"></div>
</div>
</section>
<!-- Dashboard Section -->
<section class="dashboard">
<h2>Dashboard</h2>
@ -54,7 +71,7 @@
</div>
<div class="chart-container full-width">
<h3>Jährlicher Konsum nach Sorte</h3>
<h3>Ja hrlicher Konsum nach Sorte</h3>
<canvas id="yearChart"></canvas>
</div>
</section>
@ -66,7 +83,7 @@
<form id="addTeaForm" class="add-form">
<input type="text" id="teaName" placeholder="Name der Teesorte" required>
<input type="color" id="teaColor" value="#4CAF50">
<button type="submit" class="btn btn-primary">Hinzufügen</button>
<button type="submit" class="btn btn-primary">Hinzufugen</button>
</form>
<div id="teaList" class="tea-list"></div>
</div>
@ -86,7 +103,7 @@
<select id="trackTea" required></select>
</div>
<div class="form-group">
<label>Brühzeit:</label>
<label>Bruhzeit:</label>
<div class="radio-group">
<label class="radio-label">
<input type="radio" name="brewTime" value="kurz" checked>
@ -117,7 +134,7 @@
<!-- Consumption History Section -->
<section class="history-section">
<h2>📊 Letzte Einträge</h2>
<h2>📊 Letzte Eintrage</h2>
<div class="history-controls">
<button id="filterToday" class="btn btn-secondary">Heute</button>
<button id="filterWeek" class="btn btn-secondary">Letzte 7 Tage</button>
@ -129,10 +146,12 @@
</main>
<footer class="footer">
<p>TeeTracker © <span id="current-year"></span> | Daten werden lokal gespeichert</p>
<p>TeeTracker © <span id="current-year"></span> | Daten werden in Firebase gespeichert</p>
</footer>
</div>
<!-- Firebase Configuration Template (wird durch config.js ersetzt) -->
<script src="config.js"></script>
<script src="script.js"></script>
</body>
</html>