diff --git a/frontend/src/routes/products/+page.server.ts b/frontend/src/routes/products/+page.server.ts
index 6bb8800..5248dcf 100644
--- a/frontend/src/routes/products/+page.server.ts
+++ b/frontend/src/routes/products/+page.server.ts
@@ -1,8 +1,7 @@
import { getProducts } from '$lib/api';
import type { PageServerLoad } from './$types';
-export const load: PageServerLoad = async ({ url }) => {
- const category = url.searchParams.get('category') ?? undefined;
- const products = await getProducts({ category });
- return { products, category };
+export const load: PageServerLoad = async () => {
+ const products = await getProducts();
+ return { products };
};
diff --git a/frontend/src/routes/products/+page.svelte b/frontend/src/routes/products/+page.svelte
index 6e1bd37..796f576 100644
--- a/frontend/src/routes/products/+page.svelte
+++ b/frontend/src/routes/products/+page.svelte
@@ -1,5 +1,6 @@
Products — innercontext
@@ -33,28 +60,21 @@
Products
-
{data.products.length} products
+
{totalCount} products
-
-
Filter by category:
-
+
+ {#each (['all', 'owned', 'unowned'] as OwnershipFilter[]) as f (f)}
+
+ {/each}
@@ -63,42 +83,47 @@
Name
Brand
- Category
Targets
Time
- {#each data.products as product (product.id)}
-
-
-
- {product.name}
-
-
- {product.brand}
-
- {product.category.replace(/_/g, ' ')}
-
-
-
- {#each product.targets.slice(0, 3) as t (t)}
- {t.replace(/_/g, ' ')}
- {/each}
- {#if product.targets.length > 3}
- +{product.targets.length - 3}
- {/if}
-
-
- {product.recommended_time}
-
- {:else}
+ {#if totalCount === 0}
-
+
No products found.
- {/each}
+ {:else}
+ {#each groupedProducts as [category, products] (category)}
+
+
+ {category.replace(/_/g, ' ')}
+
+
+ {#each products as product (product.id)}
+
+
+
+ {product.name}
+
+
+ {product.brand}
+
+
+ {#each product.targets.slice(0, 3) as t (t)}
+ {t.replace(/_/g, ' ')}
+ {/each}
+ {#if product.targets.length > 3}
+ +{product.targets.length - 3}
+ {/if}
+
+
+ {product.recommended_time}
+
+ {/each}
+ {/each}
+ {/if}