ublo-lib 1.16.1 → 1.16.3
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.
|
@@ -20,7 +20,9 @@ function Carousel({
|
|
|
20
20
|
}) {
|
|
21
21
|
const carouselRef = React.useRef();
|
|
22
22
|
const {
|
|
23
|
-
cmsMode
|
|
23
|
+
cmsMode,
|
|
24
|
+
lang,
|
|
25
|
+
path
|
|
24
26
|
} = useUbloContext();
|
|
25
27
|
const [sections, setSections] = React.useState([]);
|
|
26
28
|
const [current, setCurrent] = React.useState(0);
|
|
@@ -198,7 +200,7 @@ function Carousel({
|
|
|
198
200
|
});
|
|
199
201
|
if (fade) inner.style.removeProperty("transform");
|
|
200
202
|
}
|
|
201
|
-
}, [current, editing, fade, getSections]);
|
|
203
|
+
}, [current, editing, fade, getSections, lang, path]);
|
|
202
204
|
const onUndraggableElementClick = React.useCallback(e => {
|
|
203
205
|
e.preventDefault();
|
|
204
206
|
e.stopPropagation();
|
|
@@ -20,17 +20,32 @@ const fetcher = async (url, body) => {
|
|
|
20
20
|
return res.json();
|
|
21
21
|
};
|
|
22
22
|
export async function fetchInstructors(lang, body = {}) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
try {
|
|
24
|
+
return fetcher(`${host}/api/instructors-book/${resort}/${lang}`, {
|
|
25
|
+
...body,
|
|
26
|
+
project: true
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.warn(e);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
export async function fetchInstructor(lang, uri) {
|
|
29
|
-
|
|
34
|
+
try {
|
|
35
|
+
return fetcher(`${host}/api/instructors-book/${resort}/${lang}/${uri}`);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.warn(e);
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
30
40
|
}
|
|
31
41
|
export const fetchRandomInstructors = async (lang, tags, nbInstructor) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
try {
|
|
43
|
+
return fetcher(`${host}/api/instructors-book/${resort}/${lang}/byTags`, {
|
|
44
|
+
tags,
|
|
45
|
+
size: nbInstructor
|
|
46
|
+
});
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.warn(e);
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
36
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parcours-esf.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/parcours-esf/parcours-esf.tsx"],"names":[],"mappings":";AAMA,aAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC3C,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,WAAgB,EAChB,YAAiB,EACjB,aAAkB,GACnB,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"parcours-esf.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/parcours-esf/parcours-esf.tsx"],"names":[],"mappings":";AAMA,aAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC3C,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,WAAgB,EAChB,YAAiB,EACjB,aAAkB,GACnB,EAAE,KAAK,eA2CP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,EAAE,GAAG,CAAC;KAClB;CACF"}
|
|
@@ -6,22 +6,29 @@ import Loader from "dt-design-system/es/loader";
|
|
|
6
6
|
import css from "./parcours-esf.module.css";
|
|
7
7
|
const ID = "parcours-esf";
|
|
8
8
|
export default function ParcoursEsf({ parcours, constraints = [], noeudsExclus = [], niveauxExclus = [], }) {
|
|
9
|
-
const { lang } = useUbloContext();
|
|
9
|
+
const { lang, path } = useUbloContext();
|
|
10
10
|
const [loaded, setLoaded] = React.useState(false);
|
|
11
11
|
// const parcoursLang = lang === "fr" ? "fr" : "en";
|
|
12
12
|
const parcoursLang = "fr"; // seul le fr est pris en charge pour le moment
|
|
13
|
-
const
|
|
13
|
+
const loadParcours = () => {
|
|
14
14
|
window.EsfParcours.onLoad(() => {
|
|
15
15
|
setLoaded(true);
|
|
16
|
-
window.EsfParcours.start({
|
|
17
|
-
groundedTo: `#${ID}`,
|
|
18
|
-
lang: parcoursLang,
|
|
19
|
-
parcours,
|
|
20
|
-
constraints,
|
|
21
|
-
noeudsExclus,
|
|
22
|
-
niveauxExclus,
|
|
23
|
-
});
|
|
24
16
|
});
|
|
25
17
|
};
|
|
26
|
-
|
|
18
|
+
const startParcours = () => {
|
|
19
|
+
window.EsfParcours.start({
|
|
20
|
+
groundedTo: `#${ID}`,
|
|
21
|
+
lang: parcoursLang,
|
|
22
|
+
parcours,
|
|
23
|
+
constraints,
|
|
24
|
+
noeudsExclus,
|
|
25
|
+
niveauxExclus,
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
if (loaded) {
|
|
30
|
+
startParcours();
|
|
31
|
+
}
|
|
32
|
+
}, [lang, loaded, path]);
|
|
33
|
+
return (_jsxs(_Fragment, { children: [!loaded && (_jsx("div", { className: css.loader, children: _jsx(Loader, {}) })), _jsx("div", { id: ID, className: css.parcours }), _jsx(Script, { src: "https://parcours-esf.msem.tech/static/js/widget-esf-parcours.js", onLoad: loadParcours })] }));
|
|
27
34
|
}
|