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>
|
<DialogTitle>{item ? "Edit item" : "Add pantry item"}</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-4 py-2">
|
<form onSubmit={handleSubmit} noValidate className="space-y-4 py-2">
|
||||||
|
|
||||||
{/* Name with autocomplete */}
|
{/* Name with autocomplete */}
|
||||||
<div className="space-y-1 relative">
|
<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="grid grid-cols-2 gap-3">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Quantity *</Label>
|
<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>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Unit</Label>
|
<Label>Unit</Label>
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
|||||||
|
|
||||||
async function handleSubmit(e: React.FormEvent) {
|
async function handleSubmit(e: React.FormEvent) {
|
||||||
e.preventDefault();
|
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);
|
setSaving(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
@@ -65,7 +74,7 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
|||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Use {item.name}</DialogTitle>
|
<DialogTitle>Use {item.name}</DialogTitle>
|
||||||
</DialogHeader>
|
</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">
|
<p className="text-sm text-muted-foreground">
|
||||||
Currently: <strong>{item.quantity} {item.unit ?? ""}</strong>
|
Currently: <strong>{item.quantity} {item.unit ?? ""}</strong>
|
||||||
</p>
|
</p>
|
||||||
@@ -74,9 +83,8 @@ export function UseItemDialog({ item, onSuccess }: { item: PantryItem; onSuccess
|
|||||||
<input
|
<input
|
||||||
className={inputCls}
|
className={inputCls}
|
||||||
type="number"
|
type="number"
|
||||||
min="0.25"
|
min="0"
|
||||||
max={item.quantity}
|
step="1"
|
||||||
step="0.25"
|
|
||||||
value={amount}
|
value={amount}
|
||||||
onChange={e => setAmount(e.target.value)}
|
onChange={e => setAmount(e.target.value)}
|
||||||
required
|
required
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ export type ChangelogEntry = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CHANGELOG: 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",
|
version: "0.19.0",
|
||||||
date: "2026-06-29",
|
date: "2026-06-29",
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// Bump on every user-visible release. Changelog entries live in `src/lib/changelog.ts`.
|
// 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