feat(22-01): wire catalog search and detail page to collection/thread modals
- Replace handleAddStub with handleAdd dispatching to correct modal by mode - Global item detail page: add both "Add to Collection" and "Add to Thread" buttons - Remove console.log stub from detail page - Import useUIStore in both components Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -97,8 +97,16 @@ export function CatalogSearchOverlay() {
|
||||
setSelectedTags((prev) => prev.filter((t) => t !== tagName));
|
||||
}
|
||||
|
||||
function handleAddStub() {
|
||||
// Stub: actual add-to-collection / add-to-thread wired in Phase 21
|
||||
const openAddToCollection = useUIStore((s) => s.openAddToCollection);
|
||||
const openAddToThread = useUIStore((s) => s.openAddToThread);
|
||||
|
||||
function handleAdd(item: { id: number; brand: string; model: string }) {
|
||||
const itemName = `${item.brand} ${item.model}`;
|
||||
if (catalogSearchMode === "collection") {
|
||||
openAddToCollection(item.id, itemName);
|
||||
} else if (catalogSearchMode === "thread") {
|
||||
openAddToThread(item.id, itemName);
|
||||
}
|
||||
}
|
||||
|
||||
const contextText =
|
||||
@@ -398,7 +406,7 @@ export function CatalogSearchOverlay() {
|
||||
<GridCard
|
||||
key={item.id}
|
||||
item={item}
|
||||
onAdd={handleAddStub}
|
||||
onAdd={() => handleAdd(item)}
|
||||
weight={weight}
|
||||
price={price}
|
||||
/>
|
||||
@@ -410,7 +418,7 @@ export function CatalogSearchOverlay() {
|
||||
<ListRow
|
||||
key={item.id}
|
||||
item={item}
|
||||
onAdd={handleAddStub}
|
||||
onAdd={() => handleAdd(item)}
|
||||
weight={weight}
|
||||
price={price}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user