Refactor input handlings slightly

This commit is contained in:
Chandler Swift 2026-02-11 20:41:29 -06:00
parent f9435c3a21
commit 26fac96b14
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -99,16 +99,12 @@ function App() {
// Handle keyboard/scanner input
useEffect(() => {
const handleKeyDown = (ev: KeyboardEvent) => {
if (ev.key === "s") { // TODO: remove
ev.preventDefault();
lookupBarcode("075021370814");
return;
} else if (ev.key === "d") {
ev.preventDefault();
lookupBarcode("015775150522");
return
ev.preventDefault();
if (ev.key === "F1") { // TODO: remove
lookupBarcode("075021370814"); // Breakfast in America; owned
} else if (ev.key === "F2") {
lookupBarcode("015775150522"); // Crime of the Century; not owned
} else if (ev.key === "Enter") {
ev.preventDefault();
const code = buffer.join("").trim();
setBuffer([]); // Reset the buffer
lookupBarcode(code);