diff --git a/content.js b/content.js index 02f862c..c5541cf 100644 --- a/content.js +++ b/content.js @@ -865,9 +865,17 @@ const textEl = fab.querySelector('.claude-usage-tracker-fab-text'); if (!textEl) return; if (!cache || !cache.pageData) { textEl.textContent = '—'; return; } - const s = Math.round(cache.pageData.sessionUsage || 0); - const w = Math.round(cache.pageData.weeklyUsage || 0); - textEl.textContent = `${s}% / ${w}%`; + const pd = cache.pageData; + const dd = cache.dailyData || {}; + const sessionTotalMin = SESSION_DURATION_HOURS * 60; + // usado e ideal de SESIÓN + const sUsed = Math.round(pd.sessionUsage || 0); + const sIdeal = Math.max(0, Math.min(100, + Math.round(100 - ((pd.sessionTimeRemainingMin || 0) / sessionTotalMin) * 100))); + // usado e ideal SEMANAL + const wUsed = Math.round(pd.weeklyUsage || 0); + const wIdeal = Math.round(dd.idealUsedByNow || 0); + textEl.textContent = `${sUsed}%/${sIdeal}% ~ ${wUsed}%/${wIdeal}%`; } function updateFabVisibility() {