Initialer Commit: TeeTracker Web-App
- index.html: Hauptstruktur der Anwendung - styles.css: Schönes, responsives Design - script.js: Komplette Logik mit localStorage Funktionen: - Teesorten verwalten (hinzufügen/entfernen) - Tee-Konsum tracken mit Brühzeit (kurz/normal/lang) - Dashboard mit Statistiken für heute, Monat, Jahr - Grafiken mit Chart.js für Visualisierung - Konsumhistorie mit Filteroptionen - Daten werden lokal im Browser gespeichert Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
138
index.html
Normal file
138
index.html
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>TeeTracker</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="app-container">
|
||||||
|
<header class="header">
|
||||||
|
<h1>🍵 TeeTracker</h1>
|
||||||
|
<p>Verfolge deinen Tee-Konsum</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<!-- Dashboard Section -->
|
||||||
|
<section class="dashboard">
|
||||||
|
<h2>Dashboard</h2>
|
||||||
|
|
||||||
|
<div class="stats-grid">
|
||||||
|
<div class="stat-card">
|
||||||
|
<h3>Heute</h3>
|
||||||
|
<div class="stat-value" id="today-count">0</div>
|
||||||
|
<div class="stat-label">Tassen</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-card">
|
||||||
|
<h3>Dieser Monat</h3>
|
||||||
|
<div class="stat-value" id="month-count">0</div>
|
||||||
|
<div class="stat-label">Tassen</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-card">
|
||||||
|
<h3>Dieses Jahr</h3>
|
||||||
|
<div class="stat-value" id="year-count">0</div>
|
||||||
|
<div class="stat-label">Tassen</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat-card">
|
||||||
|
<h3>Lieblingssorte</h3>
|
||||||
|
<div class="stat-value" id="favorite-tea">-</div>
|
||||||
|
<div class="stat-label"><span id="favorite-count">0</span> Tassen</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="charts-row">
|
||||||
|
<div class="chart-container">
|
||||||
|
<h3>Heutiger Konsum</h3>
|
||||||
|
<canvas id="todayChart"></canvas>
|
||||||
|
</div>
|
||||||
|
<div class="chart-container">
|
||||||
|
<h3>Monatlicher Konsum</h3>
|
||||||
|
<canvas id="monthChart"></canvas>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="chart-container full-width">
|
||||||
|
<h3>Jährlicher Konsum nach Sorte</h3>
|
||||||
|
<canvas id="yearChart"></canvas>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Tea Types Section -->
|
||||||
|
<section class="tea-types-section">
|
||||||
|
<h2>📝 Teesorten verwalten</h2>
|
||||||
|
<div class="form-container">
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
<div id="teaList" class="tea-list"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Track Consumption Section -->
|
||||||
|
<section class="track-section">
|
||||||
|
<h2>☕ Tee tracken</h2>
|
||||||
|
<div class="form-container">
|
||||||
|
<form id="trackForm" class="track-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="trackDate">Datum:</label>
|
||||||
|
<input type="date" id="trackDate" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="trackTea">Teesorte:</label>
|
||||||
|
<select id="trackTea" required></select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Brühzeit:</label>
|
||||||
|
<div class="radio-group">
|
||||||
|
<label class="radio-label">
|
||||||
|
<input type="radio" name="brewTime" value="kurz" checked>
|
||||||
|
<span>Kurz (1-2 Min.)</span>
|
||||||
|
</label>
|
||||||
|
<label class="radio-label">
|
||||||
|
<input type="radio" name="brewTime" value="normal">
|
||||||
|
<span>Normal (3-4 Min.)</span>
|
||||||
|
</label>
|
||||||
|
<label class="radio-label">
|
||||||
|
<input type="radio" name="brewTime" value="lang">
|
||||||
|
<span>Lang (5+ Min.)</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="trackAmount">Menge (Tassen):</label>
|
||||||
|
<input type="number" id="trackAmount" value="1" min="1" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="trackNotes">Notizen (optional):</label>
|
||||||
|
<textarea id="trackNotes" rows="2" placeholder="z. B. besonders aromatisch..."></textarea>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Tracken</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Consumption History Section -->
|
||||||
|
<section class="history-section">
|
||||||
|
<h2>📊 Letzte Einträge</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>
|
||||||
|
<button id="filterMonth" class="btn btn-secondary">Letzter Monat</button>
|
||||||
|
<button id="filterAll" class="btn btn-secondary active">Alle</button>
|
||||||
|
</div>
|
||||||
|
<div id="historyList" class="history-list"></div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
<p>TeeTracker © <span id="current-year"></span> | Daten werden lokal gespeichert</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
675
script.js
Normal file
675
script.js
Normal file
@ -0,0 +1,675 @@
|
|||||||
|
// TeeTracker Application
|
||||||
|
// Datenmodell und Logik
|
||||||
|
|
||||||
|
const App = {
|
||||||
|
// Initialer Zustand
|
||||||
|
state: {
|
||||||
|
teaTypes: [],
|
||||||
|
consumption: [],
|
||||||
|
currentFilter: 'all'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Storage Keys
|
||||||
|
storageKeys: {
|
||||||
|
teaTypes: 'teetracker_teaTypes',
|
||||||
|
consumption: 'teetracker_consumption'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Initialisierung
|
||||||
|
init() {
|
||||||
|
this.loadData();
|
||||||
|
this.bindEvents();
|
||||||
|
this.renderAll();
|
||||||
|
this.updateDate();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Daten laden
|
||||||
|
loadData() {
|
||||||
|
const savedTeaTypes = localStorage.getItem(this.storageKeys.teaTypes);
|
||||||
|
const savedConsumption = localStorage.getItem(this.storageKeys.consumption);
|
||||||
|
|
||||||
|
if (savedTeaTypes) {
|
||||||
|
this.state.teaTypes = JSON.parse(savedTeaTypes);
|
||||||
|
} else {
|
||||||
|
// Standard-Teetypen
|
||||||
|
this.state.teaTypes = [
|
||||||
|
{ id: 1, name: 'Grüner Tee', color: '#4CAF50' },
|
||||||
|
{ id: 2, name: 'Schwarzer Tee', color: '#795548' },
|
||||||
|
{ id: 3, name: 'Weißer Tee', color: '#E9E9E9' },
|
||||||
|
{ id: 4, name: 'Oolong Tee', color: '#FF9800' },
|
||||||
|
{ id: 5, name: 'Kräutertee', color: '#9C27B0' },
|
||||||
|
{ id: 6, name: 'Früchtetee', color: '#F44336' },
|
||||||
|
{ id: 7, name: 'Chai', color: '#FF5722' },
|
||||||
|
{ id: 8, name: 'Matcha', color: '#2E7D32' }
|
||||||
|
];
|
||||||
|
this.saveTeaTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedConsumption) {
|
||||||
|
this.state.consumption = JSON.parse(savedConsumption);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alte Daten migrieren (falls nötig)
|
||||||
|
this.migrateData();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Daten migrieren (für zukünftige Versionen)
|
||||||
|
migrateData() {
|
||||||
|
// Hier können Migrationen für ältere Datenformate hinzugefügt werden
|
||||||
|
},
|
||||||
|
|
||||||
|
// Daten speichern
|
||||||
|
saveTeaTypes() {
|
||||||
|
localStorage.setItem(this.storageKeys.teaTypes, JSON.stringify(this.state.teaTypes));
|
||||||
|
},
|
||||||
|
|
||||||
|
saveConsumption() {
|
||||||
|
localStorage.setItem(this.storageKeys.consumption, JSON.stringify(this.state.consumption));
|
||||||
|
},
|
||||||
|
|
||||||
|
// Events binden
|
||||||
|
bindEvents() {
|
||||||
|
// Formular für neue Teesorte
|
||||||
|
document.getElementById('addTeaForm').addEventListener('submit', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.addTeaType();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Formular für Tracking
|
||||||
|
document.getElementById('trackForm').addEventListener('submit', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.trackConsumption();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filter-Buttons
|
||||||
|
document.getElementById('filterToday').addEventListener('click', () => {
|
||||||
|
this.setFilter('today');
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('filterWeek').addEventListener('click', () => {
|
||||||
|
this.setFilter('week');
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('filterMonth').addEventListener('click', () => {
|
||||||
|
this.setFilter('month');
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('filterAll').addEventListener('click', () => {
|
||||||
|
this.setFilter('all');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Datum auf heute setzen
|
||||||
|
document.getElementById('trackDate').valueAsDate = new Date();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Filter setzen
|
||||||
|
setFilter(filter) {
|
||||||
|
this.state.currentFilter = filter;
|
||||||
|
this.renderHistory();
|
||||||
|
this.updateFilterButtons();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Filter-Buttons aktualisieren
|
||||||
|
updateFilterButtons() {
|
||||||
|
const buttons = [
|
||||||
|
{ id: 'filterToday', filter: 'today' },
|
||||||
|
{ id: 'filterWeek', filter: 'week' },
|
||||||
|
{ id: 'filterMonth', filter: 'month' },
|
||||||
|
{ id: 'filterAll', filter: 'all' }
|
||||||
|
];
|
||||||
|
|
||||||
|
buttons.forEach(btn => {
|
||||||
|
const element = document.getElementById(btn.id);
|
||||||
|
if (this.state.currentFilter === btn.filter) {
|
||||||
|
element.classList.add('active');
|
||||||
|
} else {
|
||||||
|
element.classList.remove('active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Neue Teesorte hinzufügen
|
||||||
|
addTeaType() {
|
||||||
|
const nameInput = document.getElementById('teaName');
|
||||||
|
const colorInput = document.getElementById('teaColor');
|
||||||
|
|
||||||
|
const name = nameInput.value.trim();
|
||||||
|
const color = colorInput.value;
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
this.showToast('Bitte geben Sie einen Namen für die Teesorte ein', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prüfen, ob die Sorte bereits existiert
|
||||||
|
const exists = this.state.teaTypes.some(t => t.name.toLowerCase() === name.toLowerCase());
|
||||||
|
if (exists) {
|
||||||
|
this.showToast('Diese Teesorte existiert bereits', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newTeaType = {
|
||||||
|
id: Date.now(),
|
||||||
|
name: name,
|
||||||
|
color: color
|
||||||
|
};
|
||||||
|
|
||||||
|
this.state.teaTypes.push(newTeaType);
|
||||||
|
this.saveTeaTypes();
|
||||||
|
this.renderTeaTypes();
|
||||||
|
this.renderTrackForm();
|
||||||
|
this.renderCharts();
|
||||||
|
|
||||||
|
nameInput.value = '';
|
||||||
|
colorInput.value = '#4CAF50';
|
||||||
|
|
||||||
|
this.showToast('Teesorte erfolgreich hinzugefügt', 'success');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Teesorte entfernen
|
||||||
|
removeTeaType(teaId) {
|
||||||
|
const teaType = this.state.teaTypes.find(t => t.id === teaId);
|
||||||
|
if (!teaType) return;
|
||||||
|
|
||||||
|
// Prüfen, ob die Sorte in Konsumdaten verwendet wird
|
||||||
|
const isUsed = this.state.consumption.some(c => c.teaId === teaId);
|
||||||
|
|
||||||
|
if (isUsed) {
|
||||||
|
if (!confirm('Diese Teesorte wird in Konsumdaten verwendet. Möchten Sie sie trotzdem entfernen?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.state.teaTypes = this.state.teaTypes.filter(t => t.id !== teaId);
|
||||||
|
|
||||||
|
// Konsumdaten bereinigen
|
||||||
|
this.state.consumption = this.state.consumption.map(c => {
|
||||||
|
if (c.teaId === teaId) {
|
||||||
|
c.teaId = null;
|
||||||
|
c.teaName = '[Gelöschte Sorte]';
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.saveTeaTypes();
|
||||||
|
this.saveConsumption();
|
||||||
|
this.renderTeaTypes();
|
||||||
|
this.renderTrackForm();
|
||||||
|
this.renderHistory();
|
||||||
|
this.renderCharts();
|
||||||
|
|
||||||
|
this.showToast('Teesorte entfernt', 'success');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Konsum tracken
|
||||||
|
trackConsumption() {
|
||||||
|
const dateInput = document.getElementById('trackDate');
|
||||||
|
const teaSelect = document.getElementById('trackTea');
|
||||||
|
const amountInput = document.getElementById('trackAmount');
|
||||||
|
const notesInput = document.getElementById('trackNotes');
|
||||||
|
|
||||||
|
const date = dateInput.value;
|
||||||
|
const teaId = parseInt(teaSelect.value);
|
||||||
|
const amount = parseInt(amountInput.value) || 1;
|
||||||
|
const notes = notesInput.value.trim();
|
||||||
|
|
||||||
|
// Brühzeit
|
||||||
|
const brewTimeRadio = document.querySelector('input[name="brewTime"]:checked');
|
||||||
|
const brewTime = brewTimeRadio ? brewTimeRadio.value : 'normal';
|
||||||
|
|
||||||
|
if (!date) {
|
||||||
|
this.showToast('Bitte wählen Sie ein Datum aus', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!teaId || isNaN(teaId)) {
|
||||||
|
this.showToast('Bitte wählen Sie eine Teesorte aus', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const teaType = this.state.teaTypes.find(t => t.id === teaId);
|
||||||
|
if (!teaType) {
|
||||||
|
this.showToast('Ungültige Teesorte', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const consumptionEntry = {
|
||||||
|
id: Date.now(),
|
||||||
|
date: date,
|
||||||
|
teaId: teaId,
|
||||||
|
teaName: teaType.name,
|
||||||
|
teaColor: teaType.color,
|
||||||
|
brewTime: brewTime,
|
||||||
|
amount: amount,
|
||||||
|
notes: notes,
|
||||||
|
createdAt: new Date().toISOString()
|
||||||
|
};
|
||||||
|
|
||||||
|
this.state.consumption.push(consumptionEntry);
|
||||||
|
this.saveConsumption();
|
||||||
|
|
||||||
|
// Formular zurücksetzen
|
||||||
|
dateInput.valueAsDate = new Date();
|
||||||
|
teaSelect.selectedIndex = 0;
|
||||||
|
amountInput.value = 1;
|
||||||
|
notesInput.value = '';
|
||||||
|
brewTimeRadio.checked = true;
|
||||||
|
|
||||||
|
this.renderAll();
|
||||||
|
this.showToast('Tee-Konsum erfolgreich getrackt!', 'success');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Konsum-Eintrag entfernen
|
||||||
|
removeConsumption(entryId) {
|
||||||
|
if (!confirm('Möchten Sie diesen Eintrag wirklich entfernen?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.state.consumption = this.state.consumption.filter(c => c.id !== entryId);
|
||||||
|
this.saveConsumption();
|
||||||
|
this.renderAll();
|
||||||
|
this.showToast('Eintrag entfernt', 'success');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Alle Render-Funktionen
|
||||||
|
renderAll() {
|
||||||
|
this.renderTeaTypes();
|
||||||
|
this.renderTrackForm();
|
||||||
|
this.renderHistory();
|
||||||
|
this.renderStats();
|
||||||
|
this.renderCharts();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Teetypen rendern
|
||||||
|
renderTeaTypes() {
|
||||||
|
const teaList = document.getElementById('teaList');
|
||||||
|
|
||||||
|
if (this.state.teaTypes.length === 0) {
|
||||||
|
teaList.innerHTML = `
|
||||||
|
<div class="empty-state">
|
||||||
|
<div class="icon">🍃</div>
|
||||||
|
<p>Keine Teesorten hinterlegt</p>
|
||||||
|
<p>Fügen Sie oben eine neue Teesorte hinzu</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
teaList.innerHTML = this.state.teaTypes.map(tea => `
|
||||||
|
<div class="tea-item" data-tea-id="${tea.id}">
|
||||||
|
<div class="tea-info">
|
||||||
|
<div class="tea-color" style="background-color: ${tea.color}"></div>
|
||||||
|
<span class="tea-name">${this.escapeHtml(tea.name)}</span>
|
||||||
|
</div>
|
||||||
|
<div class="tea-actions">
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="App.removeTeaType(${tea.id})"
|
||||||
|
title="Entfernen">×</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`).join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Track-Formular rendern
|
||||||
|
renderTrackForm() {
|
||||||
|
const teaSelect = document.getElementById('trackTea');
|
||||||
|
|
||||||
|
const options = this.state.teaTypes.map(tea =>
|
||||||
|
`<option value="${tea.id}" style="color: ${tea.color}">🎨 ${this.escapeHtml(tea.name)}</option>`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Standard-Option
|
||||||
|
options.unshift('<option value="" selected disabled>Teesorte auswählen</option>');
|
||||||
|
|
||||||
|
teaSelect.innerHTML = options.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Konsum-Historie rendern
|
||||||
|
renderHistory() {
|
||||||
|
const historyList = document.getElementById('historyList');
|
||||||
|
|
||||||
|
let filteredConsumption = [...this.state.consumption];
|
||||||
|
|
||||||
|
// Filter anwenden
|
||||||
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
const weekAgo = new Date();
|
||||||
|
weekAgo.setDate(weekAgo.getDate() - 7);
|
||||||
|
const weekAgoStr = weekAgo.toISOString().split('T')[0];
|
||||||
|
const monthAgo = new Date();
|
||||||
|
monthAgo.setMonth(monthAgo.getMonth() - 1);
|
||||||
|
const monthAgoStr = monthAgo.toISOString().split('T')[0];
|
||||||
|
|
||||||
|
switch (this.state.currentFilter) {
|
||||||
|
case 'today':
|
||||||
|
filteredConsumption = filteredConsumption.filter(c => c.date === today);
|
||||||
|
break;
|
||||||
|
case 'week':
|
||||||
|
filteredConsumption = filteredConsumption.filter(c => c.date >= weekAgoStr);
|
||||||
|
break;
|
||||||
|
case 'month':
|
||||||
|
filteredConsumption = filteredConsumption.filter(c => c.date >= monthAgoStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sortieren nach Datum (neueste zuerst)
|
||||||
|
filteredConsumption.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||||
|
|
||||||
|
if (filteredConsumption.length === 0) {
|
||||||
|
historyList.innerHTML = `
|
||||||
|
<div class="empty-state">
|
||||||
|
<div class="icon">☕</div>
|
||||||
|
<p>Keine Einträge gefunden</p>
|
||||||
|
<p>Tracken Sie Ihren ersten Tee!</p>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
historyList.innerHTML = filteredConsumption.map(entry => {
|
||||||
|
const date = new Date(entry.date);
|
||||||
|
const dateStr = date.toLocaleDateString('de-DE', {
|
||||||
|
weekday: 'short',
|
||||||
|
day: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
year: 'numeric'
|
||||||
|
});
|
||||||
|
|
||||||
|
const brewTimeLabel = this.getBrewTimeLabel(entry.brewTime);
|
||||||
|
const brewTimeClass = entry.brewTime;
|
||||||
|
|
||||||
|
return `
|
||||||
|
<div class="history-entry" data-entry-id="${entry.id}">
|
||||||
|
<div class="entry-info">
|
||||||
|
<div class="entry-date">${dateStr}</div>
|
||||||
|
<div class="entry-details">
|
||||||
|
<span class="entry-amount">${entry.amount}x ${this.escapeHtml(entry.teaName)}</span>
|
||||||
|
<span class="brew-time-badge ${brewTimeClass}">${brewTimeLabel}</span>
|
||||||
|
${entry.notes ? `<span class="entry-notes">📝 ${this.escapeHtml(entry.notes)}</span>` : ''}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="entry-actions">
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="App.removeConsumption(${entry.id})"
|
||||||
|
title="Entfernen">×</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}).join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
// Statistiken rendern
|
||||||
|
renderStats() {
|
||||||
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
const currentMonth = new Date().getMonth();
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
|
// Heute
|
||||||
|
const todayConsumption = this.state.consumption.filter(c => c.date === today);
|
||||||
|
const todayCount = todayConsumption.reduce((sum, c) => sum + c.amount, 0);
|
||||||
|
document.getElementById('today-count').textContent = todayCount;
|
||||||
|
|
||||||
|
// Dieser Monat
|
||||||
|
const monthConsumption = this.state.consumption.filter(c => {
|
||||||
|
const entryDate = new Date(c.date);
|
||||||
|
return entryDate.getMonth() === currentMonth && entryDate.getFullYear() === currentYear;
|
||||||
|
});
|
||||||
|
const monthCount = monthConsumption.reduce((sum, c) => sum + c.amount, 0);
|
||||||
|
document.getElementById('month-count').textContent = monthCount;
|
||||||
|
|
||||||
|
// Dieses Jahr
|
||||||
|
const yearConsumption = this.state.consumption.filter(c => {
|
||||||
|
const entryDate = new Date(c.date);
|
||||||
|
return entryDate.getFullYear() === currentYear;
|
||||||
|
});
|
||||||
|
const yearCount = yearConsumption.reduce((sum, c) => sum + c.amount, 0);
|
||||||
|
document.getElementById('year-count').textContent = yearCount;
|
||||||
|
|
||||||
|
// Lieblingssorte (meist konsumiert in diesem Jahr)
|
||||||
|
const yearTeaCounts = {};
|
||||||
|
yearConsumption.forEach(c => {
|
||||||
|
const teaName = c.teaName || 'Unbekannt';
|
||||||
|
yearTeaCounts[teaName] = (yearTeaCounts[teaName] || 0) + c.amount;
|
||||||
|
});
|
||||||
|
|
||||||
|
const sortedTeas = Object.entries(yearTeaCounts).sort((a, b) => b[1] - a[1]);
|
||||||
|
if (sortedTeas.length > 0) {
|
||||||
|
document.getElementById('favorite-tea').textContent = this.escapeHtml(sortedTeas[0][0]);
|
||||||
|
document.getElementById('favorite-count').textContent = sortedTeas[0][1];
|
||||||
|
} else {
|
||||||
|
document.getElementById('favorite-tea').textContent = '-';
|
||||||
|
document.getElementById('favorite-count').textContent = '0';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Charts rendern
|
||||||
|
renderCharts() {
|
||||||
|
this.renderTodayChart();
|
||||||
|
this.renderMonthChart();
|
||||||
|
this.renderYearChart();
|
||||||
|
},
|
||||||
|
|
||||||
|
// Heute-Chart
|
||||||
|
renderTodayChart() {
|
||||||
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
const todayConsumption = this.state.consumption.filter(c => c.date === today);
|
||||||
|
|
||||||
|
// Nach Teesorte gruppieren
|
||||||
|
const teaCounts = {};
|
||||||
|
const teaColors = {};
|
||||||
|
|
||||||
|
todayConsumption.forEach(c => {
|
||||||
|
const teaName = c.teaName || 'Unbekannt';
|
||||||
|
teaCounts[teaName] = (teaCounts[teaName] || 0) + c.amount;
|
||||||
|
teaColors[teaName] = c.teaColor || '#CCCCCC';
|
||||||
|
});
|
||||||
|
|
||||||
|
const teaNames = Object.keys(teaCounts);
|
||||||
|
const counts = Object.values(teaCounts);
|
||||||
|
const colors = teaNames.map(name => teaColors[name]);
|
||||||
|
|
||||||
|
const ctx = document.getElementById('todayChart').getContext('2d');
|
||||||
|
|
||||||
|
// Zerstören Sie das vorherige Chart, falls vorhanden
|
||||||
|
if (this.todayChart) {
|
||||||
|
this.todayChart.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.todayChart = new Chart(ctx, {
|
||||||
|
type: 'doughnut',
|
||||||
|
data: {
|
||||||
|
labels: teaNames,
|
||||||
|
datasets: [{
|
||||||
|
data: counts,
|
||||||
|
backgroundColor: colors,
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: true,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
position: 'bottom',
|
||||||
|
labels: {
|
||||||
|
padding: 10,
|
||||||
|
font: {
|
||||||
|
size: 11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Monat-Chart
|
||||||
|
renderMonthChart() {
|
||||||
|
const currentMonth = new Date().getMonth();
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
|
const monthConsumption = this.state.consumption.filter(c => {
|
||||||
|
const entryDate = new Date(c.date);
|
||||||
|
return entryDate.getMonth() === currentMonth && entryDate.getFullYear() === currentYear;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Nach Tag gruppieren
|
||||||
|
const dayCounts = {};
|
||||||
|
monthConsumption.forEach(c => {
|
||||||
|
const day = new Date(c.date).getDate();
|
||||||
|
dayCounts[day] = (dayCounts[day] || 0) + c.amount;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Alle Tage des Monats
|
||||||
|
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
|
||||||
|
const labels = Array.from({ length: daysInMonth }, (_, i) => (i + 1).toString());
|
||||||
|
const data = labels.map(day => dayCounts[parseInt(day)] || 0);
|
||||||
|
|
||||||
|
const ctx = document.getElementById('monthChart').getContext('2d');
|
||||||
|
|
||||||
|
if (this.monthChart) {
|
||||||
|
this.monthChart.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.monthChart = new Chart(ctx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: labels,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Tassen pro Tag',
|
||||||
|
data: data,
|
||||||
|
backgroundColor: 'rgba(76, 175, 80, 0.7)',
|
||||||
|
borderColor: 'rgba(76, 175, 80, 1)',
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: true,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true,
|
||||||
|
ticks: {
|
||||||
|
stepSize: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Jahr-Chart
|
||||||
|
renderYearChart() {
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
|
const yearConsumption = this.state.consumption.filter(c => {
|
||||||
|
const entryDate = new Date(c.date);
|
||||||
|
return entryDate.getFullYear() === currentYear;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Nach Teesorte gruppieren
|
||||||
|
const teaCounts = {};
|
||||||
|
const teaColors = {};
|
||||||
|
|
||||||
|
yearConsumption.forEach(c => {
|
||||||
|
const teaName = c.teaName || 'Unbekannt';
|
||||||
|
teaCounts[teaName] = (teaCounts[teaName] || 0) + c.amount;
|
||||||
|
teaColors[teaName] = c.teaColor || '#CCCCCC';
|
||||||
|
});
|
||||||
|
|
||||||
|
const teaNames = Object.keys(teaCounts);
|
||||||
|
const counts = Object.values(teaCounts);
|
||||||
|
const colors = teaNames.map(name => teaColors[name]);
|
||||||
|
|
||||||
|
const ctx = document.getElementById('yearChart').getContext('2d');
|
||||||
|
|
||||||
|
if (this.yearChart) {
|
||||||
|
this.yearChart.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.yearChart = new Chart(ctx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: teaNames,
|
||||||
|
datasets: [{
|
||||||
|
label: 'Tassen',
|
||||||
|
data: counts,
|
||||||
|
backgroundColor: colors,
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
maintainAspectRatio: true,
|
||||||
|
indexAxis: 'y',
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
x: {
|
||||||
|
beginAtZero: true,
|
||||||
|
ticks: {
|
||||||
|
stepSize: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// Brühzeit-Label
|
||||||
|
getBrewTimeLabel(brewTime) {
|
||||||
|
const labels = {
|
||||||
|
'kurz': 'Kurz',
|
||||||
|
'normal': 'Normal',
|
||||||
|
'lang': 'Lang'
|
||||||
|
};
|
||||||
|
return labels[brewTime] || brewTime;
|
||||||
|
},
|
||||||
|
|
||||||
|
// HTML escape
|
||||||
|
escapeHtml(text) {
|
||||||
|
if (!text) return '';
|
||||||
|
const div = document.createElement('div');
|
||||||
|
div.textContent = text;
|
||||||
|
return div.innerHTML;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Toast-Nachricht anzeigen
|
||||||
|
showToast(message, type = 'success') {
|
||||||
|
// Entferne bestehende Toasts
|
||||||
|
const existingToast = document.querySelector('.toast');
|
||||||
|
if (existingToast) {
|
||||||
|
existingToast.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
const toast = document.createElement('div');
|
||||||
|
toast.className = `toast ${type}`;
|
||||||
|
toast.textContent = message;
|
||||||
|
document.body.appendChild(toast);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.style.animation = 'slideIn 0.3s ease-out reverse';
|
||||||
|
setTimeout(() => {
|
||||||
|
toast.remove();
|
||||||
|
}, 300);
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Datum aktualisieren (Fußzeile)
|
||||||
|
updateDate() {
|
||||||
|
const yearSpan = document.getElementById('current-year');
|
||||||
|
if (yearSpan) {
|
||||||
|
yearSpan.textContent = new Date().getFullYear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initialisierung beim Laden der Seite
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
App.init();
|
||||||
|
});
|
||||||
634
styles.css
Normal file
634
styles.css
Normal file
@ -0,0 +1,634 @@
|
|||||||
|
/* General Styles */
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--primary-color: #2E7D32;
|
||||||
|
--secondary-color: #4CAF50;
|
||||||
|
--accent-color: #81C784;
|
||||||
|
--background-color: #F5F5F5;
|
||||||
|
--card-background: #FFFFFF;
|
||||||
|
--text-primary: #333333;
|
||||||
|
--text-secondary: #666666;
|
||||||
|
--border-color: #E0E0E0;
|
||||||
|
--success-color: #4CAF50;
|
||||||
|
--warning-color: #FF9800;
|
||||||
|
--error-color: #F44336;
|
||||||
|
--shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
--border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-primary);
|
||||||
|
line-height: 1.6;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* App Container */
|
||||||
|
.app-container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px 0;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Content */
|
||||||
|
.main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sections */
|
||||||
|
section {
|
||||||
|
background: var(--card-background);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 25px;
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
section h2 {
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 2px solid var(--accent-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stats Grid */
|
||||||
|
.stats-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
background: linear-gradient(135deg, var(--card-background) 0%, #F9F9F9 100%);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card h3 {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Charts */
|
||||||
|
.charts-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
background: var(--card-background);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container.full-width {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container h3 {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: var(--text-primary);
|
||||||
|
margin-bottom: 15px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Forms */
|
||||||
|
.form-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-form {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-form input[type="text"] {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 200px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-form input[type="color"] {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
padding: 0;
|
||||||
|
border: 2px solid var(--border-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.track-form {
|
||||||
|
display: grid;
|
||||||
|
gap: 15px;
|
||||||
|
max-width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="text"],
|
||||||
|
.form-group input[type="number"],
|
||||||
|
.form-group input[type="date"],
|
||||||
|
.form-group select,
|
||||||
|
.form-group textarea {
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
font-size: 1rem;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus,
|
||||||
|
.form-group select:focus,
|
||||||
|
.form-group textarea:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group textarea {
|
||||||
|
resize: vertical;
|
||||||
|
min-height: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Radio Group */
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 15px;
|
||||||
|
background: var(--background-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-label:hover {
|
||||||
|
background: #E8F5E8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-label input[type="radio"] {
|
||||||
|
accent-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-label input[type="radio"]:checked + span {
|
||||||
|
color: var(--primary-color);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Buttons */
|
||||||
|
.btn {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #266F2B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-primary);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background-color: #E0E0E0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary.active {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: white;
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background-color: var(--error-color);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger:hover {
|
||||||
|
background-color: #D32F2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tea List */
|
||||||
|
.tea-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px 15px;
|
||||||
|
background: var(--background-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
border: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .tea-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .tea-color {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 2px solid var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .tea-name {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .tea-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .btn-icon {
|
||||||
|
padding: 5px 10px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* History Section */
|
||||||
|
.history-controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 15px;
|
||||||
|
background: var(--background-color);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
border-left: 4px solid var(--primary-color);
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry:hover {
|
||||||
|
transform: translateX(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-date {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-details {
|
||||||
|
display: flex;
|
||||||
|
gap: 15px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-amount {
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .brew-time-badge {
|
||||||
|
padding: 3px 8px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brew-time-badge.kurz {
|
||||||
|
background: #E3F2FD;
|
||||||
|
color: #1976D2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brew-time-badge.normal {
|
||||||
|
background: #FFF3E0;
|
||||||
|
color: #F57C00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brew-time-badge.lang {
|
||||||
|
background: #FCE4EC;
|
||||||
|
color: #C2185B;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 5px;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .btn-icon {
|
||||||
|
padding: 3px 6px;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Empty State */
|
||||||
|
.empty-state {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state p {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state .icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer */
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
margin-top: 30px;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive Design */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.charts-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-grid {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-form {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-form input[type="text"] {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-controls {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-controls .btn {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.stats-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tea-item .tea-actions {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-entry .entry-actions {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Animations */
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-animated {
|
||||||
|
animation: fadeIn 0.5s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toast Notifications */
|
||||||
|
.toast {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
background: var(--text-primary);
|
||||||
|
color: white;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||||
|
z-index: 1000;
|
||||||
|
animation: slideIn 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.success {
|
||||||
|
background: var(--success-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast.error {
|
||||||
|
background: var(--error-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slideIn {
|
||||||
|
from {
|
||||||
|
transform: translateX(100%);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: translateX(0);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal */
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1000;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background: var(--card-background);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 25px;
|
||||||
|
max-width: 500px;
|
||||||
|
width: 90%;
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h3 {
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-close:hover {
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user