diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-08 09:25:03 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-09-08 09:25:03 +0200 |
| commit | 3148742b323ab71f1ef768a2f4dc353c00944034 (patch) | |
| tree | 8f88990514fb58d11a8669b58a7265dbd3420fe0 /src/routes/groceries/+page.svelte | |
| parent | 7d85a18867ca0fe2310218c63cfc696c0f916171 (diff) | |
Share grocery row component and list-page form actions
- GroceryRow.svelte renders the toggle row (checkbox, name, best ref,
arrow link) for both the list and catalog pages
- grocery-actions.ts grows full form actions: addCategoryAction,
addGroceryAction, addGroceryAndEditAction, deleteByIdAction; the
categories/groceries route servers become thin wrappers
Diffstat (limited to 'src/routes/groceries/+page.svelte')
| -rw-r--r-- | src/routes/groceries/+page.svelte | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/routes/groceries/+page.svelte b/src/routes/groceries/+page.svelte index 3646ba7..b134da7 100644 --- a/src/routes/groceries/+page.svelte +++ b/src/routes/groceries/+page.svelte @@ -3,7 +3,7 @@ import { goto } from '$app/navigation'; import { enhance } from '$app/forms'; import FuzzyAutocomplete from '$lib/components/FuzzyAutocomplete.svelte'; - import BestRef from '$lib/components/BestRef.svelte'; + import GroceryRow from '$lib/components/GroceryRow.svelte'; import { groupByCategory } from '$lib/shared/group-by-category'; import type { EnrichedGrocery } from '$lib/server/services/groceries'; @@ -96,25 +96,7 @@ <h3 class="category-name">{cat}</h3> <ul class="item-list"> {#each items as item (item.id)} - <li class="item-row item-row--fixed"> - <button - class="item-btn item-btn--grow" - name="id" - value={item.id} - type="submit" - aria-pressed={item.checked} - > - <span class="item-text"> - {item.name} - {#if item.bestRef} - <BestRef ref={item.bestRef} /> - {/if} - </span> - </button> - <a class="ref-link" href="/grocery/{item.id}?from=/groceries" - >→</a - > - </li> + <GroceryRow {item} from="/groceries" /> {/each} </ul> {/each} |
