@@ -830,7 +830,7 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
830830 const [ showSimulationSummary , setShowSimulationSummary ] = useState ( false ) ;
831831 const [ endpointPickError , setEndpointPickError ] = useState < string | null > ( null ) ;
832832 const [ pendingNewSiteDraft , setPendingNewSiteDraft ] = useState < PendingNewSiteDraft | null > ( null ) ;
833- const [ pendingSiteMove , setPendingSiteMove ] = useState < PendingSiteMove | null > ( null ) ;
833+ const [ pendingSiteMoves , setPendingSiteMoves ] = useState < Record < string , PendingSiteMove > > ( { } ) ;
834834 const [ siteDraftStatus , setSiteDraftStatus ] = useState < string | null > ( null ) ;
835835 const [ useFallbackMapStyle , setUseFallbackMapStyle ] = useState ( false ) ;
836836 const [ interactionViewState , setInteractionViewState ] = useState < {
@@ -1091,16 +1091,22 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
10911091 setSiteDraftStatus ( null ) ;
10921092 } ;
10931093
1094+ const pendingMoveCount = Object . keys ( pendingSiteMoves ) . length ;
1095+ const pendingMoveEntries = Object . values ( pendingSiteMoves ) ;
1096+ const pendingMovePreview = pendingMoveEntries [ 0 ] ?? null ;
1097+
10941098 const savePendingSiteMove = ( ) => {
1095- if ( ! pendingSiteMove ) return ;
1096- setPendingSiteMove ( null ) ;
1099+ if ( ! pendingMoveCount ) return ;
1100+ setPendingSiteMoves ( { } ) ;
10971101 setSiteDraftStatus ( null ) ;
10981102 } ;
10991103
11001104 const dismissPendingSiteMove = ( ) => {
1101- if ( ! pendingSiteMove ) return ;
1102- updateSite ( pendingSiteMove . siteId , { position : pendingSiteMove . originalPosition } ) ;
1103- setPendingSiteMove ( null ) ;
1105+ if ( ! pendingMoveCount ) return ;
1106+ for ( const move of pendingMoveEntries ) {
1107+ updateSite ( move . siteId , { position : move . originalPosition } ) ;
1108+ }
1109+ setPendingSiteMoves ( { } ) ;
11041110 setSiteDraftStatus ( null ) ;
11051111 } ;
11061112
@@ -1115,14 +1121,17 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
11151121 lat : event . lngLat . lat ,
11161122 lon : event . lngLat . lng ,
11171123 } ;
1118- const existingPendingMove = pendingSiteMove ?. siteId === siteId ? pendingSiteMove : null ;
1124+ const existingPendingMove = pendingSiteMoves [ siteId ] ?? null ;
11191125 const originalPosition = existingPendingMove ?. originalPosition ?? site . position ;
11201126 updateSite ( siteId , { position : nextPosition } ) ;
1121- setPendingSiteMove ( {
1122- siteId,
1123- originalPosition,
1124- currentPosition : nextPosition ,
1125- } ) ;
1127+ setPendingSiteMoves ( ( current ) => ( {
1128+ ...current ,
1129+ [ siteId ] : {
1130+ siteId,
1131+ originalPosition,
1132+ currentPosition : nextPosition ,
1133+ } ,
1134+ } ) ) ;
11261135 setSiteDraftStatus ( null ) ;
11271136 } ;
11281137
@@ -1144,7 +1153,7 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
11441153 setSelectedLinkId ( id ) ;
11451154 return ;
11461155 }
1147- if ( pendingSiteMove ) {
1156+ if ( pendingMoveCount > 0 ) {
11481157 setSiteDraftStatus ( "Save or dismiss the current site move before creating another temporary site." ) ;
11491158 return ;
11501159 }
@@ -1279,13 +1288,14 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
12791288 </ span >
12801289 </ div >
12811290 ) : null }
1282- { pendingSiteMove ? (
1291+ { pendingMoveCount > 0 && pendingMovePreview ? (
12831292 < div className = "map-control-note map-control-note-tertiary" >
1284- Temporary move for { sites . find ( ( site ) => site . id === pendingSiteMove . siteId ) ?. name ?? "site" } to{ " " }
1285- { pendingSiteMove . currentPosition . lat . toFixed ( 5 ) } , { pendingSiteMove . currentPosition . lon . toFixed ( 5 ) } .
1293+ { pendingMoveCount === 1
1294+ ? `Temporary move for ${ sites . find ( ( site ) => site . id === pendingMovePreview . siteId ) ?. name ?? "site" } to ${ pendingMovePreview . currentPosition . lat . toFixed ( 5 ) } , ${ pendingMovePreview . currentPosition . lon . toFixed ( 5 ) } .`
1295+ : `${ pendingMoveCount } sites have temporary moved positions.` }
12861296 < span className = "map-inline-actions" >
12871297 < button className = "map-control-btn" onClick = { savePendingSiteMove } type = "button" >
1288- Save Position
1298+ Save Positions
12891299 </ button >
12901300 < button className = "map-control-btn" onClick = { dismissPendingSiteMove } type = "button" >
12911301 Dismiss
@@ -1430,7 +1440,7 @@ export function MapView({ isMapExpanded, onToggleMapExpanded }: MapViewProps) {
14301440 >
14311441 < div
14321442 className = { `site-pin ${ site . id === selectedSiteId ? "is-selected" : "" } ${
1433- pendingSiteMove ?. siteId === site . id ? "is-temporary" : ""
1443+ pendingSiteMoves [ site . id ] ? "is-temporary" : ""
14341444 } `}
14351445 onClick = { ( ) => onSiteClick ( site . id ) }
14361446 onKeyDown = { ( event ) => {
0 commit comments