FAB miniatura: mostrar usado/ideal sesión y semanal
Antes la miniatura mostraba solo "X% / Y%" (sesión / semanal). Ahora muestra "sUsado%/sIdeal% ~ wUsado%/wIdeal%" para ver de un vistazo si vas por encima o por debajo del ritmo proporcional al tiempo transcurrido en la sesión y en la semana. - sIdeal = % de los 5h de sesión ya transcurridos. - wIdeal = idealUsedByNow (% de la semana ya transcurrida). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
content.js
14
content.js
@@ -865,9 +865,17 @@
|
|||||||
const textEl = fab.querySelector('.claude-usage-tracker-fab-text');
|
const textEl = fab.querySelector('.claude-usage-tracker-fab-text');
|
||||||
if (!textEl) return;
|
if (!textEl) return;
|
||||||
if (!cache || !cache.pageData) { textEl.textContent = '—'; return; }
|
if (!cache || !cache.pageData) { textEl.textContent = '—'; return; }
|
||||||
const s = Math.round(cache.pageData.sessionUsage || 0);
|
const pd = cache.pageData;
|
||||||
const w = Math.round(cache.pageData.weeklyUsage || 0);
|
const dd = cache.dailyData || {};
|
||||||
textEl.textContent = `${s}% / ${w}%`;
|
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() {
|
function updateFabVisibility() {
|
||||||
|
|||||||
Reference in New Issue
Block a user