@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.
- package/dist/cjs/geotrek-rando-widget.cjs.js +1 -1
- package/dist/cjs/grw-app.cjs.entry.js +111 -0
- package/dist/cjs/{grw-app_11.cjs.entry.js → grw-filter_6.cjs.entry.js} +197 -455
- package/dist/cjs/grw-information-desk-detail_3.cjs.entry.js +52 -0
- package/dist/cjs/grw-trek-card.cjs.entry.js +47 -0
- package/dist/cjs/length-d315d156.js +34 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/store-fd04a216.js +211 -0
- package/dist/collection/components/grw-app/grw-app.js +54 -25
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +5 -4
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +1 -1
- package/dist/collection/components/grw-map/grw-map.css +19 -1
- package/dist/collection/components/grw-map/grw-map.js +65 -10
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +5 -4
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +1 -1
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +27 -3
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +17 -3
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +1 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +134 -4
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +101 -6
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +8 -3
- package/dist/collection/store/grw-trek-provider.js +24 -9
- package/dist/collection/store/grw-treks-provider.js +12 -6
- package/dist/collection/store/store.js +7 -1
- package/dist/components/grw-app.js +52 -6
- package/dist/components/grw-information-desk-detail2.js +2 -2
- package/dist/components/grw-map2.js +66 -11
- package/dist/components/grw-poi-detail2.js +2 -2
- package/dist/components/grw-sensitive-area-detail2.js +7 -2
- package/dist/components/grw-trek-detail2.js +31 -4
- package/dist/components/grw-trek-provider2.js +24 -9
- package/dist/components/grw-treks-list2.js +8 -3
- package/dist/components/grw-treks-provider2.js +12 -6
- package/dist/components/store.js +7 -1
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/grw-app.entry.js +107 -0
- package/dist/esm/{grw-app_11.entry.js → grw-filter_6.entry.js} +138 -391
- package/dist/esm/grw-information-desk-detail_3.entry.js +46 -0
- package/dist/esm/grw-trek-card.entry.js +43 -0
- package/dist/esm/{index-fe16e7b6.js → index-192d910f.js} +1 -1
- package/dist/esm/length-d82189db.js +27 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/store-b2c76c0c.js +208 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/p-1b2ba86d.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-4361afd2.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-5f17d340.entry.js +1 -0
- package/dist/geotrek-rando-widget/{p-8c206aec.js → p-6dce5e6c.js} +1 -1
- package/dist/geotrek-rando-widget/p-7715153d.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-e6710c64.js +1 -0
- package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
- package/dist/types/components/grw-app/grw-app.d.ts +7 -2
- package/dist/types/components/grw-map/grw-map.d.ts +3 -1
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +9 -4
- package/dist/types/components.d.ts +0 -2
- package/dist/types/store/grw-trek-provider.d.ts +2 -0
- package/dist/types/store/grw-treks-provider.d.ts +3 -0
- package/dist/types/store/store.d.ts +16 -3
- package/dist/types/types/types.d.ts +51 -1
- package/package.json +5 -4
- package/dist/geotrek-rando-widget/p-ed8706fb.entry.js +0 -1
|
@@ -5,7 +5,7 @@ import { d as defineCustomElement$3 } from './grw-information-desk-detail2.js';
|
|
|
5
5
|
import { d as defineCustomElement$2 } from './grw-poi-detail2.js';
|
|
6
6
|
import { d as defineCustomElement$1 } from './grw-sensitive-area-detail2.js';
|
|
7
7
|
|
|
8
|
-
const grwTrekDetailCss = ".trek-detail-container{font-family:\"Roboto\";display:flex;flex-direction:column;height:100%;overflow-y:auto}.trek-detail-container .name{color:var(--color-primary);font-size:48px;font-weight:bold;padding:24px}.trek-detail-container .image{border-radius:8px;align-self:center;width:100%;max-width:700px;height:auto;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25)}.trek-detail-container .sub-container{padding:24px}.trek-detail-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-detail-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-detail-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:24px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label{display:flex;justify-content:center;align-items:center;width:33.3333333333%}.trek-detail-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 8px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label img,.trek-detail-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:24px}.trek-detail-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-detail-container .downloads-container{padding:0px 24px 24px 24px;display:flex;flex-direction:column;justify-content:center;align-items:center}.trek-detail-container .downloads-container .download-title{color:var(--color-primary);font-size:18px;margin-bottom:
|
|
8
|
+
const grwTrekDetailCss = "grw-sensitive-area-detail,grw-information-desk-detail,grw-poi-detail{margin-top:12px}.trek-detail-container{font-family:\"Roboto\";display:flex;flex-direction:column;height:100%;overflow-y:auto}.trek-detail-container .name{color:var(--color-primary);font-size:48px;font-weight:bold;padding:24px}.trek-detail-container .image{border-radius:8px;align-self:center;width:100%;max-width:700px;height:auto;box-shadow:4px 8px 24px rgba(0, 0, 0, 0.25)}.trek-detail-container .sub-container{padding:24px}.trek-detail-container .sub-container .icons-labels-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap}.trek-detail-container .sub-container .icons-labels-container .row{display:flex;justify-content:space-between;align-items:center;width:100%}.trek-detail-container .sub-container .icons-labels-container .row:not(:last-child){margin-bottom:24px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label{display:flex;justify-content:center;align-items:center;width:33.3333333333%}.trek-detail-container .sub-container .icons-labels-container .row .icon-label:nth-child(2){margin:0px 8px}.trek-detail-container .sub-container .icons-labels-container .row .icon-label img,.trek-detail-container .sub-container .icons-labels-container .row .icon-label .svg-icon svg{width:24px;height:auto;margin-right:24px}.trek-detail-container .sub-container .icons-labels-container .row .practice img{background-color:var(--color-primary)}.trek-detail-container .downloads-container{padding:0px 24px 24px 24px;display:flex;flex-direction:column;justify-content:center;align-items:center}.trek-detail-container .downloads-container .download-title{color:var(--color-primary);font-size:18px;margin-bottom:12px}.trek-detail-container .downloads-container .links-container{display:flex}.trek-detail-container .downloads-container .links-container a{background-color:var(--color-primary);padding:8px;color:#ffffff;text-decoration:none;border-radius:8px}.trek-detail-container .downloads-container .links-container a:nth-child(2){margin:0px 12px}.trek-detail-container .downloads-container .links-container a:hover{background-color:var(--color-primary-shade)}.trek-detail-container .themes-container{display:flex;justify-content:flex-start;align-items:center;flex-wrap:wrap;padding:0px 24px 24px 24px}.trek-detail-container .themes-container .theme{background-color:var(--color-primary-tint);color:#ffffff;border-radius:8px;padding:8px;margin:0px 8px 8px 0px}.trek-detail-container .ambiance,.trek-detail-container .description-teaser,.trek-detail-container .description-container,.trek-detail-container .altimetric-profile-container,.trek-detail-container .access-container,.trek-detail-container .public-transport-container,.trek-detail-container .advice-container,.trek-detail-container .advised-parking-container,.trek-detail-container .gear-container,.trek-detail-container .pois-container,.trek-detail-container .sensitive-areas-container,.trek-detail-container .information-desks-container,.trek-detail-container .source-container,.trek-detail-container .accessibilities-container{padding:0px 24px 24px 24px}.trek-detail-container .ambiance a,.trek-detail-container .description-teaser a,.trek-detail-container .description-container a,.trek-detail-container .altimetric-profile-container a,.trek-detail-container .access-container a,.trek-detail-container .public-transport-container a,.trek-detail-container .advice-container a,.trek-detail-container .advised-parking-container a,.trek-detail-container .gear-container a,.trek-detail-container .pois-container a,.trek-detail-container .sensitive-areas-container a,.trek-detail-container .information-desks-container a,.trek-detail-container .source-container a,.trek-detail-container .accessibilities-container a{color:var(--color-primary)}.trek-detail-container .description-title,.trek-detail-container .altimetric-profile-title,.trek-detail-container .access-title,.trek-detail-container .public-transport-title,.trek-detail-container .advice-title,.trek-detail-container .advised-parking-title,.trek-detail-container .gear-title,.trek-detail-container .pois-title,.trek-detail-container .sensitive-areas-title,.trek-detail-container .information-desks-title,.trek-detail-container .source-title,.trek-detail-container .accessibilities-title{color:var(--color-primary);font-size:36px;font-weight:bold;margin:12px 0px}.label-container .label-sub-container{display:flex;align-items:center}.label-container .label-sub-container img{width:26px;margin-right:16px}.label-container .label-sub-container .label-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.source-container .source-sub-container{display:flex;align-items:center}.source-container .source-sub-container img{width:26px;margin-right:16px}.source-container .source-sub-container .source-name{color:var(--color-primary);font-size:24px;font-weight:bold;padding:12px 0px}.departure-container,.arrival-container{display:flex;align-items:center;padding:0px 24px 24px 24px}.departure-container .departure-title,.departure-container .arrival-title,.arrival-container .departure-title,.arrival-container .arrival-title{color:var(--color-primary);font-weight:bold}.accessibilities-container .accessibilities-content-container{padding:12px 0px 0px 0px;display:flex}.accessibilities-container .accessibilities-content-container .accessibility-content-container{display:flex;align-items:center;margin:0px 8px 8px 0px}.accessibilities-container .accessibilities-content-container .accessibility-content-container img{margin-right:16px;width:26px}.accessibilities-container .accessibility-level-title,.accessibilities-container .accessibility-slope-title,.accessibilities-container .accessibility-width-title,.accessibilities-container .accessibility-signage-title,.accessibilities-container .accessibility-covering-title,.accessibilities-container .accessibility-exposure-title,.accessibilities-container .accessibility-advice-title{color:var(--color-primary);font-size:24px;padding:12px 0px}";
|
|
9
9
|
|
|
10
10
|
const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -22,6 +22,13 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
22
22
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
23
23
|
this.route = state.routes.find(route => route.id === this.currentTrek.route);
|
|
24
24
|
this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
|
|
25
|
+
this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
|
|
26
|
+
this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
|
|
27
|
+
this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
|
|
28
|
+
this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
|
|
29
|
+
if (state.accessibilitiesLevel) {
|
|
30
|
+
this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
|
|
31
|
+
}
|
|
25
32
|
}
|
|
26
33
|
onChange('currentTrek', () => {
|
|
27
34
|
this.currentTrek = this.trek ? this.trek : state.currentTrek;
|
|
@@ -29,6 +36,13 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
29
36
|
this.difficulty = state.difficulties.find(difficulty => difficulty.id === this.currentTrek.difficulty);
|
|
30
37
|
this.route = state.routes.find(route => route.id === this.currentTrek.route);
|
|
31
38
|
this.practice = state.practices.find(practice => practice.id === this.currentTrek.practice);
|
|
39
|
+
this.themes = state.themes.filter(theme => this.currentTrek.themes.includes(theme.id));
|
|
40
|
+
this.labels = state.labels.filter(label => this.currentTrek.labels.includes(label.id));
|
|
41
|
+
this.sources = state.sources.filter(source => this.currentTrek.source.includes(source.id));
|
|
42
|
+
this.accessibilities = state.accessibilities.filter(accessibility => this.currentTrek.accessibilities.includes(accessibility.id));
|
|
43
|
+
if (state.accessibilitiesLevel) {
|
|
44
|
+
this.accessibilityLevel = state.accessibilitiesLevel.find(accessibilityLevel => this.currentTrek.accessibility_level === accessibilityLevel.id);
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
});
|
|
34
48
|
}
|
|
@@ -37,7 +51,15 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
37
51
|
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" }, h("div", { class: "name" }, this.currentTrek.name), this.currentTrek.attachments && this.currentTrek.attachments[0] && this.currentTrek.attachments[0].thumbnail && (h("img", { class: "image", src: this.currentTrek.attachments[0].thumbnail, loading: "lazy" })), h("div", { class: "sub-container" }, h("div", { class: "icons-labels-container" }, h("div", { class: "row" }, h("div", { class: "icon-label difficulty" }, ((_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 :
|
|
38
52
|
_b.label), h("div", { class: "icon-label duration" }, h("div", { class: "svg-icon", innerHTML: durationImage }), formatDuration((_c = this.currentTrek) === null || _c === void 0 ? void 0 : _c.duration)), h("div", { class: "icon-label route" }, ((_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 :
|
|
39
53
|
_e.route)), h("div", { class: "row" }, h("div", { class: "icon-label length" }, h("div", { class: "svg-icon", innerHTML: lengthImage }), formatLength(this.currentTrek.length_2d)), h("div", { class: "icon-label ascent" }, h("div", { class: "svg-icon", innerHTML: ascentImage }), formatAscent(this.currentTrek.ascent)), h("div", { class: "icon-label practice" }, ((_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 :
|
|
40
|
-
_g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), h("div", { class: "description", innerHTML: this.currentTrek.description
|
|
54
|
+
_g.name)))), h("div", { class: "downloads-container" }, h("div", { class: "download-title" }, "T\u00E9l\u00E9chargements"), h("div", { class: "links-container" }, h("a", { href: `${this.currentTrek.gpx}` }, "GPX"), h("a", { href: `${this.currentTrek.kml}` }, "KML"), h("a", { href: `${this.currentTrek.pdf}` }, "PDF"))), this.themes.length > 0 && (h("div", { class: "themes-container" }, this.themes.map(theme => (h("div", { class: "theme" }, theme.label))))), this.currentTrek.description_teaser && h("div", { class: "description-teaser", innerHTML: this.currentTrek.description_teaser }), this.currentTrek.ambiance && h("div", { class: "ambiance", innerHTML: this.currentTrek.ambiance }), this.currentTrek.description && (h("div", { class: "description-container" }, h("div", { class: "description-title" }, "Description"), h("div", { class: "description", innerHTML: this.currentTrek.description }))), this.currentTrek.departure && (h("div", { class: "departure-container" }, h("div", { class: "departure-title" }, "D\u00E9part :\u00A0"), h("div", { innerHTML: this.currentTrek.departure }))), this.currentTrek.arrival && (h("div", { class: "arrival-container" }, h("div", { class: "arrival-title" }, "Arriv\u00E9e :\u00A0"), h("div", { innerHTML: this.currentTrek.arrival }))), this.currentTrek.altimetric_profile && (h("div", { class: "altimetric-profile-container" }, h("div", { class: "altimetric-profile-title" }, "Profil altim\u00E9trique"), h("img", { src: `${this.currentTrek.altimetric_profile}?format=svg` }))), this.currentTrek.access && (h("div", { class: "access-container" }, h("div", { class: "access-title" }, "Acc\u00E8s routier"), h("div", { class: "access", innerHTML: this.currentTrek.access }))), this.currentTrek.public_transport && (h("div", { class: "public-transport-container" }, h("div", { class: "public-transport-title" }, "Transport"), h("div", { class: "public-transport", innerHTML: this.currentTrek.public_transport }))), (this.currentTrek.advice || this.labels.length > 0) && (h("div", { class: "advice-container" }, h("div", { class: "advice-title" }, "Recommandations"), this.currentTrek.advice && h("div", { class: "advice", innerHTML: this.currentTrek.advice }), this.labels.map(label => (h("div", { class: "label-container" }, h("div", { class: "label-sub-container" }, label.pictogram && h("img", { src: label.pictogram }), h("div", { class: "label-name", innerHTML: label.name })), h("div", { class: "label-advice", innerHTML: label.advice })))))), this.currentTrek.advised_parking && (h("div", { class: "advised-parking-container" }, h("div", { class: "advised-parking-title" }, "Parking conseill\u00E9"), h("div", { class: "advised_parking", innerHTML: this.currentTrek.advised_parking }))), this.currentTrek.gear && (h("div", { class: "gear-container" }, h("div", { class: "gear-title" }, "\u00C9quipements"), h("div", { class: "gear", innerHTML: this.currentTrek.gear }))), state.currentSensitiveAreas && state.currentSensitiveAreas.length > 0 && (h("div", { class: "sensitive-areas-container" }, h("div", { class: "sensitive-areas-title" }, "Zones de sensibilit\u00E9 environnementale"), state.currentSensitiveAreas.map(sensitiveArea => (h("grw-sensitive-area-detail", { sensitiveArea: sensitiveArea }))))), state.currentInformationDesks && state.currentInformationDesks.length > 0 && (h("div", { class: "information-desks-container" }, h("div", { class: "information-desks-title" }, "Lieux de renseignement"), state.currentInformationDesks.map(informationDesk => (h("grw-information-desk-detail", { informationDesk: informationDesk }))))), (this.currentTrek.disabled_infrastructure ||
|
|
55
|
+
(this.accessibilities && this.accessibilities.length > 0) ||
|
|
56
|
+
this.currentTrek.accessibility_level ||
|
|
57
|
+
this.currentTrek.accessibility_slope ||
|
|
58
|
+
this.currentTrek.accessibility_width ||
|
|
59
|
+
this.currentTrek.accessibility_signage ||
|
|
60
|
+
this.currentTrek.accessibility_covering ||
|
|
61
|
+
this.currentTrek.accessibility_exposure ||
|
|
62
|
+
this.currentTrek.accessibility_advice) && (h("div", { class: "accessibilities-container" }, h("div", { class: "accessibilities-title" }, "Accessibilit\u00E9"), this.currentTrek.disabled_infrastructure && h("div", { innerHTML: this.currentTrek.disabled_infrastructure }), h("div", { class: "accessibilities-content-container" }, this.accessibilities.map(accessibility => (h("div", { class: "accessibility-content-container" }, h("img", { src: accessibility.pictogram }), h("div", { innerHTML: accessibility.name }))))), this.currentTrek.accessibility_level && (h("div", { class: "accessibility-level-container" }, h("div", { class: "accessibility-level-title" }, "Niveau d'accessibilit\u00E9"), h("div", { innerHTML: this.accessibilityLevel.name }))), this.currentTrek.accessibility_slope && (h("div", { class: "accessibility-slope-container" }, h("div", { class: "accessibility-slope-title" }, "Pente"), h("div", { innerHTML: this.currentTrek.accessibility_slope }))), this.currentTrek.accessibility_width && (h("div", { class: "accessibility-width-container" }, h("div", { class: "accessibility-width-title" }, "Largeur"), h("div", { innerHTML: this.currentTrek.accessibility_width }))), this.currentTrek.accessibility_signage && (h("div", { class: "accessibility-signage-container" }, h("div", { class: "accessibility-signage-title" }, "Pente"), h("div", { innerHTML: this.currentTrek.accessibility_signage }))), this.currentTrek.accessibility_covering && (h("div", { class: "accessibility-covering-container" }, h("div", { class: "accessibility-covering-title" }, "Rev\u00EAtement"), h("div", { innerHTML: this.currentTrek.accessibility_covering }))), this.currentTrek.accessibility_exposure && (h("div", { class: "accessibility-exposure-container" }, h("div", { class: "accessibility-exposure-title" }, "Exposition"), h("div", { innerHTML: this.currentTrek.accessibility_exposure }))), this.currentTrek.accessibility_advice && (h("div", { class: "accessibility-advice-container" }, h("div", { class: "accessibility-advice-title" }, "Conseils"), h("div", { innerHTML: this.currentTrek.accessibility_advice }))))), state.currentPois && state.currentPois.length > 0 && (h("div", { class: "pois-container" }, h("div", { class: "pois-title" }, "Points d'int\u00E9r\u00EAts"), state.currentPois.map(poi => (h("grw-poi-detail", { poi: poi }))))), this.currentTrek.source && this.currentTrek.source.length > 0 && (h("div", { class: "source-container" }, h("div", { class: "source-title" }, "Sources"), this.sources.map(source => (h("div", { class: "source-sub-container" }, source.pictogram && h("img", { src: source.pictogram }), h("div", null, h("div", { class: "source-name", innerHTML: source.name }), h("a", { class: "source-advice", innerHTML: source.website })))))))))));
|
|
41
63
|
}
|
|
42
64
|
static get style() { return grwTrekDetailCss; }
|
|
43
65
|
}, [1, "grw-trek-detail", {
|
|
@@ -45,10 +67,15 @@ const GrwTrekDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
45
67
|
"colorPrimary": [1, "color-primary"],
|
|
46
68
|
"colorPrimaryShade": [1, "color-primary-shade"],
|
|
47
69
|
"colorPrimaryTint": [1, "color-primary-tint"],
|
|
48
|
-
"currentTrek": [32],
|
|
49
70
|
"difficulty": [32],
|
|
50
71
|
"route": [32],
|
|
51
|
-
"practice": [32]
|
|
72
|
+
"practice": [32],
|
|
73
|
+
"themes": [32],
|
|
74
|
+
"labels": [32],
|
|
75
|
+
"sources": [32],
|
|
76
|
+
"accessibilities": [32],
|
|
77
|
+
"accessibilityLevel": [32],
|
|
78
|
+
"currentTrek": [32]
|
|
52
79
|
}]);
|
|
53
80
|
function defineCustomElement() {
|
|
54
81
|
if (typeof customElements === "undefined") {
|
|
@@ -7,23 +7,31 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
7
7
|
this.__registerHost();
|
|
8
8
|
this.__attachShadow();
|
|
9
9
|
this.language = 'fr';
|
|
10
|
+
this.controller = new AbortController();
|
|
11
|
+
this.signal = this.controller.signal;
|
|
10
12
|
}
|
|
11
13
|
componentWillLoad() {
|
|
12
14
|
state.api = this.api;
|
|
13
15
|
const requests = [];
|
|
14
|
-
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram
|
|
15
|
-
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram
|
|
16
|
-
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram
|
|
17
|
-
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram
|
|
16
|
+
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
17
|
+
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
18
|
+
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
19
|
+
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }) : new Response('null'));
|
|
18
20
|
return Promise.all([
|
|
19
21
|
...requests,
|
|
20
|
-
fetch(`${this.api}sensitivearea/?language=${this.language}&trek=${this.trekId}&fields=id,geometry,name,description
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
fetch(`${this.api}
|
|
22
|
+
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`, {
|
|
23
|
+
signal: this.signal,
|
|
24
|
+
}).catch(() => new Response('null')),
|
|
25
|
+
fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`, { signal: this.signal }),
|
|
26
|
+
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`, { signal: this.signal }),
|
|
27
|
+
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
28
|
+
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`, { signal: this.signal }).catch(() => new Response('null')),
|
|
29
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`, { signal: this.signal }),
|
|
30
|
+
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`, { signal: this.signal }),
|
|
31
|
+
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`, { signal: this.signal }),
|
|
24
32
|
])
|
|
25
33
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
26
|
-
.then(([difficulties, routes, practices, themes, sensitiveAreas, pois, informationDesks, trek]) => {
|
|
34
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
27
35
|
if (difficulties) {
|
|
28
36
|
state.difficulties = difficulties.results;
|
|
29
37
|
}
|
|
@@ -39,12 +47,19 @@ const GrwTrekProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
39
47
|
if (sensitiveAreas) {
|
|
40
48
|
state.currentSensitiveAreas = sensitiveAreas.results;
|
|
41
49
|
}
|
|
50
|
+
state.labels = labels.results;
|
|
51
|
+
state.sources = sources.results;
|
|
52
|
+
state.accessibilities = accessibilities.results;
|
|
53
|
+
if (accessibilitiesLevel) {
|
|
54
|
+
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
55
|
+
}
|
|
42
56
|
state.currentPois = pois.results;
|
|
43
57
|
state.currentInformationDesks = informationDesks.results;
|
|
44
58
|
state.currentTrek = trek;
|
|
45
59
|
});
|
|
46
60
|
}
|
|
47
61
|
disconnectedCallback() {
|
|
62
|
+
this.controller.abort();
|
|
48
63
|
state.currentTrek = null;
|
|
49
64
|
}
|
|
50
65
|
render() {
|
|
@@ -22,11 +22,16 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
22
22
|
this.element.scroll({ top: 0 });
|
|
23
23
|
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
24
24
|
});
|
|
25
|
+
onChange('treksWithinBounds', () => {
|
|
26
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
27
|
+
this.element.scroll({ top: 0 });
|
|
28
|
+
this.treksToDisplay = [...state.treksWithinBounds.slice(0, this.step)];
|
|
29
|
+
});
|
|
25
30
|
}
|
|
26
31
|
handleInfiniteScroll(event) {
|
|
27
32
|
if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
|
|
28
|
-
if (this.treksToDisplay.length < state.
|
|
29
|
-
this.treksToDisplay = state.
|
|
33
|
+
if (this.treksToDisplay.length < state.treksWithinBounds.length) {
|
|
34
|
+
this.treksToDisplay = state.treksWithinBounds.slice(0, this.treksToDisplay.length + this.step >= state.treksWithinBounds.length ? state.treksWithinBounds.length : this.treksToDisplay.length + this.step);
|
|
30
35
|
}
|
|
31
36
|
else {
|
|
32
37
|
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
@@ -34,7 +39,7 @@ const GrwTreksList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
render() {
|
|
37
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("div", { class: "current-treks-length" }, `${state.
|
|
42
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } }, h("div", { class: "current-treks-length" }, `${state.treksWithinBounds.length} résultat${state.treksWithinBounds.length > 1 ? 's' : ''}`), 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 }))))));
|
|
38
43
|
}
|
|
39
44
|
get element() { return this; }
|
|
40
45
|
static get style() { return grwTreksListCss; }
|
|
@@ -7,10 +7,12 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
7
7
|
this.__registerHost();
|
|
8
8
|
this.__attachShadow();
|
|
9
9
|
this.language = 'fr';
|
|
10
|
+
this.controller = new AbortController();
|
|
11
|
+
this.signal = this.controller.signal;
|
|
10
12
|
}
|
|
11
13
|
componentWillLoad() {
|
|
12
14
|
state.api = this.api;
|
|
13
|
-
let treksRequest = `${this.api}trek/?language=${this.language}`;
|
|
15
|
+
let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
|
|
14
16
|
this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
|
|
15
17
|
this.cities && (treksRequest += `&cities=${this.cities}`);
|
|
16
18
|
this.districts && (treksRequest += `&districts=${this.districts}`);
|
|
@@ -21,11 +23,11 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
21
23
|
this.practices && (treksRequest += `&practices=${this.practices}`);
|
|
22
24
|
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
|
|
23
25
|
return Promise.all([
|
|
24
|
-
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram
|
|
25
|
-
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram
|
|
26
|
-
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram
|
|
27
|
-
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram
|
|
28
|
-
fetch(treksRequest),
|
|
26
|
+
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
|
|
27
|
+
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`, { signal: this.signal }),
|
|
28
|
+
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`, { signal: this.signal }),
|
|
29
|
+
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`, { signal: this.signal }),
|
|
30
|
+
fetch(treksRequest, { signal: this.signal }),
|
|
29
31
|
])
|
|
30
32
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
31
33
|
.then(([difficulties, routes, practices, themes, treks]) => {
|
|
@@ -41,8 +43,12 @@ const GrwTreksProvider = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
41
43
|
];
|
|
42
44
|
state.treks = treks.results;
|
|
43
45
|
state.currentTreks = treks.results;
|
|
46
|
+
state.treksWithinBounds = treks.results;
|
|
44
47
|
});
|
|
45
48
|
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
this.controller.abort();
|
|
51
|
+
}
|
|
46
52
|
render() {
|
|
47
53
|
return h(Host, null);
|
|
48
54
|
}
|
package/dist/components/store.js
CHANGED
|
@@ -188,14 +188,20 @@ const { state, onChange } = createStore({
|
|
|
188
188
|
api: '',
|
|
189
189
|
treks: [],
|
|
190
190
|
currentTreks: [],
|
|
191
|
+
treksWithinBounds: [],
|
|
192
|
+
currentMapTreksBounds: null,
|
|
191
193
|
difficulties: [],
|
|
192
194
|
routes: [],
|
|
193
195
|
practices: [],
|
|
194
196
|
themes: [],
|
|
195
197
|
durations: [],
|
|
196
198
|
currentSensitiveAreas: null,
|
|
197
|
-
|
|
199
|
+
labels: null,
|
|
200
|
+
sources: null,
|
|
201
|
+
accessibilities: null,
|
|
202
|
+
accessibilitiesLevel: null,
|
|
198
203
|
currentTrek: null,
|
|
204
|
+
currentPois: null,
|
|
199
205
|
currentInformationDesks: null,
|
|
200
206
|
});
|
|
201
207
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-192d910f.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["grw-
|
|
16
|
+
return bootstrapLazy([["grw-trek-card",[[1,"grw-trek-card",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"currentTrek":[32],"difficulty":[32],"route":[32],"practice":[32],"themes":[32]}]]],["grw-information-desk-detail_3",[[1,"grw-information-desk-detail",{"informationDesk":[16]}],[1,"grw-poi-detail",{"poi":[16]}],[1,"grw-sensitive-area-detail",{"sensitiveArea":[16]}]]],["grw-filter_6",[[1,"grw-trek-detail",{"trek":[16],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"difficulty":[32],"route":[32],"practice":[32],"themes":[32],"labels":[32],"sources":[32],"accessibilities":[32],"accessibilityLevel":[32],"currentTrek":[32]}],[1,"grw-treks-list",{"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"isLargeView":[4,"is-large-view"],"treksToDisplay":[32]}],[1,"grw-filter",{"filterType":[1,"filter-type"],"filterName":[1,"filter-name"],"filterNameProperty":[1,"filter-name-property"]}],[0,"grw-map",{"urlLayer":[1,"url-layer"],"attribution":[1],"center":[1],"zoom":[2],"colorPrimary":[1,"color-primary"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"mapIsReady":[32]}],[1,"grw-trek-provider",{"language":[1],"api":[1],"trekId":[1,"trek-id"]}],[1,"grw-treks-provider",{"language":[1],"api":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1]}]]],["grw-app",[[1,"grw-app",{"api":[1],"language":[1],"inBbox":[1,"in-bbox"],"cities":[1],"districts":[1],"structures":[1],"themes":[1],"portals":[1],"routes":[1],"practices":[1],"urlLayer":[1,"url-layer"],"center":[1],"zoom":[8],"attribution":[1],"colorPrimary":[1,"color-primary"],"colorPrimaryShade":[1,"color-primary-shade"],"colorPrimaryTint":[1,"color-primary-tint"],"colorTrekLine":[1,"color-trek-line"],"colorDepartureIcon":[1,"color-departure-icon"],"colorArrivalIcon":[1,"color-arrival-icon"],"colorSensitiveArea":[1,"color-sensitive-area"],"colorPoiIcon":[1,"color-poi-icon"],"showTrek":[32],"showTreksMap":[32],"showTrekMap":[32],"showFilters":[32],"isLargeView":[32],"currentTrekId":[32]},[[0,"trekCardPress","onTrekCardPress"],[9,"resize","onWindowResize"]]]]]], options);
|
|
17
17
|
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-192d910f.js';
|
|
2
|
+
import { s as state } from './store-b2c76c0c.js';
|
|
3
|
+
|
|
4
|
+
const arrowBackImage = `<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><polyline points="244 400 100 256 244 112" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/><line x1="120" y1="256" x2="412" y2="256" style="fill:none;stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round;stroke-width:48px"/></svg>`;
|
|
5
|
+
|
|
6
|
+
const grwAppCss = ".app-container{position:relative;height:100%;max-height:100vh;font-family:\"Roboto\"}.header-container,.large-view-header-container{display:flex;align-items:center;background-color:var(--color-primary);height:64px}.header-container .arrow-back-icon,.large-view-header-container .arrow-back-icon{width:48px;height:auto;margin-left:24px}.header-container .arrow-back-icon svg,.large-view-header-container .arrow-back-icon svg{cursor:pointer;width:48px;height:auto}.header-container .handle-filters-button,.large-view-header-container .handle-filters-button{user-select:none;cursor:pointer;color:var(--color-primary);background-color:#ffffff;margin-left:36px;border-radius:8px;padding:8px}.header-container .attribution-container,.large-view-header-container .attribution-container{position:absolute;right:24px}.header-container .attribution-container a,.large-view-header-container .attribution-container a{color:#ffffff;text-decoration:none}.options-container{height:calc(100% - 64px);position:absolute;width:100%;z-index:1100;top:64px}.filters-container{position:absolute;width:100%;background-color:#ffffff;padding:36px 0px;z-index:1100}.filters-container .close-filters-button{cursor:pointer;font-weight:bold;position:absolute;top:12px;right:12px;padding:12px;border-radius:12px;color:var(--color-primary);border:1px var(--color-primary) solid}.filters-container .close-filters-button:hover{background-color:var(--color-primary);color:#ffffff}.filters-container .filter-margin-top{margin-top:24px}.filters-container .current-treks-length{margin:0px 0px 32px 8px;color:var(--color-primary);font-size:24px;font-weight:bold}.back-filters-container{background-color:rgba(0, 0, 0, 0.5);width:100%;height:calc(100% - 64px);position:absolute;z-index:1099;top:64px}.loader-container,.large-view-loader-container{display:flex;justify-content:center;align-items:center;height:100%}.loader-container .loader,.large-view-loader-container .loader{width:48px;height:48px;border:5px solid var(--color-primary-tint);border-bottom-color:var(--color-primary);border-radius:50%;display:inline-block;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.content-container{position:relative;display:flex;height:calc(100% - 64px)}.app-treks-list-container,.app-trek-detail-container,.large-view-app-treks-list-container,.large-view-app-trek-detail-container{height:100%}.app-map-container,.large-view-app-map-container{width:100%;height:100%}.map-visibility-button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:absolute;bottom:24px;width:100%;z-index:400;user-select:none}.map-visibility-button div{background-color:var(--color-primary);color:#ffffff;padding:12px;border-radius:24px;width:120px;text-align:center}.header-container .title{font-size:24px}.loader-container{position:absolute;width:100%}.app-treks-list-container,.app-trek-detail-container{width:100%}.app-map-container{position:relative;width:100%;position:absolute}.large-view-header-container .title{font-size:32px}.large-view-loader-container{position:relative;width:50%}.large-view-app-treks-list-container,.large-view-app-trek-detail-container{width:50%}.large-view-app-map-container{position:relative;width:50%}";
|
|
7
|
+
|
|
8
|
+
const GrwApp = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.showTrek = false;
|
|
12
|
+
this.showTreksMap = false;
|
|
13
|
+
this.showTrekMap = false;
|
|
14
|
+
this.showFilters = false;
|
|
15
|
+
this.isLargeView = false;
|
|
16
|
+
this.language = 'fr';
|
|
17
|
+
this.colorPrimary = '#6b0030';
|
|
18
|
+
this.colorPrimaryShade = '#4a0021';
|
|
19
|
+
this.colorPrimaryTint = '#974c6e';
|
|
20
|
+
this.colorTrekLine = '#6b0030';
|
|
21
|
+
this.colorDepartureIcon = '#006b3b';
|
|
22
|
+
this.colorArrivalIcon = '#85003b';
|
|
23
|
+
this.colorSensitiveArea = '#4974a5';
|
|
24
|
+
this.colorPoiIcon = '#974c6e';
|
|
25
|
+
this.handlePopStateBind = this.handlePopState.bind(this);
|
|
26
|
+
this.largeViewSize = 1024;
|
|
27
|
+
}
|
|
28
|
+
onTrekCardPress(event) {
|
|
29
|
+
this.currentTrekId = event.detail;
|
|
30
|
+
this.showTrek = !this.showTrek;
|
|
31
|
+
const url = new URL(window.location.toString());
|
|
32
|
+
url.searchParams.set('trek', this.currentTrekId.toString());
|
|
33
|
+
window.history.pushState({}, '', url);
|
|
34
|
+
}
|
|
35
|
+
onWindowResize() {
|
|
36
|
+
this.handleView();
|
|
37
|
+
}
|
|
38
|
+
watchPropHandler() {
|
|
39
|
+
window.dispatchEvent(new window.Event('resize'));
|
|
40
|
+
}
|
|
41
|
+
componentDidLoad() {
|
|
42
|
+
this.handleView();
|
|
43
|
+
window.addEventListener('popstate', this.handlePopStateBind, false);
|
|
44
|
+
const url = new URL(window.location.toString());
|
|
45
|
+
const trekParam = url.searchParams.get('trek');
|
|
46
|
+
if (trekParam) {
|
|
47
|
+
window.history.replaceState({ isInitialHistoryWithTrek: true }, '', url);
|
|
48
|
+
this.currentTrekId = Number(trekParam);
|
|
49
|
+
this.showTrek = !this.showTrek;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
onTrekDetailsClose() {
|
|
53
|
+
this.currentTrekId = null;
|
|
54
|
+
this.showTrek = !this.showTrek;
|
|
55
|
+
}
|
|
56
|
+
handleView() {
|
|
57
|
+
this.isLargeView = this.element.getBoundingClientRect().width >= this.largeViewSize;
|
|
58
|
+
this.showTreksMap = this.isLargeView;
|
|
59
|
+
this.showTrekMap = this.isLargeView;
|
|
60
|
+
}
|
|
61
|
+
handleFilters() {
|
|
62
|
+
this.showFilters = !this.showFilters;
|
|
63
|
+
}
|
|
64
|
+
handleBackButton() {
|
|
65
|
+
if (window.history.state.isInitialHistoryWithTrek) {
|
|
66
|
+
this.onTrekDetailsClose();
|
|
67
|
+
const url = new URL(window.location.toString());
|
|
68
|
+
url.searchParams.delete('trek');
|
|
69
|
+
window.history.pushState({}, '', url);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
window.history.back();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
handlePopState() {
|
|
76
|
+
const url = new URL(window.location.toString());
|
|
77
|
+
const trekParam = url.searchParams.get('trek');
|
|
78
|
+
if (trekParam) {
|
|
79
|
+
this.currentTrekId = Number(trekParam);
|
|
80
|
+
this.showTrek = !this.showTrek;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.onTrekDetailsClose();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
handleShowMap() {
|
|
87
|
+
if (this.currentTrekId) {
|
|
88
|
+
this.showTrekMap = !this.showTrekMap;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.showTreksMap = !this.showTreksMap;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
window.removeEventListener('popstate', this.handlePopStateBind);
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint, '--color-primary-shade': this.colorPrimaryShade } }, h("grw-treks-provider", { api: this.api, language: this.language, "in-bbox": this.inBbox, cities: this.cities, districts: this.districts, structures: this.structures, themes: this.themes, portals: this.portals, routes: this.routes, practices: this.practices }), this.showTrek && this.currentTrekId && h("grw-trek-provider", { api: state.api, language: this.language, "trek-id": this.currentTrekId }), h("div", { class: "app-container" }, h("div", { class: this.isLargeView ? 'large-view-header-container' : 'header-container' }, this.showTrek ? (h("div", { onClick: () => this.handleBackButton(), class: "arrow-back-icon", innerHTML: arrowBackImage })) : (h("div", { onClick: () => this.handleFilters(), class: "handle-filters-button" }, "FILTRER")), !this.showTrek && this.showFilters && (h("div", { class: "options-container" }, h("div", { class: "filters-container" }, h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`), h("div", { onClick: () => this.handleFilters(), class: "close-filters-button" }, "X"), h("div", null, h("grw-filter", { filterName: "Pratique", filterType: "practices", filterNameProperty: "name" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Difficult\u00E9", filterType: "difficulties", filterNameProperty: "label" })), h("div", { class: "filter-margin-top" }, h("grw-filter", { filterName: "Dur\u00E9e", filterType: "durations", filterNameProperty: "name" }))), h("div", { onClick: () => this.handleFilters(), class: "back-filters-container" }))), h("div", { class: "attribution-container" }, h("a", { target: "_blank", href: "https://geotrek.fr" }, "GEOTREK"))), h("div", { class: "content-container" }, h("div", { class: this.isLargeView ? 'large-view-app-treks-list-container' : 'app-treks-list-container', style: { display: this.showTrek ? 'none' : 'flex', position: this.showTrek ? 'absolute' : 'relative' } }, h("grw-treks-list", { "is-large-view": this.isLargeView, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint })), this.showTrek && !state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-loader-container' : 'loader-container' }, h("span", { class: "loader" }))), state.currentTrek && (h("div", { class: this.isLargeView ? 'large-view-app-trek-detail-container' : 'app-trek-detail-container' }, h("grw-trek-detail", { "color-primary": this.colorPrimary, "color-primary-shade": this.colorPrimaryShade, "color-primary-tint": this.colorPrimaryTint }))), h("grw-map", { class: this.isLargeView ? 'large-view-app-map-container' : 'app-map-container', style: { visibility: (this.showTreksMap && !this.showTrek) || (this.showTrekMap && this.showTrek) ? 'visible' : 'hidden' }, "url-layer": this.urlLayer, center: this.center, zoom: this.zoom, attribution: this.attribution, "color-primary": this.colorPrimary, "color-primary-tint": this.colorPrimaryTint, "color-trek-line": this.colorTrekLine, "color-departure-icon": this.colorDepartureIcon, "color-arrival-icon": this.colorArrivalIcon, "color-sensitive-area": this.colorSensitiveArea, "color-poi-icon": this.colorPoiIcon })), h("div", { class: "map-visibility-button", style: { display: this.isLargeView ? 'none' : 'flex' } }, h("div", { onClick: () => this.handleShowMap() }, this.showTreksMap || this.showTrekMap ? (this.showTrek ? 'Voir la fiche' : 'Voir la liste') : 'Voir la carte')))));
|
|
99
|
+
}
|
|
100
|
+
get element() { return getElement(this); }
|
|
101
|
+
static get watchers() { return {
|
|
102
|
+
"isLargeView": ["watchPropHandler"]
|
|
103
|
+
}; }
|
|
104
|
+
};
|
|
105
|
+
GrwApp.style = grwAppCss;
|
|
106
|
+
|
|
107
|
+
export { GrwApp as grw_app };
|