enter submits

This commit is contained in:
Piotr Domański 2026-04-02 12:44:33 +02:00
parent 52a235f8ac
commit 1ff33bedaa
2 changed files with 8 additions and 0 deletions

View file

@ -128,6 +128,12 @@
placeholder="Search foods…" placeholder="Search foods…"
value={q} value={q}
oninput={(e) => handleSearch(e.currentTarget.value)} oninput={(e) => handleSearch(e.currentTarget.value)}
onkeydown={(e) => {
if (e.key === 'Enter') {
const first = productsQuery.data?.products[0];
if (first) selectProduct(first);
}
}}
class="w-full bg-zinc-900 border border-zinc-700 rounded-xl pl-9 pr-4 py-2.5 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:border-green-500 transition-colors" class="w-full bg-zinc-900 border border-zinc-700 rounded-xl pl-9 pr-4 py-2.5 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:border-green-500 transition-colors"
/> />
</div> </div>
@ -240,6 +246,7 @@
min="1" min="1"
max="5000" max="5000"
inputmode="decimal" inputmode="decimal"
onkeydown={(e) => { if (e.key === 'Enter') handleAddEntry(); }}
class="flex-1 bg-zinc-800 border border-zinc-700 rounded-xl px-4 py-2.5 text-center text-xl font-semibold focus:outline-none focus:border-green-500 transition-colors" class="flex-1 bg-zinc-800 border border-zinc-700 rounded-xl px-4 py-2.5 text-center text-xl font-semibold focus:outline-none focus:border-green-500 transition-colors"
/> />
<button <button

View file

@ -124,6 +124,7 @@
min="1" min="1"
max="5000" max="5000"
inputmode="decimal" inputmode="decimal"
onkeydown={(e) => { if (e.key === 'Enter') handleSave(); }}
class="flex-1 bg-zinc-900 border border-zinc-700 rounded-xl px-4 py-3 text-center text-2xl font-semibold focus:outline-none focus:border-green-500 transition-colors" class="flex-1 bg-zinc-900 border border-zinc-700 rounded-xl px-4 py-3 text-center text-2xl font-semibold focus:outline-none focus:border-green-500 transition-colors"
/> />
<button <button