@geotrekce/geotrek-rando-widget 0.0.6 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
- package/dist/cjs/grw-app.cjs.entry.js +14 -5
- package/dist/cjs/grw-filter_6.cjs.entry.js +109 -63
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +2 -2
- package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
- package/dist/cjs/{index-c2c4531d.js → index-4c76daa3.js} +8 -3
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{store-fd04a216.js → store-b4c3c507.js} +6 -4
- package/dist/collection/components/grw-app/grw-app.css +17 -11
- package/dist/collection/components/grw-app/grw-app.js +21 -9
- package/dist/collection/components/grw-filter/grw-filter.js +11 -12
- package/dist/collection/components/grw-map/grw-map.js +24 -15
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +11 -3
- package/dist/collection/components/grw-treks-list/grw-treks-list.css +0 -12
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +16 -9
- package/dist/collection/store/grw-trek-provider.js +28 -15
- package/dist/collection/store/grw-treks-provider.js +16 -8
- package/dist/collection/store/store.js +5 -3
- package/dist/components/grw-app.js +14 -5
- package/dist/components/grw-filter2.js +11 -12
- package/dist/components/grw-map2.js +24 -15
- package/dist/components/grw-trek-card2.js +1 -1
- package/dist/components/grw-trek-detail2.js +11 -3
- package/dist/components/grw-trek-provider2.js +28 -15
- package/dist/components/grw-treks-list2.js +18 -9
- package/dist/components/grw-treks-provider2.js +16 -8
- package/dist/components/store.js +5 -3
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/grw-app.entry.js +14 -5
- package/dist/esm/grw-filter_6.entry.js +109 -63
- package/dist/esm/grw-information-desk-detail_3.entry.js +2 -2
- package/dist/esm/grw-trek-card.entry.js +3 -3
- package/dist/esm/{index-192d910f.js → index-ee473772.js} +8 -3
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{store-b2c76c0c.js → store-a5f523fd.js} +6 -4
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/{p-7715153d.entry.js → p-0510e16b.entry.js} +1 -1
- package/dist/geotrek-rando-widget/p-22562f4d.js +1 -0
- package/dist/geotrek-rando-widget/p-28db12ba.entry.js +1 -0
- package/dist/geotrek-rando-widget/{p-1b2ba86d.entry.js → p-500436f1.entry.js} +1 -1
- package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-b62909db.js +2 -0
- package/dist/types/components/grw-app/grw-app.d.ts +2 -2
- package/dist/types/components/grw-filter/grw-filter.d.ts +1 -1
- package/dist/types/components/grw-map/grw-map.d.ts +1 -1
- package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +1 -1
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -1
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -2
- package/dist/types/components.d.ts +2 -2
- package/dist/types/store/grw-trek-provider.d.ts +4 -1
- package/dist/types/store/grw-treks-provider.d.ts +4 -1
- package/dist/types/store/store.d.ts +4 -0
- package/package.json +1 -1
- package/readme.md +4 -0
- package/dist/geotrek-rando-widget/p-5f17d340.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-6716c635.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
- package/dist/geotrek-rando-widget/p-e6710c64.js +0 -1
|
@@ -29,18 +29,17 @@ const GrwFilter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
29
29
|
filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
|
|
30
30
|
}
|
|
31
31
|
else if (filter.type === 'interval') {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
|
|
32
|
+
filtersTreks = [
|
|
33
|
+
...filtersTreks.filter(trek => {
|
|
34
|
+
for (const currentFilterId of currentFiltersId) {
|
|
35
|
+
const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
|
|
36
|
+
if (trek[filter.trekProperty] >= currentFilter.minValue && trek[filter.trekProperty] <= currentFilter.maxValue) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
}),
|
|
42
|
+
];
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
else {
|
|
@@ -14161,7 +14161,7 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14161
14161
|
this.colorPoiIcon = '#974c6e';
|
|
14162
14162
|
this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
|
|
14163
14163
|
}
|
|
14164
|
-
|
|
14164
|
+
connectedCallback() {
|
|
14165
14165
|
this.map = leafletSrc.map(this.element, {
|
|
14166
14166
|
center: this.center.split(',').map(Number),
|
|
14167
14167
|
zoom: this.zoom,
|
|
@@ -14174,15 +14174,17 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14174
14174
|
if (state.currentTrek) {
|
|
14175
14175
|
this.addTrek();
|
|
14176
14176
|
}
|
|
14177
|
-
else if (state.
|
|
14177
|
+
else if (state.currentTreks) {
|
|
14178
14178
|
this.addTreks();
|
|
14179
14179
|
}
|
|
14180
14180
|
onChange('currentTreks', () => {
|
|
14181
14181
|
if (state.currentTrek) {
|
|
14182
|
+
this.removeTreks();
|
|
14182
14183
|
this.addTrek();
|
|
14183
14184
|
}
|
|
14184
14185
|
else if (state.currentTreks) {
|
|
14185
14186
|
this.addTreks();
|
|
14187
|
+
this.removeTrek();
|
|
14186
14188
|
}
|
|
14187
14189
|
});
|
|
14188
14190
|
onChange('currentTrek', () => {
|
|
@@ -14203,18 +14205,20 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14203
14205
|
type: 'FeatureCollection',
|
|
14204
14206
|
features: [],
|
|
14205
14207
|
};
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14208
|
+
if (state.currentTreks) {
|
|
14209
|
+
for (const trek of state.currentTreks) {
|
|
14210
|
+
trekscurrentDepartureCoordinates.push(trek.departure_geom);
|
|
14211
|
+
treksFeatureCollection.features.push({
|
|
14212
|
+
type: 'Feature',
|
|
14213
|
+
geometry: { type: 'Point', coordinates: trek.departure_geom },
|
|
14214
|
+
properties: {
|
|
14215
|
+
id: trek.id,
|
|
14216
|
+
name: trek.name,
|
|
14217
|
+
practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
|
|
14218
|
+
imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
|
|
14219
|
+
},
|
|
14220
|
+
});
|
|
14221
|
+
}
|
|
14218
14222
|
}
|
|
14219
14223
|
if (!this.treksLayer) {
|
|
14220
14224
|
if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
|
|
@@ -14222,7 +14226,9 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14222
14226
|
this.map.fitBounds(bounds);
|
|
14223
14227
|
}
|
|
14224
14228
|
else {
|
|
14225
|
-
|
|
14229
|
+
if (state.currentMapTreksBounds) {
|
|
14230
|
+
this.map.fitBounds(state.currentMapTreksBounds);
|
|
14231
|
+
}
|
|
14226
14232
|
}
|
|
14227
14233
|
this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
|
|
14228
14234
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
@@ -14258,6 +14264,9 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14258
14264
|
const bounds = leafletSrc.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
|
|
14259
14265
|
this.map.fitBounds(bounds);
|
|
14260
14266
|
}
|
|
14267
|
+
else {
|
|
14268
|
+
this.map.fire('moveend');
|
|
14269
|
+
}
|
|
14261
14270
|
this.treksLayer.clearLayers();
|
|
14262
14271
|
this.treksLayer.addData(treksFeatureCollection);
|
|
14263
14272
|
}
|
|
@@ -14,7 +14,7 @@ const GrwTrekCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14
14
|
this.colorPrimaryTint = '#974c6e';
|
|
15
15
|
this.isLargeView = false;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
connectedCallback() {
|
|
18
18
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
19
19
|
if (this.currentTrek) {
|
|
20
20
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
@@ -16,7 +16,7 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
16
16
|
this.colorPrimaryShade = '#4a0021';
|
|
17
17
|
this.colorPrimaryTint = '#974c6e';
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
connectedCallback() {
|
|
20
20
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
21
21
|
if (this.currentTrek) {
|
|
22
22
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
@@ -26,7 +26,9 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
26
26
|
this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
|
|
27
27
|
this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
|
|
28
28
|
this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
|
|
29
|
-
|
|
29
|
+
if (state.accessibilitiesLevel) {
|
|
30
|
+
this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
onChange('currentTrek', () => {
|
|
32
34
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
@@ -37,6 +39,10 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
37
39
|
this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
|
|
38
40
|
this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
|
|
39
41
|
this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
|
|
42
|
+
this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
|
|
43
|
+
if (state.accessibilitiesLevel) {
|
|
44
|
+
this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
}
|
|
@@ -45,7 +51,9 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
45
51
|
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" }, h("div", { class: "name" }, this.currentTrek.name), this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })), h("div", { class: "sub-container" }, h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
|
|
46
52
|
_b.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)), h("div", { class: "icon-label route" }, ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
|
|
47
53
|
_e.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
|
|
48
|
-
_g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (h("div", { class: "description-container" }, h("div", { class: "description-title" }, "Description"), h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (h("div", { class: "departure-container" }, h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (h("div", { class: "arrival-container" }, h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" }, h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), h("img", { src: this.currentTrek.altimetric_profile
|
|
54
|
+
_g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (h("div", { class: "description-container" }, h("div", { class: "description-title" }, "Description"), h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (h("div", { class: "departure-container" }, h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (h("div", { class: "arrival-container" }, h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" }, h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), h("img", { src: this.currentTrek.altimetric_profile.endsWith('.json')
|
|
55
|
+
? this.currentTrek.altimetric_profile.replace('.json', '.svg')
|
|
56
|
+
: `${this.currentTrek.altimetric_profile}?format=svg` }))), this.currentTrek.access && (h("div", { class: "access-container" }, h("div", { class: "access-title" }, "Acc\u00E8s routier"), h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (h("div", { class: "public-transport-container" }, h("div", { class: "public-transport-title" }, "Transport"), h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (h("div", { class: "advice-container" }, h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (h("div", { class: "label-container" }, h("div", { class: "label-sub-container" }, label.pictogram && h("img", { src: label.pictogram }), h("div", { class: "label-name", innerHTML: label.name })), h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (h("div", { class: "advised-parking-container" }, h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (h("div", { class: "gear-container" }, h("div", { class: "gear-title" }, "\u00C9quipements"), h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" }, h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" }, h("div", { class: "information-desks-title" }, "Lieux de renseignement"), state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
|
|
49
57
|
(this.accessibilities && this.accessibilities.length > 0) ||
|
|
50
58
|
this.currentTrek.accessibility_level ||
|
|
51
59
|
this.currentTrek.accessibility_slope ||
|
|
@@ -7,27 +7,33 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
7
7
|
this.__registerHost();
|
|
8
8
|
this.__attachShadow();
|
|
9
9
|
this.language = 'fr';
|
|
10
|
+
this.trekNetworkError = false;
|
|
11
|
+
this.controller = new AbortController();
|
|
12
|
+
this.signal = this.controller.signal;
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
connectedCallback() {
|
|
12
15
|
state.api = this.api;
|
|
13
16
|
const requests = [];
|
|
14
|
-
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram
|
|
15
|
-
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram
|
|
16
|
-
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram
|
|
17
|
-
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram
|
|
18
|
-
|
|
17
|
+
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
18
|
+
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
19
|
+
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
20
|
+
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
21
|
+
Promise.all([
|
|
19
22
|
...requests,
|
|
20
|
-
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
fetch(`${this.api}
|
|
24
|
-
fetch(`${this.api}
|
|
25
|
-
fetch(`${this.api}
|
|
26
|
-
fetch(`${this.api}
|
|
27
|
-
fetch(`${this.api}
|
|
23
|
+
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
|
|
24
|
+
signal: this.signal,
|
|
25
|
+
}).catch(() => new Response('null')),
|
|
26
|
+
fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`, { signal: this.signal }),
|
|
27
|
+
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
|
|
28
|
+
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
29
|
+
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
|
|
30
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`, { signal: this.signal }),
|
|
31
|
+
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
|
|
32
|
+
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
|
|
28
33
|
])
|
|
29
34
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
30
35
|
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
36
|
+
state.trekNetworkError = false;
|
|
31
37
|
if (difficulties) {
|
|
32
38
|
state.difficulties = difficulties.results;
|
|
33
39
|
}
|
|
@@ -46,14 +52,21 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
46
52
|
state.labels = labels.results;
|
|
47
53
|
state.sources = sources.results;
|
|
48
54
|
state.accessibilities = accessibilities.results;
|
|
49
|
-
|
|
55
|
+
if (accessibilitiesLevel) {
|
|
56
|
+
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
57
|
+
}
|
|
50
58
|
state.currentPois = pois.results;
|
|
51
59
|
state.currentInformationDesks = informationDesks.results;
|
|
52
60
|
state.currentTrek = trek;
|
|
61
|
+
})
|
|
62
|
+
.catch(() => {
|
|
63
|
+
state.trekNetworkError = true;
|
|
53
64
|
});
|
|
54
65
|
}
|
|
55
66
|
disconnectedCallback() {
|
|
67
|
+
this.controller.abort();
|
|
56
68
|
state.currentTrek = null;
|
|
69
|
+
state.trekNetworkError = false;
|
|
57
70
|
}
|
|
58
71
|
render() {
|
|
59
72
|
return h(Host, null);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { s as state, o as onChange } from './store.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './grw-trek-card2.js';
|
|
4
4
|
|
|
5
|
-
const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto
|
|
5
|
+
const grwTreksListCss = ":host{font-family:\"Roboto\";width:100%;height:100%;max-height:100vh;overflow-y:auto;display:flex;flex-wrap:wrap;justify-content:space-around}grw-trek-card{margin:6px}";
|
|
6
6
|
|
|
7
7
|
const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
@@ -13,19 +13,25 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
13
13
|
this.colorPrimary = '#6b0030';
|
|
14
14
|
this.colorPrimaryTint = '#974c6e';
|
|
15
15
|
this.isLargeView = false;
|
|
16
|
-
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
17
16
|
this.step = 10;
|
|
17
|
+
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
21
|
+
if (state.currentTreks) {
|
|
22
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
23
|
+
}
|
|
20
24
|
onChange('currentTreks', () => {
|
|
21
|
-
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
22
25
|
this.element.scroll({ top: 0 });
|
|
23
|
-
|
|
26
|
+
if (state.currentTreks) {
|
|
27
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
28
|
+
}
|
|
24
29
|
});
|
|
25
30
|
onChange('treksWithinBounds', () => {
|
|
26
|
-
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
27
31
|
this.element.scroll({ top: 0 });
|
|
28
|
-
|
|
32
|
+
if (state.treksWithinBounds) {
|
|
33
|
+
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
34
|
+
}
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
37
|
handleInfiniteScroll(event) {
|
|
@@ -38,8 +44,11 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
}
|
|
47
|
+
disconnectedCallback() {
|
|
48
|
+
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
49
|
+
}
|
|
41
50
|
render() {
|
|
42
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
51
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.treksToDisplay.map(trek => (h("grw-trek-card", { key: `trek-${trek.id}`, trek: trek, "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })))));
|
|
43
52
|
}
|
|
44
53
|
get element() { return this; }
|
|
45
54
|
static get style() { return grwTreksListCss; }
|
|
@@ -7,8 +7,10 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
7
7
|
this.__registerHost();
|
|
8
8
|
this.__attachShadow();
|
|
9
9
|
this.language = 'fr';
|
|
10
|
+
this.controller = new AbortController();
|
|
11
|
+
this.signal = this.controller.signal;
|
|
10
12
|
}
|
|
11
|
-
|
|
13
|
+
connectedCallback() {
|
|
12
14
|
state.api = this.api;
|
|
13
15
|
let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
|
|
14
16
|
this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
|
|
@@ -20,15 +22,16 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
20
22
|
this.routes && (treksRequest += `&routes=${this.routes}`);
|
|
21
23
|
this.practices && (treksRequest += `&practices=${this.practices}`);
|
|
22
24
|
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
|
|
23
|
-
|
|
24
|
-
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram
|
|
25
|
-
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram
|
|
26
|
-
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram
|
|
27
|
-
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram
|
|
28
|
-
fetch(treksRequest),
|
|
25
|
+
Promise.all([
|
|
26
|
+
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
|
|
27
|
+
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
|
|
28
|
+
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
29
|
+
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
|
|
30
|
+
fetch(treksRequest, { signal: this.signal }),
|
|
29
31
|
])
|
|
30
32
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
31
33
|
.then(([difficulties, routes, practices, themes, treks]) => {
|
|
34
|
+
state.treksNetworkError = false;
|
|
32
35
|
state.difficulties = difficulties.results;
|
|
33
36
|
state.routes = routes.results;
|
|
34
37
|
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
@@ -42,7 +45,12 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
42
45
|
state.treks = treks.results;
|
|
43
46
|
state.currentTreks = treks.results;
|
|
44
47
|
state.treksWithinBounds = treks.results;
|
|
45
|
-
})
|
|
48
|
+
})
|
|
49
|
+
.catch(() => (state.treksNetworkError = true));
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
this.controller.abort();
|
|
53
|
+
state.treksNetworkError = false;
|
|
46
54
|
}
|
|
47
55
|
render() {
|
|
48
56
|
return h(Host, null);
|
package/dist/components/store.js
CHANGED
|
@@ -186,9 +186,9 @@ const createStore = (defaultState, shouldUpdate) => {
|
|
|
186
186
|
|
|
187
187
|
const { state, onChange } = createStore({
|
|
188
188
|
api: '',
|
|
189
|
-
treks:
|
|
190
|
-
currentTreks:
|
|
191
|
-
treksWithinBounds:
|
|
189
|
+
treks: null,
|
|
190
|
+
currentTreks: null,
|
|
191
|
+
treksWithinBounds: null,
|
|
192
192
|
currentMapTreksBounds: null,
|
|
193
193
|
difficulties: [],
|
|
194
194
|
routes: [],
|
|
@@ -203,6 +203,8 @@ const { state, onChange } = createStore({
|
|
|
203
203
|
currentTrek: null,
|
|
204
204
|
currentPois: null,
|
|
205
205
|
currentInformationDesks: null,
|
|
206
|
+
treksNetworkError: false,
|
|
207
|
+
trekNetworkError: false,
|
|
206
208
|
});
|
|
207
209
|
|
|
208
210
|
export { onChange as o, state as s };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-ee473772.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["grw-trek-card",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[
|
|
16
|
+
return bootstrapLazy([["grw-trek-card",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[2],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
|
|
17
17
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement } from './index-
|
|
2
|
-
import { s as state } from './store-
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-ee473772.js';
|
|
2
|
+
import { o as onChange, s as state } from './store-a5f523fd.js';
|
|
3
3
|
|
|
4
4
|
const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
|
|
5
5
|
|
|
6
|
-
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-button,.large-view-header-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:
|
|
6
|
+
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;flex-direction:row;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-container,.large-view-header-container .handle-filters-container{display:flex;align-items:center}.header-container .handle-filters-container .handle-filters-button,.large-view-header-container .handle-filters-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:12px;border-radius:8px;padding:8px}.header-container .handle-filters-container .current-treks-within-bounds-length,.large-view-header-container .handle-filters-container .current-treks-within-bounds-length{margin-left:12px;color:#ffffff}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.init-loader-container,.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.init-loader-container .loader,.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.init-loader-container,.loader-container{width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
|
|
7
7
|
|
|
8
8
|
const GrwApp = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -22,8 +22,8 @@ const GrwApp = class {
|
|
|
22
22
|
this.colorArrivalIcon = '#85003b';
|
|
23
23
|
this.colorSensitiveArea = '#4974a5';
|
|
24
24
|
this.colorPoiIcon = '#974c6e';
|
|
25
|
-
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
26
25
|
this.largeViewSize = 1024;
|
|
26
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
27
27
|
}
|
|
28
28
|
onTrekCardPress(event) {
|
|
29
29
|
this.currentTrekId = event.detail;
|
|
@@ -39,6 +39,14 @@ const GrwApp = class {
|
|
|
39
39
|
window.dispatchEvent(new window.Event('resize'));
|
|
40
40
|
}
|
|
41
41
|
componentDidLoad() {
|
|
42
|
+
onChange('trekNetworkError', () => {
|
|
43
|
+
if (state.trekNetworkError) {
|
|
44
|
+
const urlRedirect = new URL(window.location.toString());
|
|
45
|
+
urlRedirect.searchParams.delete('trek');
|
|
46
|
+
window.history.replaceState({}, '', urlRedirect);
|
|
47
|
+
this.onTrekDetailsClose();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
42
50
|
this.handleView();
|
|
43
51
|
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
44
52
|
const url = new URL(window.location.toString());
|
|
@@ -50,6 +58,7 @@ const GrwApp = class {
|
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
onTrekDetailsClose() {
|
|
61
|
+
state.currentTrek = null;
|
|
53
62
|
this.currentTrekId = null;
|
|
54
63
|
this.showTrek = !this.showTrek;
|
|
55
64
|
}
|
|
@@ -95,7 +104,7 @@ const GrwApp = class {
|
|
|
95
104
|
window.removeEventListener('popstate', this.handlePopStateBind);
|
|
96
105
|
}
|
|
97
106
|
render() {
|
|
98
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")
|
|
107
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), !state.currentTreks && !state.currentTrek && (h("div", { class: "init-loader-container" }, h("span", { class: "loader" }))), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), (state.currentTreks || state.currentTrek) && (h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { class: "handle-filters-container" }, h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER"), state.treksWithinBounds && (h("div", { class: "current-treks-within-bounds-length" }, `${state.treksWithinBounds.length} randonnée${state.treksWithinBounds.length > 1 ? 's' : ''}`)))), !this.showTrek && this.showFilters && (h("div", { class: "options-container" }, h("div", { class: "filters-container" }, h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), h("div", null, h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), h("div", { class: "attribution-container" }, h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), h("div", { class: "content-container" }, h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => this.handleShowMap() }, this.showTrek ? (this.showTrekMap ? 'Voir la fiche' : 'Voir la carte') : this.showTreksMap ? 'Voir la liste' : 'Voir la carte'))))));
|
|
99
108
|
}
|
|
100
109
|
get element() { return getElement(this); }
|
|
101
110
|
static get watchers() { return {
|