Feature: Multi-select on relevant pages#148
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds a multi-select feature and replaces individual filter buttons with a ToggleGroup UI on several pages to streamline filtering and bulk actions.
- Introduce
MultiSelectProvidercontext and bulk action dialogs across pages (shipping, museum, walnuts, fishing, crafting, cooking). - Replace
FilterButtoncomponents withToggleGroupfor single-select filters and rearrange filter/search layouts. - Implement shift-click range selection in recipe cards and add bulk action buttons to sheets.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/shipping.tsx | Swapped filter buttons for ToggleGroup UI |
| src/pages/relationships.tsx | Added ToggleGroup for relationships filter |
| src/pages/museum.tsx | Integrated multi-select and bulk actions |
| src/pages/island/walnuts.tsx | Added multi-select & bulk actions |
| src/pages/fishing.tsx | Added multi-select & bulk actions |
| src/pages/crafting.tsx | Shift+click selection in recipe cards |
| src/pages/cooking.tsx | Shift+click selection & bulk actions |
| src/pages/_app.tsx | Wrapped app in MultiSelectProvider |
| src/contexts/multi-select-context.tsx | New multi-select context definition |
| src/components/dialogs/bulk-action-dialog.tsx | BulkActionDialog implementation |
| src/components/cards/recipe-card.tsx | Multi-select in recipe cards |
Comments suppressed due to low confidence (4)
src/pages/island/walnuts.tsx:288
- Using
type="museum"for the walnuts page’s bulk-action dialog is semantically misleading. Consider extendingBulkActionDialogto support a dedicatedwalnutstype or allow explicit label props instead of reusing the museum type.
<BulkActionDialog open={bulkActionOpen} setOpen={setBulkActionOpen} type="museum" onBulkAction={handleWalnutBulkAction} />
src/pages/shipping.tsx:70
- [nitpick] The main filter state is named
filterbut the season filter still uses_seasonFilter. Rename_seasonFilter(and its setter) toseasonFilterfor naming consistency and readability.
const [_seasonFilter, setSeasonFilter] = useState("all");
src/pages/fishing.tsx:387
- [nitpick] Reusing
type="shipping"for fishing bulk actions can be confusing. To better express domain intent, consider adding afishingtype toBulkActionDialogor allow an explicit label prop rather than overloading the shipping type.
<BulkActionDialog open={bulkActionOpen} setOpen={setBulkActionOpen} type="shipping" onBulkAction={handleFishingBulkAction} />
src/contexts/multi-select-context.tsx:1
- The new multi-select context implements toggle/range logic but currently has no unit tests. Adding tests for
toggleItem,addItems,removeItems, and shift-key range selection will help ensure correct behavior and prevent regressions.
import { createContext, useContext, useState, ReactNode } from "react";
| onClick={() => handleBulkAction(2)} | ||
| disabled={selectedItems.size === 0} | ||
| > | ||
| {onBulkAction && window.location.pathname.includes("walnuts") |
There was a problem hiding this comment.
Relying on window.location.pathname to switch between “Found” and “Donated” labels couples this component to the router and makes it brittle. Instead, drive the label logic via props or the type parameter.
|
|
||
| const isSelected = selectedItems.has(recipe.itemID.toString()); | ||
|
|
||
| const handleClick = (e: React.MouseEvent) => { |
There was a problem hiding this comment.
[nitpick] The lastSelectedIndex ref isn’t reset when toggling multi-select mode, which could lead to unexpected range selections. Consider clearing lastSelectedIndex.current when exiting or entering multi-select mode.
CleanShot.2025-06-15.at.22.06.56.mp4