Repository navigation
eddie/browse-page-item-category-filter - #179
Conversation
Adds BrowseFundraiserSchema (BasicFundraiserSchema plus itemCategories) for the browse list. getAllFundraisers includes only each item's category and returns the distinct values, so the list stays one request with a fixed number of queries. itemCategories defaults to [] so a frontend deployed before the backend still parses the response.
Restores the Items section in the filter menu and its chips (hidden in 271325a) and keeps fundraisers that sell at least one item in a selected category. The category list comes from lib/item-categories, so it matches the seller dropdown and the buyer badges.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
|
|
Thanks for working on this - Looks good, merging! |
Summary
Buyers can filter the browse page by item category (Desserts, Food, Drinks, Apparel, Others). This follows #175, which added the category field, and turns back on the Items filter that was hidden in 271325a.
Task: https://app.notion.com/p/Add-item-categories-into-browse-filter-4060ad723ce180baba40e6d3432ebcfa?v=a70ed4d4260644abbf58c725c46f01f2&source=copy_link
Changes
BrowseFundraiserSchema=BasicFundraiserSchema+itemCategories: ItemCategory[], used only by the browse list.CompleteFundraiserSchemais unchanged.getAllFundraisersincludesitems: { select: { category: true } }and returns the distinct categories per fundraiser.GET /api/fundraiserstays one request with 4 queries (fundraisers, organizations, pickup events, items) however many fundraisers there are, and it doesn't bring back the per-fundraiser item calls removed in b206383.filterFundraiserskeeps fundraisers with at least one item in a selected category.lib/item-categories, so labels and icons match the seller dropdown and buyer badges.How to test
pnpm assemble.commonchanged. There's no migration./buyer/browse(works signed out), open Filter, and tick Drinks under Items. The grid and calendar show only fundraisers selling a drink, and a Drinks chip appears. Removing the chip clears the filter.Screenshots
Category.Filter.Demo.mp4
Checklist
mainpnpm assembleand both dev serversschema.prismachanged: migration file is included and existing rows are backfilledcommon/changed:pnpm buildincommonand both consumers updated.env*files, keys, or real user data in the diff or screenshotsNote
Off-sale items count toward a fundraiser's categories, since buyers still see them on the fundraiser page.