@geotrekce/geotrek-rando-widget 0.0.4 → 0.0.7

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 (61) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +1 -1
  2. package/dist/cjs/grw-app.cjs.entry.js +111 -0
  3. package/dist/cjs/{grw-app_11.cjs.entry.js → grw-filter_6.cjs.entry.js} +197 -455
  4. package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +52 -0
  5. package/dist/cjs/grw-trek-card.cjs.entry.js +47 -0
  6. package/dist/cjs/length-d315d156.js +34 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/store-fd04a216.js +211 -0
  9. package/dist/collection/components/grw-app/grw-app.js +54 -25
  10. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +5 -4
  11. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +1 -1
  12. package/dist/collection/components/grw-map/grw-map.css +19 -1
  13. package/dist/collection/components/grw-map/grw-map.js +65 -10
  14. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +5 -4
  15. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
  16. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +27 -3
  17. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +17 -3
  18. package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
  19. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +134 -4
  20. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +101 -6
  21. package/dist/collection/components/grw-treks-list/grw-treks-list.js +8 -3
  22. package/dist/collection/store/grw-trek-provider.js +24 -9
  23. package/dist/collection/store/grw-treks-provider.js +12 -6
  24. package/dist/collection/store/store.js +7 -1
  25. package/dist/components/grw-app.js +52 -6
  26. package/dist/components/grw-information-desk-detail2.js +2 -2
  27. package/dist/components/grw-map2.js +66 -11
  28. package/dist/components/grw-poi-detail2.js +2 -2
  29. package/dist/components/grw-sensitive-area-detail2.js +7 -2
  30. package/dist/components/grw-trek-detail2.js +31 -4
  31. package/dist/components/grw-trek-provider2.js +24 -9
  32. package/dist/components/grw-treks-list2.js +8 -3
  33. package/dist/components/grw-treks-provider2.js +12 -6
  34. package/dist/components/store.js +7 -1
  35. package/dist/esm/geotrek-rando-widget.js +2 -2
  36. package/dist/esm/grw-app.entry.js +107 -0
  37. package/dist/esm/{grw-app_11.entry.js → grw-filter_6.entry.js} +138 -391
  38. package/dist/esm/grw-information-desk-detail_3.entry.js +46 -0
  39. package/dist/esm/grw-trek-card.entry.js +43 -0
  40. package/dist/esm/{index-fe16e7b6.js → index-192d910f.js} +1 -1
  41. package/dist/esm/length-d82189db.js +27 -0
  42. package/dist/esm/loader.js +2 -2
  43. package/dist/esm/store-b2c76c0c.js +208 -0
  44. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  45. package/dist/geotrek-rando-widget/p-1b2ba86d.entry.js +1 -0
  46. package/dist/geotrek-rando-widget/p-4361afd2.entry.js +1 -0
  47. package/dist/geotrek-rando-widget/p-5f17d340.entry.js +1 -0
  48. package/dist/geotrek-rando-widget/{p-8c206aec.js → p-6dce5e6c.js} +1 -1
  49. package/dist/geotrek-rando-widget/p-7715153d.entry.js +1 -0
  50. package/dist/geotrek-rando-widget/p-e6710c64.js +1 -0
  51. package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
  52. package/dist/types/components/grw-app/grw-app.d.ts +7 -2
  53. package/dist/types/components/grw-map/grw-map.d.ts +3 -1
  54. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +9 -4
  55. package/dist/types/components.d.ts +0 -2
  56. package/dist/types/store/grw-trek-provider.d.ts +2 -0
  57. package/dist/types/store/grw-treks-provider.d.ts +3 -0
  58. package/dist/types/store/store.d.ts +16 -3
  59. package/dist/types/types/types.d.ts +51 -1
  60. package/package.json +5 -4
  61. package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +0 -1
@@ -14,6 +14,7 @@ export class GrwMap {
14
14
  this.colorArrivalIcon = '#85003b';
15
15
  this.colorSensitiveArea = ' #4974a5';
16
16
  this.colorPoiIcon = '#974c6e';
17
+ this.handleTreksWithinBoundsBind = this.handleTreksWithinBounds.bind(this);
17
18
  }
18
19
  componentDidLoad() {
19
20
  this.map = L.map(this.element, {
@@ -70,16 +71,18 @@ export class GrwMap {
70
71
  },
71
72
  });
72
73
  }
73
- if (trekscurrentDepartureCoordinates.length > 0) {
74
- const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
75
- this.currentBounds = bounds;
76
- this.map.fitBounds(this.currentBounds);
77
- }
78
74
  if (!this.treksLayer) {
75
+ if (trekscurrentDepartureCoordinates.length > 0 && !state.currentMapTreksBounds) {
76
+ const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
77
+ this.map.fitBounds(bounds);
78
+ }
79
+ else {
80
+ this.map.fitBounds(state.currentMapTreksBounds);
81
+ }
79
82
  this.treksLayer = L.geoJSON(treksFeatureCollection, {
80
83
  pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
81
84
  icon: L.divIcon({
82
- html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
85
+ html: geoJsonPoint.properties.practice ? `<img src=${geoJsonPoint.properties.practice} />` : `<img />`,
83
86
  className: 'trek-marker',
84
87
  iconSize: 48,
85
88
  }),
@@ -106,17 +109,27 @@ export class GrwMap {
106
109
  }).addTo(this.map);
107
110
  }
108
111
  else {
112
+ if (trekscurrentDepartureCoordinates.length > 0) {
113
+ const bounds = L.latLngBounds(trekscurrentDepartureCoordinates.map(coordinate => [coordinate[1], coordinate[0]]));
114
+ this.map.fitBounds(bounds);
115
+ }
109
116
  this.treksLayer.clearLayers();
110
117
  this.treksLayer.addData(treksFeatureCollection);
111
118
  }
112
119
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
120
+ this.map.on('moveend', this.handleTreksWithinBoundsBind);
113
121
  }
114
122
  removeTreks() {
115
123
  if (this.treksLayer) {
124
+ state.currentMapTreksBounds = this.map.getBounds();
116
125
  this.map.removeLayer(this.treksLayer);
117
126
  this.treksLayer = null;
127
+ this.map.off('moveend', this.handleTreksWithinBoundsBind);
118
128
  }
119
129
  }
130
+ handleTreksWithinBounds() {
131
+ state.treksWithinBounds = state.currentTreks.filter(trek => this.map.getBounds().contains(L.latLng(trek.departure_geom[1], trek.departure_geom[0])));
132
+ }
120
133
  addTrek() {
121
134
  const currentTrekFeature = {
122
135
  type: 'Feature',
@@ -130,8 +143,7 @@ export class GrwMap {
130
143
  interactive: false,
131
144
  }).addTo(this.map);
132
145
  const bounds = L.latLngBounds(state.currentTrek.geometry.coordinates.map(coordinate => [coordinate[1], coordinate[0]]));
133
- this.currentBounds = bounds;
134
- this.map.fitBounds(this.currentBounds);
146
+ this.map.fitBounds(bounds);
135
147
  const currentDepartureCoordinates = [state.currentTrek.geometry.coordinates.at(0)[0], state.currentTrek.geometry.coordinates.at(0)[1]];
136
148
  const currentArrivalCoordinates = [state.currentTrek.geometry.coordinates.at(-1)[0], state.currentTrek.geometry.coordinates.at(-1)[1]];
137
149
  const currentDepartureArrivalFeatureCollection = {
@@ -190,11 +202,24 @@ export class GrwMap {
190
202
  for (const sensitiveArea of state.currentSensitiveAreas) {
191
203
  currentSensitiveAreasFeatureCollection.features.push({
192
204
  type: 'Feature',
193
- properties: {},
205
+ properties: { name: sensitiveArea.name },
194
206
  geometry: sensitiveArea.geometry,
195
207
  });
196
208
  }
197
- this.currentSensitiveAreasLayer = L.geoJSON(currentSensitiveAreasFeatureCollection, { style: () => ({ color: this.colorSensitiveArea }) }).addTo(this.map);
209
+ this.currentSensitiveAreasLayer = L.geoJSON(currentSensitiveAreasFeatureCollection, {
210
+ onEachFeature: (geoJsonPoint, layer) => {
211
+ layer.once('mouseover', () => {
212
+ const sensitiveAreaTooltip = L.DomUtil.create('div');
213
+ sensitiveAreaTooltip.className = 'sensitive-area-tooltip';
214
+ const sensitiveAreaName = L.DomUtil.create('div');
215
+ sensitiveAreaName.innerHTML = geoJsonPoint.properties.name;
216
+ sensitiveAreaName.className = 'sensitive-area-name';
217
+ sensitiveAreaTooltip.appendChild(sensitiveAreaName);
218
+ layer.bindTooltip(sensitiveAreaTooltip).openTooltip();
219
+ });
220
+ },
221
+ style: () => ({ color: this.colorSensitiveArea }),
222
+ }).addTo(this.map);
198
223
  L.Control.SensitiveAreasCheckboxContainer = L.Control.extend({
199
224
  onAdd: () => {
200
225
  const sensitiveAreasCheckboxContainer = L.DomUtil.create('div');
@@ -288,6 +313,32 @@ export class GrwMap {
288
313
  },
289
314
  }).addTo(this.map);
290
315
  }
316
+ if (state.currentTrek.points_reference) {
317
+ const currentPointsReferenceFeatureCollection = {
318
+ type: 'FeatureCollection',
319
+ features: [],
320
+ };
321
+ currentPointsReferenceFeatureCollection.features.push({
322
+ type: 'Feature',
323
+ properties: {},
324
+ geometry: state.currentTrek.points_reference,
325
+ });
326
+ let index = 0;
327
+ this.currentPointsReferenceLayer = L.geoJSON(currentPointsReferenceFeatureCollection, {
328
+ pointToLayer: (_geoJsonPoint, latlng) => {
329
+ index += 1;
330
+ return L.marker(latlng, {
331
+ icon: L.divIcon({
332
+ html: index,
333
+ className: 'point-reference-icon',
334
+ iconSize: 24,
335
+ }),
336
+ autoPanOnFocus: false,
337
+ interactive: false,
338
+ });
339
+ },
340
+ }).addTo(this.map);
341
+ }
291
342
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
292
343
  }
293
344
  removeTrek() {
@@ -317,6 +368,10 @@ export class GrwMap {
317
368
  this.map.removeLayer(this.currentInformationDesksLayer);
318
369
  this.currentInformationDesksLayer = null;
319
370
  }
371
+ if (this.currentPointsReferenceLayer) {
372
+ this.map.removeLayer(this.currentPointsReferenceLayer);
373
+ this.currentPointsReferenceLayer = null;
374
+ }
320
375
  }
321
376
  render() {
322
377
  return (h(Host, { style: {
@@ -1,7 +1,9 @@
1
1
  :host {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- padding: 0px 8px 8px 8px;
4
+ }
5
+ :host a {
6
+ color: var(--color-primary);
5
7
  }
6
8
 
7
9
  .poi-img {
@@ -12,17 +14,16 @@
12
14
  border-radius: 8px;
13
15
  }
14
16
 
15
- .poi-right-container {
17
+ .poi-sub-container {
16
18
  display: flex;
17
19
  flex-direction: column;
18
- padding: 8px;
19
20
  }
20
21
 
21
22
  .poi-name {
22
23
  color: var(--color-primary);
23
24
  font-size: 24px;
24
25
  font-weight: bold;
25
- padding: 0px 0px 8px 0px;
26
+ padding: 12px 0px;
26
27
  }
27
28
 
28
29
  .poi-description {
@@ -4,7 +4,7 @@ export class GrwPoiDetail {
4
4
  return (h(Host, null,
5
5
  this.poi.attachments && this.poi.attachments[0] && this.poi.attachments[0].thumbnail && (h("div", { class: "poi-img" },
6
6
  h("img", { src: this.poi.attachments[0].thumbnail, loading: "lazy" }))),
7
- h("div", { class: "poi-right-container" },
7
+ h("div", { class: "poi-sub-container" },
8
8
  h("div", { class: "poi-name" }, this.poi.name),
9
9
  h("div", { class: "poi-description", innerHTML: this.poi.description }))));
10
10
  }
@@ -1,16 +1,40 @@
1
1
  :host {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- padding: 0px 8px 8px 8px;
4
+ }
5
+ :host a {
6
+ color: var(--color-primary);
5
7
  }
6
8
 
7
- .sensitive-area-name {
9
+ .sensitive-area-title {
8
10
  color: var(--color-primary);
9
11
  font-size: 24px;
12
+ padding: 12px 0px;
10
13
  font-weight: bold;
11
- padding: 0px 0px 8px 0px;
12
14
  }
13
15
 
14
16
  .sensitive-area-description {
15
17
  font-size: 16px;
18
+ }
19
+
20
+ .sensitive-area-period-container .sensitive-area-period-title,
21
+ .sensitive-area-period-container .sensitive-area-practice-title,
22
+ .sensitive-area-period-container .sensitive-area-contact-title,
23
+ .sensitive-area-practice-container .sensitive-area-period-title,
24
+ .sensitive-area-practice-container .sensitive-area-practice-title,
25
+ .sensitive-area-practice-container .sensitive-area-contact-title,
26
+ .sensitive-area-contact-container .sensitive-area-period-title,
27
+ .sensitive-area-contact-container .sensitive-area-practice-title,
28
+ .sensitive-area-contact-container .sensitive-area-contact-title {
29
+ color: var(--color-primary);
30
+ font-size: 24px;
31
+ padding: 12px 0px;
32
+ }
33
+ .sensitive-area-period-container .sensitive-area-period-values,
34
+ .sensitive-area-period-container .sensitive-area-practice-values,
35
+ .sensitive-area-practice-container .sensitive-area-period-values,
36
+ .sensitive-area-practice-container .sensitive-area-practice-values,
37
+ .sensitive-area-contact-container .sensitive-area-period-values,
38
+ .sensitive-area-contact-container .sensitive-area-practice-values {
39
+ display: flex;
16
40
  }
@@ -1,9 +1,23 @@
1
1
  import { Component, Host, h, Prop } from '@stencil/core';
2
+ import state from 'store/store';
2
3
  export class GrwSensitiveAreaDetail {
3
4
  render() {
4
5
  return (h(Host, null,
5
- h("div", { class: "sensitive-area-name" }, this.sensitiveArea.name),
6
- h("div", { class: "sensitive-area-description", innerHTML: this.sensitiveArea.description })));
6
+ h("div", { class: "sensitive-area-title" }, this.sensitiveArea.name),
7
+ h("div", { class: "sensitive-area-description", innerHTML: this.sensitiveArea.description }),
8
+ this.sensitiveArea.practices && this.sensitiveArea.practices.length > 0 && (h("div", { class: "sensitive-area-practice-container" },
9
+ h("div", { class: "sensitive-area-practice-title" }, "Domaines d'activit\u00E9s concern\u00E9s :"),
10
+ h("div", { class: "sensitive-area-practice-values" }, this.sensitiveArea.practices.map((practice, index) => (h("div", { innerHTML: `${state.practices.find(statePractice => statePractice.id === practice).name.toUpperCase()}${index + 1 !== this.sensitiveArea.practices.length ? ' -&nbsp;' : ''}` })))))),
11
+ this.sensitiveArea.period && this.sensitiveArea.period.length > 0 && (h("div", { class: "sensitive-area-period-container" },
12
+ h("div", { class: "sensitive-area-period-title" }, "P\u00E9riodes de sensibilit\u00E9"),
13
+ h("div", { class: "sensitive-area-period-values" }, this.sensitiveArea.period.map((month, index) => {
14
+ if (month) {
15
+ return (h("div", { innerHTML: `${new Date(0, index + 1, 0).toLocaleDateString('fr', { month: 'long' }).toUpperCase()}${this.sensitiveArea.period.slice(index + 1).find(month => month) ? ' -&nbsp;' : ''}` }));
16
+ }
17
+ })))),
18
+ h("div", { class: "sensitive-area-contact-container" },
19
+ h("div", { class: "sensitive-area-contact-title" }, "Contact"),
20
+ h("div", { innerHTML: this.sensitiveArea.contact, class: "sensitive-area-contact-value" }))));
7
21
  }
8
22
  static get is() { return "grw-sensitive-area-detail"; }
9
23
  static get encapsulation() { return "shadow"; }
@@ -19,7 +33,7 @@ export class GrwSensitiveAreaDetail {
19
33
  "mutable": false,
20
34
  "complexType": {
21
35
  "original": "SensitiveArea",
22
- "resolved": "{ id: number; geometry: Geometry; name: string; description: string; }",
36
+ "resolved": "{ id: number; geometry: Geometry; name: string; description: string; contact: string; info_url: string; period: boolean[]; practices: number[]; }",
23
37
  "references": {
24
38
  "SensitiveArea": {
25
39
  "location": "import",
@@ -73,7 +73,7 @@ export class GrwTrekCard {
73
73
  "mutable": false,
74
74
  "complexType": {
75
75
  "original": "Trek",
76
- "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; themes: number[]; duration: number; length_2d: number; ascent: number; departure: string; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; }",
76
+ "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; themes: number[]; duration: number; length_2d: number; ascent: number; departure: string; arrival?: string; altimetric_profile?: string; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; ambiance?: string; access?: string; public_transport?: string; advice?: string; advised_parking?: string; gear?: string; labels?: number[]; points_reference?: MultiPoint; source?: number[]; structure?: number; disabled_infrastructure?: string; accessibilities?: number[]; accessibility_level?: number; accessibility_slope?: string; accessibility_width?: string; accessibility_signage?: string; accessibility_covering?: string; accessibility_exposure?: string; accessibility_advice?: string; }",
77
77
  "references": {
78
78
  "Trek": {
79
79
  "location": "import",
@@ -1,3 +1,9 @@
1
+ grw-sensitive-area-detail,
2
+ grw-information-desk-detail,
3
+ grw-poi-detail {
4
+ margin-top: 12px;
5
+ }
6
+
1
7
  .trek-detail-container {
2
8
  font-family: "Roboto";
3
9
  display: flex;
@@ -65,7 +71,10 @@
65
71
  .trek-detail-container .downloads-container .download-title {
66
72
  color: var(--color-primary);
67
73
  font-size: 18px;
68
- margin-bottom: 18px;
74
+ margin-bottom: 12px;
75
+ }
76
+ .trek-detail-container .downloads-container .links-container {
77
+ display: flex;
69
78
  }
70
79
  .trek-detail-container .downloads-container .links-container a {
71
80
  background-color: var(--color-primary);
@@ -80,14 +89,135 @@
80
89
  .trek-detail-container .downloads-container .links-container a:hover {
81
90
  background-color: var(--color-primary-shade);
82
91
  }
83
- .trek-detail-container .description {
92
+ .trek-detail-container .themes-container {
93
+ display: flex;
94
+ justify-content: flex-start;
95
+ align-items: center;
96
+ flex-wrap: wrap;
84
97
  padding: 0px 24px 24px 24px;
85
98
  }
99
+ .trek-detail-container .themes-container .theme {
100
+ background-color: var(--color-primary-tint);
101
+ color: #ffffff;
102
+ border-radius: 8px;
103
+ padding: 8px;
104
+ margin: 0px 8px 8px 0px;
105
+ }
106
+ .trek-detail-container .ambiance,
107
+ .trek-detail-container .description-teaser,
108
+ .trek-detail-container .description-container,
109
+ .trek-detail-container .altimetric-profile-container,
110
+ .trek-detail-container .access-container,
111
+ .trek-detail-container .public-transport-container,
112
+ .trek-detail-container .advice-container,
113
+ .trek-detail-container .advised-parking-container,
114
+ .trek-detail-container .gear-container,
115
+ .trek-detail-container .pois-container,
116
+ .trek-detail-container .sensitive-areas-container,
117
+ .trek-detail-container .information-desks-container,
118
+ .trek-detail-container .source-container,
119
+ .trek-detail-container .accessibilities-container {
120
+ padding: 0px 24px 24px 24px;
121
+ }
122
+ .trek-detail-container .ambiance a,
123
+ .trek-detail-container .description-teaser a,
124
+ .trek-detail-container .description-container a,
125
+ .trek-detail-container .altimetric-profile-container a,
126
+ .trek-detail-container .access-container a,
127
+ .trek-detail-container .public-transport-container a,
128
+ .trek-detail-container .advice-container a,
129
+ .trek-detail-container .advised-parking-container a,
130
+ .trek-detail-container .gear-container a,
131
+ .trek-detail-container .pois-container a,
132
+ .trek-detail-container .sensitive-areas-container a,
133
+ .trek-detail-container .information-desks-container a,
134
+ .trek-detail-container .source-container a,
135
+ .trek-detail-container .accessibilities-container a {
136
+ color: var(--color-primary);
137
+ }
138
+ .trek-detail-container .description-title,
139
+ .trek-detail-container .altimetric-profile-title,
140
+ .trek-detail-container .access-title,
141
+ .trek-detail-container .public-transport-title,
142
+ .trek-detail-container .advice-title,
143
+ .trek-detail-container .advised-parking-title,
144
+ .trek-detail-container .gear-title,
86
145
  .trek-detail-container .pois-title,
87
146
  .trek-detail-container .sensitive-areas-title,
88
- .trek-detail-container .information-desks-title {
147
+ .trek-detail-container .information-desks-title,
148
+ .trek-detail-container .source-title,
149
+ .trek-detail-container .accessibilities-title {
89
150
  color: var(--color-primary);
90
151
  font-size: 36px;
91
152
  font-weight: bold;
92
- padding: 16px;
153
+ margin: 12px 0px;
154
+ }
155
+
156
+ .label-container .label-sub-container {
157
+ display: flex;
158
+ align-items: center;
159
+ }
160
+ .label-container .label-sub-container img {
161
+ width: 26px;
162
+ margin-right: 16px;
163
+ }
164
+ .label-container .label-sub-container .label-name {
165
+ color: var(--color-primary);
166
+ font-size: 24px;
167
+ font-weight: bold;
168
+ padding: 12px 0px;
169
+ }
170
+
171
+ .source-container .source-sub-container {
172
+ display: flex;
173
+ align-items: center;
174
+ }
175
+ .source-container .source-sub-container img {
176
+ width: 26px;
177
+ margin-right: 16px;
178
+ }
179
+ .source-container .source-sub-container .source-name {
180
+ color: var(--color-primary);
181
+ font-size: 24px;
182
+ font-weight: bold;
183
+ padding: 12px 0px;
184
+ }
185
+
186
+ .departure-container,
187
+ .arrival-container {
188
+ display: flex;
189
+ align-items: center;
190
+ padding: 0px 24px 24px 24px;
191
+ }
192
+ .departure-container .departure-title,
193
+ .departure-container .arrival-title,
194
+ .arrival-container .departure-title,
195
+ .arrival-container .arrival-title {
196
+ color: var(--color-primary);
197
+ font-weight: bold;
198
+ }
199
+
200
+ .accessibilities-container .accessibilities-content-container {
201
+ padding: 12px 0px 0px 0px;
202
+ display: flex;
203
+ }
204
+ .accessibilities-container .accessibilities-content-container .accessibility-content-container {
205
+ display: flex;
206
+ align-items: center;
207
+ margin: 0px 8px 8px 0px;
208
+ }
209
+ .accessibilities-container .accessibilities-content-container .accessibility-content-container img {
210
+ margin-right: 16px;
211
+ width: 26px;
212
+ }
213
+ .accessibilities-container .accessibility-level-title,
214
+ .accessibilities-container .accessibility-slope-title,
215
+ .accessibilities-container .accessibility-width-title,
216
+ .accessibilities-container .accessibility-signage-title,
217
+ .accessibilities-container .accessibility-covering-title,
218
+ .accessibilities-container .accessibility-exposure-title,
219
+ .accessibilities-container .accessibility-advice-title {
220
+ color: var(--color-primary);
221
+ font-size: 24px;
222
+ padding: 12px 0px;
93
223
  }
@@ -16,6 +16,13 @@ export class GrwTrekDetail {
16
16
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
17
17
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
18
18
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
19
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
20
+ this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
21
+ this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
22
+ this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
23
+ if (state.accessibilitiesLevel) {
24
+ this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
25
+ }
19
26
  }
20
27
  onChange('currentTrek', () => {
21
28
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -23,6 +30,13 @@ export class GrwTrekDetail {
23
30
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
24
31
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
25
32
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
33
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
34
+ this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
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
+ }
26
40
  }
27
41
  });
28
42
  }
@@ -59,16 +73,92 @@ export class GrwTrekDetail {
59
73
  h("a", { href: `${this.currentTrek.gpx}` }, "GPX"),
60
74
  h("a", { href: `${this.currentTrek.kml}` }, "KML"),
61
75
  h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))),
62
- h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser }),
76
+ this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))),
77
+ this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }),
78
+ this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }),
79
+ this.currentTrek.description && (h("div", { class: "description-container" },
80
+ h("div", { class: "description-title" }, "Description"),
81
+ h("div", { class: "description", innerHTML: this.currentTrek.description }))),
82
+ this.currentTrek.departure && (h("div", { class: "departure-container" },
83
+ h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"),
84
+ h("div", { innerHTML: this.currentTrek.departure }))),
85
+ this.currentTrek.arrival && (h("div", { class: "arrival-container" },
86
+ h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"),
87
+ h("div", { innerHTML: this.currentTrek.arrival }))),
88
+ this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" },
89
+ h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"),
90
+ h("img", { src: `${this.currentTrek.altimetric_profile}?format=svg` }))),
91
+ this.currentTrek.access && (h("div", { class: "access-container" },
92
+ h("div", { class: "access-title" }, "Acc\u00E8s routier"),
93
+ h("div", { class: "access", innerHTML: this.currentTrek.access }))),
94
+ this.currentTrek.public_transport && (h("div", { class: "public-transport-container" },
95
+ h("div", { class: "public-transport-title" }, "Transport"),
96
+ h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))),
97
+ (this.currentTrek.advice || this.labels.length > 0) && (h("div", { class: "advice-container" },
98
+ h("div", { class: "advice-title" }, "Recommandations"),
99
+ this.currentTrek.advice && h("div", { class: "advice", innerHTML: this.currentTrek.advice }),
100
+ this.labels.map(label => (h("div", { class: "label-container" },
101
+ h("div", { class: "label-sub-container" },
102
+ label.pictogram && h("img", { src: label.pictogram }),
103
+ h("div", { class: "label-name", innerHTML: label.name })),
104
+ h("div", { class: "label-advice", innerHTML: label.advice })))))),
105
+ this.currentTrek.advised_parking && (h("div", { class: "advised-parking-container" },
106
+ h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"),
107
+ h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))),
108
+ this.currentTrek.gear && (h("div", { class: "gear-container" },
109
+ h("div", { class: "gear-title" }, "\u00C9quipements"),
110
+ h("div", { class: "gear", innerHTML: this.currentTrek.gear }))),
63
111
  state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" },
64
- h("div", { class: "sensitive-areas-title" }, "Zones sensibles"),
112
+ h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"),
65
113
  state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))),
66
114
  state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" },
67
115
  h("div", { class: "information-desks-title" }, "Lieux de renseignement"),
68
116
  state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))),
117
+ (this.currentTrek.disabled_infrastructure ||
118
+ (this.accessibilities && this.accessibilities.length > 0) ||
119
+ this.currentTrek.accessibility_level ||
120
+ this.currentTrek.accessibility_slope ||
121
+ this.currentTrek.accessibility_width ||
122
+ this.currentTrek.accessibility_signage ||
123
+ this.currentTrek.accessibility_covering ||
124
+ this.currentTrek.accessibility_exposure ||
125
+ this.currentTrek.accessibility_advice) && (h("div", { class: "accessibilities-container" },
126
+ h("div", { class: "accessibilities-title" }, "Accessibilit\u00E9"),
127
+ this.currentTrek.disabled_infrastructure && h("div", { innerHTML: this.currentTrek.disabled_infrastructure }),
128
+ h("div", { class: "accessibilities-content-container" }, this.accessibilities.map(accessibility => (h("div", { class: "accessibility-content-container" },
129
+ h("img", { src: accessibility.pictogram }),
130
+ h("div", { innerHTML: accessibility.name }))))),
131
+ this.currentTrek.accessibility_level && (h("div", { class: "accessibility-level-container" },
132
+ h("div", { class: "accessibility-level-title" }, "Niveau d'accessibilit\u00E9"),
133
+ h("div", { innerHTML: this.accessibilityLevel.name }))),
134
+ this.currentTrek.accessibility_slope && (h("div", { class: "accessibility-slope-container" },
135
+ h("div", { class: "accessibility-slope-title" }, "Pente"),
136
+ h("div", { innerHTML: this.currentTrek.accessibility_slope }))),
137
+ this.currentTrek.accessibility_width && (h("div", { class: "accessibility-width-container" },
138
+ h("div", { class: "accessibility-width-title" }, "Largeur"),
139
+ h("div", { innerHTML: this.currentTrek.accessibility_width }))),
140
+ this.currentTrek.accessibility_signage && (h("div", { class: "accessibility-signage-container" },
141
+ h("div", { class: "accessibility-signage-title" }, "Pente"),
142
+ h("div", { innerHTML: this.currentTrek.accessibility_signage }))),
143
+ this.currentTrek.accessibility_covering && (h("div", { class: "accessibility-covering-container" },
144
+ h("div", { class: "accessibility-covering-title" }, "Rev\u00EAtement"),
145
+ h("div", { innerHTML: this.currentTrek.accessibility_covering }))),
146
+ this.currentTrek.accessibility_exposure && (h("div", { class: "accessibility-exposure-container" },
147
+ h("div", { class: "accessibility-exposure-title" }, "Exposition"),
148
+ h("div", { innerHTML: this.currentTrek.accessibility_exposure }))),
149
+ this.currentTrek.accessibility_advice && (h("div", { class: "accessibility-advice-container" },
150
+ h("div", { class: "accessibility-advice-title" }, "Conseils"),
151
+ h("div", { innerHTML: this.currentTrek.accessibility_advice }))))),
69
152
  state.currentPois && state.currentPois.length > 0 && (h("div", { class: "pois-container" },
70
153
  h("div", { class: "pois-title" }, "Points d'int\u00E9r\u00EAts"),
71
- state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi })))))))));
154
+ state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi }))))),
155
+ this.currentTrek.source && this.currentTrek.source.length > 0 && (h("div", { class: "source-container" },
156
+ h("div", { class: "source-title" }, "Sources"),
157
+ this.sources.map(source => (h("div", { class: "source-sub-container" },
158
+ source.pictogram && h("img", { src: source.pictogram }),
159
+ h("div", null,
160
+ h("div", { class: "source-name", innerHTML: source.name }),
161
+ h("a", { class: "source-advice", innerHTML: source.website })))))))))));
72
162
  }
73
163
  static get is() { return "grw-trek-detail"; }
74
164
  static get encapsulation() { return "shadow"; }
@@ -84,7 +174,7 @@ export class GrwTrekDetail {
84
174
  "mutable": false,
85
175
  "complexType": {
86
176
  "original": "Trek",
87
- "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; themes: number[]; duration: number; length_2d: number; ascent: number; departure: string; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; }",
177
+ "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; themes: number[]; duration: number; length_2d: number; ascent: number; departure: string; arrival?: string; altimetric_profile?: string; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; ambiance?: string; access?: string; public_transport?: string; advice?: string; advised_parking?: string; gear?: string; labels?: number[]; points_reference?: MultiPoint; source?: number[]; structure?: number; disabled_infrastructure?: string; accessibilities?: number[]; accessibility_level?: number; accessibility_slope?: string; accessibility_width?: string; accessibility_signage?: string; accessibility_covering?: string; accessibility_exposure?: string; accessibility_advice?: string; }",
88
178
  "references": {
89
179
  "Trek": {
90
180
  "location": "import",
@@ -155,9 +245,14 @@ export class GrwTrekDetail {
155
245
  }
156
246
  }; }
157
247
  static get states() { return {
158
- "currentTrek": {},
159
248
  "difficulty": {},
160
249
  "route": {},
161
- "practice": {}
250
+ "practice": {},
251
+ "themes": {},
252
+ "labels": {},
253
+ "sources": {},
254
+ "accessibilities": {},
255
+ "accessibilityLevel": {},
256
+ "currentTrek": {}
162
257
  }; }
163
258
  }
@@ -15,11 +15,16 @@ export class GrwTreksList {
15
15
  this.element.scroll({ top: 0 });
16
16
  this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
17
17
  });
18
+ onChange('treksWithinBounds', () => {
19
+ this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
20
+ this.element.scroll({ top: 0 });
21
+ this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
22
+ });
18
23
  }
19
24
  handleInfiniteScroll(event) {
20
25
  if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
21
- if (this.treksToDisplay.length < state.treks.length) {
22
- this.treksToDisplay = state.currentTreks.slice(0, this.treksToDisplay.length + this.step >= state.currentTreks.length ? state.currentTreks.length : this.treksToDisplay.length + this.step);
26
+ if (this.treksToDisplay.length < state.treksWithinBounds.length) {
27
+ this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
23
28
  }
24
29
  else {
25
30
  this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
@@ -28,7 +33,7 @@ export class GrwTreksList {
28
33
  }
29
34
  render() {
30
35
  return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
31
- h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
36
+ h("div", { class: "current-treks-length" }, `${state.treksWithinBounds.length} résultat${state.treksWithinBounds.length > 1 ? 's' : ''}`),
32
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 }))))));
33
38
  }
34
39
  static get is() { return "grw-treks-list"; }