Skip to content

Commit 66208a8

Browse files
committed
fix: only display NutritionCalculator component on product pages
1 parent 704a5fb commit 66208a8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/routes/+layout.svelte

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import Logo from '$lib/ui/Logo.svelte';
1414
import Navbar from '$lib/ui/Navbar.svelte';
1515
import Footer from '$lib/ui/Footer.svelte';
16-
import NutritionCalculator from '$lib/ui/NutritionCalculator.svelte';
1716
import SearchBar from '$lib/ui/SearchBar.svelte';
1817
import Toast from '$lib/ui/Toast.svelte';
1918
@@ -168,7 +167,9 @@
168167
<progress class="progress progress-secondary fixed top-0 h-1 rounded-none"></progress>
169168
{/if}
170169

171-
{#if !$isLoading}
170+
{#if $isLoading}
171+
<div class="py-10 text-center text-xl font-medium">Loading translations...</div>
172+
{:else}
172173
<div class="flex justify-center">
173174
<div class="bg-base-100 navbar hidden max-w-7xl px-10 xl:flex">
174175
<div class="navbar-start">
@@ -178,7 +179,6 @@
178179
<SearchBar bind:searchQuery onSearch={gotoProductsSearch} loading={isSearching} />
179180
</div>
180181
<div class="navbar-end gap-2">
181-
<NutritionCalculator />
182182
{#if $userInfo != null}
183183
<a class="btn btn-outline link" href={KEYCLOAK_ACCOUNT_URL}>Account</a>
184184
<a class="btn btn-outline link" href="/logout">Log out</a>
@@ -291,9 +291,6 @@
291291
{@render children?.()}
292292
</div>
293293
{/if}
294-
<NutritionCalculator />
295294
<Footer />
296295
<Toast />
297-
{:else}
298-
<div class="py-10 text-center text-xl font-medium">Loading translations...</div>
299296
{/if}

src/routes/products/[barcode]/+page.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import { userInfo } from '$lib/stores/pkceLoginStore';
2020
import { getWebsiteCtx } from '$lib/stores/website';
2121
import type { KnowledgePanel, Product } from '@openfoodfacts/openfoodfacts-nodejs';
22+
import NutritionCalculator from '$lib/ui/NutritionCalculator.svelte';
2223
2324
type Props = { data: PageData };
2425
@@ -123,3 +124,5 @@
123124
</Card>
124125
{/if}
125126
</div>
127+
128+
<NutritionCalculator />

0 commit comments

Comments
 (0)