(self["webpackChunk_N_E"] = self["webpackChunk_N_E"] || []).push([[931],{ /***/ 4176: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { Promise.resolve(/* import() eager */).then(__webpack_require__.bind(__webpack_require__, 1462)) /***/ }), /***/ 1462: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* binding */ ScheduleTable; } }); // EXTERNAL MODULE: ./node_modules/next/dist/compiled/react/jsx-runtime.js var jsx_runtime = __webpack_require__(7437); // EXTERNAL MODULE: ./node_modules/next/dist/compiled/react/index.js var react = __webpack_require__(2265); ;// CONCATENATED MODULE: ./components/schedule/schedule-booker.js function ScheduleBooker(param) { let { link, type } = param; return /*#__PURE__*/ (0,jsx_runtime.jsx)("a", { className: "btn btn-".concat(type), href: link, children: type }); } ;// CONCATENATED MODULE: ./components/schedule/schedule-class.js function ScheduleClass(param) { let { scheduledClass } = param; const startDate = new Date(scheduledClass.dateTime); const startHours = startDate.getHours() > 12 ? startDate.getHours() - 12 : startDate.getHours(); const startMinutes = startDate.getMinutes() < 10 ? "0".concat(startDate.getMinutes()) : startDate.getMinutes(); const startAm = startDate.getHours() > 11 ? "pm" : "am"; const start = "".concat(startHours, ":").concat(startMinutes).concat(startAm); const endDate = new Date(scheduledClass.dateTime); endDate.setMinutes(startDate.getMinutes() + scheduledClass.duration); const endHours = endDate.getHours() > 12 ? endDate.getHours() - 12 : endDate.getHours(); const endMinutes = endDate.getMinutes() < 10 ? "0".concat(endDate.getMinutes()) : endDate.getMinutes(); const endAm = endDate.getHours() > 11 ? "pm" : "am"; const end = "".concat(endHours, ":").concat(endMinutes).concat(endAm); const remainingSpots = Math.max(scheduledClass.capacity - scheduledClass.ticketsSold, 0); let buttonType = "reserve"; let classClass = "class"; let past = false; if (remainingSpots === 0) { classClass += " class-full"; buttonType = "waitlist"; } if (Date.now() > startDate) { classClass += " class-past"; past = true; } const teacherNames = scheduledClass.teacher.split(" "); if (teacherNames[1] === "") teacherNames.splice(1, 1); const teacher = "".concat(teacherNames[0], " ").concat(teacherNames[1][0], "."); if (scheduledClass.isCancelled === true) { return null; } return /*#__PURE__*/ (0,jsx_runtime.jsxs)("li", { className: classClass, "data-coach": scheduledClass.teacherId, "data-class": "10041", children: [ /*#__PURE__*/ (0,jsx_runtime.jsxs)("h4", { className: "class-name", children: [ scheduledClass.title, /*#__PURE__*/ (0,jsx_runtime.jsx)("span", { className: "tip", children: /*#__PURE__*/ (0,jsx_runtime.jsx)("svg", { className: "svg-inline--fa fa-question-circle fa-w-16", "aria-hidden": "true", focusable: "false", "data-prefix": "far", "data-icon": "question-circle", role: "img", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", "data-fa-i2svg": "", children: /*#__PURE__*/ (0,jsx_runtime.jsx)("path", { fill: "currentColor", d: "M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm107.244-255.2c0 67.052-72.421 68.084-72.421 92.863V300c0 6.627-5.373 12-12 12h-45.647c-6.627 0-12-5.373-12-12v-8.659c0-35.745 27.1-50.034 47.579-61.516 17.561-9.845 28.324-16.541 28.324-29.579 0-17.246-21.999-28.693-39.784-28.693-23.189 0-33.894 10.977-48.942 29.969-4.057 5.12-11.46 6.071-16.666 2.124l-27.824-21.098c-5.107-3.872-6.251-11.066-2.644-16.363C184.846 131.491 214.94 112 261.794 112c49.071 0 101.45 38.304 101.45 88.8zM298 368c0 23.159-18.841 42-42 42s-42-18.841-42-42 18.841-42 42-42 42 18.841 42 42z" }) }) }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", { className: "class-time", children: [ start, " - ", end, " ", /*#__PURE__*/ (0,jsx_runtime.jsxs)("span", { className: "class-duration sm muted", children: [ "(", scheduledClass.duration, " min)" ] }) ] }), /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { className: "class-teacher", children: teacher }), /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { className: "class-status", children: remainingSpots <= 2 && remainingSpots > 0 && !past ? "".concat(remainingSpots, " ").concat(remainingSpots === 1 ? "spot" : "spots", " left") : "" }), /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { className: "class-cta", children: /*#__PURE__*/ (0,jsx_runtime.jsx)(ScheduleBooker, { link: scheduledClass.link, type: buttonType }) }) ] }); } ;// CONCATENATED MODULE: ./components/schedule/schedule-day.js /* __next_internal_client_entry_do_not_use__ default auto */ function ScheduleDay(param) { let { scheduledDay } = param; return /*#__PURE__*/ (0,jsx_runtime.jsxs)("div", { className: "schedule-day", children: [ /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { className: "schedule-day-header", children: /*#__PURE__*/ (0,jsx_runtime.jsxs)("h3", { children: [ scheduledDay.dayOfWeek, " ", /*#__PURE__*/ (0,jsx_runtime.jsxs)("strong", { children: [ scheduledDay.date, "/", scheduledDay.month + 1 ] }) ] }) }), /*#__PURE__*/ (0,jsx_runtime.jsx)("ul", { className: "classes", children: scheduledDay.classes.map((c, i)=>/*#__PURE__*/ (0,jsx_runtime.jsx)(ScheduleClass, { scheduledClass: c }, i)) }) ] }); } ;// CONCATENATED MODULE: ./components/schedule/schedule-table.js /* __next_internal_client_entry_do_not_use__ default auto */ function getDayOfWeek(date) { const days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; return days[date]; } function ScheduleTable(param) { let {} = param; const [events, setEvents] = (0,react.useState)(null); const [isLoading, setLoading] = (0,react.useState)(true); const s = new Array(); const hostId = 24392; const token = "d0e9e93640"; (0,react.useEffect)(()=>{ fetch("https://api.withribbon.com/api/v1/Events?hostId=".concat(hostId, "&token=").concat(token)).then((res)=>res.json()).then((events)=>{ setEvents(events); setLoading(false); }); }, []); if (isLoading) return /*#__PURE__*/ (0,jsx_runtime.jsx)("p", { children: "Loading..." }); if (!events) { return /*#__PURE__*/ (0,jsx_runtime.jsx)("p", { children: "No events" }); } else { // Initialise the dates for the schedule view // Classes are empty now, but we're about to push them in const date = new Date(); Array(7).fill(1).map((i)=>{ s.push({ date: date.getDate(), month: date.getMonth(), dayOfWeek: getDayOfWeek(date.getDay()), classes: [] }); date.setDate(date.getDate() + i); }); const startDate = new Date(); const endDate = new Date(); startDate.setDate(startDate.getDate() - 1); endDate.setDate(startDate.getDate() + 7); // Remove any events from outside our date range events.filter((e)=>{ const eDate = new Date(e.dateTime); return eDate > startDate && eDate < endDate; }).map((e)=>{ const eDate = new Date(e.dateTime); s.forEach((t)=>{ if (eDate.getDate() === t.date && eDate.getMonth() === t.month) { t.classes.push(e); } }); }); } return /*#__PURE__*/ (0,jsx_runtime.jsx)("div", { id: "scheduleContentTable", className: "schedule schedule-grid", children: s.map((scheduledDay, i)=>/*#__PURE__*/ (0,jsx_runtime.jsx)(ScheduleDay, { scheduledDay: scheduledDay }, i)) }); } /***/ }), /***/ 622: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; /* React react-jsx-runtime.production.min.js Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ var f=__webpack_require__(2265),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0}; function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q; //# sourceMappingURL=react-jsx-runtime.production.min.js.map /***/ }), /***/ 7437: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; if (true) { module.exports = __webpack_require__(622); } else {} /***/ }) }, /******/ function(__webpack_require__) { // webpackRuntimeModules /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); } /******/ var __webpack_exports__ = (__webpack_exec__(4176)); /******/ _N_E = __webpack_exports__; /******/ } ]);