@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.
Files changed (59) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/grw-app.cjs.entry.js +14 -5
  3. package/dist/cjs/grw-filter_6.cjs.entry.js +109 -63
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +2 -2
  5. package/dist/cjs/grw-trek-card.cjs.entry.js +3 -3
  6. package/dist/cjs/{index-c2c4531d.js → index-4c76daa3.js} +8 -3
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/{store-fd04a216.js → store-b4c3c507.js} +6 -4
  9. package/dist/collection/components/grw-app/grw-app.css +17 -11
  10. package/dist/collection/components/grw-app/grw-app.js +21 -9
  11. package/dist/collection/components/grw-filter/grw-filter.js +11 -12
  12. package/dist/collection/components/grw-map/grw-map.js +24 -15
  13. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  14. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +11 -3
  15. package/dist/collection/components/grw-treks-list/grw-treks-list.css +0 -12
  16. package/dist/collection/components/grw-treks-list/grw-treks-list.js +16 -9
  17. package/dist/collection/store/grw-trek-provider.js +28 -15
  18. package/dist/collection/store/grw-treks-provider.js +16 -8
  19. package/dist/collection/store/store.js +5 -3
  20. package/dist/components/grw-app.js +14 -5
  21. package/dist/components/grw-filter2.js +11 -12
  22. package/dist/components/grw-map2.js +24 -15
  23. package/dist/components/grw-trek-card2.js +1 -1
  24. package/dist/components/grw-trek-detail2.js +11 -3
  25. package/dist/components/grw-trek-provider2.js +28 -15
  26. package/dist/components/grw-treks-list2.js +18 -9
  27. package/dist/components/grw-treks-provider2.js +16 -8
  28. package/dist/components/store.js +5 -3
  29. package/dist/esm/geotrek-rando-widget.js +2 -2
  30. package/dist/esm/grw-app.entry.js +14 -5
  31. package/dist/esm/grw-filter_6.entry.js +109 -63
  32. package/dist/esm/grw-information-desk-detail_3.entry.js +2 -2
  33. package/dist/esm/grw-trek-card.entry.js +3 -3
  34. package/dist/esm/{index-192d910f.js → index-ee473772.js} +8 -3
  35. package/dist/esm/loader.js +2 -2
  36. package/dist/esm/{store-b2c76c0c.js → store-a5f523fd.js} +6 -4
  37. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  38. package/dist/geotrek-rando-widget/{p-7715153d.entry.js → p-0510e16b.entry.js} +1 -1
  39. package/dist/geotrek-rando-widget/p-22562f4d.js +1 -0
  40. package/dist/geotrek-rando-widget/p-28db12ba.entry.js +1 -0
  41. package/dist/geotrek-rando-widget/{p-1b2ba86d.entry.js → p-500436f1.entry.js} +1 -1
  42. package/dist/geotrek-rando-widget/p-94f0db4d.entry.js +1 -0
  43. package/dist/geotrek-rando-widget/p-b62909db.js +2 -0
  44. package/dist/types/components/grw-app/grw-app.d.ts +2 -2
  45. package/dist/types/components/grw-filter/grw-filter.d.ts +1 -1
  46. package/dist/types/components/grw-map/grw-map.d.ts +1 -1
  47. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +1 -1
  48. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +1 -1
  49. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -2
  50. package/dist/types/components.d.ts +2 -2
  51. package/dist/types/store/grw-trek-provider.d.ts +4 -1
  52. package/dist/types/store/grw-treks-provider.d.ts +4 -1
  53. package/dist/types/store/store.d.ts +4 -0
  54. package/package.json +1 -1
  55. package/readme.md +4 -0
  56. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +0 -1
  57. package/dist/geotrek-rando-widget/p-6716c635.entry.js +0 -1
  58. package/dist/geotrek-rando-widget/p-6dce5e6c.js +0 -2
  59. package/dist/geotrek-rando-widget/p-e6710c64.js +0 -1
@@ -8,6 +8,7 @@
8
8
  .header-container,
9
9
  .large-view-header-container {
10
10
  display: flex;
11
+ flex-direction: row;
11
12
  align-items: center;
12
13
  background-color: var(--color-primary);
13
14
  height: 64px;
@@ -24,16 +25,26 @@
24
25
  width: 48px;
25
26
  height: auto;
26
27
  }
27
- .header-container .handle-filters-button,
28
- .large-view-header-container .handle-filters-button {
28
+ .header-container .handle-filters-container,
29
+ .large-view-header-container .handle-filters-container {
30
+ display: flex;
31
+ align-items: center;
32
+ }
33
+ .header-container .handle-filters-container .handle-filters-button,
34
+ .large-view-header-container .handle-filters-container .handle-filters-button {
29
35
  user-select: none;
30
36
  cursor: pointer;
31
37
  color: var(--color-primary);
32
38
  background-color: #ffffff;
33
- margin-left: 36px;
39
+ margin-left: 12px;
34
40
  border-radius: 8px;
35
41
  padding: 8px;
36
42
  }
43
+ .header-container .handle-filters-container .current-treks-within-bounds-length,
44
+ .large-view-header-container .handle-filters-container .current-treks-within-bounds-length {
45
+ margin-left: 12px;
46
+ color: #ffffff;
47
+ }
37
48
  .header-container .attribution-container,
38
49
  .large-view-header-container .attribution-container {
39
50
  position: absolute;
@@ -78,12 +89,6 @@
78
89
  .filters-container .filter-margin-top {
79
90
  margin-top: 24px;
80
91
  }
81
- .filters-container .current-treks-length {
82
- margin: 0px 0px 32px 8px;
83
- color: var(--color-primary);
84
- font-size: 24px;
85
- font-weight: bold;
86
- }
87
92
 
88
93
  .back-filters-container {
89
94
  background-color: rgba(0, 0, 0, 0.5);
@@ -94,6 +99,7 @@
94
99
  top: 64px;
95
100
  }
96
101
 
102
+ .init-loader-container,
97
103
  .loader-container,
98
104
  .large-view-loader-container {
99
105
  display: flex;
@@ -101,6 +107,7 @@
101
107
  align-items: center;
102
108
  height: 100%;
103
109
  }
110
+ .init-loader-container .loader,
104
111
  .loader-container .loader,
105
112
  .large-view-loader-container .loader {
106
113
  width: 48px;
@@ -164,8 +171,8 @@
164
171
  font-size: 24px;
165
172
  }
166
173
 
174
+ .init-loader-container,
167
175
  .loader-container {
168
- position: absolute;
169
176
  width: 100%;
170
177
  }
171
178
 
@@ -185,7 +192,6 @@
185
192
  }
186
193
 
187
194
  .large-view-loader-container {
188
- position: relative;
189
195
  width: 50%;
190
196
  }
191
197
 
@@ -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", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")),
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.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
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": "any",
350
+ "type": "number",
339
351
  "mutable": false,
340
352
  "complexType": {
341
- "original": "any",
342
- "resolved": "any",
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
- let minValue;
27
- let maxValue;
28
- for (const currentFilterId of currentFiltersId) {
29
- const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
30
- if (isNaN(minValue) || currentFilter.minValue < minValue) {
31
- minValue = currentFilter.minValue;
32
- }
33
- if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
34
- maxValue = currentFilter.maxValue;
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
- componentDidLoad() {
19
+ connectedCallback() {
20
20
  this.map = L.map(this.element, {
21
21
  center: this.center.split(',').map(Number),
22
22
  zoom: this.zoom,
@@ -29,15 +29,17 @@ export class GrwMap {
29
29
  if (state.currentTrek) {
30
30
  this.addTrek();
31
31
  }
32
- else if (state.currentTrek) {
32
+ else if (state.currentTreks) {
33
33
  this.addTreks();
34
34
  }
35
35
  onChange('currentTreks', () => {
36
36
  if (state.currentTrek) {
37
+ this.removeTreks();
37
38
  this.addTrek();
38
39
  }
39
40
  else if (state.currentTreks) {
40
41
  this.addTreks();
42
+ this.removeTrek();
41
43
  }
42
44
  });
43
45
  onChange('currentTrek', () => {
@@ -58,18 +60,20 @@ export class GrwMap {
58
60
  type: 'FeatureCollection',
59
61
  features: [],
60
62
  };
61
- for (const trek of state.currentTreks) {
62
- trekscurrentDepartureCoordinates.push(trek.departure_geom);
63
- treksFeatureCollection.features.push({
64
- type: 'Feature',
65
- geometry: { type: 'Point', coordinates: trek.departure_geom },
66
- properties: {
67
- id: trek.id,
68
- name: trek.name,
69
- practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
70
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
71
- },
72
- });
63
+ if (state.currentTreks) {
64
+ for (const trek of state.currentTreks) {
65
+ trekscurrentDepartureCoordinates.push(trek.departure_geom);
66
+ treksFeatureCollection.features.push({
67
+ type: 'Feature',
68
+ geometry: { type: 'Point', coordinates: trek.departure_geom },
69
+ properties: {
70
+ id: trek.id,
71
+ name: trek.name,
72
+ practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
73
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
74
+ },
75
+ });
76
+ }
73
77
  }
74
78
  if (!this.treksLayer) {
75
79
  if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
@@ -77,7 +81,9 @@ export class GrwMap {
77
81
  this.map.fitBounds(bounds);
78
82
  }
79
83
  else {
80
- this.map.fitBounds(state.currentMapTreksBounds);
84
+ if (state.currentMapTreksBounds) {
85
+ this.map.fitBounds(state.currentMapTreksBounds);
86
+ }
81
87
  }
82
88
  this.treksLayer = L.geoJSON(treksFeatureCollection, {
83
89
  pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
@@ -113,6 +119,9 @@ export class GrwMap {
113
119
  const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
114
120
  this.map.fitBounds(bounds);
115
121
  }
122
+ else {
123
+ this.map.fire('moveend');
124
+ }
116
125
  this.treksLayer.clearLayers();
117
126
  this.treksLayer.addData(treksFeatureCollection);
118
127
  }
@@ -10,7 +10,7 @@ export class GrwTrekCard {
10
10
  this.colorPrimaryTint = '#974c6e';
11
11
  this.isLargeView = false;
12
12
  }
13
- componentWillLoad() {
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
- componentWillLoad() {
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);
@@ -20,7 +20,9 @@ export class GrwTrekDetail {
20
20
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
21
21
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
22
22
  this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
23
- this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
23
+ if (state.accessibilitiesLevel) {
24
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
25
+ }
24
26
  }
25
27
  onChange('currentTrek', () => {
26
28
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -31,6 +33,10 @@ export class GrwTrekDetail {
31
33
  this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
32
34
  this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
33
35
  this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
36
+ this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
37
+ if (state.accessibilitiesLevel) {
38
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
39
+ }
34
40
  }
35
41
  });
36
42
  }
@@ -81,7 +87,9 @@ export class GrwTrekDetail {
81
87
  h("div", { innerHTML: this.currentTrek.arrival }))),
82
88
  this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" },
83
89
  h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"),
84
- h("img", { src: this.currentTrek.altimetric_profile }))),
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` }))),
85
93
  this.currentTrek.access && (h("div", { class: "access-container" },
86
94
  h("div", { class: "access-title" }, "Acc\u00E8s routier"),
87
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
- componentWillLoad() {
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
- this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
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
- this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
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,27 +3,33 @@ import state from 'store/store';
3
3
  export class GrwTrekProvider {
4
4
  constructor() {
5
5
  this.language = 'fr';
6
+ this.trekNetworkError = false;
7
+ this.controller = new AbortController();
8
+ this.signal = this.controller.signal;
6
9
  }
7
- componentWillLoad() {
10
+ connectedCallback() {
8
11
  state.api = this.api;
9
12
  const requests = [];
10
- requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
11
- requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
12
- requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
13
- requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
14
- return Promise.all([
13
+ requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
14
+ requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
15
+ requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
16
+ requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
17
+ Promise.all([
15
18
  ...requests,
16
- fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`).catch(() => new Response('null')),
17
- fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`),
18
- fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`),
19
- fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`),
20
- fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`),
21
- 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`),
22
- 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`),
23
- 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`),
19
+ fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
20
+ signal: this.signal,
21
+ }).catch(() => new Response('null')),
22
+ fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`, { signal: this.signal }),
23
+ fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
24
+ fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
25
+ fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
26
+ 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 }),
27
+ 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 }),
28
+ 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 }),
24
29
  ])
25
30
  .then(responses => Promise.all(responses.map(response => response.json())))
26
31
  .then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
32
+ state.trekNetworkError = false;
27
33
  if (difficulties) {
28
34
  state.difficulties = difficulties.results;
29
35
  }
@@ -42,14 +48,21 @@ export class GrwTrekProvider {
42
48
  state.labels = labels.results;
43
49
  state.sources = sources.results;
44
50
  state.accessibilities = accessibilities.results;
45
- state.accessibilitiesLevel = accessibilitiesLevel.results;
51
+ if (accessibilitiesLevel) {
52
+ state.accessibilitiesLevel = accessibilitiesLevel.results;
53
+ }
46
54
  state.currentPois = pois.results;
47
55
  state.currentInformationDesks = informationDesks.results;
48
56
  state.currentTrek = trek;
57
+ })
58
+ .catch(() => {
59
+ state.trekNetworkError = true;
49
60
  });
50
61
  }
51
62
  disconnectedCallback() {
63
+ this.controller.abort();
52
64
  state.currentTrek = null;
65
+ state.trekNetworkError = false;
53
66
  }
54
67
  render() {
55
68
  return h(Host, null);
@@ -3,8 +3,10 @@ import state from 'store/store';
3
3
  export class GrwTreksProvider {
4
4
  constructor() {
5
5
  this.language = 'fr';
6
+ this.controller = new AbortController();
7
+ this.signal = this.controller.signal;
6
8
  }
7
- componentWillLoad() {
9
+ connectedCallback() {
8
10
  state.api = this.api;
9
11
  let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
10
12
  this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
@@ -16,15 +18,16 @@ export class GrwTreksProvider {
16
18
  this.routes && (treksRequest += `&routes=${this.routes}`);
17
19
  this.practices && (treksRequest += `&practices=${this.practices}`);
18
20
  treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
19
- return Promise.all([
20
- fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
21
- fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
22
- fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
23
- fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
24
- fetch(treksRequest),
21
+ Promise.all([
22
+ fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
23
+ fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
24
+ fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
25
+ fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
26
+ fetch(treksRequest, { signal: this.signal }),
25
27
  ])
26
28
  .then(responses => Promise.all(responses.map(response => response.json())))
27
29
  .then(([difficulties, routes, practices, themes, treks]) => {
30
+ state.treksNetworkError = false;
28
31
  state.difficulties = difficulties.results;
29
32
  state.routes = routes.results;
30
33
  state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
@@ -38,7 +41,12 @@ export class GrwTreksProvider {
38
41
  state.treks = treks.results;
39
42
  state.currentTreks = treks.results;
40
43
  state.treksWithinBounds = treks.results;
41
- });
44
+ })
45
+ .catch(() => (state.treksNetworkError = true));
46
+ }
47
+ disconnectedCallback() {
48
+ this.controller.abort();
49
+ state.treksNetworkError = false;
42
50
  }
43
51
  render() {
44
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:36px;border-radius:8px;padding:8px}.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}.filters-container .current-treks-length{margin:0px 0px 32px 8px;color:var(--color-primary);font-size:24px;font-weight:bold}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.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}.loader-container{position:absolute;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{position:relative;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%}";
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")), !this.showTrek && this.showFilters && (h("div", { class: "options-container" }, h("div", { class: "filters-container" }, h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`), 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.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
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": [8],
139
+ "zoom": [2],
131
140
  "attribution": [1],
132
141
  "colorPrimary": [1, "color-primary"],
133
142
  "colorPrimaryShade": [1, "color-primary-shade"],