diff --git a/src/components/Icon/index.js b/src/components/Icon/index.js index bb753b463..5b65b69a4 100644 --- a/src/components/Icon/index.js +++ b/src/components/Icon/index.js @@ -8,7 +8,7 @@ const Icon = ({ icon, ...rest }) => { const Comp = loadable(() => import(`./set/${icon}`).catch((err) => console.error(err)) ); - return ; + return icon && ; }; Icon.propTypes = { icon: PropTypes.string.isRequired, diff --git a/src/components/UpcomingDates/index.js b/src/components/UpcomingDates/index.js index 3d67a86ea..592b98899 100644 --- a/src/components/UpcomingDates/index.js +++ b/src/components/UpcomingDates/index.js @@ -142,7 +142,8 @@ const UpcomingDates = ({ const academySlug = session.academyAliasDictionary[location] ? session.academyAliasDictionary[location] : location; - const cohorts = await getCohorts({ academy: academySlug }); + let cohorts = await getCohorts({ academy: academySlug, limit: 10 }); + cohorts = cohorts?.results || []; console.log("cohorts upcoming", cohorts); let syllabus = []; for (let i in cohorts) { diff --git a/src/data/page/calendar.es.yml b/src/data/page/calendar.es.yml index 64bfcc2f9..fdfd7bda8 100644 --- a/src/data/page/calendar.es.yml +++ b/src/data/page/calendar.es.yml @@ -8,6 +8,8 @@ meta_info: redirects: ["/calendario", "/es/calendario"] seo_title: "Coding Bootcamp" +show_more: Mostrar más +show_less: Mostrar menos header: title: Próximos programas y Eventos de 4GEEKS ACADEMY paragraph: "Ajusta los filtros a los eventos de los cursos que más te interesan" diff --git a/src/data/page/calendar.us.yml b/src/data/page/calendar.us.yml index bb44b3e9d..959a4d94e 100644 --- a/src/data/page/calendar.us.yml +++ b/src/data/page/calendar.us.yml @@ -8,6 +8,8 @@ meta_info: redirects: ["/upcoming", "/dates", "/calendar", "/us/calendar"] seo_title: "Coding Bootcamp" +show_more: Show more +show_less: Show less header: title: Upcoming Courses paragraph: "Filter the events or cohorts based what you are interested on" diff --git a/src/pages/thumbnail.js b/src/pages/thumbnail.js index 70cb0c3d8..3b6c91598 100644 --- a/src/pages/thumbnail.js +++ b/src/pages/thumbnail.js @@ -58,9 +58,10 @@ const ThumbnailPage = () => { if (isWindow) document.body.className = "page-thumbnail"; }, [data]); + const url = `/images/bg/random-bg${Math.floor(Math.random() * 4) + 1}.png`; + const Div = styled.div` - background: url("/images/bg/random-bg${Math.floor(Math.random() * 4) + - 1}.png"); + background: url("${url}"); background-repeat: no-repeat; background-size: cover; height: 100vh; diff --git a/src/templates/calendar.js b/src/templates/calendar.js index f500b2867..cb2949a8e 100644 --- a/src/templates/calendar.js +++ b/src/templates/calendar.js @@ -83,9 +83,10 @@ const Calendar = (props) => { useEffect(() => { const getData = async () => { - let cohorts = await getCohorts(); + let cohorts = await getCohorts({ limit: 100 }); let events = await getEvents(); let syllabus = []; + cohorts = cohorts?.results || []; for (let i in cohorts) { let name = cohorts[i].syllabus_version.name; name === "Full-Stack Software Developer FT" @@ -581,7 +582,7 @@ const Calendar = (props) => { cursor="pointer" onClick={() => setLimit(!limit)} > - Show more + {content.show_more} )} @@ -596,7 +597,7 @@ const Calendar = (props) => { cursor="pointer" onClick={() => setLimit(!limit)} > - Show less + {content.show_less} )} @@ -618,7 +619,7 @@ const Calendar = (props) => { > <> {datas.events.filtered.map((m, i) => { - const limits = limit == true ? 6 : 100; + const limits = limit ? 6 : 100; return ( i < limits && (
{ const doc = loadYML(_path); if (!doc || !doc.yaml) fail("Invalid YML syntax for " + _path); }); + try { + const resp = await fetch( + `https://breathecode.herokuapp.com/v1/marketing/downloadable` + ); + const downloadables = await resp.json(); - const _files = files.filter( - (f) => - (f.indexOf(".yml") > 1 || f.indexOf(".yaml") > 1) && - f.indexOf("additional-redirects.yml") === -1 && - f.indexOf("call-to-actions.yml") === -1 - ); + const _files = files.filter( + (f) => + (f.indexOf(".yml") > 1 || f.indexOf(".yaml") > 1) && + f.indexOf("additional-redirects.yml") === -1 && + f.indexOf("call-to-actions.yml") === -1 + ); - for (let i = 0; i < _files.length; i++) { - const _path = _files[i]; - const doc = loadYML(_path); - if (!doc.yaml) fail("Invalid YML syntax for " + _path); - if (!doc.lang) fail("Missing language on yml file name for " + _path); + for (let i = 0; i < _files.length; i++) { + const _path = _files[i]; + const doc = loadYML(_path); + if (!doc.yaml) fail("Invalid YML syntax for " + _path); + if (!doc.lang) fail("Missing language on yml file name for " + _path); - let meta_info_image = doc.yaml.meta_info.image; - let header_image = doc.yaml.header_data.image; + let meta_info_image = doc.yaml.meta_info.image; + let header_image = doc.yaml.header_data.image; - localizeImage(header_image, "relative_images", _path, "."); - localizeImage(meta_info_image, "relative_images", _path, "bg"); + localizeImage(header_image, "relative_images", _path, "."); + localizeImage(meta_info_image, "relative_images", _path, "bg"); - try { const data = doc.yaml; const meta_keys = Object.keys(data.meta_info); const current_download = data.meta_info.current_download; - const resp = await fetch( - `https://breathecode.herokuapp.com/v1/marketing/downloadable` - ); - const downloadables = await resp.json(); const scanResult = downloadables.some( (el) => el.slug === current_download ); @@ -68,10 +68,10 @@ walk(`${__dirname}/../data/downloadable`, async (err, files) => { if (!meta_keys.includes(obj["key"])) fail(`Missing prop ${obj["key"]} from course on ${_path}`); }); - } catch (error) { - console.error(`Error on file: ${_path}`.red); - fail(error.message || error); } + success("All Downloadables yml have correct properties"); + } catch (error) { + console.error(`Error on file: ${_path}`.red); + fail(error.message || error); } - success("All Downloadables yml have correct properties"); });