fix: include breadcrumb data when selecting plants via search
- Add sectionCode to PlantSearch SearchResult - handleSearchSelect now passes room/section to selectedPlant.breadcrumb - This makes breadcrumb visible in plant info panel
This commit is contained in:
parent
3d57fc96a3
commit
5f65997412
2 changed files with 13 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ interface SearchResult {
|
||||||
label: string;
|
label: string;
|
||||||
sublabel: string;
|
sublabel: string;
|
||||||
roomName: string;
|
roomName: string;
|
||||||
|
sectionCode: string;
|
||||||
position: {
|
position: {
|
||||||
roomX: number;
|
roomX: number;
|
||||||
roomY: number;
|
roomY: number;
|
||||||
|
|
@ -51,6 +52,7 @@ export function PlantSearch({ floorData, onSelectResult, onHighlightResults }: P
|
||||||
label: pos.plant.tagNumber,
|
label: pos.plant.tagNumber,
|
||||||
sublabel: `${pos.plant.strain || 'Unknown'} • ${pos.plant.stage || 'N/A'}`,
|
sublabel: `${pos.plant.strain || 'Unknown'} • ${pos.plant.stage || 'N/A'}`,
|
||||||
roomName: room.name,
|
roomName: room.name,
|
||||||
|
sectionCode: section.code || section.name,
|
||||||
position: {
|
position: {
|
||||||
roomX: room.posX,
|
roomX: room.posX,
|
||||||
roomY: room.posY,
|
roomY: room.posY,
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,17 @@ export default function Facility3DViewerPage() {
|
||||||
setBeaconPosition([x, y, z]);
|
setBeaconPosition([x, y, z]);
|
||||||
setHighlightedTags([result.label]);
|
setHighlightedTags([result.label]);
|
||||||
setDimMode(true);
|
setDimMode(true);
|
||||||
setSelectedPlant({ ...result.plant, x, y, z });
|
// Include breadcrumb data from search result
|
||||||
|
setSelectedPlant({
|
||||||
|
...result.plant,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
breadcrumb: {
|
||||||
|
room: result.roomName,
|
||||||
|
section: result.sectionCode,
|
||||||
|
},
|
||||||
|
});
|
||||||
}, [floorData]);
|
}, [floorData]);
|
||||||
|
|
||||||
// Highlight handler for search typing
|
// Highlight handler for search typing
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue