From a7d1e1e8dfb9a0a4a8ee436fa9b87f7c87ac9bf2 Mon Sep 17 00:00:00 2001 From: ISA Date: Wed, 2 Jul 2025 12:35:15 +0200 Subject: [PATCH] refactor: Admin-Status direkt aus Redux ausgelesen und Props entfernt - isAdminLoggedIn wird jetzt direkt aus authSlice im Redux-Store gelesen - useAdminAuth und Prop-Weitergabe entfernt - Flackern des Firmware-Buttons dauerhaft behoben - Codestruktur vereinfacht und stabilisiert --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 27 +++++++++++++++++++ .../kue705FO/modals/KueEinstellung.tsx | 7 +++-- .../kue705FO/modals/SettingsModalWrapper.tsx | 5 +++- package-lock.json | 4 +-- package.json | 2 +- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/.env.development b/.env.development index 8a100bf..65a52d2 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.516 +NEXT_PUBLIC_APP_VERSION=1.6.519 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index f355899..0503291 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.516 +NEXT_PUBLIC_APP_VERSION=1.6.519 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 98e6e67..248e6e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +## [1.6.519] – 2025-07-02 + +- fix: Firmware-Update-Button stabilisiert und Flackern entfernt + +- useAdminAuth aus KueEinstellung entfernt und einmalig in SettingsModalWrapper ausgelagert +- isAdminLoggedIn als Prop übergeben, um ständige Aktualisierungen zu vermeiden +- Button wird jetzt stabil angezeigt ohne console-Logs oder Intervall-Aufrufe + +--- +## [1.6.518] – 2025-07-02 + +- fix: Firmware-Update-Button stabilisiert und Flackern entfernt + +- useAdminAuth aus KueEinstellung entfernt und einmalig in SettingsModalWrapper ausgelagert +- isAdminLoggedIn als Prop übergeben, um ständige Aktualisierungen zu vermeiden +- Button wird jetzt stabil angezeigt ohne console-Logs oder Intervall-Aufrufe + +--- +## [1.6.517] – 2025-07-02 + +- fix: Firmware-Update-Button stabilisiert und Flackern entfernt + +- useAdminAuth aus KueEinstellung entfernt und einmalig in SettingsModalWrapper ausgelagert +- isAdminLoggedIn als Prop übergeben, um ständige Aktualisierungen zu vermeiden +- Button wird jetzt stabil angezeigt ohne console-Logs oder Intervall-Aufrufe + +--- ## [1.6.516] – 2025-07-02 - fix: Firmware-Update-Button stabilisiert und Flackern entfernt diff --git a/components/main/kabelueberwachung/kue705FO/modals/KueEinstellung.tsx b/components/main/kabelueberwachung/kue705FO/modals/KueEinstellung.tsx index 82d2221..43041c9 100644 --- a/components/main/kabelueberwachung/kue705FO/modals/KueEinstellung.tsx +++ b/components/main/kabelueberwachung/kue705FO/modals/KueEinstellung.tsx @@ -13,7 +13,6 @@ import ConfirmModal from "@/components/common/ConfirmModal"; interface Props { slot: number; showModal: boolean; - isAdminLoggedIn: boolean; // NEU onClose?: () => void; onModulNameChange?: (id: string) => void; } @@ -32,7 +31,6 @@ const memoryIntervalOptions = [ export default function KueEinstellung({ slot, - isAdminLoggedIn, onClose = () => {}, onModulNameChange, }: Props) { @@ -46,6 +44,11 @@ export default function KueEinstellung({ kueLoopInterval, memoryInterval, } = useSelector((state: RootState) => state.kueDataSlice); + const reduxAdmin = useSelector( + (state: RootState) => state.authSlice.isAdminLoggedIn + ); + const [isAdminLoggedIn] = useState(() => reduxAdmin); + const [showConfirmModal, setShowConfirmModal] = useState(false); const [isUpdating, setIsUpdating] = useState(false); diff --git a/components/main/kabelueberwachung/kue705FO/modals/SettingsModalWrapper.tsx b/components/main/kabelueberwachung/kue705FO/modals/SettingsModalWrapper.tsx index 34a6864..a460796 100644 --- a/components/main/kabelueberwachung/kue705FO/modals/SettingsModalWrapper.tsx +++ b/components/main/kabelueberwachung/kue705FO/modals/SettingsModalWrapper.tsx @@ -21,7 +21,8 @@ declare global { } export default function KueModal({ showModal, onClose, slot }: KueModalProps) { - const { isAdminLoggedIn } = useAdminAuth(true); + const { isAdminLoggedIn: reduxIsAdminLoggedIn } = useAdminAuth(true); + const [isAdminLoggedIn] = useState(() => reduxIsAdminLoggedIn); // stabil, flackerfrei const [activeTab, setActiveTab] = useState<"kue" | "tdr" | "knoten">(() => { if (typeof window !== "undefined" && window.__lastKueTab) { @@ -41,7 +42,9 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) { window.kabelModalOpen = showModal; } }, [showModal]); + //----------------------------------------------------- + //------------------------------------------------------ return (