diff --git a/web/src/components/ListScreen.svelte b/web/src/components/ListScreen.svelte index a981b31..8436ed0 100644 --- a/web/src/components/ListScreen.svelte +++ b/web/src/components/ListScreen.svelte @@ -20,6 +20,7 @@ import ItemRow from './ItemRow.svelte'; import ItemSheet from './ItemSheet.svelte'; import TripBar from './TripBar.svelte'; + import SectionHeading from './SectionHeading.svelte'; import SectionSheet from './SectionSheet.svelte'; import Thumb from './Thumb.svelte'; import ListPicker from './ListPicker.svelte'; @@ -34,13 +35,18 @@ // the section whose icon is being picked; null for Other let iconFor = $state<{ section: Section | undefined } | null>(null); let input: HTMLInputElement; + const pickIcon = (section: Section | undefined) => (iconFor = { section }); const open = $derived(toBuy(items.items)); const trip = $derived(trips.current); - const groups = $derived(bySection(open, catalogue.kindSections, (i) => choices.sectionOf(i))); + // both the list and what was bought are grouped by section, in aisle order + const inSections = (list: Item[]) => + bySection(list, catalogue.kindSections, (i) => choices.sectionOf(i)); + const groups = $derived(inSections(open)); // products, barcodes and usual brands are for groceries const groceries = $derived(household.kind === GROCERIES); const recent = $derived(recentlyBought(items.items)); + const recentGroups = $derived(inSections(recent)); // "milk, bread, eggs" or a pasted list is several items const entries = $derived(splitEntries(text)); const many = $derived(entries.length > 1); @@ -274,20 +280,8 @@ {/if} {#each groups as group (group.section?.key ?? 'other')} - {@const label = sectionLabel(group.section, catalogue.lang) || t('list.other')}
-

- - -

+