feat: Credits-System mit Verbrauchsanzeige im User-Dropdown
- DB-Migration: credits_total/credits_used/cost_per_credit auf licenses, token_usage_monthly Tabelle - Orchestrator: Monatliche Token-Aggregation + Credits-Abzug nach Refresh - Auth: Credits-Daten im /me Endpoint + Bugfix fehlende Klammer in get() - Frontend: Credits-Balken im User-Dropdown mit Farbwechsel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dieser Commit ist enthalten in:
@@ -466,6 +466,32 @@ const App = {
|
||||
licInfoEl.textContent = label;
|
||||
}
|
||||
|
||||
// Credits-Anzeige im Dropdown
|
||||
const creditsSection = document.getElementById('credits-section');
|
||||
if (creditsSection && user.credits_total) {
|
||||
creditsSection.style.display = 'block';
|
||||
const bar = document.getElementById('credits-bar');
|
||||
const remainingEl = document.getElementById('credits-remaining');
|
||||
const totalEl = document.getElementById('credits-total');
|
||||
|
||||
const remaining = user.credits_remaining || 0;
|
||||
const total = user.credits_total || 1;
|
||||
const percentUsed = user.credits_percent_used || 0;
|
||||
const percentRemaining = Math.max(0, 100 - percentUsed);
|
||||
|
||||
remainingEl.textContent = remaining.toLocaleString('de-DE');
|
||||
totalEl.textContent = total.toLocaleString('de-DE');
|
||||
bar.style.width = percentRemaining + '%';
|
||||
|
||||
// Farbwechsel je nach Verbrauch
|
||||
bar.classList.remove('warning', 'critical');
|
||||
if (percentUsed > 80) {
|
||||
bar.classList.add('critical');
|
||||
} else if (percentUsed > 50) {
|
||||
bar.classList.add('warning');
|
||||
}
|
||||
}
|
||||
|
||||
// Dropdown Toggle
|
||||
const userBtn = document.getElementById('header-user-btn');
|
||||
const userDropdown = document.getElementById('header-user-dropdown');
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren