mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
page flash
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
|||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
|
<meta name="apple-mobile-web-app-title" content="Roomba Rover" />
|
||||||
<title>Roomba Rover</title>
|
<title>Roomba Rover</title>
|
||||||
<script type="module" crossorigin src="/assets/index-lHlhzRkR.js"></script>
|
<script type="module" crossorigin src="/assets/index-BwAhhUs8.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-Djpv3bOo.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-Djpv3bOo.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ function playSubmitBeep() {
|
|||||||
export default function ScannerContent() {
|
export default function ScannerContent() {
|
||||||
const socket = useSocket();
|
const socket = useSocket();
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
|
const flashTimerRef = useRef(null);
|
||||||
const [scannerState, setScannerState] = useState(EMPTY_SCANNER_STATE);
|
const [scannerState, setScannerState] = useState(EMPTY_SCANNER_STATE);
|
||||||
|
const [flashActive, setFlashActive] = useState(false);
|
||||||
|
|
||||||
useDefaultNickname();
|
useDefaultNickname();
|
||||||
useUserIdentitySync();
|
useUserIdentitySync();
|
||||||
@@ -59,6 +61,12 @@ export default function ScannerContent() {
|
|||||||
focusInput();
|
focusInput();
|
||||||
}, [focusInput]);
|
}, [focusInput]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
window.clearTimeout(flashTimerRef.current);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleScannerState(nextState = {}) {
|
function handleScannerState(nextState = {}) {
|
||||||
setScannerState({
|
setScannerState({
|
||||||
@@ -81,6 +89,15 @@ export default function ScannerContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scannerState.beepAllowed) {
|
if (scannerState.beepAllowed) {
|
||||||
|
// The flash is paired with the local submit beep so rovers get an
|
||||||
|
// immediate visual confirmation that the scanner computer accepted input.
|
||||||
|
// It is intentionally not a success indicator; the server result still
|
||||||
|
// arrives separately as the resolved text and spoken label.
|
||||||
|
window.clearTimeout(flashTimerRef.current);
|
||||||
|
setFlashActive(true);
|
||||||
|
flashTimerRef.current = window.setTimeout(() => {
|
||||||
|
setFlashActive(false);
|
||||||
|
}, 120);
|
||||||
playSubmitBeep();
|
playSubmitBeep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +114,9 @@ export default function ScannerContent() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main
|
<main
|
||||||
className="flex min-h-screen cursor-default flex-col items-center justify-center overflow-hidden bg-black px-6 text-center text-white"
|
className={`flex min-h-screen cursor-default flex-col items-center justify-center overflow-hidden px-6 text-center ${
|
||||||
|
flashActive ? 'bg-white text-black' : 'bg-black text-white'
|
||||||
|
}`}
|
||||||
onClick={focusInput}
|
onClick={focusInput}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
@@ -115,7 +134,7 @@ export default function ScannerContent() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<section className="flex min-h-screen w-full items-center justify-center">
|
<section className="flex min-h-screen w-full items-center justify-center">
|
||||||
<h1 className="max-w-full break-words text-[18vw] font-black leading-none tracking-normal text-white">
|
<h1 className="max-w-full break-words text-[18vw] font-black leading-none tracking-normal">
|
||||||
{label}
|
{label}
|
||||||
</h1>
|
</h1>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user