fix: Timer für jeder KÜ separate und nicht eine für alle, aktuell wird prozentzahl bei allen das gleiche angezeigt

This commit is contained in:
ISA
2025-09-08 10:46:20 +02:00
parent 9c218b2a1d
commit 72341abb23
8 changed files with 44 additions and 32 deletions

View File

@@ -1,7 +1,6 @@
"use client";
import React, { useEffect, useState } from "react";
import { useAppSelector, useAppDispatch } from "@/redux/store";
import { initPersistedTimings } from "@/redux/slices/deviceEventsSlice";
import { useAppSelector } from "@/redux/store";
export default function SlotActivityOverlay({
slotIndex,
@@ -25,32 +24,11 @@ export default function SlotActivityOverlay({
const comparisonStartedAtBySlot = useAppSelector(
(s) => s.deviceEvents.comparisonStartedAtBySlot
);
const dispatch = useAppDispatch();
const loopActive = Array.isArray(ksx) && ksx[slotIndex] === 1;
const tdrActive = Array.isArray(ksy) && ksy[slotIndex] === 1;
const comparisonActive = Array.isArray(ksz) && ksz[slotIndex] === 1;
// Load persisted timings only once (on mount)
useEffect(() => {
try {
const raw = localStorage.getItem("deviceEventsTimingsV1");
if (raw) {
const parsed = JSON.parse(raw);
dispatch(
initPersistedTimings({
loop: parsed.loop,
tdr: parsed.tdr,
compare: parsed.align || parsed.compare,
})
);
}
} catch (e) {
// eslint-disable-next-line no-console
console.warn("Failed to load persisted timings", e);
}
}, [dispatch]);
// Persist whenever arrays change
useEffect(() => {
try {