Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/yeti/map-layers/DataAvalancheLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ export default {
this.overlay.date = null;
},
dateValid(date, days) {
return (new Date() - new Date(date)) / 1000 < 60 * 60 * 24 * days;
let todayString = this.$dateUtils.toLocalizedString(new Date(), 'YYYY-MM-DD');
return (new Date(todayString) - new Date(date)) / 1000 < 60 * 60 * 24 * days;
},
differenceDays(date) {
return Math.round((new Date() - new Date(date)) / 1000 / 60 / 60 / 24);
let todayString = this.$dateUtils.toLocalizedString(new Date(), 'YYYY-MM-DD');
return Math.round((new Date(todayString) - new Date(date)) / 1000 / 60 / 60 / 24);
},
onFeatures(features) {
this.features = features;
Expand Down
4 changes: 0 additions & 4 deletions src/components/yeti/map-layers/RouteLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -628,10 +628,6 @@ export default {
ol.extent.extend(extent, this.featuresLayerSource.getExtent());

this.view.fit(extent, { size: this.map.getSize() });

let actualZoom = Math.round(new ol.View().getZoomForResolution(this.map.getView().getResolution()) * 10) / 10;
// set a minimum zoom level
this.view.setZoom(Math.max(this.validMinimumMapZoom, actualZoom) / this.zoomDelta);
},
fitMapToGeom(geom) {
let feature = new ol.format.GeoJSON().readFeature(geom);
Expand Down
1 change: 0 additions & 1 deletion src/components/yeti/map-layers/WinterRouteLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default {
checked: this.showWinterRoute,
action: this.onShowWinterRoute,
image: 'winter-route.png',
country: 'fr',
contentComponent: WinterRouteLayerContent,
contentTitleComponent: WinterRouteLayerContentTitle,
};
Expand Down
107 changes: 55 additions & 52 deletions src/views/portals/YetiView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,54 @@ export default {
tabs() {
return Yetix.tabs;
},
localTabs() {
let tabs = [];

// layer tab
let tabLayer = {
id: 'layer',
icon: 'layer-group',
title: this.$gettext('Layers'),
};
tabs.push(tabLayer);

// risk tab
let tabRisk = {
id: 'risk',
name: this.$gettext('Risk'),
icon: 'bolt',
};
tabs.push(tabRisk);

// route tab
let tabRoute = {
id: 'route',
name: this.$gettext('My outing'),
icon: 'route',
};
if (this.hasFeatures && !this.validSimplifyTolerance) {
tabRoute.counter = {
text: this.featuresLength,
title: this.$gettext('Route on map'),
};
}
if (this.validSimplifyTolerance) {
tabRoute.problemIcon = {
title: this.$gettext('Not simplified yet'),
};
}
tabs.push(tabRoute);

// meteo tab
let tabMeteo = {
id: 'meteo',
name: this.$gettext('Meteo'),
icon: 'sun',
};
tabs.push(tabMeteo);

return tabs;
},
errors() {
return {
area: {
Expand Down Expand Up @@ -252,6 +300,13 @@ export default {
'method.potentialDanger': 'check',
mapZoom: 'check',
areaOk: 'check',
localTabs: {
deep: true, // nested
immediate: true, // also when created
handler(tabs) {
Yetix.setTabs(tabs);
},
},
},

created() {
Expand All @@ -263,65 +318,13 @@ export default {
Yetix.setDefault();
// remove all previous events (navigating from other c2c pages)
Yetix.$off();

// build tabs
let tabs = this.setTabs();
Yetix.setTabs(tabs);
},

mounted() {
this.check();
},

methods: {
setTabs() {
let tabs = [];

// layer tab
let tabLayer = {
id: 'layer',
icon: 'layer-group',
title: this.$gettext('Layers'),
};
tabs.push(tabLayer);

// risk tab
let tabRisk = {
id: 'risk',
name: this.$gettext('Risk'),
icon: 'bolt',
};
tabs.push(tabRisk);

// route tab
let tabRoute = {
id: 'route',
name: this.$gettext('My outing'),
icon: 'route',
};
if (this.hasFeatures && !this.validSimplifyTolerance) {
tabRoute.counter = {
text: this.featuresLength,
title: this.$gettext('Route on map'),
};
}
if (this.validSimplifyTolerance) {
tabRoute.problemIcon = {
title: this.$gettext('Not simplified yet'),
};
}
tabs.push(tabRoute);

// meteo tab
let tabMeteo = {
id: 'meteo',
name: this.$gettext('Meteo'),
icon: 'sun',
};
tabs.push(tabMeteo);

return tabs;
},
check() {
if (!this.areaOk) {
this.formError = 'area';
Expand Down
Loading