Skip to content

Commit bb1b1d7

Browse files
authored
Merge pull request #63 from hyp3rd/feat/market-scoped
fix(food-search): bound the search sheet to a modal on desktop + fix the market flag
2 parents 7c59cba + c1c92a9 commit bb1b1d7

4 files changed

Lines changed: 23 additions & 14 deletions

File tree

components/macro/FoodSearchSheet.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,22 @@ export function FoodSearchSheet({
8181
role="dialog"
8282
aria-modal="true"
8383
aria-label={`Add food to ${mealName}`}
84-
className="fixed inset-0 z-[60] flex flex-col bg-background pt-safe"
84+
// Full-screen on mobile (the guided flow this was built for). On desktop
85+
// (sm+) a full-bleed layout is a small list floating in a black void, so
86+
// it becomes a centered, bounded modal over a dimmed backdrop — matching
87+
// the meal hub it's launched from. The inner panel sizes to its content
88+
// (short for the portion step, up to 85vh + scroll for the results).
89+
className="fixed inset-0 z-[60] flex flex-col bg-background pt-safe sm:items-center sm:justify-center sm:bg-black/70 sm:p-6"
8590
>
86-
<FoodSearchBody
87-
mealId={mealId}
88-
mealName={mealName}
89-
customFoodsRev={customFoodsRev}
90-
onLogFood={onLogFood}
91-
onBack={onBack}
92-
/>
91+
<div className="flex min-h-0 flex-1 flex-col sm:max-h-[85vh] sm:w-full sm:max-w-2xl sm:flex-none sm:overflow-hidden sm:rounded-2xl sm:border sm:border-border/60 sm:bg-background sm:shadow-2xl">
92+
<FoodSearchBody
93+
mealId={mealId}
94+
mealName={mealName}
95+
customFoodsRev={customFoodsRev}
96+
onLogFood={onLogFood}
97+
onBack={onBack}
98+
/>
99+
</div>
93100
</div>,
94101
document.body,
95102
);
@@ -168,7 +175,7 @@ function FoodSearchBody({
168175
</div>
169176
</header>
170177

171-
<div className="flex flex-1 flex-col gap-5 overflow-y-auto px-4 py-5">
178+
<div className="flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 py-5">
172179
<p className="flex flex-wrap items-center gap-x-2 font-mono text-sm tabular-nums">
173180
<span className="text-foreground">{pickedKcal} kcal</span>
174181
<span className="text-muted-foreground/50">·</span>
@@ -280,7 +287,7 @@ function FoodSearchBody({
280287
</div>
281288
</div>
282289

283-
<div className="flex-1 space-y-1.5 overflow-y-auto px-3 py-3">
290+
<div className="min-h-0 flex-1 space-y-1.5 overflow-y-auto px-3 py-3">
284291
{search.results.map((food) => (
285292
<button
286293
key={food.id ?? food.name}

components/macro/MarketSwitcher.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export function MarketSwitcher() {
5353
</DropdownMenuTrigger>
5454
<DropdownMenuContent
5555
align="end"
56-
className="max-h-[60vh] min-w-[12rem] overflow-y-auto"
56+
// Above the food-search sheet's opaque z-[60] overlay — otherwise the
57+
// menu opens behind it and the trigger looks dead.
58+
className="z-[70] max-h-[60vh] min-w-[12rem] overflow-y-auto"
5759
>
5860
{/* Tier 1 — defer to the synced home market / browser region. */}
5961
<DropdownMenuItem

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "maqro",
3-
"version": "0.6.23",
3+
"version": "0.6.24",
44
"private": true,
55
"license": "Attribution-NonCommercial-NoDerivatives 4.0 International",
66
"workspaces": [

0 commit comments

Comments
 (0)