v0.19.1 — Pantry: quantity steppers go by whole numbers
Changed step from 0.25 to 1 on the Quantity and "how much are you using" number inputs so the spinner arrows move by wholes. Added noValidate on both forms (native step-mismatch validation would otherwise block submitting typed partials like 2.5) plus manual amount-bounds checks in the use dialog to replace the native min/max constraints that noValidate disables. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -224,7 +224,7 @@ export function PantryItemDialog({ item, locations, plants, onSuccess }: Props)
|
||||
<DialogTitle>{item ? "Edit item" : "Add pantry item"}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<form onSubmit={handleSubmit} className="space-y-4 py-2">
|
||||
<form onSubmit={handleSubmit} noValidate className="space-y-4 py-2">
|
||||
|
||||
{/* Name with autocomplete */}
|
||||
<div className="space-y-1 relative">
|
||||
@@ -308,7 +308,7 @@ export function PantryItemDialog({ item, locations, plants, onSuccess }: Props)
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Label>Quantity *</Label>
|
||||
<input className={inputCls} type="number" min="0" step="0.25" value={form.quantity} onChange={e => set("quantity", e.target.value)} required />
|
||||
<input className={inputCls} type="number" min="0" step="1" value={form.quantity} onChange={e => set("quantity", e.target.value)} required />
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<Label>Unit</Label>
|
||||
|
||||
@@ -31,6 +31,15 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
||||
|
||||
async function handleSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
const parsed = parseFloat(amount);
|
||||
if (!parsed || parsed <= 0) {
|
||||
setError("Enter an amount greater than 0");
|
||||
return;
|
||||
}
|
||||
if (parsed > item.quantity) {
|
||||
setError(`Only ${item.quantity} ${item.unit ?? ""} on hand`.trim());
|
||||
return;
|
||||
}
|
||||
setSaving(true);
|
||||
setError(null);
|
||||
try {
|
||||
@@ -65,7 +74,7 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
||||
<DialogHeader>
|
||||
<DialogTitle>Use {item.name}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<form onSubmit={handleSubmit} className="space-y-4 py-2">
|
||||
<form onSubmit={handleSubmit} noValidate className="space-y-4 py-2">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Currently: <strong>{item.quantity} {item.unit ?? ""}</strong>
|
||||
</p>
|
||||
@@ -74,9 +83,8 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
||||
<input
|
||||
className={inputCls}
|
||||
type="number"
|
||||
min="0.25"
|
||||
max={item.quantity}
|
||||
step="0.25"
|
||||
min="0"
|
||||
step="1"
|
||||
value={amount}
|
||||
onChange={e => setAmount(e.target.value)}
|
||||
required
|
||||
|
||||
@@ -8,6 +8,13 @@ export type ChangelogEntry = {
|
||||
};
|
||||
|
||||
export const CHANGELOG: ChangelogEntry[] = [
|
||||
{
|
||||
version: "0.19.1",
|
||||
date: "2026-06-29",
|
||||
changes: [
|
||||
"Pantry: the quantity up/down arrows now step by whole numbers instead of quarters — you can still type a partial amount like 2.5 directly.",
|
||||
],
|
||||
},
|
||||
{
|
||||
version: "0.19.0",
|
||||
date: "2026-06-29",
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`.
|
||||
export const APP_VERSION = "0.19.0";
|
||||
export const APP_VERSION = "0.19.1";
|
||||
|
||||
Reference in New Issue
Block a user