@geotrekce/geotrek-rando-widget 0.0.2 → 0.0.5
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 +2 -2
- package/dist/cjs/grw-app.cjs.entry.js +93 -0
- package/dist/cjs/{grw-app_7.cjs.entry.js → grw-filter_6.cjs.entry.js} +424 -384
- 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/{index-c6f73e30.js → index-c2c4531d.js} +46 -1
- package/dist/cjs/length-d315d156.js +34 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/store-972b8d2a.js +209 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/grw-app/grw-app.css +70 -5
- package/dist/collection/components/grw-app/grw-app.js +139 -33
- package/dist/collection/components/grw-filter/grw-filter.css +29 -0
- package/dist/collection/components/grw-filter/grw-filter.js +132 -0
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.css +31 -0
- package/dist/collection/components/grw-information-desk-detail/grw-information-desk-detail.js +53 -0
- package/dist/collection/components/grw-map/grw-map.css +99 -0
- package/dist/collection/components/grw-map/grw-map.js +315 -42
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.css +31 -0
- package/dist/collection/components/grw-poi-detail/grw-poi-detail.js +41 -0
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.css +39 -0
- package/dist/collection/components/grw-sensitive-area-detail/grw-sensitive-area-detail.js +52 -0
- package/dist/collection/components/grw-trek-card/grw-trek-card.css +67 -30
- package/dist/collection/components/grw-trek-card/grw-trek-card.js +37 -13
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.css +160 -1
- package/dist/collection/components/grw-trek-detail/grw-trek-detail.js +123 -8
- package/dist/collection/components/grw-treks-list/grw-treks-list.css +17 -3
- package/dist/collection/components/grw-treks-list/grw-treks-list.js +29 -7
- package/dist/collection/store/grw-trek-provider.js +36 -8
- package/dist/collection/store/grw-treks-provider.js +16 -7
- package/dist/collection/store/store.js +10 -0
- package/dist/collection/stories/App.js +22 -16
- package/dist/collection/stories/App.stories.js +14 -9
- package/dist/collection/stories/TrekCard.js +2 -1
- package/dist/collection/stories/TrekCard.stories.js +4 -3
- package/dist/collection/stories/TrekDetail.js +3 -1
- package/dist/collection/stories/TrekDetail.stories.js +5 -3
- package/dist/collection/stories/TrekMap.js +6 -4
- package/dist/collection/stories/TrekMap.stories.js +10 -7
- package/dist/collection/stories/TreksList.js +10 -9
- package/dist/collection/stories/TreksList.stories.js +4 -3
- package/dist/collection/stories/TreksMap.stories.js +6 -5
- package/dist/collection/utils/utils.js +2 -2
- package/dist/components/grw-app.js +76 -11
- package/dist/components/grw-filter.d.ts +11 -0
- package/dist/components/grw-filter.js +6 -0
- package/dist/components/grw-filter2.js +95 -0
- package/dist/components/grw-information-desk-detail.d.ts +11 -0
- package/dist/components/grw-information-desk-detail.js +6 -0
- package/dist/components/grw-information-desk-detail2.js +34 -0
- package/dist/components/grw-map2.js +263 -39
- package/dist/components/grw-poi-detail.d.ts +11 -0
- package/dist/components/grw-poi-detail.js +6 -0
- package/dist/components/grw-poi-detail2.js +32 -0
- package/dist/components/grw-sensitive-area-detail.d.ts +11 -0
- package/dist/components/grw-sensitive-area-detail.js +6 -0
- package/dist/components/grw-sensitive-area-detail2.js +37 -0
- package/dist/components/grw-trek-card2.js +11 -6
- package/dist/components/grw-trek-detail2.js +40 -7
- package/dist/components/grw-trek-provider2.js +36 -8
- package/dist/components/grw-treks-list2.js +10 -7
- package/dist/components/grw-treks-provider2.js +16 -7
- package/dist/components/length.js +2 -2
- package/dist/components/store.js +10 -0
- package/dist/esm/geotrek-rando-widget.js +2 -2
- package/dist/esm/grw-app.entry.js +89 -0
- package/dist/esm/{grw-app_7.entry.js → grw-filter_6.entry.js} +398 -357
- 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-7aa9e822.js → index-192d910f.js} +47 -2
- package/dist/esm/length-d82189db.js +27 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/store-5a42b5d8.js +206 -0
- package/dist/geotrek-rando-widget/geotrek-rando-widget.css +1 -1
- package/dist/geotrek-rando-widget/geotrek-rando-widget.esm.js +1 -1
- package/dist/geotrek-rando-widget/p-206a52d9.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-2d9ae918.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-6dce5e6c.js +2 -0
- package/dist/geotrek-rando-widget/p-8cfa03c0.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-d3aa9819.entry.js +1 -0
- package/dist/geotrek-rando-widget/p-e63213a9.js +1 -0
- package/dist/geotrek-rando-widget/p-f3f7d6be.js +1 -0
- package/dist/types/components/grw-app/grw-app.d.ts +13 -2
- package/dist/types/components/grw-filter/grw-filter.d.ts +9 -0
- package/dist/types/components/grw-information-desk-detail/grw-information-desk-detail.d.ts +5 -0
- package/dist/types/components/grw-map/grw-map.d.ts +14 -4
- package/dist/types/components/grw-poi-detail/grw-poi-detail.d.ts +5 -0
- package/dist/types/components/grw-sensitive-area-detail/grw-sensitive-area-detail.d.ts +5 -0
- package/dist/types/components/grw-trek-card/grw-trek-card.d.ts +6 -4
- package/dist/types/components/grw-trek-detail/grw-trek-detail.d.ts +10 -4
- package/dist/types/components/grw-treks-list/grw-treks-list.d.ts +1 -0
- package/dist/types/components.d.ts +88 -3
- package/dist/types/store/store.d.ts +21 -1
- package/dist/types/types/types.d.ts +119 -3
- package/package.json +9 -10
- package/readme.md +19 -1
- package/dist/geotrek-rando-widget/p-332ba9ab.js +0 -2
- package/dist/geotrek-rando-widget/p-b7c66d2d.entry.js +0 -1
|
@@ -4,20 +4,22 @@ export class GrwTreksList {
|
|
|
4
4
|
constructor() {
|
|
5
5
|
this.treksToDisplay = [];
|
|
6
6
|
this.colorPrimary = '#6b0030';
|
|
7
|
-
this.colorPrimaryTint = '#
|
|
7
|
+
this.colorPrimaryTint = '#974c6e';
|
|
8
|
+
this.isLargeView = false;
|
|
8
9
|
this.handleInfiniteScrollBind = this.handleInfiniteScroll.bind(this);
|
|
9
10
|
this.step = 10;
|
|
10
11
|
}
|
|
11
12
|
componentWillLoad() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
13
|
+
onChange('currentTreks', () => {
|
|
14
|
+
this.element.addEventListener('scroll', this.handleInfiniteScrollBind);
|
|
15
|
+
this.element.scroll({ top: 0 });
|
|
16
|
+
this.treksToDisplay = [...state.currentTreks.slice(0, this.step)];
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
19
|
handleInfiniteScroll(event) {
|
|
18
20
|
if (event.composedPath()[0].scrollTop + event.composedPath()[0].scrollHeight / 2 >= event.composedPath()[0].scrollHeight) {
|
|
19
21
|
if (this.treksToDisplay.length < state.treks.length) {
|
|
20
|
-
this.treksToDisplay = state.
|
|
22
|
+
this.treksToDisplay = state.currentTreks.slice(0, this.treksToDisplay.length + this.step >= state.currentTreks.length ? state.currentTreks.length : this.treksToDisplay.length + this.step);
|
|
21
23
|
}
|
|
22
24
|
else {
|
|
23
25
|
this.element.removeEventListener('scroll', this.handleInfiniteScrollBind);
|
|
@@ -25,7 +27,9 @@ export class GrwTreksList {
|
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
render() {
|
|
28
|
-
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
30
|
+
return (h(Host, { style: { '--color-primary': this.colorPrimary, '--color-primary-tint': this.colorPrimaryTint } },
|
|
31
|
+
h("div", { class: "current-treks-length" }, `${state.currentTreks.length} résultat${state.currentTreks.length > 1 ? 's' : ''}`),
|
|
32
|
+
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 }))))));
|
|
29
33
|
}
|
|
30
34
|
static get is() { return "grw-treks-list"; }
|
|
31
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -70,7 +74,25 @@ export class GrwTreksList {
|
|
|
70
74
|
},
|
|
71
75
|
"attribute": "color-primary-tint",
|
|
72
76
|
"reflect": false,
|
|
73
|
-
"defaultValue": "'#
|
|
77
|
+
"defaultValue": "'#974c6e'"
|
|
78
|
+
},
|
|
79
|
+
"isLargeView": {
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"complexType": {
|
|
83
|
+
"original": "boolean",
|
|
84
|
+
"resolved": "boolean",
|
|
85
|
+
"references": {}
|
|
86
|
+
},
|
|
87
|
+
"required": false,
|
|
88
|
+
"optional": false,
|
|
89
|
+
"docs": {
|
|
90
|
+
"tags": [],
|
|
91
|
+
"text": ""
|
|
92
|
+
},
|
|
93
|
+
"attribute": "is-large-view",
|
|
94
|
+
"reflect": false,
|
|
95
|
+
"defaultValue": "false"
|
|
74
96
|
}
|
|
75
97
|
}; }
|
|
76
98
|
static get states() { return {
|
|
@@ -6,17 +6,45 @@ export class GrwTrekProvider {
|
|
|
6
6
|
}
|
|
7
7
|
componentWillLoad() {
|
|
8
8
|
state.api = this.api;
|
|
9
|
+
const requests = [];
|
|
10
|
+
requests.push(!state.difficulties ? fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
|
|
11
|
+
requests.push(!state.routes ? fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`) : new Response('null'));
|
|
12
|
+
requests.push(!state.practices ? fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`) : new Response('null'));
|
|
13
|
+
requests.push(!state.themes ? fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`) : new Response('null'));
|
|
9
14
|
return Promise.all([
|
|
10
|
-
|
|
11
|
-
fetch(`${this.api}
|
|
12
|
-
fetch(`${this.api}
|
|
13
|
-
fetch(`${this.api}
|
|
15
|
+
...requests,
|
|
16
|
+
fetch(`${this.api}sensitivearea/?language=${this.language}&published=true&trek=${this.trekId}&fields=id,geometry,name,description,contact,info_url,period,practices`).catch(() => new Response('null')),
|
|
17
|
+
fetch(`${this.api}label/?language=${this.language}&fields=id,name,advice,pictogram`),
|
|
18
|
+
fetch(`${this.api}source/?language=${this.language}&fields=id,name,website,pictogram`),
|
|
19
|
+
fetch(`${this.api}trek_accessibility/?language=${this.language}&fields=id,name,pictogram`),
|
|
20
|
+
fetch(`${this.api}trek_accessibility_level/?language=${this.language}&fields=id,name`),
|
|
21
|
+
fetch(`${this.api}poi/?language=${this.language}&trek=${this.trekId}&published=true&fields=id,name,description,attachments,type,type_label,type_pictogram,url,published,geometry&page_size=999`),
|
|
22
|
+
fetch(`${this.api}informationdesk/?language=${this.language}&near_trek=${this.trekId}&fields=id,name,description,type,phone,email,website,municipality,postal_code,street,photo_url,latitude,longitude&page_size=999`),
|
|
23
|
+
fetch(`${this.api}trek/${this.trekId}/?language=${this.language}&published=true&fields=id,name,attachments,description,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,geometry,gpx,kml,pdf,parking_location,departure,arrival,altimetric_profile,ambiance,access,public_transport,advice,advised_parking,gear,labels,source,points_reference,disabled_infrastructure,accessibility_level,accessibility_slope,accessibility_width,accessibility_signage,accessibility_covering,accessibility_exposure,accessibility_advice,accessibilities`),
|
|
14
24
|
])
|
|
15
25
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
16
|
-
.then(([difficulties, routes, practices, trek]) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
.then(([difficulties, routes, practices, themes, sensitiveAreas, labels, sources, accessibilities, accessibilitiesLevel, pois, informationDesks, trek]) => {
|
|
27
|
+
if (difficulties) {
|
|
28
|
+
state.difficulties = difficulties.results;
|
|
29
|
+
}
|
|
30
|
+
if (routes) {
|
|
31
|
+
state.routes = routes.results;
|
|
32
|
+
}
|
|
33
|
+
if (practices) {
|
|
34
|
+
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
35
|
+
}
|
|
36
|
+
if (themes) {
|
|
37
|
+
state.themes = themes.results;
|
|
38
|
+
}
|
|
39
|
+
if (sensitiveAreas) {
|
|
40
|
+
state.currentSensitiveAreas = sensitiveAreas.results;
|
|
41
|
+
}
|
|
42
|
+
state.labels = labels.results;
|
|
43
|
+
state.sources = sources.results;
|
|
44
|
+
state.accessibilities = accessibilities.results;
|
|
45
|
+
state.accessibilitiesLevel = accessibilitiesLevel.results;
|
|
46
|
+
state.currentPois = pois.results;
|
|
47
|
+
state.currentInformationDesks = informationDesks.results;
|
|
20
48
|
state.currentTrek = trek;
|
|
21
49
|
});
|
|
22
50
|
}
|
|
@@ -6,7 +6,7 @@ export class GrwTreksProvider {
|
|
|
6
6
|
}
|
|
7
7
|
componentWillLoad() {
|
|
8
8
|
state.api = this.api;
|
|
9
|
-
let treksRequest = `${this.api}trek/?language=${this.language}`;
|
|
9
|
+
let treksRequest = `${this.api}trek/?language=${this.language}&published=true`;
|
|
10
10
|
this.inBbox && (treksRequest += `&in_bbox=${this.inBbox}`);
|
|
11
11
|
this.cities && (treksRequest += `&cities=${this.cities}`);
|
|
12
12
|
this.districts && (treksRequest += `&districts=${this.districts}`);
|
|
@@ -15,19 +15,28 @@ export class GrwTreksProvider {
|
|
|
15
15
|
this.portals && (treksRequest += `&portals=${this.portals}`);
|
|
16
16
|
this.routes && (treksRequest += `&routes=${this.routes}`);
|
|
17
17
|
this.practices && (treksRequest += `&practices=${this.practices}`);
|
|
18
|
-
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,route,departure_geom&page_size=999`;
|
|
18
|
+
treksRequest += `&fields=id,name,attachments,description_teaser,difficulty,duration,ascent,length_2d,practice,themes,route,departure,departure_geom&page_size=999`;
|
|
19
19
|
return Promise.all([
|
|
20
|
-
fetch(`${this.api}trek_difficulty/?language=${this.language}`),
|
|
21
|
-
fetch(`${this.api}trek_route/?language=${this.language}`),
|
|
22
|
-
fetch(`${this.api}trek_practice/?language=${this.language}`),
|
|
20
|
+
fetch(`${this.api}trek_difficulty/?language=${this.language}&fields=id,label,pictogram`),
|
|
21
|
+
fetch(`${this.api}trek_route/?language=${this.language}&fields=id,route,pictogram`),
|
|
22
|
+
fetch(`${this.api}trek_practice/?language=${this.language}&fields=id,name,pictogram`),
|
|
23
|
+
fetch(`${this.api}theme/?language=${this.language}&fields=id,label,pictogram`),
|
|
23
24
|
fetch(treksRequest),
|
|
24
25
|
])
|
|
25
26
|
.then(responses => Promise.all(responses.map(response => response.json())))
|
|
26
|
-
.then(([difficulties, routes, practices, treks]) => {
|
|
27
|
+
.then(([difficulties, routes, practices, themes, treks]) => {
|
|
27
28
|
state.difficulties = difficulties.results;
|
|
28
29
|
state.routes = routes.results;
|
|
29
|
-
state.practices = practices.results;
|
|
30
|
+
state.practices = practices.results.map(practice => (Object.assign(Object.assign({}, practice), { selected: false })));
|
|
31
|
+
state.themes = themes.results;
|
|
32
|
+
state.durations = [
|
|
33
|
+
{ id: 1, name: '0 - 1h', minValue: 0, maxValue: 1, selected: false },
|
|
34
|
+
{ id: 2, name: '1 - 2h', minValue: 1, maxValue: 2, selected: false },
|
|
35
|
+
{ id: 3, name: '2 - 5h', minValue: 2, maxValue: 5, selected: false },
|
|
36
|
+
{ id: 4, name: '5 - 10h', minValue: 5, maxValue: 10, selected: false },
|
|
37
|
+
];
|
|
30
38
|
state.treks = treks.results;
|
|
39
|
+
state.currentTreks = treks.results;
|
|
31
40
|
});
|
|
32
41
|
}
|
|
33
42
|
render() {
|
|
@@ -2,10 +2,20 @@ import { createStore } from '@stencil/store';
|
|
|
2
2
|
const { state, onChange } = createStore({
|
|
3
3
|
api: '',
|
|
4
4
|
treks: [],
|
|
5
|
+
currentTreks: [],
|
|
5
6
|
difficulties: [],
|
|
6
7
|
routes: [],
|
|
7
8
|
practices: [],
|
|
9
|
+
themes: [],
|
|
10
|
+
durations: [],
|
|
11
|
+
currentSensitiveAreas: null,
|
|
12
|
+
labels: null,
|
|
13
|
+
sources: null,
|
|
14
|
+
accessibilities: null,
|
|
15
|
+
accessibilitiesLevel: null,
|
|
8
16
|
currentTrek: null,
|
|
17
|
+
currentPois: null,
|
|
18
|
+
currentInformationDesks: null,
|
|
9
19
|
});
|
|
10
20
|
export { onChange };
|
|
11
21
|
export default state;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const createApp = ({
|
|
2
2
|
api,
|
|
3
|
+
language,
|
|
3
4
|
inBbox,
|
|
4
5
|
cities,
|
|
5
6
|
districts,
|
|
@@ -8,32 +9,37 @@ export const createApp = ({
|
|
|
8
9
|
portals,
|
|
9
10
|
routes,
|
|
10
11
|
practices,
|
|
11
|
-
appName,
|
|
12
12
|
urlLayer,
|
|
13
13
|
attribution,
|
|
14
14
|
colorPrimary,
|
|
15
|
+
colorPrimaryShade,
|
|
15
16
|
colorPrimaryTint,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
colorTrekLine,
|
|
18
|
+
colorDepartureIcon,
|
|
19
|
+
colorArrivalIcon,
|
|
20
|
+
colorSensitiveArea,
|
|
21
|
+
colorPoiIcon,
|
|
19
22
|
}) => {
|
|
20
23
|
const app = document.createElement('grw-app');
|
|
21
24
|
app.setAttribute('api', api);
|
|
22
|
-
app.setAttribute('
|
|
23
|
-
app.setAttribute('
|
|
24
|
-
app.setAttribute('
|
|
25
|
-
app.setAttribute('
|
|
26
|
-
app.setAttribute('
|
|
27
|
-
app.setAttribute('
|
|
28
|
-
app.setAttribute('
|
|
29
|
-
app.setAttribute('
|
|
30
|
-
app.setAttribute('
|
|
25
|
+
app.setAttribute('language', language);
|
|
26
|
+
inBbox && app.setAttribute('in-bbox', inBbox);
|
|
27
|
+
cities && app.setAttribute('cities', cities);
|
|
28
|
+
districts && app.setAttribute('districts', districts);
|
|
29
|
+
structures && app.setAttribute('structures', structures);
|
|
30
|
+
themes && app.setAttribute('themes', themes);
|
|
31
|
+
portals && app.setAttribute('portals', portals);
|
|
32
|
+
routes && app.setAttribute('routes', routes);
|
|
33
|
+
practices && app.setAttribute('practices', practices);
|
|
31
34
|
app.setAttribute('url-layer', urlLayer);
|
|
32
35
|
app.setAttribute('attribution', attribution);
|
|
33
36
|
app.setAttribute('color-primary', colorPrimary);
|
|
37
|
+
app.setAttribute('color-primary-shade', colorPrimaryShade);
|
|
34
38
|
app.setAttribute('color-primary-tint', colorPrimaryTint);
|
|
35
|
-
app.setAttribute('trek-line
|
|
36
|
-
app.setAttribute('departure-icon
|
|
37
|
-
app.setAttribute('arrival-icon
|
|
39
|
+
app.setAttribute('color-trek-line', colorTrekLine);
|
|
40
|
+
app.setAttribute('color-departure-icon', colorDepartureIcon);
|
|
41
|
+
app.setAttribute('color-arrival-icon', colorArrivalIcon);
|
|
42
|
+
app.setAttribute('color-sensitive-area', colorSensitiveArea);
|
|
43
|
+
app.setAttribute('color-poi-icon', colorPoiIcon);
|
|
38
44
|
return app;
|
|
39
45
|
};
|
|
@@ -5,22 +5,25 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2:
|
|
12
|
+
'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
13
|
},
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
};
|
|
15
17
|
|
|
16
|
-
const Template = ({
|
|
17
|
-
return createApp({
|
|
18
|
+
const Template = ({ ...args }) => {
|
|
19
|
+
return createApp({ ...args });
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export const App = Template.bind({});
|
|
21
23
|
|
|
22
24
|
App.args = {
|
|
23
25
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
26
|
+
language: 'fr',
|
|
24
27
|
inBbox: '',
|
|
25
28
|
cities: '',
|
|
26
29
|
districts: '',
|
|
@@ -29,13 +32,15 @@ App.args = {
|
|
|
29
32
|
portals: '',
|
|
30
33
|
routes: '',
|
|
31
34
|
practices: '',
|
|
32
|
-
appName: 'Geotrek Rando Widget',
|
|
33
35
|
urlLayer: 'openstreetmap',
|
|
34
|
-
attribution: '© OpenStreetMap',
|
|
36
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
35
37
|
colorPrimary: '#6b0030',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
colorPrimaryShade: '4a0021',
|
|
39
|
+
colorPrimaryTint: '#974c6e',
|
|
40
|
+
colorTrekLine: '#6b0030',
|
|
41
|
+
colorDepartureIcon: '#006b3b',
|
|
42
|
+
colorArrivalIcon: '#85003b',
|
|
43
|
+
colorSensitiveArea: '#4974a5',
|
|
44
|
+
colorPoiIcon: '#974c6e',
|
|
40
45
|
};
|
|
41
46
|
App.storyName = 'App';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export const createTrekCard = ({ api, trekId, colorPrimary, colorPrimaryTint }) => {
|
|
1
|
+
export const createTrekCard = ({ api, language, trekId, colorPrimary, colorPrimaryTint }) => {
|
|
2
2
|
const container = document.createElement('div');
|
|
3
3
|
const trek = document.createElement('grw-trek-provider');
|
|
4
4
|
trek.setAttribute('api', api);
|
|
5
|
+
trek.setAttribute('language', language);
|
|
5
6
|
trek.setAttribute('trek-id', trekId);
|
|
6
7
|
container.appendChild(trek);
|
|
7
8
|
const card = document.createElement('grw-trek-card');
|
|
@@ -5,16 +5,17 @@ export default {
|
|
|
5
5
|
argTypes: {},
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const Template = ({
|
|
9
|
-
return createTrekCard({
|
|
8
|
+
const Template = ({ ...args }) => {
|
|
9
|
+
return createTrekCard({ ...args });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const TrekCard = Template.bind({});
|
|
13
13
|
|
|
14
14
|
TrekCard.args = {
|
|
15
15
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
16
|
+
language: 'fr',
|
|
16
17
|
trekId: 242872,
|
|
17
18
|
colorPrimary: '#6b0030',
|
|
18
|
-
colorPrimaryTint: '#
|
|
19
|
+
colorPrimaryTint: '#974c6e',
|
|
19
20
|
};
|
|
20
21
|
TrekCard.storyName = 'Trek card';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export const createTrekDetail = ({ api, trekId, colorPrimary, colorPrimaryTint }) => {
|
|
1
|
+
export const createTrekDetail = ({ api, language, trekId, colorPrimary, colorPrimaryShade, colorPrimaryTint }) => {
|
|
2
2
|
const container = document.createElement('div');
|
|
3
3
|
const trek = document.createElement('grw-trek-provider');
|
|
4
4
|
trek.setAttribute('api', api);
|
|
5
|
+
trek.setAttribute('language', language);
|
|
5
6
|
trek.setAttribute('trek-id', trekId);
|
|
6
7
|
container.appendChild(trek);
|
|
7
8
|
const detail = document.createElement('grw-trek-detail');
|
|
8
9
|
detail.setAttribute('color-primary', colorPrimary);
|
|
10
|
+
detail.setAttribute('color-primary-shade', colorPrimaryShade);
|
|
9
11
|
detail.setAttribute('color-primary-tint', colorPrimaryTint);
|
|
10
12
|
container.appendChild(detail);
|
|
11
13
|
return container;
|
|
@@ -5,16 +5,18 @@ export default {
|
|
|
5
5
|
argTypes: {},
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const Template = ({
|
|
9
|
-
return createTrekDetail({
|
|
8
|
+
const Template = ({ ...args }) => {
|
|
9
|
+
return createTrekDetail({ ...args });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const TrekDetail = Template.bind({});
|
|
13
13
|
|
|
14
14
|
TrekDetail.args = {
|
|
15
15
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
16
|
+
language: 'fr',
|
|
16
17
|
trekId: 242872,
|
|
17
18
|
colorPrimary: '#6b0030',
|
|
18
|
-
|
|
19
|
+
colorPrimaryShade: '4a0021',
|
|
20
|
+
colorPrimaryTint: '#974c6e',
|
|
19
21
|
};
|
|
20
22
|
TrekDetail.storyName = 'Trek detail';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution,
|
|
1
|
+
export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution, colorTrekLine, colorDepartureIcon, colorArrivalIcon, colorSensitiveArea, colorPoiIcon }) => {
|
|
2
2
|
const container = document.createElement('div');
|
|
3
3
|
container.style = 'height: 100%';
|
|
4
4
|
const trek = document.createElement('grw-trek-provider');
|
|
@@ -10,9 +10,11 @@ export const createTrekMap = ({ api, trekId, urlLayer, center, zoom, attribution
|
|
|
10
10
|
trekMap.setAttribute('center', center);
|
|
11
11
|
trekMap.setAttribute('zoom', zoom);
|
|
12
12
|
trekMap.setAttribute('attribution', attribution);
|
|
13
|
-
trekMap.setAttribute('trek-line
|
|
14
|
-
trekMap.setAttribute('departure-icon
|
|
15
|
-
trekMap.setAttribute('arrival-icon
|
|
13
|
+
trekMap.setAttribute('color-trek-line', colorTrekLine);
|
|
14
|
+
trekMap.setAttribute('color-departure-icon', colorDepartureIcon);
|
|
15
|
+
trekMap.setAttribute('color-arrival-icon', colorArrivalIcon);
|
|
16
|
+
trekMap.setAttribute('color-sensitive-area', colorSensitiveArea);
|
|
17
|
+
trekMap.setAttribute('color-poi-icon', colorPoiIcon);
|
|
16
18
|
container.appendChild(trekMap);
|
|
17
19
|
return container;
|
|
18
20
|
};
|
|
@@ -5,16 +5,17 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2: 'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const Template = ({
|
|
17
|
-
return createTrekMap({
|
|
17
|
+
const Template = ({ ...args }) => {
|
|
18
|
+
return createTrekMap({ ...args });
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const TrekMap = Template.bind({});
|
|
@@ -25,9 +26,11 @@ TrekMap.args = {
|
|
|
25
26
|
urlLayer: 'openstreetmap',
|
|
26
27
|
center: '46.50761080179829, 5.927117067721017',
|
|
27
28
|
zoom: 8,
|
|
28
|
-
attribution: '© OpenStreetMap',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
30
|
+
colorTrekLine: '#6b0030',
|
|
31
|
+
colorDepartureIcon: '#006b3b',
|
|
32
|
+
colorArrivalIcon: '#85003b',
|
|
33
|
+
colorSensitiveArea: '#4974a5',
|
|
34
|
+
colorPoiIcon: '#974c6e',
|
|
32
35
|
};
|
|
33
36
|
TrekMap.storyName = 'Trek map';
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export const createTreksList = ({ api, inBbox, cities, districts, structures, themes, portals, routes, practices, colorPrimary, colorPrimaryTint }) => {
|
|
1
|
+
export const createTreksList = ({ api, language, inBbox, cities, districts, structures, themes, portals, routes, practices, colorPrimary, colorPrimaryTint }) => {
|
|
2
2
|
const container = document.createElement('div');
|
|
3
3
|
const treks = document.createElement('grw-treks-provider');
|
|
4
4
|
treks.setAttribute('api', api);
|
|
5
|
-
treks.setAttribute('
|
|
6
|
-
treks.setAttribute('
|
|
7
|
-
treks.setAttribute('
|
|
8
|
-
treks.setAttribute('
|
|
9
|
-
treks.setAttribute('
|
|
10
|
-
treks.setAttribute('
|
|
11
|
-
treks.setAttribute('
|
|
12
|
-
treks.setAttribute('
|
|
5
|
+
treks.setAttribute('language', language);
|
|
6
|
+
inBbox && treks.setAttribute('in-bbox', inBbox);
|
|
7
|
+
cities && treks.setAttribute('cities', cities);
|
|
8
|
+
districts && treks.setAttribute('districts', districts);
|
|
9
|
+
structures && treks.setAttribute('structures', structures);
|
|
10
|
+
themes && treks.setAttribute('themes', themes);
|
|
11
|
+
portals && treks.setAttribute('portals', portals);
|
|
12
|
+
routes && treks.setAttribute('routes', routes);
|
|
13
|
+
practices && treks.setAttribute('practices', practices);
|
|
13
14
|
container.appendChild(treks);
|
|
14
15
|
const list = document.createElement('grw-treks-list');
|
|
15
16
|
list.setAttribute('color-primary', colorPrimary);
|
|
@@ -5,14 +5,15 @@ export default {
|
|
|
5
5
|
argTypes: {},
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
const Template = ({
|
|
9
|
-
return createTreksList({
|
|
8
|
+
const Template = ({ ...args }) => {
|
|
9
|
+
return createTreksList({ ...args });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const TreksList = Template.bind({});
|
|
13
13
|
|
|
14
14
|
TreksList.args = {
|
|
15
15
|
api: 'https://randoadmin.parc-haut-jura.fr/api/v2/',
|
|
16
|
+
language: 'fr',
|
|
16
17
|
inBbox: '',
|
|
17
18
|
cities: '',
|
|
18
19
|
districts: '',
|
|
@@ -22,6 +23,6 @@ TreksList.args = {
|
|
|
22
23
|
routes: '',
|
|
23
24
|
practices: '',
|
|
24
25
|
colorPrimary: '#6b0030',
|
|
25
|
-
colorPrimaryTint: '#
|
|
26
|
+
colorPrimaryTint: '#974c6e',
|
|
26
27
|
};
|
|
27
28
|
TreksList.storyName = 'Treks list';
|
|
@@ -5,16 +5,17 @@ export default {
|
|
|
5
5
|
argTypes: {
|
|
6
6
|
urlLayer: {
|
|
7
7
|
control: 'select',
|
|
8
|
-
options: ['openstreetmap'],
|
|
8
|
+
options: ['openstreetmap', 'planignv2'],
|
|
9
9
|
mapping: {
|
|
10
10
|
openstreetmap: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
11
|
+
planignv2: 'https://wxs.ign.fr/cartes/geoportail/wmts?&REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&STYLE=normal&TILEMATRIXSET=PM&FORMAT=image/png&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}',
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
const Template = ({
|
|
17
|
-
return createTreksMap({
|
|
17
|
+
const Template = ({ ...args }) => {
|
|
18
|
+
return createTreksMap({ ...args });
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const TreksMap = Template.bind({});
|
|
@@ -24,8 +25,8 @@ TreksMap.args = {
|
|
|
24
25
|
urlLayer: 'openstreetmap',
|
|
25
26
|
center: '46.50761080179829, 5.927117067721017',
|
|
26
27
|
zoom: 8,
|
|
27
|
-
attribution: '© OpenStreetMap',
|
|
28
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors',
|
|
28
29
|
colorPrimary: '#6b0030',
|
|
29
|
-
colorPrimaryTint: '#
|
|
30
|
+
colorPrimaryTint: '#974c6e',
|
|
30
31
|
};
|
|
31
32
|
TreksMap.storyName = 'Treks map';
|
|
@@ -12,8 +12,8 @@ export function formatDuration(duration) {
|
|
|
12
12
|
return formattedDuration;
|
|
13
13
|
}
|
|
14
14
|
export function formatLength(length) {
|
|
15
|
-
return `${Math.round(length / 1000)}
|
|
15
|
+
return `${Math.round(length / 1000)}km`;
|
|
16
16
|
}
|
|
17
17
|
export function formatAscent(ascent) {
|
|
18
|
-
return `${ascent}
|
|
18
|
+
return `${ascent}m`;
|
|
19
19
|
}
|