Skip to content

Commit 9c52ebe

Browse files
committed
fix: eliminar los NaN del panel de estado del dashboard
El objeto `state` solo contiene running, remainingMs, color y colorInfo, pero el panel leia `state.currentSequenceIndex` y `state.totalMs`, que nunca se setean. - "Secuencia" mostraba NaN/0 de forma permanente: la guarda era `!== null` y el valor era undefined, asi que entraba igual y hacia undefined + 1. Ahora usa sequenceMode, currentSequenceIndex y timerSequence.length, que son los valores reales del componente. - "Progreso" quedaba clavado en 0% y la barra calculaba un ancho NaN. Ahora usan el totalMs del componente. Detectado levantando la app, no compilando: los dos casos compilan sin warnings.
1 parent 1713552 commit 9c52ebe

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

src/main.jsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,15 +2066,17 @@ function App() {
20662066
<div
20672067
className="h-full transition-all duration-1000"
20682068
style={{
2069-
width: `${Math.max(
2070-
0,
2071-
Math.min(
2072-
100,
2073-
((state.totalMs - state.remainingMs) /
2074-
state.totalMs) *
2075-
100
2076-
)
2077-
)}%`,
2069+
width: `${
2070+
totalMs > 0
2071+
? Math.max(
2072+
0,
2073+
Math.min(
2074+
100,
2075+
((totalMs - state.remainingMs) / totalMs) * 100
2076+
)
2077+
)
2078+
: 0
2079+
}%`,
20782080
backgroundColor: getPreviewTextColor(),
20792081
}}
20802082
></div>
@@ -2096,10 +2098,11 @@ function App() {
20962098
Progreso
20972099
</div>
20982100
<div className="text-gray-800 dark:text-gray-200">
2099-
{Math.round(
2100-
((state.totalMs - state.remainingMs) / state.totalMs) *
2101-
100 || 0
2102-
)}
2101+
{totalMs > 0
2102+
? Math.round(
2103+
((totalMs - state.remainingMs) / totalMs) * 100
2104+
)
2105+
: 0}
21032106
%
21042107
</div>
21052108
</div>
@@ -2108,10 +2111,8 @@ function App() {
21082111
Secuencia
21092112
</div>
21102113
<div className="text-gray-800 dark:text-gray-200">
2111-
{state.currentSequenceIndex !== null
2112-
? `${state.currentSequenceIndex + 1}/${
2113-
timerSequence.length
2114-
}`
2114+
{sequenceMode && timerSequence.length > 0
2115+
? `${currentSequenceIndex + 1}/${timerSequence.length}`
21152116
: "Individual"}
21162117
</div>
21172118
</div>

0 commit comments

Comments
 (0)