@geotrekce/geotrek-rando-widget 0.0.3 → 0.0.4

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 (51) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/{grw-app_10.cjs.entry.js → grw-app_11.cjs.entry.js} +172 -58
  3. package/dist/cjs/{index-c6f73e30.js → index-c2c4531d.js} +46 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -0
  6. package/dist/collection/components/grw-app/grw-app.css +69 -5
  7. package/dist/collection/components/grw-app/grw-app.js +24 -5
  8. package/dist/collection/components/grw-filter/grw-filter.css +29 -0
  9. package/dist/collection/components/grw-filter/grw-filter.js +132 -0
  10. package/dist/collection/components/grw-map/grw-map.js +37 -31
  11. package/dist/collection/components/grw-trek-card/grw-trek-card.css +66 -32
  12. package/dist/collection/components/grw-trek-card/grw-trek-card.js +34 -10
  13. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +1 -1
  14. package/dist/collection/components/grw-treks-list/grw-treks-list.css +16 -3
  15. package/dist/collection/components/grw-treks-list/grw-treks-list.js +27 -5
  16. package/dist/collection/store/grw-trek-provider.js +24 -10
  17. package/dist/collection/store/grw-treks-provider.js +12 -3
  18. package/dist/collection/store/store.js +3 -0
  19. package/dist/collection/stories/App.js +8 -10
  20. package/dist/collection/stories/App.stories.js +4 -3
  21. package/dist/collection/stories/TrekMap.stories.js +3 -2
  22. package/dist/collection/stories/TreksList.js +8 -8
  23. package/dist/collection/stories/TreksMap.stories.js +3 -2
  24. package/dist/components/grw-app.js +15 -4
  25. package/dist/components/grw-filter.d.ts +11 -0
  26. package/dist/components/grw-filter.js +6 -0
  27. package/dist/components/grw-filter2.js +95 -0
  28. package/dist/components/grw-map2.js +37 -31
  29. package/dist/components/grw-trek-card2.js +10 -5
  30. package/dist/components/grw-trek-provider2.js +24 -10
  31. package/dist/components/grw-treks-list2.js +9 -6
  32. package/dist/components/grw-treks-provider2.js +12 -3
  33. package/dist/components/store.js +3 -0
  34. package/dist/esm/geotrek-rando-widget.js +2 -2
  35. package/dist/esm/{grw-app_10.entry.js → grw-app_11.entry.js} +172 -59
  36. package/dist/esm/{index-7aa9e822.js → index-fe16e7b6.js} +46 -1
  37. package/dist/esm/loader.js +2 -2
  38. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  39. package/dist/geotrek-rando-widget/p-8c206aec.js +2 -0
  40. package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +1 -0
  41. package/dist/types/components/grw-app/grw-app.d.ts +2 -0
  42. package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
  43. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -4
  44. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
  45. package/dist/types/components.d.ts +23 -0
  46. package/dist/types/store/store.d.ts +7 -1
  47. package/dist/types/types/types.d.ts +23 -0
  48. package/package.json +1 -1
  49. package/readme.md +4 -5
  50. package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
  51. package/dist/geotrek-rando-widget/p-73bc92fe.entry.js +0 -1
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "entries": [
3
3
  "./components/grw-app/grw-app.js",
4
+ "./components/grw-filter/grw-filter.js",
4
5
  "./components/grw-information-desk-detail/grw-information-desk-detail.js",
5
6
  "./components/grw-map/grw-map.js",
6
7
  "./components/grw-poi-detail/grw-poi-detail.js",
@@ -12,11 +12,6 @@
12
12
  background-color: var(--color-primary);
13
13
  height: 64px;
14
14
  }
15
- .header-container .title,
16
- .large-view-header-container .title {
17
- color: #ffffff;
18
- margin-left: 24px;
19
- }
20
15
  .header-container .arrow-back-icon,
21
16
  .large-view-header-container .arrow-back-icon {
22
17
  width: 48px;
@@ -29,6 +24,75 @@
29
24
  width: 48px;
30
25
  height: auto;
31
26
  }
27
+ .header-container .handle-filters-button,
28
+ .large-view-header-container .handle-filters-button {
29
+ user-select: none;
30
+ cursor: pointer;
31
+ color: var(--color-primary);
32
+ background-color: #ffffff;
33
+ margin-left: 36px;
34
+ border-radius: 8px;
35
+ padding: 8px;
36
+ }
37
+ .header-container .attribution-container,
38
+ .large-view-header-container .attribution-container {
39
+ position: absolute;
40
+ right: 24px;
41
+ }
42
+ .header-container .attribution-container a,
43
+ .large-view-header-container .attribution-container a {
44
+ color: #ffffff;
45
+ text-decoration: none;
46
+ }
47
+
48
+ .options-container {
49
+ height: calc(100% - 64px);
50
+ position: absolute;
51
+ width: 100%;
52
+ z-index: 1100;
53
+ top: 64px;
54
+ }
55
+
56
+ .filters-container {
57
+ position: absolute;
58
+ width: 100%;
59
+ background-color: #ffffff;
60
+ padding: 36px 0px;
61
+ z-index: 1100;
62
+ }
63
+ .filters-container .close-filters-button {
64
+ cursor: pointer;
65
+ font-weight: bold;
66
+ position: absolute;
67
+ top: 12px;
68
+ right: 12px;
69
+ padding: 12px;
70
+ border-radius: 12px;
71
+ color: var(--color-primary);
72
+ border: 1px var(--color-primary) solid;
73
+ }
74
+ .filters-container .close-filters-button:hover {
75
+ background-color: var(--color-primary);
76
+ color: #ffffff;
77
+ }
78
+ .filters-container .filter-margin-top {
79
+ margin-top: 24px;
80
+ }
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
+
88
+ .back-filters-container {
89
+ background-color: rgba(0, 0, 0, 0.5);
90
+ width: 100%;
91
+ height: calc(100% - 64px);
92
+ position: absolute;
93
+ z-index: 1099;
94
+ top: 64px;
95
+ }
32
96
 
33
97
  .loader-container,
34
98
  .large-view-loader-container {
@@ -5,6 +5,7 @@ export class GrwApp {
5
5
  constructor() {
6
6
  this.showTrek = false;
7
7
  this.showMap = false;
8
+ this.showFilters = false;
8
9
  this.isLargeView = false;
9
10
  this.language = 'fr';
10
11
  this.appName = 'Geotrek Rando Widget';
@@ -16,7 +17,7 @@ export class GrwApp {
16
17
  this.colorArrivalIcon = '#85003b';
17
18
  this.colorSensitiveArea = '#4974a5';
18
19
  this.colorPoiIcon = '#974c6e';
19
- this.largeViewSize = 664;
20
+ this.largeViewSize = 1024;
20
21
  }
21
22
  onTrekCardPress(event) {
22
23
  this.currentTrekId = event.detail;
@@ -39,20 +40,37 @@ export class GrwApp {
39
40
  this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
40
41
  this.showMap = this.isLargeView;
41
42
  }
43
+ handleFilters() {
44
+ this.showFilters = !this.showFilters;
45
+ }
42
46
  render() {
43
- return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
47
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } },
44
48
  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 }),
45
49
  this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }),
46
50
  h("div", { class: "app-container" },
47
- h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage }) : h("div", { class: "title" }, this.appName)),
51
+ h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' },
52
+ this.showTrek ? (h("div", { onClick: () => this.onTrekDetailsClose(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")),
53
+ !this.showTrek && this.showFilters && (h("div", { class: "options-container" },
54
+ h("div", { class: "filters-container" },
55
+ h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
56
+ h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"),
57
+ h("div", null,
58
+ h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })),
59
+ h("div", { class: "filter-margin-top" },
60
+ h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })),
61
+ h("div", { class: "filter-margin-top" },
62
+ h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))),
63
+ h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))),
64
+ h("div", { class: "attribution-container" },
65
+ h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))),
48
66
  h("div", { class: "content-container" },
49
67
  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' } },
50
- h("grw-treks-list", { "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })),
68
+ h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })),
51
69
  this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' },
52
70
  h("span", { class: "loader" }))),
53
71
  state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' },
54
72
  h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))),
55
- h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: this.showMap ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "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 })),
73
+ h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: this.showMap ? '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 })),
56
74
  h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } },
57
75
  h("div", { onClick: () => (this.showMap = !this.showMap) }, this.showMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
58
76
  }
@@ -470,6 +488,7 @@ export class GrwApp {
470
488
  static get states() { return {
471
489
  "showTrek": {},
472
490
  "showMap": {},
491
+ "showFilters": {},
473
492
  "isLargeView": {},
474
493
  "currentTrekId": {}
475
494
  }; }
@@ -0,0 +1,29 @@
1
+ .filter-name {
2
+ margin-left: 8px;
3
+ color: var(--color-primary);
4
+ font-size: 24px;
5
+ font-weight: bold;
6
+ }
7
+
8
+ .filter-button-container {
9
+ display: flex;
10
+ flex-direction: row;
11
+ flex-wrap: wrap;
12
+ }
13
+ .filter-button-container .filter-button,
14
+ .filter-button-container .selected-filter-button {
15
+ user-select: none;
16
+ cursor: pointer;
17
+ border: 1px var(--color-primary) solid;
18
+ border-radius: 8px;
19
+ margin: 8px 0px 0px 8px;
20
+ padding: 8px;
21
+ }
22
+ .filter-button-container .filter-button {
23
+ color: var(--color-primary);
24
+ background-color: #ffffff;
25
+ }
26
+ .filter-button-container .selected-filter-button {
27
+ color: #ffffff;
28
+ background-color: var(--color-primary);
29
+ }
@@ -0,0 +1,132 @@
1
+ import { Component, Host, h, Prop } from '@stencil/core';
2
+ import state from 'store/store';
3
+ export class GrwFilter {
4
+ constructor() {
5
+ this.filters = [
6
+ { property: 'practices', trekProperty: 'practice', type: 'include' },
7
+ { property: 'difficulties', trekProperty: 'difficulty', type: 'include' },
8
+ { property: 'durations', trekProperty: 'duration', type: 'interval' },
9
+ ];
10
+ }
11
+ handleFilter(_event, filterToHandle) {
12
+ const filterFromState = [...state[this.filterType]];
13
+ filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id).selected = !filterFromState.find(currentFilter => currentFilter.id === filterToHandle.id)
14
+ .selected;
15
+ state[this.filterType] = filterFromState;
16
+ let isUsingFilter = false;
17
+ let filtersTreks = [];
18
+ for (const filter of this.filters) {
19
+ const currentFiltersId = state[filter.property].filter(currentFilter => currentFilter.selected).map(currentFilter => currentFilter.id);
20
+ if (currentFiltersId.length > 0) {
21
+ if (filtersTreks.length > 0) {
22
+ if (filter.type === 'include') {
23
+ filtersTreks = [...filtersTreks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
24
+ }
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)];
38
+ }
39
+ }
40
+ else {
41
+ if (!isUsingFilter) {
42
+ isUsingFilter = true;
43
+ }
44
+ if (filter.type === 'include') {
45
+ filtersTreks = [...state.treks.filter(trek => currentFiltersId.includes(trek[filter.trekProperty]))];
46
+ }
47
+ else if (filter.type === 'interval') {
48
+ let minValue;
49
+ let maxValue;
50
+ for (const currentFilterId of currentFiltersId) {
51
+ const currentFilter = state[filter.property].find(property => property.id === currentFilterId);
52
+ if (isNaN(minValue) || currentFilter.minValue < minValue) {
53
+ minValue = currentFilter.minValue;
54
+ }
55
+ if (isNaN(maxValue) || currentFilter.maxValue > maxValue) {
56
+ maxValue = currentFilter.maxValue;
57
+ }
58
+ }
59
+ filtersTreks = [...state.treks.filter(trek => trek[filter.trekProperty] >= minValue && trek[filter.trekProperty] <= maxValue)];
60
+ }
61
+ }
62
+ }
63
+ }
64
+ state.currentTreks = isUsingFilter ? filtersTreks : state.treks;
65
+ }
66
+ render() {
67
+ return (h(Host, null,
68
+ h("div", { class: "filter-name" }, this.filterName),
69
+ h("div", { class: "filter-button-container" }, state[this.filterType].map(currentFilter => (h("div", { onClick: event => this.handleFilter(event, currentFilter), class: currentFilter.selected ? 'selected-filter-button' : 'filter-button' }, currentFilter[this.filterNameProperty]))))));
70
+ }
71
+ static get is() { return "grw-filter"; }
72
+ static get encapsulation() { return "shadow"; }
73
+ static get originalStyleUrls() { return {
74
+ "$": ["grw-filter.scss"]
75
+ }; }
76
+ static get styleUrls() { return {
77
+ "$": ["grw-filter.css"]
78
+ }; }
79
+ static get properties() { return {
80
+ "filterType": {
81
+ "type": "string",
82
+ "mutable": false,
83
+ "complexType": {
84
+ "original": "string",
85
+ "resolved": "string",
86
+ "references": {}
87
+ },
88
+ "required": false,
89
+ "optional": false,
90
+ "docs": {
91
+ "tags": [],
92
+ "text": ""
93
+ },
94
+ "attribute": "filter-type",
95
+ "reflect": false
96
+ },
97
+ "filterName": {
98
+ "type": "string",
99
+ "mutable": false,
100
+ "complexType": {
101
+ "original": "string",
102
+ "resolved": "string",
103
+ "references": {}
104
+ },
105
+ "required": false,
106
+ "optional": false,
107
+ "docs": {
108
+ "tags": [],
109
+ "text": ""
110
+ },
111
+ "attribute": "filter-name",
112
+ "reflect": false
113
+ },
114
+ "filterNameProperty": {
115
+ "type": "string",
116
+ "mutable": false,
117
+ "complexType": {
118
+ "original": "string",
119
+ "resolved": "string",
120
+ "references": {}
121
+ },
122
+ "required": false,
123
+ "optional": false,
124
+ "docs": {
125
+ "tags": [],
126
+ "text": ""
127
+ },
128
+ "attribute": "filter-name-property",
129
+ "reflect": false
130
+ }
131
+ }; }
132
+ }
@@ -31,11 +31,11 @@ export class GrwMap {
31
31
  else if (state.currentTrek) {
32
32
  this.addTreks();
33
33
  }
34
- onChange('treks', () => {
34
+ onChange('currentTreks', () => {
35
35
  if (state.currentTrek) {
36
36
  this.addTrek();
37
37
  }
38
- else if (state.treks) {
38
+ else if (state.currentTreks) {
39
39
  this.addTreks();
40
40
  }
41
41
  });
@@ -57,7 +57,7 @@ export class GrwMap {
57
57
  type: 'FeatureCollection',
58
58
  features: [],
59
59
  };
60
- for (const trek of state.treks) {
60
+ for (const trek of state.currentTreks) {
61
61
  trekscurrentDepartureCoordinates.push(trek.departure_geom);
62
62
  treksFeatureCollection.features.push({
63
63
  type: 'Feature',
@@ -66,7 +66,7 @@ export class GrwMap {
66
66
  id: trek.id,
67
67
  name: trek.name,
68
68
  practice: (_a = state.practices.find(practice => practice.id === trek.practice)) === null || _a === void 0 ? void 0 : _a.pictogram,
69
- imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].url,
69
+ imgSrc: trek.attachments && trek.attachments.length > 0 && trek.attachments[0].thumbnail,
70
70
  },
71
71
  });
72
72
  }
@@ -75,34 +75,40 @@ export class GrwMap {
75
75
  this.currentBounds = bounds;
76
76
  this.map.fitBounds(this.currentBounds);
77
77
  }
78
- this.treksLayer = L.geoJSON(treksFeatureCollection, {
79
- pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
80
- icon: L.divIcon({
81
- html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
82
- className: 'trek-marker',
83
- iconSize: 48,
78
+ if (!this.treksLayer) {
79
+ this.treksLayer = L.geoJSON(treksFeatureCollection, {
80
+ pointToLayer: (geoJsonPoint, latlng) => L.marker(latlng, {
81
+ icon: L.divIcon({
82
+ html: geoJsonPoint.properties.practice && `<img src=${geoJsonPoint.properties.practice} />`,
83
+ className: 'trek-marker',
84
+ iconSize: 48,
85
+ }),
86
+ autoPanOnFocus: false,
84
87
  }),
85
- autoPanOnFocus: false,
86
- }),
87
- onEachFeature: (geoJsonPoint, layer) => {
88
- layer.once('click', () => {
89
- const trekDeparturePopup = L.DomUtil.create('div');
90
- trekDeparturePopup.className = 'trek-departure-popup';
91
- trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
92
- const trekName = L.DomUtil.create('div');
93
- trekName.innerHTML = geoJsonPoint.properties.name;
94
- trekName.className = 'trek-name';
95
- if (geoJsonPoint.properties.imgSrc) {
96
- trekName.className += ' trek-name-margin-top';
97
- const trekImg = L.DomUtil.create('img');
98
- trekImg.src = geoJsonPoint.properties.imgSrc;
99
- trekDeparturePopup.appendChild(trekImg);
100
- }
101
- trekDeparturePopup.appendChild(trekName);
102
- layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
103
- });
104
- },
105
- }).addTo(this.map);
88
+ onEachFeature: (geoJsonPoint, layer) => {
89
+ layer.once('click', () => {
90
+ const trekDeparturePopup = L.DomUtil.create('div');
91
+ trekDeparturePopup.className = 'trek-departure-popup';
92
+ trekDeparturePopup.onclick = () => this.trekCardPress.emit(geoJsonPoint.properties.id);
93
+ const trekName = L.DomUtil.create('div');
94
+ trekName.innerHTML = geoJsonPoint.properties.name;
95
+ trekName.className = 'trek-name';
96
+ if (geoJsonPoint.properties.imgSrc) {
97
+ trekName.className += ' trek-name-margin-top';
98
+ const trekImg = L.DomUtil.create('img');
99
+ trekImg.src = geoJsonPoint.properties.imgSrc;
100
+ trekDeparturePopup.appendChild(trekImg);
101
+ }
102
+ trekDeparturePopup.appendChild(trekName);
103
+ layer.bindPopup(trekDeparturePopup, { interactive: true, autoPan: false, closeButton: false }).openPopup();
104
+ });
105
+ },
106
+ }).addTo(this.map);
107
+ }
108
+ else {
109
+ this.treksLayer.clearLayers();
110
+ this.treksLayer.addData(treksFeatureCollection);
111
+ }
106
112
  !this.mapIsReady && (this.mapIsReady = !this.mapIsReady);
107
113
  }
108
114
  removeTreks() {
@@ -1,69 +1,103 @@
1
- .trek-card-container {
1
+ .trek-card-container,
2
+ .trek-card-large-view-container {
2
3
  font-family: "Roboto";
3
- width: 350px;
4
- height: auto;
5
4
  border-radius: 8px;
6
5
  box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.25);
7
6
  cursor: pointer;
8
7
  }
9
- .trek-card-container .image {
10
- border-radius: 8px 8px 0px 0px;
11
- width: 100%;
12
- height: auto;
13
- box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.25);
8
+ .trek-card-container .image,
9
+ .trek-card-large-view-container .image {
10
+ object-fit: cover;
14
11
  }
15
- .trek-card-container .sub-container {
12
+ .trek-card-container .sub-container,
13
+ .trek-card-large-view-container .sub-container {
14
+ display: flex;
15
+ flex-direction: column;
16
+ justify-content: center;
16
17
  padding: 12px;
17
18
  }
18
- .trek-card-container .sub-container .name {
19
+ .trek-card-container .sub-container .name,
20
+ .trek-card-large-view-container .sub-container .name {
19
21
  color: var(--color-primary);
20
22
  font-size: 24px;
21
23
  font-weight: bold;
22
- margin-bottom: 12px;
24
+ margin-bottom: 8px;
23
25
  }
24
- .trek-card-container .sub-container .description {
25
- max-height: 24px;
26
- white-space: nowrap;
27
- overflow: hidden;
28
- text-overflow: ellipsis;
29
- margin-bottom: 12px;
26
+ .trek-card-container .sub-container .departure,
27
+ .trek-card-large-view-container .sub-container .departure {
28
+ color: rgba(0, 0, 0, 0.7);
29
+ font-size: 16px;
30
+ margin: 4px 0px;
30
31
  }
31
- .trek-card-container .sub-container .description p {
32
- white-space: nowrap;
33
- overflow: hidden;
34
- text-overflow: ellipsis;
35
- margin: 0;
32
+ .trek-card-container .sub-container .themes-container,
33
+ .trek-card-large-view-container .sub-container .themes-container {
34
+ display: flex;
35
+ justify-content: flex-start;
36
+ align-items: center;
37
+ flex-wrap: wrap;
36
38
  }
37
- .trek-card-container .sub-container .icons-labels-container {
39
+ .trek-card-container .sub-container .themes-container .theme,
40
+ .trek-card-large-view-container .sub-container .themes-container .theme {
41
+ background-color: var(--color-primary-tint);
42
+ color: #ffffff;
43
+ border-radius: 8px;
44
+ padding: 8px;
45
+ margin: 0px 8px 8px 0px;
46
+ }
47
+ .trek-card-container .sub-container .icons-labels-container,
48
+ .trek-card-large-view-container .sub-container .icons-labels-container {
38
49
  display: flex;
39
50
  justify-content: flex-start;
40
51
  align-items: center;
41
52
  flex-wrap: wrap;
42
53
  }
43
- .trek-card-container .sub-container .icons-labels-container .row {
54
+ .trek-card-container .sub-container .icons-labels-container .row,
55
+ .trek-card-large-view-container .sub-container .icons-labels-container .row {
44
56
  display: flex;
45
57
  justify-content: space-between;
46
58
  align-items: center;
47
59
  width: 100%;
48
60
  }
49
- .trek-card-container .sub-container .icons-labels-container .row:not(:last-child) {
61
+ .trek-card-container .sub-container .icons-labels-container .row:not(:last-child),
62
+ .trek-card-large-view-container .sub-container .icons-labels-container .row:not(:last-child) {
50
63
  margin-bottom: 12px;
51
64
  }
52
- .trek-card-container .sub-container .icons-labels-container .row .icon-label {
65
+ .trek-card-container .sub-container .icons-labels-container .row .icon-label,
66
+ .trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label {
53
67
  display: flex;
54
- justify-content: center;
55
68
  align-items: center;
56
- width: 33.3333333333%;
69
+ width: 50%;
57
70
  }
58
- .trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2) {
71
+ .trek-card-container .sub-container .icons-labels-container .row .icon-label:nth-child(2),
72
+ .trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label:nth-child(2) {
59
73
  margin: 0px 4px;
60
74
  }
61
75
  .trek-card-container .sub-container .icons-labels-container .row .icon-label img,
62
- .trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg {
76
+ .trek-card-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg,
77
+ .trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label img,
78
+ .trek-card-large-view-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg {
63
79
  width: 24px;
64
80
  height: auto;
65
- margin-right: 24px;
81
+ margin-right: 8px;
66
82
  }
67
- .trek-card-container .sub-container .icons-labels-container .row .practice img {
83
+ .trek-card-container .sub-container .icons-labels-container .row .practice img,
84
+ .trek-card-large-view-container .sub-container .icons-labels-container .row .practice img {
68
85
  background-color: var(--color-primary);
86
+ }
87
+
88
+ .trek-card-container {
89
+ width: 350px;
90
+ height: auto;
91
+ }
92
+ .trek-card-container .image {
93
+ width: 100%;
94
+ }
95
+
96
+ .trek-card-large-view-container {
97
+ height: auto;
98
+ display: flex;
99
+ flex-direction: row;
100
+ }
101
+ .trek-card-large-view-container .image {
102
+ width: 250px;
69
103
  }
@@ -8,6 +8,7 @@ export class GrwTrekCard {
8
8
  constructor() {
9
9
  this.colorPrimary = '#6b0030';
10
10
  this.colorPrimaryTint = '#974c6e';
11
+ this.isLargeView = false;
11
12
  }
12
13
  componentWillLoad() {
13
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -15,6 +16,7 @@ export class GrwTrekCard {
15
16
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
16
17
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
17
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));
18
20
  }
19
21
  onChange('currentTrek', () => {
20
22
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
@@ -22,16 +24,18 @@ export class GrwTrekCard {
22
24
  this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
23
25
  this.route = state.routes.find(route => route.id === this.currentTrek.route);
24
26
  this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
27
+ this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
25
28
  }
26
29
  });
27
30
  }
28
31
  render() {
29
32
  var _a, _b, _c, _d, _e, _f, _g, _h;
30
- return (h(Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-card-container" },
33
+ return (h(Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id), style: { 'width': this.isLargeView ? '100%' : 'auto', '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: this.isLargeView ? 'trek-card-large-view-container' : 'trek-card-container' },
31
34
  this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: `${this.currentTrek.attachments[0].thumbnail}`, loading: "lazy" })),
32
35
  h("div", { class: "sub-container" },
33
- h("div", { class: "name" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.name),
34
- h("div", { class: "description", innerHTML: (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.description_teaser }),
36
+ h("div", { class: "departure" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.departure),
37
+ h("div", { class: "name" }, (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.name),
38
+ h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label)))),
35
39
  h("div", { class: "icons-labels-container" },
36
40
  h("div", { class: "row" },
37
41
  h("div", { class: "icon-label difficulty" },
@@ -39,17 +43,18 @@ export class GrwTrekCard {
39
43
  _d.label),
40
44
  h("div", { class: "icon-label duration" },
41
45
  h("div", { class: "svg-icon", innerHTML: durationImage }),
42
- formatDuration(this.currentTrek.duration)),
43
- h("div", { class: "icon-label route" },
44
- ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
45
- _f.route)),
46
+ formatDuration(this.currentTrek.duration))),
46
47
  h("div", { class: "row" },
47
48
  h("div", { class: "icon-label length" },
48
49
  h("div", { class: "svg-icon", innerHTML: lengthImage }),
49
50
  formatLength(this.currentTrek.length_2d)),
50
51
  h("div", { class: "icon-label ascent" },
51
52
  h("div", { class: "svg-icon", innerHTML: ascentImage }),
52
- formatAscent(this.currentTrek.ascent)),
53
+ formatAscent(this.currentTrek.ascent))),
54
+ h("div", { class: "row" },
55
+ h("div", { class: "icon-label route" },
56
+ ((_e = this.route) === null || _e === void 0 ? void 0 : _e.pictogram) && h("img", { src: this.route.pictogram }), (_f = this.route) === null || _f === void 0 ? void 0 :
57
+ _f.route),
53
58
  h("div", { class: "icon-label practice" },
54
59
  ((_g = this.practice) === null || _g === void 0 ? void 0 : _g.pictogram) && h("img", { src: this.practice.pictogram }), (_h = this.practice) === null || _h === void 0 ? void 0 :
55
60
  _h.name))))))));
@@ -68,7 +73,7 @@ export class GrwTrekCard {
68
73
  "mutable": false,
69
74
  "complexType": {
70
75
  "original": "Trek",
71
- "resolved": "{ id: number; name: string; attachments: Attachments; description?: string; description_teaser: string; difficulty: number; route: number; practice: number; duration: number; length_2d: number; ascent: number; 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; geometry?: LineString; departure_geom?: Position; gpx?: string; kml?: string; pdf?: string; parking_location?: Position; }",
72
77
  "references": {
73
78
  "Trek": {
74
79
  "location": "import",
@@ -118,13 +123,32 @@ export class GrwTrekCard {
118
123
  "attribute": "color-primary-tint",
119
124
  "reflect": false,
120
125
  "defaultValue": "'#974c6e'"
126
+ },
127
+ "isLargeView": {
128
+ "type": "boolean",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "boolean",
132
+ "resolved": "boolean",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": ""
140
+ },
141
+ "attribute": "is-large-view",
142
+ "reflect": false,
143
+ "defaultValue": "false"
121
144
  }
122
145
  }; }
123
146
  static get states() { return {
124
147
  "currentTrek": {},
125
148
  "difficulty": {},
126
149
  "route": {},
127
- "practice": {}
150
+ "practice": {},
151
+ "themes": {}
128
152
  }; }
129
153
  static get events() { return [{
130
154
  "method": "trekCardPress",