v0.18.1 patch — Pantry: location dropdown shows Kitchen only

Filter locations to Kitchen and its children (fridge, freezer, pantry
shelves, etc.). Display the full path so "Kitchen › Freezer" shows
instead of just "Freezer".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Bonna Moon
2026-06-29 17:49:37 -05:00
parent e501679416
commit c449b0c2ae
3 changed files with 13 additions and 3 deletions

View File

@@ -17,7 +17,17 @@ export default async function PantryPage() {
plant: { select: { id: true, commonName: true, variety: true } }, plant: { select: { id: true, commonName: true, variety: true } },
}, },
}), }),
db.location.findMany({ where: { active: true }, orderBy: { name: "asc" }, select: { id: true, name: true } }), db.location.findMany({
where: {
active: true,
OR: [
{ name: { equals: "Kitchen", mode: "insensitive" } },
{ path: { contains: "Kitchen", mode: "insensitive" } },
],
},
orderBy: { path: "asc" },
select: { id: true, name: true, path: true },
}),
db.plant.findMany({ where: { active: true }, orderBy: { commonName: "asc" }, select: { id: true, commonName: true, variety: true } }), db.plant.findMany({ where: { active: true }, orderBy: { commonName: "asc" }, select: { id: true, commonName: true, variety: true } }),
]); ]);

View File

@@ -26,7 +26,7 @@ export type PantryItem = {
notes: string | null; notes: string | null;
}; };
export type LocationOption = { id: string; name: string }; export type LocationOption = { id: string; name: string; path: string | null };
export type PlantOption = { id: string; commonName: string; variety: string | null }; export type PlantOption = { id: string; commonName: string; variety: string | null };
const SOURCE_LABELS: Record<string, string> = { const SOURCE_LABELS: Record<string, string> = {

View File

@@ -341,7 +341,7 @@ export function PantryItemDialog({ item, locations, plants, onSuccess }: Props)
<Label>Location</Label> <Label>Location</Label>
<select className={inputCls} value={form.locationId} onChange={e => set("locationId", e.target.value)}> <select className={inputCls} value={form.locationId} onChange={e => set("locationId", e.target.value)}>
<option value=""> none </option> <option value=""> none </option>
{locations.map(l => <option key={l.id} value={l.id}>{l.name}</option>)} {locations.map(l => <option key={l.id} value={l.id}>{l.path ?? l.name}</option>)}
</select> </select>
</div> </div>