21 Commits

Author SHA1 Message Date
c628cf2069 Fix: Korrigiert Aufruf von migrateToDataDirectory - muss auf nextcloudStorage-Instanz aufgerufen werden, nicht auf TeeTracker-Instanz
Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 18:58:01 +00:00
f111153bde Fix: Event-Delegation für dynamisch erstellte Buttons (Bearbeiten/Löschen in Tee-Karten). Entfernt onclick-Attribute und ersetzt sie durch data-Attribute + Event-Delegation auf dem Container.
Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 18:50:09 +00:00
0baceb14c6 Fix: Buttons reagieren nicht auf Klicks - Event-Listener werden jetzt sofort registriert, nicht erst nach dem Laden der Daten. Entfernt onclick-Attribute aus HTML, die zu Konflikten führen können.
Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 18:48:49 +00:00
91367a7198 Fix: Verhindere Ueberschreiben von Nextcloud-Daten mit leeren Arrays
- In saveNextcloudConfig(): Nur speichern, wenn Daten vorhanden sind
- Falls keine lokalen Daten, aber Nextcloud hat Daten: behalte Nextcloud-Daten
- Verhindert Datenverlust, wenn Nextcloud bereits Daten hat

Fixes: Datenverlust bei Nextcloud-Anmeldung

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 11:28:05 +00:00
7e1f52a5b2 Fix: Behandle leere Nextcloud-Dateien korrekt
- Aendert loadFile(): Gibt leeres Array zurueck, wenn Datei existiert aber leer ist
- Verhindert, dass leere Dateien als null interpretiert werden und lokale Daten
  oder leere Arrays geladen werden

Fixes: Datenverlust bei Nextcloud-Anmeldung mit leeren Dateien

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 11:26:26 +00:00
7f059c9b4c Fix: Lade Nextcloud-Daten vor dem Speichern, um Datenverlust zu vermeiden
- Aendert loadData(): Laedt zuerst Nextcloud-Daten und faellt nur bei fehlenden
  Dateien auf localStorage zurueck
- Aendert saveNextcloudConfig(): Laedt Daten von Nextcloud BEVOR sie gespeichert
  werden, um Ueberschreiben bestehender Nextcloud-Daten zu verhindern
- Behebt das Problem, dass lokale Daten die Nextcloud-Daten ueberschreiben

Fixes: Datenverlust bei Nextcloud-Anmeldung

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-05 10:50:20 +00:00
a16da66c2d fix: Add missing background image section to index.html
- Background image section was missing from previous commit
- Add bg-image-upload, bg-enabled, save-bg, remove-bg elements
- This fixes the non-responsive buttons issue for background settings

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 18:26:16 +00:00
073834a5dc feat: Add image upload for tea varieties
- Add image upload field to tea form with preview
- Add image property to tea data model
- Update addTea() to include image data (base64)
- Update openTeaModal() to display image when editing
- Display tea images on tea cards
- Add handleImageUpload() method for file processing
- Add migration for existing teas without image field
- Add CSS styles for image preview and display on cards
- Images stored as base64 in localStorage/Nextcloud

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 17:04:26 +00:00
ac12cc5cab feat: Add 5-star rating system for tea varieties
- Add star rating component (5 stars) to tea form
- Add rating field to tea data model (default: 3)
- Update addTea() to include rating
- Update openTeaModal() to set rating when editing
- Display rating on tea cards with star icons
- Add renderStarRating() for interactive rating in form
- Add renderStarRatingStatic() for display on cards
- Add handleStarRatingClick() for user interaction
- Add migration for existing teas without rating
- Add CSS styles for rating display and interaction

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 17:00:50 +00:00
394480c516 feat: Add tea powder amount (teaspoons) to tracking
- Add new field 'Menge Tee-Pulver (Teelöffel)' to track form
- Add teaspoons property to entry data model
- Update addEntry() to include teaspoons (default: 1)
- Update handleTrackFormSubmit() to read teaspoons from form
- Display teaspoons in recent entries (e.g., '2 Tassen (1.5 TL)')
- Add migration for existing entries without teaspoons field
- Input allows decimal values (step=0.5) for half teaspoons

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 16:53:24 +00:00
ff37d35134 feat: Add background image customization
- Add background image upload in settings
- Add preview for uploaded background images
- Add toggle to enable/disable background
- Store background image in localStorage as base64
- Add CSS for background image display with overlay
- Add currentBgImage property to TeeTracker class
- Add setupBackgroundListeners() method
- Add handleBackgroundUpload(), toggleBackground(), saveBackgroundSettings(), removeBackground(), loadBackgroundSettings() methods

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 16:43:56 +00:00
4f8890da7f feat: Store data in data/ subdirectory for better organization
- Add DATA_DIRECTORY constant ('data/')
- Update all file paths to use data/teas.json and data/entries.json
- Add ensureSubDirectory('data') call to create data directory
- Add migrateToDataDirectory() method to automatically migrate old files
- Migration runs on first load if old files exist in root directory

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 16:36:49 +00:00
733e2db3c4 fix: Prevent data loss when connecting to Nextcloud for the first time
- Load existing data from localStorage before switching to Nextcloud
- This prevents existing teas and entries from being overwritten with empty arrays
- When enabling Nextcloud sync, existing local data is preserved and uploaded

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 16:23:53 +00:00
30e0077c6e refactor: Remove CORS proxy code (not needed for same-domain setup)
- Remove NEXTCLOUD_PROXY constant
- Remove fetchWithProxy() and getProxiedUrl() methods
- Remove useProxy flag from NextcloudStorage
- Keep window.app onclick handlers for dynamically generated buttons
- Clean up code since Nextcloud and TeeTracker run on same domain (wralto.org)

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 15:56:33 +00:00
7b9f509728 fix: Remove undefined error reference in fetchWithProxy catch block
- Fix reference to undefined 'error' variable in proxy error handler
- Use only proxyError.message in the error message

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 15:32:44 +00:00
6addc628e8 fix: Add CORS proxy fallback for Nextcloud WebDAV connections
- Add NEXTCLOUD_PROXY constant for corsproxy.io
- Add getProxiedUrl() method to NextcloudStorage class
- Add fetchWithProxy() wrapper method that tries direct connection first,
  then falls back to CORS proxy if direct connection fails
- Update all fetch() calls in NextcloudStorage to use fetchWithProxy()
- Add useProxy flag to track proxy usage
- This fixes 'NetworkError when attempting to fetch resource' for servers
  like wralto.org/nextcloud3 that have CORS restrictions

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 15:24:42 +00:00
58e2a70201 fix: Use window.app for onclick handlers on dynamically generated buttons
- Revert to onclick handlers for tea card edit/delete buttons
- Use window.app instead of app to ensure global accessibility
- Remove event delegation code that wasn't working
- Add onclick handlers to import modal buttons in HTML
- This ensures buttons work reliably on dynamically generated content

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 15:06:42 +00:00
b3c1041792 fix: Add CORS proxy fallback for Nextcloud WebDAV connections
- Add corsproxy.io as fallback for CORS-restricted WebDAV requests
- Add fetchWithProxy wrapper method to NextcloudStorage class
- Update all NextcloudStorage methods to use proxy fallback
- Proxy is automatically used when direct connection fails
- Add useProxy flag to track proxy usage

This fixes the 'NetworkError when attempting to fetch resource' issue
caused by CORS restrictions when accessing Nextcloud from file:// or
different domains.

Generated by Vibe Code

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 13:08:31 +00:00
233647be4a fix: Remove plain text password from code, use sessionStorage for security
- Remove hardcoded Nextcloud credentials from app.js
- Remove pre-filled password from HTML form
- Store password in sessionStorage (cleared on browser close) instead of localStorage
- Store only URL, username, and path in localStorage
- Update README with security notes
- Update quick start guide to reflect manual password entry
- Add autocomplete attribute to password field

Security improvement: Password is now only stored temporarily in sessionStorage
and must be entered manually by the user on first use or after browser restart.

Generated by Vibe Code

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 12:27:10 +00:00
990ebb134d docs: Update README.md with Nextcloud integration and new features
- Add Nextcloud badge
- Document all new features (Bio checkbox, today period, recent entries)
- Add comprehensive Nextcloud integration section
- Add troubleshooting guide
- Add changelog
- Update screenshots section
- Add usage instructions for Nextcloud sync
- Document data backup/restore procedures

Generated by Vibe Code

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 12:20:12 +00:00
142a671016 feat: Add Nextcloud WebDAV integration for cross-device synchronization
- Add NextcloudStorage class with WebDAV API support
- Add Settings tab with Nextcloud configuration
- Pre-configure with user's Nextcloud credentials (wralto.org/nextcloud3)
- Auto-test and enable Nextcloud sync on app startup
- Add data export/import functionality
- Add backup/restore capabilities
- Add clear data confirmation
- Add sync status indicator
- Add statistics overview in settings
- Fallback to localStorage if Nextcloud unavailable
- All existing features preserved (Bio checkbox, today period, recent entries)

Generated by Vibe Code

Co-authored-by: trevor1969 <trevor1969@users.noreply.github.com>
2026-06-04 12:17:26 +00:00
4 changed files with 1861 additions and 370 deletions

234
README.md
View File

@ -7,14 +7,15 @@
[![CSS3](https://img.shields.io/badge/CSS3-1572B6?logo=css3&logoColor=white)] [![CSS3](https://img.shields.io/badge/CSS3-1572B6?logo=css3&logoColor=white)]
[![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=black)] [![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?logo=javascript&logoColor=black)]
[![Chart.js](https://img.shields.io/badge/Chart.js-FF6384?logo=chart.js&logoColor=white)] [![Chart.js](https://img.shields.io/badge/Chart.js-FF6384?logo=chart.js&logoColor=white)]
[![Nextcloud](https://img.shields.io/badge/Nextcloud-0082C9?logo=nextcloud&logoColor=white)]
--- ---
## 📸 Screenshots ## 📸 Screenshots
| Dashboard | Tee-Sorten | Tracken | Statistiken | | Dashboard | Tee-Sorten | Tracken | Statistiken | Einstellungen |
|-----------|------------|---------|-------------| |-----------|------------|---------|-------------|--------------|
| ![Dashboard](https://via.placeholder.com/300x200/8B4513/FFFFFF?text=Dashboard) | ![Tee-Sorten](https://via.placeholder.com/300x200/4ECDC4/FFFFFF?text=Tee-Sorten) | ![Tracken](https://via.placeholder.com/300x200/228B22/FFFFFF?text=Tracken) | ![Statistiken](https://via.placeholder.com/300x200/FF6347/FFFFFF?text=Statistiken) | | ![Dashboard](https://via.placeholder.com/300x200/8B4513/FFFFFF?text=Dashboard) | ![Tee-Sorten](https://via.placeholder.com/300x200/4ECDC4/FFFFFF?text=Tee-Sorten) | ![Tracken](https://via.placeholder.com/300x200/228B22/FFFFFF?text=Tracken) | ![Statistiken](https://via.placeholder.com/300x200/FF6347/FFFFFF?text=Statistiken) | ![Einstellungen](https://via.placeholder.com/300x200/6c757d/FFFFFF?text=Einstellungen) |
*(Screenshots werden automatisch generiert, sobald die App live ist)* *(Screenshots werden automatisch generiert, sobald die App live ist)*
@ -33,6 +34,7 @@
- **Hinzufügen**: Neue Tee-Sorten mit allen Details anlegen - **Hinzufügen**: Neue Tee-Sorten mit allen Details anlegen
- Name (Pflichtfeld) - Name (Pflichtfeld)
- Typ (Schwarztee, Grüntee, Weißtee, Oolong, Pu-Erh, Früchtetee, Kräutertee, Sonstiges) - Typ (Schwarztee, Grüntee, Weißtee, Oolong, Pu-Erh, Früchtetee, Kräutertee, Sonstiges)
- **Bio-Checkbox** 🌱: Kennzeichnung für Bio-Tees
- Marke (optional) - Marke (optional)
- Beschreibung (optional) - Beschreibung (optional)
- Farbe (für individuelle Darstellung) - Farbe (für individuelle Darstellung)
@ -48,6 +50,7 @@
- **Uhrzeit** angeben (optional) - **Uhrzeit** angeben (optional)
- **Menge** in Tassen (Pflichtfeld, 1-10) - **Menge** in Tassen (Pflichtfeld, 1-10)
- **Notizen** hinzufügen (z.B. "Mit Honig", "besonders stark") - **Notizen** hinzufügen (z.B. "Mit Honig", "besonders stark")
- **Letzte 10 Einträge** werden unter dem Formular angezeigt
### 📈 Statistiken ### 📈 Statistiken
- **Diagramme**: Visuelle Darstellung deines Konsums - **Diagramme**: Visuelle Darstellung deines Konsums
@ -59,7 +62,22 @@
- Aktive Tage - Aktive Tage
- Verschiedene Tees - Verschiedene Tees
- Meist getrunkener Tee - Meist getrunkener Tee
- **Zeitraum-Filter**: Letzte 7 Tage, Monat, Jahr oder Gesamt - **Zeitraum-Filter**: **Heute**, Letzte 7 Tage, Monat, Jahr oder Gesamt
### ⚙️ Einstellungen (NEU!)
- **Nextcloud-Synchronisation** 🌐
- Verbindung zu deiner Nextcloud-Instanz herstellen
- Automatische Synchronisation zwischen Geräten
- Verbindungstest
- Synchronisationsstatus-Anzeige
- **Datenverwaltung**
- 📤 **Daten exportieren** (JSON-Datei herunterladen)
- 📥 **Daten importieren** (JSON-Datei hochladen)
- 🗑️ **Alle Daten löschen** (mit Bestätigung)
- **Statistik-Übersicht**
- Gesamt Tassen
- Anzahl Tee-Sorten
- Erster/Letzter Eintrag
--- ---
@ -94,11 +112,21 @@
- Folder: `/ (root)` auswählen - Folder: `/ (root)` auswählen
3. Deine App ist dann unter `https://trevor1969.github.io/teatracker/` erreichbar 3. Deine App ist dann unter `https://trevor1969.github.io/teatracker/` erreichbar
### Option 3: Netlify/Vercel ### Option 3: Mit Nextcloud-Synchronisation (empfohlen!)
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/trevor1969/teatracker) 1. **App öffnen** (lokal oder über GitHub Pages)
2. Gehe zum Tab **⚙️ Einstellungen**
3. Aktiviere **Nextcloud-Synchronisation**
4. Trage deine Nextcloud-Daten ein:
- **URL**: `https://wralto.org/nextcloud3`
- **Benutzername**: `teetracker`
- **App-Passwort**: (dein App-Passwort aus Nextcloud)
- **Speicherpfad**: `/TeeTracker/` (Standard)
5. Klicke auf **🔍 Verbindung testen**
6. Speichere die Konfiguration mit **💾 Speichern**
7. **Fertig!** 🎉 Deine Daten werden jetzt automatisch synchronisiert
Einfach auf den Button klicken und deine eigene Instanz deployen! **Hinweis:** Aus Sicherheitsgründen musst du dein Passwort manuell eingeben. Es wird nicht in der App gespeichert (nur temporär in sessionStorage).
--- ---
@ -106,7 +134,8 @@ Einfach auf den Button klicken und deine eigene Instanz deployen!
- **Frontend**: HTML5, CSS3, Vanilla JavaScript (ES6+) - **Frontend**: HTML5, CSS3, Vanilla JavaScript (ES6+)
- **Charts**: [Chart.js](https://www.chartjs.org/) (über CDN) - **Charts**: [Chart.js](https://www.chartjs.org/) (über CDN)
- **Speicher**: localStorage (Daten bleiben im Browser erhalten) - **Cloud-Speicher**: [Nextcloud WebDAV API](https://docs.nextcloud.com/server/latest/developer_manual/third_party/webdav.html)
- **Lokaler Speicher**: localStorage (Fallback)
- **Design**: Responsive, Mobile-First, Tee-inspirierte Farben - **Design**: Responsive, Mobile-First, Tee-inspirierte Farben
--- ---
@ -115,14 +144,67 @@ Einfach auf den Button klicken und deine eigene Instanz deployen!
``` ```
teatracker/ teatracker/
├── index.html # Haupt-HTML-Datei ├── index.html # Haupt-HTML-Datei mit allen Tabs
├── styles.css # Alle Styles und Design ├── styles.css # Alle Styles und Design
├── app.js # gesamte Anwendungslogik ├── app.js # gesamte Anwendungslogik + Nextcloud-Integration
── README.md # Diese Datei ── README.md # Diese Datei
└── LICENSE # MIT License
``` ```
--- ---
## 🌐 Nextcloud-Integration
### Wie es funktioniert
Die App nutzt die **WebDAV-API** von Nextcloud, um Daten als JSON-Dateien zu speichern:
```
/TeeTracker/
├── teas.json # Deine Tee-Sorten
├── entries.json # Deine Tracking-Einträge
└── backup/ # Automatische Backups
└── teetracker_backup_2024-06-05T10-30-00.json
```
### Vorteile
| Vorteil | Beschreibung |
|---------|--------------|
| **🌍 Plattformübergreifend** | Zugriff von allen Geräten mit Internetverbindung |
| **🔄 Echtzeit-Sync** | Änderungen werden sofort synchronisiert |
| **💾 Automatische Backups** | Daten bleiben in Nextcloud erhalten |
| **⚡ Schnell** | Keine Datenbank nötig, einfache Dateispeicherung |
| **🔒 Sicher** | HTTPS-Verschlüsselung, App-Passwort (nicht Hauptpasswort) |
### Fallback-Mechanismus
Falls Nextcloud nicht erreichbar ist:
1. Die App **funktioniert weiter** mit lokalen Daten (localStorage)
2. Änderungen werden **lokal gespeichert**
3. Beim nächsten erfolgreichen Verbindungsaufbau werden die Daten **automatisch synchronisiert**
### 🔐 Sicherheitshinweise
**WICHTIG:** Aus Sicherheitsgründen wird dein Passwort **NICHT** im Klartext in der App oder im localStorage gespeichert!
- **sessionStorage**: Das Passwort wird nur in `sessionStorage` gespeichert (wird beim Schließen des Browsers gelöscht)
- **Keine Vorbefüllung**: Du musst dein Passwort manuell eingeben
- **Kein Klartext in Dateien**: Das Passwort erscheint nirgends im Code
### App-Passwort erstellen
Falls du ein neues Passwort brauchst:
1. Logge dich in deine Nextcloud ein (`https://wralto.org/nextcloud3`)
2. Gehe zu **Einstellungen → Sicherheit**
3. Suche nach **"App-Passwörter"**
4. Erstelle ein neues Passwort mit dem Namen **"TeeTracker"**
5. Kopiere das Passwort und trage es in den Einstellungen ein
**Tipp:** Speichere das App-Passwort in einem Passwort-Manager, da es nach dem Erstellen nicht mehr angezeigt wird.
---
## 🎨 Design ## 🎨 Design
### Farben ### Farben
@ -132,6 +214,7 @@ teatracker/
| ![#4ECDC4](https://via.placeholder.com/20/4ECDC4/000000?text=+) `#4ECDC4` | Sekundärfarbe (Türkis) | | ![#4ECDC4](https://via.placeholder.com/20/4ECDC4/000000?text=+) `#4ECDC4` | Sekundärfarbe (Türkis) |
| ![#228B22](https://via.placeholder.com/20/228B22/000000?text=+) `#228B22` | Grüntee | | ![#228B22](https://via.placeholder.com/20/228B22/000000?text=+) `#228B22` | Grüntee |
| ![#FF6347](https://via.placeholder.com/20/FF6347/000000?text=+) `#FF6347` | Akzentfarbe | | ![#FF6347](https://via.placeholder.com/20/FF6347/000000?text=+) `#FF6347` | Akzentfarbe |
| ![#28a745](https://via.placeholder.com/20/28a745/000000?text=+) `#28a745` | Erfolg (Grün) |
### Responsive Design ### Responsive Design
- ✅ Desktop (ab 1200px) - ✅ Desktop (ab 1200px)
@ -143,35 +226,93 @@ teatracker/
## 💡 Tipps & Tricks ## 💡 Tipps & Tricks
### Daten sichern ### Daten sichern (Backup)
Da die Daten im localStorage gespeichert werden, sind sie nur in deinem Browser verfügbar. Um ein Backup zu erstellen:
1. Browser-Konsole öffnen (F12 → Console) **Option 1: Automatisch (Nextcloud)**
2. Folgenden Code ausführen: - Die Daten werden automatisch in deiner Nextcloud gespeichert
```javascript - Backups werden im `/TeeTracker/backup/` Verzeichnis erstellt
const teas = JSON.parse(localStorage.getItem('teatracker_teas'));
const entries = JSON.parse(localStorage.getItem('teatracker_entries'));
console.log('Teas:', teas);
console.log('Entries:', entries);
```
3. Daten kopieren und in einer Datei speichern
### Daten wiederherstellen **Option 2: Manuell (Export)**
```javascript 1. Gehe zu **Einstellungen → Datenverwaltung**
const backupTeas = [/* deine gesicherten Tees */]; 2. Klicke auf **📤 Daten exportieren**
const backupEntries = [/* deine gesicherten Einträge */]; 3. Speichere die JSON-Datei an einem sicheren Ort
localStorage.setItem('teatracker_teas', JSON.stringify(backupTeas));
localStorage.setItem('teatracker_entries', JSON.stringify(backupEntries)); ### Daten wiederherstellen (Restore)
location.reload();
``` **Option 1: Automatisch (Nextcloud)**
- Einfach die App auf einem neuen Gerät öffnen
- Die Daten werden automatisch von Nextcloud geladen
**Option 2: Manuell (Import)**
1. Gehe zu **Einstellungen → Datenverwaltung**
2. Klicke auf **📥 Daten importieren**
3. Füge deine exportierten Daten ein oder lade die JSON-Datei hoch
4. Wähle, ob du die Daten **ersetzen** oder **zusammenführen** möchtest
### Daten zurücksetzen ### Daten zurücksetzen
Falls du von vorne beginnen möchtest: Falls du von vorne beginnen möchtest:
```javascript 1. Gehe zu **Einstellungen → Datenverwaltung**
localStorage.removeItem('teatracker_teas'); 2. Klicke auf **🗑️ Alle Daten löschen**
localStorage.removeItem('teatracker_entries'); 3. Bestätige die Aktion
location.reload();
``` **Achtung:** Dieser Vorgang kann nicht rückgängig gemacht werden!
### Nextcloud-Verbindung prüfen
Falls die Synchronisation nicht funktioniert:
1. Gehe zu **Einstellungen → Nextcloud-Synchronisation**
2. Klicke auf **🔍 Verbindung testen**
3. Prüfe die Fehlermeldung und korrigiere deine Eingaben
---
## 🔧 Problembehebung
### ❌ Verbindung zu Nextcloud fehlgeschlagen
**Mögliche Ursachen:**
- Falsche URL (muss mit `https://` beginnen)
- Falscher Benutzername oder Passwort
- Nextcloud ist nicht erreichbar
- WebDAV ist deaktiviert (standardmäßig aktiv)
- CORS-Probleme (Browser-Beschränkungen)
**Lösungen:**
1. Prüfe, ob du dich manuell in Nextcloud einloggen kannst
2. Teste die WebDAV-URL direkt im Browser:
```
https://wralto.org/nextcloud3/remote.php/dav/
```
3. Erstelle ein neues App-Passwort in Nextcloud
4. Versuche einen anderen Browser
5. Prüfe die Browser-Konsole (F12 → Console) auf Fehler
### ❌ Daten werden nicht synchronisiert
**Mögliche Ursachen:**
- Nextcloud ist offline
- Browser blockiert die Verbindung
- Zu viele Anfragen in kurzer Zeit
**Lösungen:**
1. Prüfe deine Internetverbindung
2. Lade die Seite neu
3. Warte einige Minuten und versuche es erneut
4. Prüfe die Browser-Konsole auf Fehler
5. Versuche, die Daten manuell zu exportieren/importieren
### ❌ Daten sind verschwunden
**Keine Sorge!** Die Daten sind an mehreren Orten gespeichert:
1. **Nextcloud** (falls verbunden)
2. **localStorage** (Fallback)
**Lösungen:**
1. Lade die Seite neu
2. Prüfe, ob du mit einem anderen Gerät/Browser verbunden bist
3. Gehe zu **Einstellungen → Daten exportieren** und sichere deine Daten
4. Falls nötig: Importiere deine exportierten Daten
--- ---
@ -196,16 +337,37 @@ Dieses Projekt steht unter der **MIT License** sieh die [LICENSE](LICENSE) D
## 🙏 Danksagung ## 🙏 Danksagung
- [Chart.js](https://www.chartjs.org/) Für die tollen Diagramme - [Chart.js](https://www.chartjs.org/) Für die tollen Diagramme
- [Nextcloud](https://nextcloud.com/) Für die sichere Cloud-Speicherung
- Alle Tee-Liebhaber da draußen! ☕🍵 - Alle Tee-Liebhaber da draußen! ☕🍵
--- ---
## 📞 Kontakt ## 📞 Kontakt & Support
Fragen oder Feedback? Öffne einfach ein [Issue](https://github.com/trevor1969/teatracker/issues) oder einen [Pull Request](https://github.com/trevor1969/teatracker/pulls). Fragen oder Feedback? Öffne einfach ein [Issue](https://github.com/trevor1969/teatracker/issues) oder einen [Pull Request](https://github.com/trevor1969/teatracker/pulls).
--- ---
## 🎉 Changelog
### 🆕 Neueste Änderungen
- **🌐 Nextcloud-Integration** Plattformübergreifende Synchronisation via WebDAV
- **⚙️ Einstellungen-Tab** Nextcloud-Konfiguration, Daten-Export/Import
- **🌱 Bio-Checkbox** Kennzeichnung für Bio-Tees
- **📅 Zeitraum "Heute"** Filter für aktuelle Tagesdaten in Statistiken
- **📝 Letzte 10 Einträge** Anzeige auf der Tracken-Seite
### 📅 Versionshistorie
| Version | Datum | Änderungen |
|---------|-------|-----------|
| 1.2.0 | Juni 2024 | Nextcloud-Integration, Einstellungen-Tab, Bio-Checkbox, "Heute"-Filter, letzte Einträge |
| 1.1.0 | Juni 2024 | Bio-Checkbox, "Heute"-Zeitraum, letzte 10 Einträge auf Tracken-Seite |
| 1.0.0 | Juni 2024 | Erste Version mit Dashboard, Tee-Verwaltung, Tracking, Statistiken |
---
**Viel Spaß beim Tee-Tracken!** 🍵✨ **Viel Spaß beim Tee-Tracken!** 🍵✨
*Made with ❤️ and JavaScript* *Made with ❤️ and JavaScript*

1564
app.js

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
<button class="tab-button" data-tab="teas">Tee-Sorten</button> <button class="tab-button" data-tab="teas">Tee-Sorten</button>
<button class="tab-button" data-tab="track">Tracken</button> <button class="tab-button" data-tab="track">Tracken</button>
<button class="tab-button" data-tab="stats">Statistiken</button> <button class="tab-button" data-tab="stats">Statistiken</button>
<button class="tab-button" data-tab="settings">⚙️ Einstellungen</button>
</nav> </nav>
<main class="tab-content"> <main class="tab-content">
@ -100,6 +101,11 @@
<input type="number" id="track-amount" min="1" max="10" value="1" required> <input type="number" id="track-amount" min="1" max="10" value="1" required>
</div> </div>
<div class="form-group">
<label for="track-teaspoons">Menge Tee-Pulver (Teelöffel)</label>
<input type="number" id="track-teaspoons" min="0" max="10" value="1" step="0.5">
</div>
<div class="form-group"> <div class="form-group">
<label for="track-notes">Notizen</label> <label for="track-notes">Notizen</label>
<textarea id="track-notes" rows="3" placeholder="z.B. Mit Honig, besonders stark..."></textarea> <textarea id="track-notes" rows="3" placeholder="z.B. Mit Honig, besonders stark..."></textarea>
@ -117,6 +123,123 @@
</div> </div>
</section> </section>
<!-- Einstellungen Tab -->
<section id="settings" class="tab-pane">
<h2>⚙️ Einstellungen</h2>
<div class="settings-section">
<h3>🌐 Nextcloud-Synchronisation</h3>
<p>Verbinde TeeTracker mit deiner Nextcloud-Instanz für plattformübergreifende Synchronisation.</p>
<div class="form-group checkbox-group">
<label>
<input type="checkbox" id="nc-enabled">
<span class="checkmark"></span>
Nextcloud-Synchronisation aktivieren
</label>
</div>
<div id="nc-config" style="display: none;">
<div class="form-group">
<label for="nc-url">Nextcloud-URL *</label>
<input type="url" id="nc-url" placeholder="https://deine-nextcloud.de">
</div>
<div class="form-group">
<label for="nc-username">Benutzername *</label>
<input type="text" id="nc-username" placeholder="Dein Nextcloud-Benutzername">
</div>
<div class="form-group">
<label for="nc-password">App-Passwort *</label>
<input type="password" id="nc-password" placeholder="App-Passwort aus Nextcloud" autocomplete="current-password">
</div>
<div class="form-group">
<label for="nc-path">Speicherpfad</label>
<input type="text" id="nc-path" placeholder="/TeeTracker/" value="/TeeTracker/">
</div>
<div class="form-actions">
<button id="test-nc-connection" class="btn btn-secondary">🔍 Verbindung testen</button>
<button id="save-nc-config" class="btn btn-primary">💾 Speichern</button>
</div>
</div>
<div id="nc-status" class="status-message"></div>
</div>
<div class="settings-section">
<h3>💾 Datenverwaltung</h3>
<div class="form-group">
<label>Synchronisationsstatus</label>
<div id="sync-status" class="status-badge">Lokaler Modus</div>
</div>
<div class="form-actions">
<button id="export-data" class="btn btn-secondary">📤 Daten exportieren</button>
<button id="import-data" class="btn btn-secondary">📥 Daten importieren</button>
<button id="clear-data" class="btn btn-danger">🗑️ Alle Daten löschen</button>
</div>
<div class="settings-section">
<h3>🎨 Hintergrundbild</h3>
<p>Wähle ein Hintergrundbild für deine TeeTracker-App.</p>
<div class="form-group">
<label for="bg-image-upload">Hintergrundbild hochladen:</label>
<input type="file" id="bg-image-upload" accept="image/*">
</div>
<div class="form-group">
<label for="bg-image-preview">Vorschau:</label>
<div id="bg-image-preview" class="bg-preview" style="display: none;">
<img id="bg-preview-img" style="max-width: 200px; max-height: 150px; border-radius: 8px; margin-top: 10px;">
</div>
</div>
<div class="form-group checkbox-group">
<label>
<input type="checkbox" id="bg-enabled">
<span class="checkmark"></span>
Hintergrundbild aktivieren
</label>
</div>
<div class="form-actions">
<button id="remove-bg" class="btn btn-secondary" style="display: none;">🗑️ Hintergrund entfernen</button>
<button id="save-bg" class="btn btn-primary">💾 Hintergrund speichern</button>
</div>
</div>
</div>
</div>
<div class="settings-section">
<h3>📊 Statistik</h3>
<div class="stats-overview">
<div class="stat-item">
<span class="stat-label">Gesamt Tassen:</span>
<span id="settings-total-cups">0</span>
</div>
<div class="stat-item">
<span class="stat-label">Tee-Sorten:</span>
<span id="settings-total-teas">0</span>
</div>
<div class="stat-item">
<span class="stat-label">Erster Eintrag:</span>
<span id="settings-first-entry">-</span>
</div>
<div class="stat-item">
<span class="stat-label">Letzter Eintrag:</span>
<span id="settings-last-entry">-</span>
</div>
</div>
</div>
</section>
<!-- Statistiken Tab --> <!-- Statistiken Tab -->
<section id="stats" class="tab-pane"> <section id="stats" class="tab-pane">
<h2>Statistiken</h2> <h2>Statistiken</h2>
@ -200,6 +323,27 @@
</label> </label>
</div> </div>
<div class="form-group">
<label>Bewertung</label>
<div class="star-rating" id="tea-rating">
<span class="star" data-value="1"></span>
<span class="star" data-value="2"></span>
<span class="star" data-value="3"></span>
<span class="star" data-value="4"></span>
<span class="star" data-value="5"></span>
</div>
<input type="hidden" id="tea-rating-value" value="3">
</div>
<div class="form-group">
<label for="tea-image-upload">Tee-Foto</label>
<input type="file" id="tea-image-upload" accept="image/*">
<div id="tea-image-preview" class="image-preview" style="display: none; margin-top: 10px;">
<img id="tea-image-preview-img" style="max-width: 150px; max-height: 150px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.2);">
</div>
<input type="hidden" id="tea-image-data" value="">
</div>
<div class="form-group"> <div class="form-group">
<label for="tea-color">Farbe</label> <label for="tea-color">Farbe</label>
<input type="color" id="tea-color" value="#8B4513"> <input type="color" id="tea-color" value="#8B4513">
@ -229,6 +373,24 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Import Modal -->
<div id="import-modal" class="modal">
<div class="modal-content" style="max-width: 600px;">
<div class="modal-header">
<h2>Daten importieren</h2>
<button id="close-import-modal" class="close-btn">&times;</button>
</div>
<div class="modal-body">
<p>Füge deine exportierten TeeTracker-Daten hier ein:</p>
<textarea id="import-data-textarea" class="modal-textarea" placeholder="{\n \"teas\": [...],\n \"entries\": [...]\n}"></textarea>
</div>
<div class="modal-footer">
<button id="import-data-btn" class="btn btn-primary">📥 Importieren</button>
<button id="cancel-import-btn" class="btn btn-secondary">Abbrechen</button>
</div>
</div>
</div>
</div> </div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

View File

@ -815,3 +815,224 @@ header p {
.organic-badge:hover { .organic-badge:hover {
transform: scale(1.1); transform: scale(1.1);
} }
/* Settings Section */
.settings-section {
background-color: var(--card-bg);
border-radius: var(--border-radius);
padding: 20px;
box-shadow: var(--box-shadow);
margin-bottom: 20px;
}
.settings-section h3 {
margin-bottom: 15px;
color: var(--text-color);
border-bottom: 2px solid var(--primary-light);
padding-bottom: 10px;
}
.settings-section p {
color: var(--text-light);
margin-bottom: 20px;
line-height: 1.6;
}
/* Status Message */
.status-message {
margin-top: 15px;
padding: 10px;
border-radius: var(--border-radius);
font-size: 0.9rem;
}
.status-message.success {
background-color: rgba(40, 167, 69, 0.1);
color: var(--success-color);
border: 1px solid var(--success-color);
}
.status-message.error {
background-color: rgba(220, 53, 69, 0.1);
color: var(--danger-color);
border: 1px solid var(--danger-color);
}
.status-message.info {
background-color: rgba(78, 205, 196, 0.1);
color: var(--secondary-color);
border: 1px solid var(--secondary-color);
}
/* Status Badge */
.status-badge {
display: inline-block;
padding: 6px 12px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 600;
}
.status-badge.local {
background-color: #6c757d;
color: white;
}
.status-badge.connected {
background-color: var(--success-color);
color: white;
}
.status-badge.disconnected {
background-color: var(--danger-color);
color: white;
}
.status-badge.syncing {
background-color: var(--warning-color);
color: #333;
}
/* Stats Overview */
.stats-overview {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-top: 15px;
}
.stat-item {
display: flex;
justify-content: space-between;
padding: 10px;
background-color: #f9f9f9;
border-radius: var(--border-radius);
}
.stat-label {
color: var(--text-light);
font-size: 0.9rem;
}
.stat-value {
color: var(--text-color);
font-weight: 600;
}
/* Modal for Import/Export */
.modal-textarea {
width: 100%;
min-height: 200px;
font-family: monospace;
font-size: 0.85rem;
background-color: #f5f5f5;
border: 2px solid #ddd;
border-radius: var(--border-radius);
padding: 12px;
resize: vertical;
}
.modal-textarea:focus {
outline: none;
border-color: var(--primary-color);
}
/* Background Image Settings */
.bg-preview {
margin-top: 10px;
}
.bg-preview img {
max-width: 200px;
max-height: 150px;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
object-fit: cover;
}
/* Background Image for App */
.app-container {
background-image: var(--bg-image, none);
background-size: cover;
background-position: center;
background-attachment: fixed;
background-repeat: no-repeat;
}
/* Overlay for better text readability */
.app-container::before {
content: '';
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.85);
z-index: -1;
pointer-events: none;
}
/* Star Rating */
.star-rating {
display: flex;
gap: 5px;
font-size: 1.5rem;
cursor: pointer;
margin-top: 5px;
}
.star-rating .star {
color: #ccc;
transition: color 0.2s;
}
.star-rating .star:hover,
.star-rating .star.active {
color: #FFD700;
}
.star-rating .star:hover ~ .star {
color: #ccc;
}
/* Rating display on tea cards */
.rating-display {
color: #FFD700;
font-size: 0.9rem;
margin-left: 5px;
}
/* Rating display on tea cards */
.tea-rating-display {
display: inline-block;
margin-left: 8px;
font-size: 0.9rem;
}
.tea-rating-display .star {
color: #FFD700;
font-size: 1rem;
}
/* Image Upload Preview */
.image-preview {
margin-top: 10px;
}
.image-preview img {
max-width: 150px;
max-height: 150px;
border-radius: var(--border-radius);
box-shadow: var(--box-shadow);
object-fit: cover;
}
/* Tea card image */
.tea-image {
width: 60px;
height: 60px;
border-radius: var(--border-radius);
object-fit: cover;
box-shadow: var(--box-shadow);
margin-right: 10px;
}