From 228b0617e6b1ef906b5a9c0c227b8e0329d0e26e Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:06:39 +0100 Subject: [PATCH] Mrt Button bug --- .../pilot/_components/mrt/MrtButtons.tsx | 151 ++++++++++ .../pilot/_components/mrt/MrtDisplay.tsx | 270 ++++++++++++++++++ .../mrt/images/PAGE_Home_no_group.png | Bin 0 -> 4472224 bytes .../navbar/_components/Connection.tsx | 1 - 4 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 apps/dispatch/app/(app)/pilot/_components/mrt/MrtButtons.tsx create mode 100644 apps/dispatch/app/(app)/pilot/_components/mrt/MrtDisplay.tsx create mode 100644 apps/dispatch/app/(app)/pilot/_components/mrt/images/PAGE_Home_no_group.png diff --git a/apps/dispatch/app/(app)/pilot/_components/mrt/MrtButtons.tsx b/apps/dispatch/app/(app)/pilot/_components/mrt/MrtButtons.tsx new file mode 100644 index 00000000..c7ace86d --- /dev/null +++ b/apps/dispatch/app/(app)/pilot/_components/mrt/MrtButtons.tsx @@ -0,0 +1,151 @@ +import { CSSProperties, useRef } from "react"; +import { useButtons } from "./useButtons"; + +const MRT_BUTTON_STYLES: CSSProperties = { + cursor: "pointer", + zIndex: "9999", + backgroundColor: "transparent", + border: "none", +}; + +interface MrtButtonProps { + onClick: () => void; + onHold?: () => void; + style: CSSProperties; +} + +const MrtButton = ({ onClick, onHold, style }: MrtButtonProps) => { + const timeoutRef = useRef(null); + + const handleMouseDown = () => { + if (!onHold) return; + timeoutRef.current = setTimeout(handleTimeoutExpired, 500); + }; + + const handleTimeoutExpired = () => { + timeoutRef.current = null; + if (onHold) { + onHold(); + } + }; + + const handleMouseUp = () => { + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + + onClick(); + } + }; + + return ( +