@geotrekce/geotrek-rando-widget 0.0.7 → 0.0.8
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 +70 -44
- 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 +22 -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 +4 -2
- 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 +8 -2
- package/dist/collection/store/grw-treks-provider.js +6 -3
- 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 +22 -15
- package/dist/components/grw-trek-card2.js +1 -1
- package/dist/components/grw-trek-detail2.js +4 -2
- package/dist/components/grw-trek-provider2.js +8 -2
- package/dist/components/grw-treks-list2.js +18 -9
- package/dist/components/grw-treks-provider2.js +6 -3
- 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 +70 -44
- 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-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-9a25f817.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 +2 -1
- package/dist/types/store/grw-treks-provider.d.ts +1 -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-4361afd2.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-5f17d340.entry.js +0 -1
- package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
- package/dist/geotrek-rando-widget/p-e6710c64.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, Host, h, Listen, State, Prop, Element, Watch } from '@stencil/core';
|
|
2
|
-
import state from 'store/store';
|
|
2
|
+
import state, { onChange } from 'store/store';
|
|
3
3
|
import arrowBackImage from '../../assets/arrow-back.svg';
|
|
4
4
|
export class GrwApp {
|
|
5
5
|
constructor() {
|
|
@@ -17,8 +17,8 @@ export class GrwApp {
|
|
|
17
17
|
this.colorArrivalIcon = '#85003b';
|
|
18
18
|
this.colorSensitiveArea = '#4974a5';
|
|
19
19
|
this.colorPoiIcon = '#974c6e';
|
|
20
|
-
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
21
20
|
this.largeViewSize = 1024;
|
|
21
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
22
22
|
}
|
|
23
23
|
onTrekCardPress(event) {
|
|
24
24
|
this.currentTrekId = event.detail;
|
|
@@ -34,6 +34,14 @@ export class GrwApp {
|
|
|
34
34
|
window.dispatchEvent(new window.Event('resize'));
|
|
35
35
|
}
|
|
36
36
|
componentDidLoad() {
|
|
37
|
+
onChange('trekNetworkError', () => {
|
|
38
|
+
if (state.trekNetworkError) {
|
|
39
|
+
const urlRedirect = new URL(window.location.toString());
|
|
40
|
+
urlRedirect.searchParams.delete('trek');
|
|
41
|
+
window.history.replaceState({}, '', urlRedirect);
|
|
42
|
+
this.onTrekDetailsClose();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
37
45
|
this.handleView();
|
|
38
46
|
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
39
47
|
const url = new URL(window.location.toString());
|
|
@@ -45,6 +53,7 @@ export class GrwApp {
|
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
onTrekDetailsClose() {
|
|
56
|
+
state.currentTrek = null;
|
|
48
57
|
this.currentTrekId = null;
|
|
49
58
|
this.showTrek = !this.showTrek;
|
|
50
59
|
}
|
|
@@ -92,13 +101,16 @@ export class GrwApp {
|
|
|
92
101
|
render() {
|
|
93
102
|
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } },
|
|
94
103
|
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 }),
|
|
104
|
+
!state.currentTreks && !state.currentTrek && (h("div", { class: "init-loader-container" },
|
|
105
|
+
h("span", { class: "loader" }))),
|
|
95
106
|
this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }),
|
|
96
|
-
h("div", { class: "app-container" },
|
|
107
|
+
(state.currentTreks || state.currentTrek) && (h("div", { class: "app-container" },
|
|
97
108
|
h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' },
|
|
98
|
-
this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", {
|
|
109
|
+
this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { class: "handle-filters-container" },
|
|
110
|
+
h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER"),
|
|
111
|
+
state.treksWithinBounds && (h("div", { class: "current-treks-within-bounds-length" }, `${state.treksWithinBounds.length} randonnée${state.treksWithinBounds.length > 1 ? 's' : ''}`)))),
|
|
99
112
|
!this.showTrek && this.showFilters && (h("div", { class: "options-container" },
|
|
100
113
|
h("div", { class: "filters-container" },
|
|
101
|
-
h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
|
|
102
114
|
h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"),
|
|
103
115
|
h("div", null,
|
|
104
116
|
h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })),
|
|
@@ -118,7 +130,7 @@ export class GrwApp {
|
|
|
118
130
|
h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))),
|
|
119
131
|
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 })),
|
|
120
132
|
h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } },
|
|
121
|
-
h("div", { onClick: () => this.handleShowMap() }, this.
|
|
133
|
+
h("div", { onClick: () => this.handleShowMap() }, this.showTrek ? (this.showTrekMap ? 'Voir la fiche' : 'Voir la carte') : this.showTreksMap ? 'Voir la liste' : 'Voir la carte'))))));
|
|
122
134
|
}
|
|
123
135
|
static get is() { return "grw-app"; }
|
|
124
136
|
static get encapsulation() { return "shadow"; }
|
|
@@ -335,11 +347,11 @@ export class GrwApp {
|
|
|
335
347
|
"reflect": false
|
|
336
348
|
},
|
|
337
349
|
"zoom": {
|
|
338
|
-
"type": "
|
|
350
|
+
"type": "number",
|
|
339
351
|
"mutable": false,
|
|
340
352
|
"complexType": {
|
|
341
|
-
"original": "
|
|
342
|
-
"resolved": "
|
|
353
|
+
"original": "number",
|
|
354
|
+
"resolved": "number",
|
|
343
355
|
"references": {}
|
|
344
356
|
},
|
|
345
357
|
"required": false,
|
|
@@ -23,18 +23,17 @@ export class GrwFilter {
|
|
|
23
23
|
filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
|
|
24
24
|
}
|
|
25
25
|
else if (filter.type === 'interval') {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
filtersTreks = [...filtersTreks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
|
|
26
|
+
filtersTreks = [
|
|
27
|
+
...filtersTreks.filter(trek => {
|
|
28
|
+
for (const currentFilterId of currentFiltersId) {
|
|
29
|
+
const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
|
|
30
|
+
if (trek[filter.trekProperty] >= currentFilter.minValue && trek[filter.trekProperty] <= currentFilter.maxValue) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
else {
|
|
@@ -16,7 +16,7 @@ export class GrwMap {
|
|
|
16
16
|
this.colorPoiIcon = '#974c6e';
|
|
17
17
|
this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
connectedCallback() {
|
|
20
20
|
this.map = L.map(this.element, {
|
|
21
21
|
center: this.center.split(',').map(Number),
|
|
22
22
|
zoom: this.zoom,
|
|
@@ -29,7 +29,7 @@ export class GrwMap {
|
|
|
29
29
|
if (state.currentTrek) {
|
|
30
30
|
this.addTrek();
|
|
31
31
|
}
|
|
32
|
-
else if (state.
|
|
32
|
+
else if (state.currentTreks) {
|
|
33
33
|
this.addTreks();
|
|
34
34
|
}
|
|
35
35
|
onChange('currentTreks', () => {
|
|
@@ -58,18 +58,20 @@ export class GrwMap {
|
|
|
58
58
|
type: 'FeatureCollection',
|
|
59
59
|
features: [],
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
if (state.currentTreks) {
|
|
62
|
+
for (const trek of state.currentTreks) {
|
|
63
|
+
trekscurrentDepartureCoordinates.push(trek.departure_geom);
|
|
64
|
+
treksFeatureCollection.features.push({
|
|
65
|
+
type: 'Feature',
|
|
66
|
+
geometry: { type: 'Point', coordinates: trek.departure_geom },
|
|
67
|
+
properties: {
|
|
68
|
+
id: trek.id,
|
|
69
|
+
name: trek.name,
|
|
70
|
+
practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
|
|
71
|
+
imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
73
75
|
}
|
|
74
76
|
if (!this.treksLayer) {
|
|
75
77
|
if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
|
|
@@ -77,7 +79,9 @@ export class GrwMap {
|
|
|
77
79
|
this.map.fitBounds(bounds);
|
|
78
80
|
}
|
|
79
81
|
else {
|
|
80
|
-
|
|
82
|
+
if (state.currentMapTreksBounds) {
|
|
83
|
+
this.map.fitBounds(state.currentMapTreksBounds);
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
this.treksLayer = L.geoJSON(treksFeatureCollection, {
|
|
83
87
|
pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
|
|
@@ -113,6 +117,9 @@ export class GrwMap {
|
|
|
113
117
|
const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
|
|
114
118
|
this.map.fitBounds(bounds);
|
|
115
119
|
}
|
|
120
|
+
else {
|
|
121
|
+
this.map.fire('moveend');
|
|
122
|
+
}
|
|
116
123
|
this.treksLayer.clearLayers();
|
|
117
124
|
this.treksLayer.addData(treksFeatureCollection);
|
|
118
125
|
}
|
|
@@ -10,7 +10,7 @@ export class GrwTrekCard {
|
|
|
10
10
|
this.colorPrimaryTint = '#974c6e';
|
|
11
11
|
this.isLargeView = false;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
connectedCallback() {
|
|
14
14
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
15
15
|
if (this.currentTrek) {
|
|
16
16
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
@@ -10,7 +10,7 @@ export class GrwTrekDetail {
|
|
|
10
10
|
this.colorPrimaryShade = '#4a0021';
|
|
11
11
|
this.colorPrimaryTint = '#974c6e';
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
connectedCallback() {
|
|
14
14
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
15
15
|
if (this.currentTrek) {
|
|
16
16
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
@@ -87,7 +87,9 @@ export class GrwTrekDetail {
|
|
|
87
87
|
h("div", { innerHTML: this.currentTrek.arrival }))),
|
|
88
88
|
this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" },
|
|
89
89
|
h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"),
|
|
90
|
-
h("img", { src:
|
|
90
|
+
h("img", { src: this.currentTrek.altimetric_profile.endsWith('.json')
|
|
91
|
+
? this.currentTrek.altimetric_profile.replace('.json', '.svg')
|
|
92
|
+
: `${this.currentTrek.altimetric_profile}?format=svg` }))),
|
|
91
93
|
this.currentTrek.access && (h("div", { class: "access-container" },
|
|
92
94
|
h("div", { class: "access-title" }, "Acc\u00E8s routier"),
|
|
93
95
|
h("div", { class: "access", innerHTML: this.currentTrek.access }))),
|
|
@@ -4,18 +4,6 @@
|
|
|
4
4
|
height: 100%;
|
|
5
5
|
max-height: 100vh;
|
|
6
6
|
overflow-y: auto;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.current-treks-length {
|
|
10
|
-
width: 100%;
|
|
11
|
-
text-align: center;
|
|
12
|
-
padding: 32px 0px;
|
|
13
|
-
color: var(--color-primary);
|
|
14
|
-
font-size: 24px;
|
|
15
|
-
font-weight: bold;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.current-treks-container {
|
|
19
7
|
display: flex;
|
|
20
8
|
flex-wrap: wrap;
|
|
21
9
|
justify-content: space-around;
|
|
@@ -6,19 +6,25 @@ export class GrwTreksList {
|
|
|
6
6
|
this.colorPrimary = '#6b0030';
|
|
7
7
|
this.colorPrimaryTint = '#974c6e';
|
|
8
8
|
this.isLargeView = false;
|
|
9
|
-
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
10
9
|
this.step = 10;
|
|
10
|
+
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
14
|
+
if (state.currentTreks) {
|
|
15
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
16
|
+
}
|
|
13
17
|
onChange('currentTreks', () => {
|
|
14
|
-
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
15
18
|
this.element.scroll({ top: 0 });
|
|
16
|
-
|
|
19
|
+
if (state.currentTreks) {
|
|
20
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
21
|
+
}
|
|
17
22
|
});
|
|
18
23
|
onChange('treksWithinBounds', () => {
|
|
19
|
-
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
20
24
|
this.element.scroll({ top: 0 });
|
|
21
|
-
|
|
25
|
+
if (state.treksWithinBounds) {
|
|
26
|
+
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
27
|
+
}
|
|
22
28
|
});
|
|
23
29
|
}
|
|
24
30
|
handleInfiniteScroll(event) {
|
|
@@ -31,10 +37,11 @@ export class GrwTreksList {
|
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
}
|
|
40
|
+
disconnectedCallback() {
|
|
41
|
+
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
42
|
+
}
|
|
34
43
|
render() {
|
|
35
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
36
|
-
h("div", { class: "current-treks-length" }, `${state.treksWithinBounds.length} résultat${state.treksWithinBounds.length > 1 ? 's' : ''}`),
|
|
37
|
-
h("div", { class: "current-treks-container" }, 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 }))))));
|
|
44
|
+
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 })))));
|
|
38
45
|
}
|
|
39
46
|
static get is() { return "grw-treks-list"; }
|
|
40
47
|
static get encapsulation() { return "shadow"; }
|
|
@@ -3,17 +3,18 @@ import state from 'store/store';
|
|
|
3
3
|
export class GrwTrekProvider {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.language = 'fr';
|
|
6
|
+
this.trekNetworkError = false;
|
|
6
7
|
this.controller = new AbortController();
|
|
7
8
|
this.signal = this.controller.signal;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
connectedCallback() {
|
|
10
11
|
state.api = this.api;
|
|
11
12
|
const requests = [];
|
|
12
13
|
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
13
14
|
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
14
15
|
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
15
16
|
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
16
|
-
|
|
17
|
+
Promise.all([
|
|
17
18
|
...requests,
|
|
18
19
|
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
|
|
19
20
|
signal: this.signal,
|
|
@@ -28,6 +29,7 @@ export class GrwTrekProvider {
|
|
|
28
29
|
])
|
|
29
30
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
30
31
|
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
32
|
+
state.trekNetworkError = false;
|
|
31
33
|
if (difficulties) {
|
|
32
34
|
state.difficulties = difficulties.results;
|
|
33
35
|
}
|
|
@@ -52,11 +54,15 @@ export class GrwTrekProvider {
|
|
|
52
54
|
state.currentPois = pois.results;
|
|
53
55
|
state.currentInformationDesks = informationDesks.results;
|
|
54
56
|
state.currentTrek = trek;
|
|
57
|
+
})
|
|
58
|
+
.catch(() => {
|
|
59
|
+
state.trekNetworkError = true;
|
|
55
60
|
});
|
|
56
61
|
}
|
|
57
62
|
disconnectedCallback() {
|
|
58
63
|
this.controller.abort();
|
|
59
64
|
state.currentTrek = null;
|
|
65
|
+
state.trekNetworkError = false;
|
|
60
66
|
}
|
|
61
67
|
render() {
|
|
62
68
|
return h(Host, null);
|
|
@@ -6,7 +6,7 @@ export class GrwTreksProvider {
|
|
|
6
6
|
this.controller = new AbortController();
|
|
7
7
|
this.signal = this.controller.signal;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
connectedCallback() {
|
|
10
10
|
state.api = this.api;
|
|
11
11
|
let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
|
|
12
12
|
this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
|
|
@@ -18,7 +18,7 @@ export class GrwTreksProvider {
|
|
|
18
18
|
this.routes && (treksRequest += `&routes=${this.routes}`);
|
|
19
19
|
this.practices && (treksRequest += `&practices=${this.practices}`);
|
|
20
20
|
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
|
|
21
|
-
|
|
21
|
+
Promise.all([
|
|
22
22
|
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
|
|
23
23
|
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
|
|
24
24
|
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
@@ -27,6 +27,7 @@ export class GrwTreksProvider {
|
|
|
27
27
|
])
|
|
28
28
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
29
29
|
.then(([difficulties, routes, practices, themes, treks]) => {
|
|
30
|
+
state.treksNetworkError = false;
|
|
30
31
|
state.difficulties = difficulties.results;
|
|
31
32
|
state.routes = routes.results;
|
|
32
33
|
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
@@ -40,10 +41,12 @@ export class GrwTreksProvider {
|
|
|
40
41
|
state.treks = treks.results;
|
|
41
42
|
state.currentTreks = treks.results;
|
|
42
43
|
state.treksWithinBounds = treks.results;
|
|
43
|
-
})
|
|
44
|
+
})
|
|
45
|
+
.catch(() => (state.treksNetworkError = true));
|
|
44
46
|
}
|
|
45
47
|
disconnectedCallback() {
|
|
46
48
|
this.controller.abort();
|
|
49
|
+
state.treksNetworkError = false;
|
|
47
50
|
}
|
|
48
51
|
render() {
|
|
49
52
|
return h(Host, null);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createStore } from '@stencil/store';
|
|
2
2
|
const { state, onChange } = createStore({
|
|
3
3
|
api: '',
|
|
4
|
-
treks:
|
|
5
|
-
currentTreks:
|
|
6
|
-
treksWithinBounds:
|
|
4
|
+
treks: null,
|
|
5
|
+
currentTreks: null,
|
|
6
|
+
treksWithinBounds: null,
|
|
7
7
|
currentMapTreksBounds: null,
|
|
8
8
|
difficulties: [],
|
|
9
9
|
routes: [],
|
|
@@ -18,6 +18,8 @@ const { state, onChange } = createStore({
|
|
|
18
18
|
currentTrek: null,
|
|
19
19
|
currentPois: null,
|
|
20
20
|
currentInformationDesks: null,
|
|
21
|
+
treksNetworkError: false,
|
|
22
|
+
trekNetworkError: false,
|
|
21
23
|
});
|
|
22
24
|
export { onChange };
|
|
23
25
|
export default state;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { s as state } from './store.js';
|
|
2
|
+
import { o as onChange, s as state } from './store.js';
|
|
3
3
|
import { d as defineCustomElement$b } from './grw-filter2.js';
|
|
4
4
|
import { d as defineCustomElement$a } from './grw-information-desk-detail2.js';
|
|
5
5
|
import { d as defineCustomElement$9 } from './grw-map2.js';
|
|
@@ -13,7 +13,7 @@ import { d as defineCustomElement$2 } from './grw-treks-provider2.js';
|
|
|
13
13
|
|
|
14
14
|
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>`;
|
|
15
15
|
|
|
16
|
-
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:
|
|
16
|
+
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%}";
|
|
17
17
|
|
|
18
18
|
const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
19
19
|
constructor() {
|
|
@@ -34,8 +34,8 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
34
|
this.colorArrivalIcon = '#85003b';
|
|
35
35
|
this.colorSensitiveArea = '#4974a5';
|
|
36
36
|
this.colorPoiIcon = '#974c6e';
|
|
37
|
-
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
38
37
|
this.largeViewSize = 1024;
|
|
38
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
39
39
|
}
|
|
40
40
|
onTrekCardPress(event) {
|
|
41
41
|
this.currentTrekId = event.detail;
|
|
@@ -51,6 +51,14 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
51
|
window.dispatchEvent(new window.Event('resize'));
|
|
52
52
|
}
|
|
53
53
|
componentDidLoad() {
|
|
54
|
+
onChange('trekNetworkError', () => {
|
|
55
|
+
if (state.trekNetworkError) {
|
|
56
|
+
const urlRedirect = new URL(window.location.toString());
|
|
57
|
+
urlRedirect.searchParams.delete('trek');
|
|
58
|
+
window.history.replaceState({}, '', urlRedirect);
|
|
59
|
+
this.onTrekDetailsClose();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
54
62
|
this.handleView();
|
|
55
63
|
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
56
64
|
const url = new URL(window.location.toString());
|
|
@@ -62,6 +70,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
onTrekDetailsClose() {
|
|
73
|
+
state.currentTrek = null;
|
|
65
74
|
this.currentTrekId = null;
|
|
66
75
|
this.showTrek = !this.showTrek;
|
|
67
76
|
}
|
|
@@ -107,7 +116,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
107
116
|
window.removeEventListener('popstate', this.handlePopStateBind);
|
|
108
117
|
}
|
|
109
118
|
render() {
|
|
110
|
-
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")
|
|
119
|
+
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'))))));
|
|
111
120
|
}
|
|
112
121
|
get element() { return this; }
|
|
113
122
|
static get watchers() { return {
|
|
@@ -127,7 +136,7 @@ const GrwApp$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
127
136
|
"practices": [1],
|
|
128
137
|
"urlLayer": [1, "url-layer"],
|
|
129
138
|
"center": [1],
|
|
130
|
-
"zoom": [
|
|
139
|
+
"zoom": [2],
|
|
131
140
|
"attribution": [1],
|
|
132
141
|
"colorPrimary": [1, "color-primary"],
|
|
133
142
|
"colorPrimaryShade": [1, "color-primary-shade"],
|
|
@@ -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,7 +14174,7 @@ 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', () => {
|
|
@@ -14203,18 +14203,20 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14203
14203
|
type: 'FeatureCollection',
|
|
14204
14204
|
features: [],
|
|
14205
14205
|
};
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14206
|
+
if (state.currentTreks) {
|
|
14207
|
+
for (const trek of state.currentTreks) {
|
|
14208
|
+
trekscurrentDepartureCoordinates.push(trek.departure_geom);
|
|
14209
|
+
treksFeatureCollection.features.push({
|
|
14210
|
+
type: 'Feature',
|
|
14211
|
+
geometry: { type: 'Point', coordinates: trek.departure_geom },
|
|
14212
|
+
properties: {
|
|
14213
|
+
id: trek.id,
|
|
14214
|
+
name: trek.name,
|
|
14215
|
+
practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
|
|
14216
|
+
imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
|
|
14217
|
+
},
|
|
14218
|
+
});
|
|
14219
|
+
}
|
|
14218
14220
|
}
|
|
14219
14221
|
if (!this.treksLayer) {
|
|
14220
14222
|
if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
|
|
@@ -14222,7 +14224,9 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14222
14224
|
this.map.fitBounds(bounds);
|
|
14223
14225
|
}
|
|
14224
14226
|
else {
|
|
14225
|
-
|
|
14227
|
+
if (state.currentMapTreksBounds) {
|
|
14228
|
+
this.map.fitBounds(state.currentMapTreksBounds);
|
|
14229
|
+
}
|
|
14226
14230
|
}
|
|
14227
14231
|
this.treksLayer = leafletSrc.geoJSON(treksFeatureCollection, {
|
|
14228
14232
|
pointToLayer: (geoJsonPoint, latlng) => leafletSrc.marker(latlng, {
|
|
@@ -14258,6 +14262,9 @@ const GrwMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
14258
14262
|
const bounds = leafletSrc.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
|
|
14259
14263
|
this.map.fitBounds(bounds);
|
|
14260
14264
|
}
|
|
14265
|
+
else {
|
|
14266
|
+
this.map.fire('moveend');
|
|
14267
|
+
}
|
|
14261
14268
|
this.treksLayer.clearLayers();
|
|
14262
14269
|
this.treksLayer.addData(treksFeatureCollection);
|
|
14263
14270
|
}
|
|
@@ -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);
|