@geotrekce/geotrek-rando-widget 0.0.1 → 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 (87) hide show
  1. package/dist/cjs/geotrek-rando-widget.cjs.js +2 -2
  2. package/dist/cjs/{grw-app_7.cjs.entry.js → grw-app_11.cjs.entry.js} +513 -89
  3. package/dist/cjs/{index-31255e29.js → index-c2c4531d.js} +82 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/assets/departure-arrival.svg +1 -1
  6. package/dist/collection/collection-manifest.json +4 -0
  7. package/dist/collection/components/grw-app/grw-app.css +127 -39
  8. package/dist/collection/components/grw-app/grw-app.js +375 -18
  9. package/dist/collection/components/grw-filter/grw-filter.css +29 -0
  10. package/dist/collection/components/grw-filter/grw-filter.js +132 -0
  11. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +30 -0
  12. package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +53 -0
  13. package/dist/collection/components/grw-map/grw-map.css +117 -0
  14. package/dist/collection/components/grw-map/grw-map.js +409 -40
  15. package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +30 -0
  16. package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +41 -0
  17. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +16 -0
  18. package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +38 -0
  19. package/dist/collection/components/grw-trek-card/grw-trek-card.css +67 -30
  20. package/dist/collection/components/grw-trek-card/grw-trek-card.js +112 -33
  21. package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +36 -1
  22. package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +122 -33
  23. package/dist/collection/components/grw-treks-list/grw-treks-list.css +17 -12
  24. package/dist/collection/components/grw-treks-list/grw-treks-list.js +70 -6
  25. package/dist/collection/store/grw-trek-provider.js +50 -8
  26. package/dist/collection/store/grw-treks-provider.js +166 -11
  27. package/dist/collection/store/store.js +6 -0
  28. package/dist/collection/stories/App.js +39 -3
  29. package/dist/collection/stories/App.stories.js +30 -5
  30. package/dist/collection/stories/TrekCard.js +9 -3
  31. package/dist/collection/stories/TrekCard.stories.js +5 -2
  32. package/dist/collection/stories/TrekDetail.js +10 -3
  33. package/dist/collection/stories/TrekDetail.stories.js +6 -2
  34. package/dist/collection/stories/TrekMap.js +15 -6
  35. package/dist/collection/stories/TrekMap.stories.js +21 -6
  36. package/dist/collection/stories/TreksList.js +17 -3
  37. package/dist/collection/stories/TreksList.stories.js +13 -2
  38. package/dist/collection/stories/TreksMap.js +12 -3
  39. package/dist/collection/stories/TreksMap.stories.js +18 -3
  40. package/dist/collection/utils/utils.js +2 -2
  41. package/dist/components/grw-app.js +79 -9
  42. package/dist/components/grw-filter.d.ts +11 -0
  43. package/dist/components/grw-filter.js +6 -0
  44. package/dist/components/grw-filter2.js +95 -0
  45. package/dist/components/grw-information-desk-detail.d.ts +11 -0
  46. package/dist/components/grw-information-desk-detail.js +6 -0
  47. package/dist/components/grw-information-desk-detail2.js +34 -0
  48. package/dist/components/grw-map2.js +260 -43
  49. package/dist/components/grw-poi-detail.d.ts +11 -0
  50. package/dist/components/grw-poi-detail.js +6 -0
  51. package/dist/components/grw-poi-detail2.js +32 -0
  52. package/dist/components/grw-sensitive-area-detail.d.ts +11 -0
  53. package/dist/components/grw-sensitive-area-detail.js +6 -0
  54. package/dist/components/grw-sensitive-area-detail2.js +32 -0
  55. package/dist/components/grw-trek-card2.js +33 -10
  56. package/dist/components/grw-trek-detail2.js +47 -9
  57. package/dist/components/grw-trek-provider2.js +32 -9
  58. package/dist/components/grw-treks-list2.js +15 -6
  59. package/dist/components/grw-treks-provider2.js +37 -13
  60. package/dist/components/length.js +2 -2
  61. package/dist/components/store.js +6 -0
  62. package/dist/esm/geotrek-rando-widget.js +2 -2
  63. package/dist/esm/{grw-app_7.entry.js → grw-app_11.entry.js} +510 -90
  64. package/dist/esm/{index-b36f38f5.js → index-fe16e7b6.js} +82 -1
  65. package/dist/esm/loader.js +2 -2
  66. package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -1
  67. package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
  68. package/dist/geotrek-rando-widget/p-8c206aec.js +2 -0
  69. package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +1 -0
  70. package/dist/types/components/grw-app/grw-app.d.ts +27 -2
  71. package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
  72. package/dist/types/components/grw-information-desk-detail/grw-information-desk-detail.d.ts +5 -0
  73. package/dist/types/components/grw-map/grw-map.d.ts +19 -2
  74. package/dist/types/components/grw-poi-detail/grw-poi-detail.d.ts +5 -0
  75. package/dist/types/components/grw-sensitive-area-detail/grw-sensitive-area-detail.d.ts +5 -0
  76. package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -2
  77. package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +3 -0
  78. package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +3 -0
  79. package/dist/types/components.d.ts +158 -1
  80. package/dist/types/store/grw-trek-provider.d.ts +1 -0
  81. package/dist/types/store/grw-treks-provider.d.ts +8 -0
  82. package/dist/types/store/store.d.ts +13 -1
  83. package/dist/types/types/types.d.ts +69 -3
  84. package/package.json +5 -7
  85. package/readme.md +19 -1
  86. package/dist/geotrek-rando-widget/p-f721481d.js +0 -2
  87. package/dist/geotrek-rando-widget/p-fe788eaa.entry.js +0 -1
@@ -1,66 +1,103 @@
1
- .trek-card-container {
2
- width: 350px;
3
- height: auto;
1
+ .trek-card-container,
2
+ .trek-card-large-view-container {
3
+ font-family: "Roboto";
4
4
  border-radius: 8px;
5
5
  box-shadow: 4px 8px 24px rgba(0, 0, 0, 0.25);
6
6
  cursor: pointer;
7
7
  }
8
- .trek-card-container .image {
9
- width: 100%;
10
- height: auto;
8
+ .trek-card-container .image,
9
+ .trek-card-large-view-container .image {
10
+ object-fit: cover;
11
11
  }
12
- .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;
13
17
  padding: 12px;
14
18
  }
15
- .trek-card-container .sub-container .name {
19
+ .trek-card-container .sub-container .name,
20
+ .trek-card-large-view-container .sub-container .name {
16
21
  color: var(--color-primary);
17
22
  font-size: 24px;
18
23
  font-weight: bold;
19
- margin-bottom: 12px;
24
+ margin-bottom: 8px;
20
25
  }
21
- .trek-card-container .sub-container .description {
22
- max-height: 24px;
23
- white-space: nowrap;
24
- overflow: hidden;
25
- text-overflow: ellipsis;
26
- 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;
31
+ }
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;
27
38
  }
28
- .trek-card-container .sub-container .description p {
29
- white-space: nowrap;
30
- overflow: hidden;
31
- text-overflow: ellipsis;
32
- margin: 0;
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;
33
46
  }
34
- .trek-card-container .sub-container .icons-labels-container {
47
+ .trek-card-container .sub-container .icons-labels-container,
48
+ .trek-card-large-view-container .sub-container .icons-labels-container {
35
49
  display: flex;
36
50
  justify-content: flex-start;
37
51
  align-items: center;
38
52
  flex-wrap: wrap;
39
53
  }
40
- .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 {
41
56
  display: flex;
42
57
  justify-content: space-between;
43
58
  align-items: center;
44
59
  width: 100%;
45
60
  }
46
- .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) {
47
63
  margin-bottom: 12px;
48
64
  }
49
- .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 {
50
67
  display: flex;
51
- justify-content: center;
52
68
  align-items: center;
53
- width: 33.3333333333%;
69
+ width: 50%;
54
70
  }
55
- .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) {
56
73
  margin: 0px 4px;
57
74
  }
58
75
  .trek-card-container .sub-container .icons-labels-container .row .icon-label img,
59
- .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 {
60
79
  width: 24px;
61
80
  height: auto;
62
- margin-right: 24px;
81
+ margin-right: 8px;
63
82
  }
64
- .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 {
65
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;
66
103
  }
@@ -1,45 +1,63 @@
1
- import { Component, Host, h, Prop, Event } from '@stencil/core';
2
- import state from 'store/store';
1
+ import { Component, Host, h, Prop, Event, State } from '@stencil/core';
2
+ import state, { onChange } from 'store/store';
3
3
  import { formatDuration, formatLength, formatAscent } from 'utils/utils';
4
4
  import ascentImage from '../../assets/ascent.svg';
5
5
  import durationImage from '../../assets/duration.svg';
6
6
  import lengthImage from '../../assets/length.svg';
7
7
  export class GrwTrekCard {
8
+ constructor() {
9
+ this.colorPrimary = '#6b0030';
10
+ this.colorPrimaryTint = '#974c6e';
11
+ this.isLargeView = false;
12
+ }
8
13
  componentWillLoad() {
9
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
10
- this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
11
- this.route = state.routes.find(route => route.id === this.currentTrek.route);
12
- this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
15
+ if (this.currentTrek) {
16
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
17
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
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
+ }
21
+ onChange('currentTrek', () => {
22
+ this.currentTrek = this.trek ? this.trek : state.currentTrek;
23
+ if (this.currentTrek) {
24
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
25
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
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));
28
+ }
29
+ });
13
30
  }
14
31
  render() {
15
32
  var _a, _b, _c, _d, _e, _f, _g, _h;
16
- return (h(Host, { onClick: () => this.trekCardPress.emit(this.currentTrek.id) },
17
- h("div", { class: "trek-card-container" },
18
- this.currentTrek.attachments[0] && h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" }),
19
- h("div", { class: "sub-container" },
20
- h("div", { class: "name" }, (_a = this.currentTrek) === null || _a === void 0 ? void 0 : _a.name),
21
- h("div", { class: "description", innerHTML: (_b = this.currentTrek) === null || _b === void 0 ? void 0 : _b.description_teaser }),
22
- h("div", { class: "icons-labels-container" },
23
- h("div", { class: "row" },
24
- h("div", { class: "icon-label difficulty" },
25
- ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
26
- _d.label),
27
- h("div", { class: "icon-label duration" },
28
- h("div", { class: "svg-icon", innerHTML: durationImage }),
29
- formatDuration(this.currentTrek.duration)),
30
- h("div", { class: "icon-label route" },
31
- ((_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 :
32
- _f.route)),
33
- h("div", { class: "row" },
34
- h("div", { class: "icon-label length" },
35
- h("div", { class: "svg-icon", innerHTML: lengthImage }),
36
- formatLength(this.currentTrek.length_2d)),
37
- h("div", { class: "icon-label ascent" },
38
- h("div", { class: "svg-icon", innerHTML: ascentImage }),
39
- formatAscent(this.currentTrek.ascent)),
40
- h("div", { class: "icon-label practice" },
41
- ((_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 :
42
- _h.name)))))));
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' },
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" })),
35
+ h("div", { class: "sub-container" },
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)))),
39
+ h("div", { class: "icons-labels-container" },
40
+ h("div", { class: "row" },
41
+ h("div", { class: "icon-label difficulty" },
42
+ ((_c = this.difficulty) === null || _c === void 0 ? void 0 : _c.pictogram) && h("img", { src: this.difficulty.pictogram }), (_d = this.difficulty) === null || _d === void 0 ? void 0 :
43
+ _d.label),
44
+ h("div", { class: "icon-label duration" },
45
+ h("div", { class: "svg-icon", innerHTML: durationImage }),
46
+ formatDuration(this.currentTrek.duration))),
47
+ h("div", { class: "row" },
48
+ h("div", { class: "icon-label length" },
49
+ h("div", { class: "svg-icon", innerHTML: lengthImage }),
50
+ formatLength(this.currentTrek.length_2d)),
51
+ h("div", { class: "icon-label ascent" },
52
+ h("div", { class: "svg-icon", innerHTML: ascentImage }),
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),
58
+ h("div", { class: "icon-label practice" },
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 :
60
+ _h.name))))))));
43
61
  }
44
62
  static get is() { return "grw-trek-card"; }
45
63
  static get encapsulation() { return "shadow"; }
@@ -55,7 +73,7 @@ export class GrwTrekCard {
55
73
  "mutable": false,
56
74
  "complexType": {
57
75
  "original": "Trek",
58
- "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; }",
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; }",
59
77
  "references": {
60
78
  "Trek": {
61
79
  "location": "import",
@@ -69,8 +87,69 @@ export class GrwTrekCard {
69
87
  "tags": [],
70
88
  "text": ""
71
89
  }
90
+ },
91
+ "colorPrimary": {
92
+ "type": "string",
93
+ "mutable": false,
94
+ "complexType": {
95
+ "original": "string",
96
+ "resolved": "string",
97
+ "references": {}
98
+ },
99
+ "required": false,
100
+ "optional": false,
101
+ "docs": {
102
+ "tags": [],
103
+ "text": ""
104
+ },
105
+ "attribute": "color-primary",
106
+ "reflect": false,
107
+ "defaultValue": "'#6b0030'"
108
+ },
109
+ "colorPrimaryTint": {
110
+ "type": "string",
111
+ "mutable": false,
112
+ "complexType": {
113
+ "original": "string",
114
+ "resolved": "string",
115
+ "references": {}
116
+ },
117
+ "required": false,
118
+ "optional": false,
119
+ "docs": {
120
+ "tags": [],
121
+ "text": ""
122
+ },
123
+ "attribute": "color-primary-tint",
124
+ "reflect": false,
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"
72
144
  }
73
145
  }; }
146
+ static get states() { return {
147
+ "currentTrek": {},
148
+ "difficulty": {},
149
+ "route": {},
150
+ "practice": {},
151
+ "themes": {}
152
+ }; }
74
153
  static get events() { return [{
75
154
  "method": "trekCardPress",
76
155
  "name": "trekCardPress",
@@ -1,7 +1,8 @@
1
1
  .trek-detail-container {
2
+ font-family: "Roboto";
2
3
  display: flex;
3
4
  flex-direction: column;
4
- max-height: calc(100vh - 64px);
5
+ height: 100%;
5
6
  overflow-y: auto;
6
7
  }
7
8
  .trek-detail-container .name {
@@ -11,6 +12,7 @@
11
12
  padding: 24px;
12
13
  }
13
14
  .trek-detail-container .image {
15
+ border-radius: 8px;
14
16
  align-self: center;
15
17
  width: 100%;
16
18
  max-width: 700px;
@@ -53,6 +55,39 @@
53
55
  .trek-detail-container .sub-container .icons-labels-container .row .practice img {
54
56
  background-color: var(--color-primary);
55
57
  }
58
+ .trek-detail-container .downloads-container {
59
+ padding: 0px 24px 24px 24px;
60
+ display: flex;
61
+ flex-direction: column;
62
+ justify-content: center;
63
+ align-items: center;
64
+ }
65
+ .trek-detail-container .downloads-container .download-title {
66
+ color: var(--color-primary);
67
+ font-size: 18px;
68
+ margin-bottom: 18px;
69
+ }
70
+ .trek-detail-container .downloads-container .links-container a {
71
+ background-color: var(--color-primary);
72
+ padding: 8px;
73
+ color: #ffffff;
74
+ text-decoration: none;
75
+ border-radius: 8px;
76
+ }
77
+ .trek-detail-container .downloads-container .links-container a:nth-child(2) {
78
+ margin: 0px 12px;
79
+ }
80
+ .trek-detail-container .downloads-container .links-container a:hover {
81
+ background-color: var(--color-primary-shade);
82
+ }
56
83
  .trek-detail-container .description {
57
84
  padding: 0px 24px 24px 24px;
85
+ }
86
+ .trek-detail-container .pois-title,
87
+ .trek-detail-container .sensitive-areas-title,
88
+ .trek-detail-container .information-desks-title {
89
+ color: var(--color-primary);
90
+ font-size: 36px;
91
+ font-weight: bold;
92
+ padding: 16px;
58
93
  }
@@ -1,45 +1,74 @@
1
- import { Component, Host, h, Prop } from '@stencil/core';
2
- import state from 'store/store';
1
+ import { Component, Host, h, Prop, State } from '@stencil/core';
2
+ import state, { onChange } from 'store/store';
3
3
  import { formatDuration, formatLength, formatAscent } from 'utils/utils';
4
4
  import ascentImage from '../../assets/ascent.svg';
5
5
  import durationImage from '../../assets/duration.svg';
6
6
  import lengthImage from '../../assets/length.svg';
7
7
  export class GrwTrekDetail {
8
+ constructor() {
9
+ this.colorPrimary = '#6b0030';
10
+ this.colorPrimaryShade = '#4a0021';
11
+ this.colorPrimaryTint = '#974c6e';
12
+ }
8
13
  componentWillLoad() {
9
14
  this.currentTrek = this.trek ? this.trek : state.currentTrek;
10
- this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
11
- this.route = state.routes.find(route => route.id === this.currentTrek.route);
12
- this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
15
+ if (this.currentTrek) {
16
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
17
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
18
+ this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
19
+ }
20
+ onChange('currentTrek', () => {
21
+ this.currentTrek = this.trek ? this.trek : state.currentTrek;
22
+ if (this.currentTrek) {
23
+ this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
24
+ this.route = state.routes.find(route => route.id === this.currentTrek.route);
25
+ this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
26
+ }
27
+ });
13
28
  }
14
29
  render() {
15
30
  var _a, _b, _c, _d, _e, _f, _g;
16
- return (h(Host, null,
17
- h("div", { class: "trek-detail-container" },
18
- h("div", { class: "name" }, this.currentTrek.name),
19
- this.currentTrek.attachments[0] && h("img", { class: "image", src: this.currentTrek.attachments[0].url, loading: "lazy" }),
20
- h("div", { class: "sub-container" },
21
- h("div", { class: "icons-labels-container" },
22
- h("div", { class: "row" },
23
- h("div", { class: "icon-label difficulty" },
24
- ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
25
- _b.label),
26
- h("div", { class: "icon-label duration" },
27
- h("div", { class: "svg-icon", innerHTML: durationImage }),
28
- formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)),
29
- h("div", { class: "icon-label route" },
30
- ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
31
- _e.route)),
32
- h("div", { class: "row" },
33
- h("div", { class: "icon-label length" },
34
- h("div", { class: "svg-icon", innerHTML: lengthImage }),
35
- formatLength(this.currentTrek.length_2d)),
36
- h("div", { class: "icon-label ascent" },
37
- h("div", { class: "svg-icon", innerHTML: ascentImage }),
38
- formatAscent(this.currentTrek.ascent)),
39
- h("div", { class: "icon-label practice" },
40
- ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
41
- _g.name)))),
42
- h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser }))));
31
+ return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-shade': this.colorPrimaryShade, '--color-primary-tint': this.colorPrimaryTint } }, this.currentTrek && (h("div", { class: "trek-detail-container" },
32
+ h("div", { class: "name" }, this.currentTrek.name),
33
+ this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })),
34
+ h("div", { class: "sub-container" },
35
+ h("div", { class: "icons-labels-container" },
36
+ h("div", { class: "row" },
37
+ h("div", { class: "icon-label difficulty" },
38
+ ((_a = this.difficulty) === null || _a === void 0 ? void 0 : _a.pictogram) && h("img", { src: this.difficulty.pictogram }), (_b = this.difficulty) === null || _b === void 0 ? void 0 :
39
+ _b.label),
40
+ h("div", { class: "icon-label duration" },
41
+ h("div", { class: "svg-icon", innerHTML: durationImage }),
42
+ formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)),
43
+ h("div", { class: "icon-label route" },
44
+ ((_d = this.route) === null || _d === void 0 ? void 0 : _d.pictogram) && h("img", { src: this.route.pictogram }), (_e = this.route) === null || _e === void 0 ? void 0 :
45
+ _e.route)),
46
+ h("div", { class: "row" },
47
+ h("div", { class: "icon-label length" },
48
+ h("div", { class: "svg-icon", innerHTML: lengthImage }),
49
+ formatLength(this.currentTrek.length_2d)),
50
+ h("div", { class: "icon-label ascent" },
51
+ h("div", { class: "svg-icon", innerHTML: ascentImage }),
52
+ formatAscent(this.currentTrek.ascent)),
53
+ h("div", { class: "icon-label practice" },
54
+ ((_f = this.practice) === null || _f === void 0 ? void 0 : _f.pictogram) && h("img", { src: this.practice.pictogram }), (_g = this.practice) === null || _g === void 0 ? void 0 :
55
+ _g.name)))),
56
+ h("div", { class: "downloads-container" },
57
+ h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"),
58
+ h("div", { class: "links-container" },
59
+ h("a", { href: `${this.currentTrek.gpx}` }, "GPX"),
60
+ h("a", { href: `${this.currentTrek.kml}` }, "KML"),
61
+ h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))),
62
+ h("div", { class: "description", innerHTML: this.currentTrek.description ? this.currentTrek.description : this.currentTrek.description_teaser }),
63
+ state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" },
64
+ h("div", { class: "sensitive-areas-title" }, "Zones sensibles"),
65
+ state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))),
66
+ state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" },
67
+ h("div", { class: "information-desks-title" }, "Lieux de renseignement"),
68
+ state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))),
69
+ state.currentPois && state.currentPois.length > 0 && (h("div", { class: "pois-container" },
70
+ h("div", { class: "pois-title" }, "Points d'int\u00E9r\u00EAts"),
71
+ state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi })))))))));
43
72
  }
44
73
  static get is() { return "grw-trek-detail"; }
45
74
  static get encapsulation() { return "shadow"; }
@@ -55,7 +84,7 @@ export class GrwTrekDetail {
55
84
  "mutable": false,
56
85
  "complexType": {
57
86
  "original": "Trek",
58
- "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; }",
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; }",
59
88
  "references": {
60
89
  "Trek": {
61
90
  "location": "import",
@@ -69,6 +98,66 @@ export class GrwTrekDetail {
69
98
  "tags": [],
70
99
  "text": ""
71
100
  }
101
+ },
102
+ "colorPrimary": {
103
+ "type": "string",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "string",
107
+ "resolved": "string",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": false,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": ""
115
+ },
116
+ "attribute": "color-primary",
117
+ "reflect": false,
118
+ "defaultValue": "'#6b0030'"
119
+ },
120
+ "colorPrimaryShade": {
121
+ "type": "string",
122
+ "mutable": false,
123
+ "complexType": {
124
+ "original": "string",
125
+ "resolved": "string",
126
+ "references": {}
127
+ },
128
+ "required": false,
129
+ "optional": false,
130
+ "docs": {
131
+ "tags": [],
132
+ "text": ""
133
+ },
134
+ "attribute": "color-primary-shade",
135
+ "reflect": false,
136
+ "defaultValue": "'#4a0021'"
137
+ },
138
+ "colorPrimaryTint": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": ""
151
+ },
152
+ "attribute": "color-primary-tint",
153
+ "reflect": false,
154
+ "defaultValue": "'#974c6e'"
72
155
  }
73
156
  }; }
157
+ static get states() { return {
158
+ "currentTrek": {},
159
+ "difficulty": {},
160
+ "route": {},
161
+ "practice": {}
162
+ }; }
74
163
  }
@@ -1,19 +1,24 @@
1
1
  :host {
2
- display: flex;
3
- flex-wrap: wrap;
4
- justify-content: center;
5
- max-height: calc(100vh - 64px);
2
+ font-family: "Roboto";
3
+ width: 100%;
4
+ height: 100%;
5
+ max-height: 100vh;
6
6
  overflow-y: auto;
7
7
  }
8
- @media (min-width: 664px) {
9
- :host {
10
- justify-content: space-between;
11
- }
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;
12
16
  }
13
- @media (min-width: 996px) {
14
- :host {
15
- justify-content: flex-start;
16
- }
17
+
18
+ .current-treks-container {
19
+ display: flex;
20
+ flex-wrap: wrap;
21
+ justify-content: space-around;
17
22
  }
18
23
 
19
24
  grw-trek-card {