{#if scannerOpen} scannerOpen = false} /> {/if} handleSearch(e.currentTarget.value)} autofocus 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" /> { scanError = null; scannerOpen = true; }} disabled={scanLoading} class="w-11 h-11 flex items-center justify-center rounded-xl bg-zinc-900 border border-zinc-700 text-zinc-400 hover:text-green-400 hover:border-green-500 disabled:opacity-50 transition-colors shrink-0" aria-label="Scan barcode" > {#if scanLoading} {:else} {/if} {#if scanError} {scanError} {/if} {#if productsQuery.isPending} {#each Array(6) as _} {/each} {:else if productsQuery.data?.products.length === 0} No products found Try a different name or Create "{q || 'new product'}" {:else} {#each productsQuery.data?.products ?? [] as product (product.id)} selectProduct(product)} class="w-full flex items-center justify-between px-4 py-3.5 hover:bg-zinc-900 transition-colors text-left" > {product.name} {kcal(product.calories)} kcal · P {g(product.protein)}g · C {g(product.carb)}g · F {g(product.fat)}g per 100g {/each} {/if} selectedProduct = null} title={selectedProduct?.name ?? ''} > {#if selectedProduct} {#if preview} {#each [ { label: 'kcal', value: preview.calories }, { label: 'protein', value: preview.protein + 'g' }, { label: 'carbs', value: preview.carb + 'g' }, { label: 'fat', value: preview.fat + 'g' }, ] as m} {m.value} {m.label} {/each} {/if} Grams grams = Math.max(1, grams - 10)} class="w-11 h-11 rounded-xl bg-zinc-800 hover:bg-zinc-700 transition-colors text-lg font-medium flex items-center justify-center" >− grams = grams + 10} class="w-11 h-11 rounded-xl bg-zinc-800 hover:bg-zinc-700 transition-colors text-lg font-medium flex items-center justify-center" >+ {submitting ? 'Adding…' : 'Add to meal'} {/if}
{scanError}
No products found
Try a different name or
{product.name}
{kcal(product.calories)} kcal · P {g(product.protein)}g · C {g(product.carb)}g · F {g(product.fat)}g per 100g
{m.value}
{m.label}