Skip to content

Commit 9976797

Browse files
committed
DBC22-6431: auto open advisory panel on initial load with shared link
1 parent e8bcc00 commit 9976797

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

  • src/frontend/src/Components/map

src/frontend/src/Components/map/Map.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,29 @@ export default function DriveBCMap(props) {
689689
};
690690
}, []);
691691

692+
// Auto-open panel from URL params on initial load
693+
useEffect(() => {
694+
if (!mapRendered) return;
695+
696+
const type = searchParams.get('type');
697+
const id = searchParams.get('id');
698+
699+
if (!type || !id) return;
700+
701+
if (type === 'advisory') {
702+
const advisoryData = filteredAdvisories?.find(a => a.id === parseInt(id));
703+
if (advisoryData) {
704+
setTimeout(() => {
705+
const olFeature = new Feature();
706+
olFeature.set('type', 'advisory');
707+
olFeature.set('id', advisoryData.id);
708+
olFeature.set('data', advisoryData);
709+
updateClickedFeature(olFeature);
710+
}, 500);
711+
}
712+
}
713+
}, [mapRendered]);
714+
692715
/* Map operations on location search */
693716
useEffect(() => {
694717
if (searchLocationFrom && searchLocationFrom.length) {

0 commit comments

Comments
 (0)