1
0

auto-git:

[change] renderer.js
This commit is contained in:
2025-05-26 10:04:36 +02:00
parent 9c8d686600
commit 730e7fea42

View File

@@ -316,21 +316,21 @@ folders.forEach(folderObj => {
return `${m}:${sec}`; return `${m}:${sec}`;
} }
async function updateContentList(folderObj) { async function updateInteractionBar(folderObj) {
// 1. Commits Today (global) // Commits Today
const stats = await window.electronAPI.getDailyCommitStats(); const stats = await window.electronAPI.getDailyCommitStats();
const today = new Date().toISOString().slice(0, 10); const today = new Date().toISOString().slice(0, 10);
const commitsToday = stats[today] || 0; const commitsToday = stats[today] || 0;
// 2. Globale Werte // Globale Variablen (falls du sie irgendwo setzt)
const intelligentCommitThreshold = window.intelligentCommitThreshold || 50; const intelligentCommitThreshold = window.intelligentCommitThreshold || 50;
const minutesCommitThreshold = window.minutesCommitThreshold || 20; const minutesCommitThreshold = window.minutesCommitThreshold || 20;
// 3. Lines until next Rewrite // Lines until next Rewrite
const linesChanged = folderObj?.linesChanged || 0; const linesChanged = folderObj?.linesChanged || 0;
const linesUntilRewrite = Math.max(0, intelligentCommitThreshold - linesChanged); const linesUntilRewrite = Math.max(0, intelligentCommitThreshold - linesChanged);
// 4. Time until next Rewrite // Time until next Rewrite
let countdown = "00:00"; let countdown = "00:00";
if (folderObj?.firstCandidateBirthday) { if (folderObj?.firstCandidateBirthday) {
const msThreshold = minutesCommitThreshold * 60 * 1000; const msThreshold = minutesCommitThreshold * 60 * 1000;
@@ -339,12 +339,19 @@ async function updateContentList(folderObj) {
countdown = formatCountdown(msLeft); countdown = formatCountdown(msLeft);
} }
// 5. Schreibe Werte ins UI // Einsetzen in die Bar
document.getElementById('contentList').innerHTML = ` document.getElementById('commitsToday').textContent = commitsToday;
<div>Commits Today: <b>${commitsToday}</b></div> document.getElementById('linesUntilRewrite').textContent = linesUntilRewrite;
<div>Lines until next Rewrite: <b>${linesUntilRewrite}</b></div> document.getElementById('countdown').textContent = countdown;
<div>Time until next Rewrite: <b>${countdown}</b></div> }
`;
// 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 // Helfer für mm:ss