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:
@@ -17,7 +17,17 @@ export default async function PantryPage() {
|
||||
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 } }),
|
||||
]);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export type PantryItem = {
|
||||
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 };
|
||||
|
||||
const SOURCE_LABELS: Record<string, string> = {
|
||||
|
||||
@@ -341,7 +341,7 @@ export function PantryItemDialog({ item, locations, plants, onSuccess }: Props)
|
||||
<Label>Location</Label>
|
||||
<select className={inputCls} value={form.locationId} onChange={e => set("locationId", e.target.value)}>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user