From 730e7fea42becd07cd580c400183a4893876160e Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 26 May 2025 10:04:36 +0200 Subject: [PATCH] auto-git: [change] renderer.js --- renderer.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/renderer.js b/renderer.js index 6aec3b2..b8b6a95 100644 --- a/renderer.js +++ b/renderer.js @@ -316,21 +316,21 @@ folders.forEach(folderObj => { return `${m}:${sec}`; } -async function updateContentList(folderObj) { - // 1. Commits Today (global) +async function updateInteractionBar(folderObj) { + // Commits Today const stats = await window.electronAPI.getDailyCommitStats(); const today = new Date().toISOString().slice(0, 10); const commitsToday = stats[today] || 0; - // 2. Globale Werte + // Globale Variablen (falls du sie irgendwo setzt) const intelligentCommitThreshold = window.intelligentCommitThreshold || 50; const minutesCommitThreshold = window.minutesCommitThreshold || 20; - // 3. Lines until next Rewrite + // Lines until next Rewrite const linesChanged = folderObj?.linesChanged || 0; const linesUntilRewrite = Math.max(0, intelligentCommitThreshold - linesChanged); - // 4. Time until next Rewrite + // Time until next Rewrite let countdown = "00:00"; if (folderObj?.firstCandidateBirthday) { const msThreshold = minutesCommitThreshold * 60 * 1000; @@ -339,12 +339,19 @@ async function updateContentList(folderObj) { countdown = formatCountdown(msLeft); } - // 5. Schreibe Werte ins UI - document.getElementById('contentList').innerHTML = ` -
Commits Today: ${commitsToday}
-
Lines until next Rewrite: ${linesUntilRewrite}
-
Time until next Rewrite: ${countdown}
- `; + // Einsetzen in die Bar + document.getElementById('commitsToday').textContent = commitsToday; + document.getElementById('linesUntilRewrite').textContent = linesUntilRewrite; + document.getElementById('countdown').textContent = countdown; +} + +// Zeit-Formatter (wie gehabt) +function formatCountdown(ms) { + if (!ms || ms < 0) return "00:00"; + const totalSec = Math.floor(ms / 1000); + const min = Math.floor(totalSec / 60).toString().padStart(2, "0"); + const sec = (totalSec % 60).toString().padStart(2, "0"); + return `${min}:${sec}`; } // Helfer für mm:ss