Skip to content

Commit e8c4201

Browse files
authored
Merge pull request #3370 from Vizzuality/feature/zoom-alert
feature/zoom-alert
2 parents 8b36ab9 + 2c007d0 commit e8c4201

File tree

5 files changed

+23
-1
lines changed

5 files changed

+23
-1
lines changed

app/assets/javascripts/map/presenters/ReactMapMiddlePresenter.js

+9
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ define(
6060
window.dispatchEvent(new Event('isRecentImageryActivated'));
6161
}
6262
}
63+
},
64+
{
65+
'ReactMap/zoom-go-back': function(slug) {
66+
mps.publish('Map/set-zoom', [this.view.previousZoom]);
67+
}
6368
}
6469
],
6570

@@ -96,6 +101,10 @@ define(
96101
return {
97102
recentImagery: this.status.get('recentImagery')
98103
};
104+
},
105+
106+
notificate: function(id) {
107+
mps.publish('Notification/open', [id]);
99108
}
100109
});
101110

app/assets/javascripts/map/views/ReactMapMiddleView.js

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ define(
5252
this.presenter.updateLayer(slug);
5353
},
5454

55+
showZoomAlert: function(alert, currentZoom) {
56+
this.previousZoom = currentZoom;
57+
this.showAlertNotification(alert);
58+
},
59+
60+
showAlertNotification: function(alert) {
61+
this.presenter.notificate(alert);
62+
},
63+
5564
getParams: function(e) {
5665
return this.params;
5766
},

app/javascript/pages/map/recent-imagery/recent-imagery-reducers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const initialState = {
1414
left: '50%'
1515
},
1616
layerSlug: 'sentinel_tiles',
17-
minZoom: 8,
17+
minZoom: 9,
1818
thumbsToShow: 5,
1919
selectedTileIndex: 0,
2020
date: null,

app/javascript/pages/map/recent-imagery/recent-imagery.js

+1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class RecentImageryContainer extends PureComponent {
165165
});
166166
if (zoom < minZoom) {
167167
map.setZoom(minZoom);
168+
this.middleView.showZoomAlert('notification-zoom-go-back', zoom);
168169
}
169170
}
170171

app/views/shared/_notifications.html.erb

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@
101101
<div id="notification-no-images-highres" data-type="error">
102102
<p>No imagery is available in this area for the selected time period and settings.</p>
103103
</div>
104+
<div id="notification-zoom-go-back" data-type="warning">
105+
<p>We are zooming the map to overlay recent satellite imagery. <button class="btn little white action" data-action="ReactMap/zoom-go-back">Cancel</button></p>
106+
</div>
104107

105108

106109
<!-- SOURCE MAP -->

0 commit comments

Comments
 (0)