radio.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. (() => {
  2. var exports = {};
  3. exports.id = 72383;
  4. exports.ids = [72383,64820];
  5. exports.modules = {
  6. /***/ 2941:
  7. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  8. "use strict";
  9. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  10. __webpack_require__.r(__webpack_exports__);
  11. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  12. /* harmony export */ "default": () => (/* binding */ pageWrapperTemplate),
  13. /* harmony export */ "getServerSideProps": () => (/* binding */ getServerSideProps),
  14. /* harmony export */ "getStaticProps": () => (/* binding */ getStaticProps)
  15. /* harmony export */ });
  16. /* harmony import */ var _sentry_server_config_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96270);
  17. /* harmony import */ var _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(58097);
  18. /* harmony import */ var _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__);
  19. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20997);
  20. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__);
  21. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59003);
  22. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);
  23. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(60866);
  24. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4__);
  25. /* harmony import */ var _index_module_scss__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(23848);
  26. /* harmony import */ var _index_module_scss__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_index_module_scss__WEBPACK_IMPORTED_MODULE_12__);
  27. /* harmony import */ var _radio_module_scss__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(60968);
  28. /* harmony import */ var _radio_module_scss__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_radio_module_scss__WEBPACK_IMPORTED_MODULE_13__);
  29. /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(92684);
  30. /* harmony import */ var _components_NextSeoWrapper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(25869);
  31. /* harmony import */ var _components_Radio_CuratedStationList__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(53611);
  32. /* harmony import */ var _components_Radio_ReciterStationList__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58953);
  33. /* harmony import */ var _utils_chapter__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(95892);
  34. /* harmony import */ var _utils_locale__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(24709);
  35. /* harmony import */ var _utils_navigation__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(57933);
  36. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_components_Radio_CuratedStationList__WEBPACK_IMPORTED_MODULE_7__, _components_Radio_ReciterStationList__WEBPACK_IMPORTED_MODULE_8__, _utils_navigation__WEBPACK_IMPORTED_MODULE_11__]);
  37. ([_components_Radio_CuratedStationList__WEBPACK_IMPORTED_MODULE_7__, _components_Radio_ReciterStationList__WEBPACK_IMPORTED_MODULE_8__, _utils_navigation__WEBPACK_IMPORTED_MODULE_11__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  38. const NAVIGATION_URL = "/radio";
  39. const RadioPage = ({ reciters })=>{
  40. const { t , lang } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_4___default()("radio");
  41. return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment, {
  42. children: [
  43. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_NextSeoWrapper__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {
  44. title: t("common:quran-radio"),
  45. canonical: (0,_utils_navigation__WEBPACK_IMPORTED_MODULE_11__/* .getCanonicalUrl */ .Z2)(lang, NAVIGATION_URL),
  46. languageAlternates: (0,_utils_locale__WEBPACK_IMPORTED_MODULE_10__/* .getLanguageAlternates */ .qc)(NAVIGATION_URL),
  47. description: t("radio-desc")
  48. }),
  49. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
  50. className: (_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().pageContainer),
  51. children: [
  52. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  53. className: (_radio_module_scss__WEBPACK_IMPORTED_MODULE_13___default().ribbon)
  54. }),
  55. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div", {
  56. className: (_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().flow),
  57. children: [
  58. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  59. className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().flowItem), (_radio_module_scss__WEBPACK_IMPORTED_MODULE_13___default().title), (_radio_module_scss__WEBPACK_IMPORTED_MODULE_13___default().titleOnRibbon)),
  60. children: t("curated-stations")
  61. }),
  62. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  63. className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().flowItem), (_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().fullWidth)),
  64. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_Radio_CuratedStationList__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {})
  65. }),
  66. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  67. className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().flowItem), (_radio_module_scss__WEBPACK_IMPORTED_MODULE_13___default().title)),
  68. children: t("reciter-stations")
  69. }),
  70. /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div", {
  71. className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().flowItem), (_index_module_scss__WEBPACK_IMPORTED_MODULE_12___default().fullWidth)),
  72. children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(_components_Radio_ReciterStationList__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {
  73. reciters: reciters
  74. })
  75. })
  76. ]
  77. })
  78. ]
  79. })
  80. ]
  81. });
  82. };
  83. const getStaticProps$1 = async ({ locale })=>{
  84. try {
  85. const chaptersData = await (0,_utils_chapter__WEBPACK_IMPORTED_MODULE_9__/* .getAllChaptersData */ .T4)(locale);
  86. const { reciters } = await (0,_api__WEBPACK_IMPORTED_MODULE_5__/* .getAvailableReciters */ .tS)(locale, [
  87. "profile_picture"
  88. ]);
  89. return {
  90. props: {
  91. chaptersData,
  92. reciters
  93. }
  94. };
  95. } catch (e) {
  96. return {
  97. notFound: true
  98. };
  99. }
  100. };
  101. var serverComponentModule = /*#__PURE__*/Object.freeze({
  102. __proto__: null,
  103. getStaticProps: getStaticProps$1,
  104. 'default': RadioPage
  105. });
  106. /*
  107. * This file is a template for the code which will be substituted when our webpack loader handles non-API files in the
  108. * `pages/` directory.
  109. *
  110. * We use `__SENTRY_WRAPPING_TARGET_FILE__.cjs` as a placeholder for the path to the file being wrapped. Because it's not a real package,
  111. * this causes both TS and ESLint to complain, hence the pragma comments below.
  112. */
  113. const userPageModule = serverComponentModule ;
  114. const pageComponent = userPageModule ? userPageModule.default : undefined;
  115. const origGetInitialProps = pageComponent ? pageComponent.getInitialProps : undefined;
  116. const origGetStaticProps = userPageModule ? userPageModule.getStaticProps : undefined;
  117. const origGetServerSideProps = userPageModule ? userPageModule.getServerSideProps : undefined;
  118. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  119. const getInitialPropsWrappers = {
  120. '/_app': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapAppGetInitialPropsWithSentry,
  121. '/_document': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapDocumentGetInitialPropsWithSentry,
  122. '/_error': _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapErrorGetInitialPropsWithSentry,
  123. };
  124. const getInitialPropsWrapper = getInitialPropsWrappers['/radio'] || _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetInitialPropsWithSentry;
  125. if (pageComponent && typeof origGetInitialProps === 'function') {
  126. pageComponent.getInitialProps = getInitialPropsWrapper(origGetInitialProps) ;
  127. }
  128. const getStaticProps =
  129. typeof origGetStaticProps === 'function'
  130. ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetStaticPropsWithSentry(origGetStaticProps, '/radio')
  131. : undefined;
  132. const getServerSideProps =
  133. typeof origGetServerSideProps === 'function'
  134. ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapGetServerSidePropsWithSentry(origGetServerSideProps, '/radio')
  135. : undefined;
  136. const pageWrapperTemplate = pageComponent ? _sentry_nextjs__WEBPACK_IMPORTED_MODULE_1__.wrapPageComponentWithSentry(pageComponent ) : pageComponent;
  137. __webpack_async_result__();
  138. } catch(e) { __webpack_async_result__(e); } });
  139. /***/ }),
  140. /***/ 71872:
  141. /***/ ((module) => {
  142. // Exports
  143. module.exports = {
  144. "container": "CuratedStationList_container__AwJQZ",
  145. "item": "CuratedStationList_item__P7_sR"
  146. };
  147. /***/ }),
  148. /***/ 9087:
  149. /***/ ((module) => {
  150. // Exports
  151. module.exports = {
  152. "container": "ReciterStationList_container__zUdts"
  153. };
  154. /***/ }),
  155. /***/ 60968:
  156. /***/ ((module) => {
  157. // Exports
  158. module.exports = {
  159. "title": "radio_title__ZPrd6",
  160. "titleOnRibbon": "radio_titleOnRibbon__DJfOZ",
  161. "footerContainer": "radio_footerContainer__Tvi1H",
  162. "ribbon": "radio_ribbon__OVBhI"
  163. };
  164. /***/ }),
  165. /***/ 53611:
  166. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  167. "use strict";
  168. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  169. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  170. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  171. /* harmony export */ });
  172. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  173. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  174. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  175. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  176. /* harmony import */ var _xstate_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59456);
  177. /* harmony import */ var _xstate_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_xstate_react__WEBPACK_IMPORTED_MODULE_2__);
  178. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(60866);
  179. /* harmony import */ var next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3__);
  180. /* harmony import */ var _dls_Card_Card__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(81035);
  181. /* harmony import */ var _CuratedStationList_module_scss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(71872);
  182. /* harmony import */ var _CuratedStationList_module_scss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_CuratedStationList_module_scss__WEBPACK_IMPORTED_MODULE_11__);
  183. /* harmony import */ var _curatedStations__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(80701);
  184. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16868);
  185. /* harmony import */ var _icons_pause_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(51512);
  186. /* harmony import */ var _icons_play_arrow_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27333);
  187. /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(55943);
  188. /* harmony import */ var src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(64564);
  189. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_dls_Card_Card__WEBPACK_IMPORTED_MODULE_4__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_9__, src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__]);
  190. ([_dls_Card_Card__WEBPACK_IMPORTED_MODULE_4__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_9__, src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  191. // When one of the curated station is clicked,
  192. // 1) Pick (randomly) one of the audioTrack listen in the station
  193. // the listen can be found in curatadStations.ts
  194. // 2) Update the current station state in the redux
  195. // 3) Play the audio
  196. const CuratedStationList = ()=>{
  197. const { t } = next_translate_useTranslation__WEBPACK_IMPORTED_MODULE_3___default()("radio");
  198. const audioService = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__/* .AudioPlayerMachineContext */ .c);
  199. const isAudioPlaying = (0,_xstate_react__WEBPACK_IMPORTED_MODULE_2__.useSelector)(audioService, (state)=>state.matches("VISIBLE.AUDIO_PLAYER_INITIATED.PLAYING"));
  200. const radioActor = (0,_xstate_react__WEBPACK_IMPORTED_MODULE_2__.useSelector)(audioService, (state)=>state.context.radioActor);
  201. const playStation = async (id)=>{
  202. (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_9__/* .logEvent */ .Kz)("station_played", {
  203. stationId: id,
  204. type: _types__WEBPACK_IMPORTED_MODULE_6__/* .StationType.Curated */ .T.Curated
  205. });
  206. audioService.send({
  207. type: "PLAY_RADIO",
  208. stationType: _types__WEBPACK_IMPORTED_MODULE_6__/* .StationType.Curated */ .T.Curated,
  209. stationId: Number(id)
  210. });
  211. };
  212. const radioContext = radioActor?.getSnapshot()?.context || {};
  213. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  214. className: (_CuratedStationList_module_scss__WEBPACK_IMPORTED_MODULE_11___default().container),
  215. children: Object.entries(_curatedStations__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z).map(([id, station])=>{
  216. const isSelectedStation = radioContext.type === _types__WEBPACK_IMPORTED_MODULE_6__/* .StationType.Curated */ .T.Curated && radioContext.id === Number(id);
  217. let onClick;
  218. if (!isSelectedStation) onClick = ()=>playStation(id);
  219. if (isSelectedStation && isAudioPlaying) onClick = ()=>audioService.send("TOGGLE");
  220. if (isSelectedStation && !isAudioPlaying) onClick = ()=>audioService.send("TOGGLE");
  221. const actionIcon = isSelectedStation && isAudioPlaying ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_pause_svg__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {}) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_play_arrow_svg__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .Z, {});
  222. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  223. className: (_CuratedStationList_module_scss__WEBPACK_IMPORTED_MODULE_11___default().item),
  224. children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Card_Card__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
  225. shouldFlipIconOnRTL: false,
  226. actionIcon: actionIcon,
  227. imgSrc: station.bannerImgSrc,
  228. size: _dls_Card_Card__WEBPACK_IMPORTED_MODULE_4__/* .CardSize.Large */ .I.Large,
  229. tooltip: t("common:audio.play"),
  230. ariaLabel: t("common:audio.play"),
  231. title: t(`curated-station.${station.title}`),
  232. imgAlt: t(`curated-station.${station.title}`),
  233. description: t(`curated-station.${station.description}`),
  234. onImgClick: onClick,
  235. onActionIconClick: onClick
  236. })
  237. }, id);
  238. })
  239. });
  240. };
  241. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CuratedStationList);
  242. __webpack_async_result__();
  243. } catch(e) { __webpack_async_result__(e); } });
  244. /***/ }),
  245. /***/ 58953:
  246. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  247. "use strict";
  248. __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
  249. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  250. /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
  251. /* harmony export */ });
  252. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
  253. /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
  254. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
  255. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
  256. /* harmony import */ var _xstate_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59456);
  257. /* harmony import */ var _xstate_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_xstate_react__WEBPACK_IMPORTED_MODULE_2__);
  258. /* harmony import */ var _dls_Card_Card__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(81035);
  259. /* harmony import */ var _dls_Link_Link__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(61239);
  260. /* harmony import */ var _ReciterStationList_module_scss__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(9087);
  261. /* harmony import */ var _ReciterStationList_module_scss__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_ReciterStationList_module_scss__WEBPACK_IMPORTED_MODULE_11__);
  262. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16868);
  263. /* harmony import */ var _icons_pause_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(51512);
  264. /* harmony import */ var _icons_play_arrow_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(27333);
  265. /* harmony import */ var _utils_cdn__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(17339);
  266. /* harmony import */ var _utils_eventLogger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(55943);
  267. /* harmony import */ var _utils_navigation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(57933);
  268. /* harmony import */ var src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(64564);
  269. var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_dls_Card_Card__WEBPACK_IMPORTED_MODULE_3__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_8__, _utils_navigation__WEBPACK_IMPORTED_MODULE_9__, src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__]);
  270. ([_dls_Card_Card__WEBPACK_IMPORTED_MODULE_3__, _utils_eventLogger__WEBPACK_IMPORTED_MODULE_8__, _utils_navigation__WEBPACK_IMPORTED_MODULE_9__, src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
  271. const ReciterStationList = ({ reciters })=>{
  272. const audioService = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(src_xstate_AudioPlayerMachineContext__WEBPACK_IMPORTED_MODULE_10__/* .AudioPlayerMachineContext */ .c);
  273. const isAudioPlaying = (0,_xstate_react__WEBPACK_IMPORTED_MODULE_2__.useSelector)(audioService, (state)=>state.matches("VISIBLE.AUDIO_PLAYER_INITIATED.PLAYING"));
  274. const radioActor = (0,_xstate_react__WEBPACK_IMPORTED_MODULE_2__.useSelector)(audioService, (state)=>state.context.radioActor);
  275. const radioContext = radioActor?.getSnapshot()?.context || {};
  276. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
  277. className: (_ReciterStationList_module_scss__WEBPACK_IMPORTED_MODULE_11___default().container),
  278. children: reciters.map((reciter)=>{
  279. const isSelectedStation = radioContext.type === _types__WEBPACK_IMPORTED_MODULE_5__/* .StationType.Reciter */ .T.Reciter && Number(radioContext.id) === reciter.id;
  280. let onClick;
  281. if (!isSelectedStation) {
  282. onClick = ()=>{
  283. (0,_utils_eventLogger__WEBPACK_IMPORTED_MODULE_8__/* .logEvent */ .Kz)("station_played", {
  284. stationId: reciter.id,
  285. type: _types__WEBPACK_IMPORTED_MODULE_5__/* .StationType.Curated */ .T.Curated
  286. });
  287. audioService.send({
  288. type: "PLAY_RADIO",
  289. stationType: _types__WEBPACK_IMPORTED_MODULE_5__/* .StationType.Reciter */ .T.Reciter,
  290. stationId: reciter.id
  291. });
  292. };
  293. }
  294. if (isSelectedStation) {
  295. onClick = ()=>audioService.send("TOGGLE");
  296. }
  297. const actionIcon = isSelectedStation && isAudioPlaying ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_pause_svg__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .Z, {}) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_play_arrow_svg__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z, {});
  298. return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Card_Card__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
  299. actionIcon: actionIcon,
  300. imgSrc: (0,_utils_cdn__WEBPACK_IMPORTED_MODULE_12__/* .makeCDNUrl */ .Kr)(reciter.profilePicture),
  301. onImgClick: onClick,
  302. title: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Link_Link__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
  303. href: (0,_utils_navigation__WEBPACK_IMPORTED_MODULE_9__/* .getReciterNavigationUrl */ .aT)(reciter.id.toString()),
  304. children: reciter.translatedName.name
  305. }, reciter.id),
  306. imgAlt: reciter.translatedName.name,
  307. description: reciter.style.name,
  308. size: _dls_Card_Card__WEBPACK_IMPORTED_MODULE_3__/* .CardSize.Medium */ .I.Medium
  309. }, reciter.id);
  310. })
  311. });
  312. };
  313. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReciterStationList);
  314. __webpack_async_result__();
  315. } catch(e) { __webpack_async_result__(e); } });
  316. /***/ }),
  317. /***/ 17339:
  318. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  319. "use strict";
  320. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  321. /* harmony export */ "Kr": () => (/* binding */ makeCDNUrl)
  322. /* harmony export */ });
  323. /* unused harmony exports CDN_HOST, CDN_ASSETS_VERSION */
  324. const CDN_HOST = "https://static.qurancdn.com";
  325. const CDN_ASSETS_VERSION = "1";
  326. /**
  327. * Generate versioned URL of static asset
  328. *
  329. * @param {string} path the path of static asset
  330. * @returns {string}
  331. */ const makeCDNUrl = (path)=>{
  332. return `${CDN_HOST}/${path}?v=${CDN_ASSETS_VERSION}`;
  333. };
  334. /***/ }),
  335. /***/ 75184:
  336. /***/ ((module) => {
  337. "use strict";
  338. module.exports = require("@reduxjs/toolkit");
  339. /***/ }),
  340. /***/ 58097:
  341. /***/ ((module) => {
  342. "use strict";
  343. module.exports = require("@sentry/nextjs");
  344. /***/ }),
  345. /***/ 59456:
  346. /***/ ((module) => {
  347. "use strict";
  348. module.exports = require("@xstate/react");
  349. /***/ }),
  350. /***/ 59003:
  351. /***/ ((module) => {
  352. "use strict";
  353. module.exports = require("classnames");
  354. /***/ }),
  355. /***/ 59606:
  356. /***/ ((module) => {
  357. "use strict";
  358. module.exports = require("humps");
  359. /***/ }),
  360. /***/ 12372:
  361. /***/ ((module) => {
  362. "use strict";
  363. module.exports = require("lodash/findKey");
  364. /***/ }),
  365. /***/ 98492:
  366. /***/ ((module) => {
  367. "use strict";
  368. module.exports = require("lodash/groupBy");
  369. /***/ }),
  370. /***/ 35526:
  371. /***/ ((module) => {
  372. "use strict";
  373. module.exports = require("lodash/random");
  374. /***/ }),
  375. /***/ 64042:
  376. /***/ ((module) => {
  377. "use strict";
  378. module.exports = require("lodash/range");
  379. /***/ }),
  380. /***/ 47657:
  381. /***/ ((module) => {
  382. "use strict";
  383. module.exports = require("lodash/sample");
  384. /***/ }),
  385. /***/ 16641:
  386. /***/ ((module) => {
  387. "use strict";
  388. module.exports = require("next-seo");
  389. /***/ }),
  390. /***/ 60866:
  391. /***/ ((module) => {
  392. "use strict";
  393. module.exports = require("next-translate/useTranslation");
  394. /***/ }),
  395. /***/ 3280:
  396. /***/ ((module) => {
  397. "use strict";
  398. module.exports = require("next/dist/shared/lib/app-router-context.js");
  399. /***/ }),
  400. /***/ 92796:
  401. /***/ ((module) => {
  402. "use strict";
  403. module.exports = require("next/dist/shared/lib/head-manager-context.js");
  404. /***/ }),
  405. /***/ 94957:
  406. /***/ ((module) => {
  407. "use strict";
  408. module.exports = require("next/dist/shared/lib/head.js");
  409. /***/ }),
  410. /***/ 3539:
  411. /***/ ((module) => {
  412. "use strict";
  413. module.exports = require("next/dist/shared/lib/i18n/detect-domain-locale.js");
  414. /***/ }),
  415. /***/ 34014:
  416. /***/ ((module) => {
  417. "use strict";
  418. module.exports = require("next/dist/shared/lib/i18n/normalize-locale-path.js");
  419. /***/ }),
  420. /***/ 50744:
  421. /***/ ((module) => {
  422. "use strict";
  423. module.exports = require("next/dist/shared/lib/image-config-context.js");
  424. /***/ }),
  425. /***/ 35843:
  426. /***/ ((module) => {
  427. "use strict";
  428. module.exports = require("next/dist/shared/lib/image-config.js");
  429. /***/ }),
  430. /***/ 78524:
  431. /***/ ((module) => {
  432. "use strict";
  433. module.exports = require("next/dist/shared/lib/is-plain-object.js");
  434. /***/ }),
  435. /***/ 78020:
  436. /***/ ((module) => {
  437. "use strict";
  438. module.exports = require("next/dist/shared/lib/mitt.js");
  439. /***/ }),
  440. /***/ 64406:
  441. /***/ ((module) => {
  442. "use strict";
  443. module.exports = require("next/dist/shared/lib/page-path/denormalize-page-path.js");
  444. /***/ }),
  445. /***/ 24964:
  446. /***/ ((module) => {
  447. "use strict";
  448. module.exports = require("next/dist/shared/lib/router-context.js");
  449. /***/ }),
  450. /***/ 93431:
  451. /***/ ((module) => {
  452. "use strict";
  453. module.exports = require("next/dist/shared/lib/router/utils/add-locale.js");
  454. /***/ }),
  455. /***/ 11751:
  456. /***/ ((module) => {
  457. "use strict";
  458. module.exports = require("next/dist/shared/lib/router/utils/add-path-prefix.js");
  459. /***/ }),
  460. /***/ 46220:
  461. /***/ ((module) => {
  462. "use strict";
  463. module.exports = require("next/dist/shared/lib/router/utils/compare-states.js");
  464. /***/ }),
  465. /***/ 10299:
  466. /***/ ((module) => {
  467. "use strict";
  468. module.exports = require("next/dist/shared/lib/router/utils/format-next-pathname-info.js");
  469. /***/ }),
  470. /***/ 23938:
  471. /***/ ((module) => {
  472. "use strict";
  473. module.exports = require("next/dist/shared/lib/router/utils/format-url.js");
  474. /***/ }),
  475. /***/ 29565:
  476. /***/ ((module) => {
  477. "use strict";
  478. module.exports = require("next/dist/shared/lib/router/utils/get-asset-path-from-route.js");
  479. /***/ }),
  480. /***/ 35789:
  481. /***/ ((module) => {
  482. "use strict";
  483. module.exports = require("next/dist/shared/lib/router/utils/get-next-pathname-info.js");
  484. /***/ }),
  485. /***/ 1897:
  486. /***/ ((module) => {
  487. "use strict";
  488. module.exports = require("next/dist/shared/lib/router/utils/is-bot.js");
  489. /***/ }),
  490. /***/ 1428:
  491. /***/ ((module) => {
  492. "use strict";
  493. module.exports = require("next/dist/shared/lib/router/utils/is-dynamic.js");
  494. /***/ }),
  495. /***/ 28854:
  496. /***/ ((module) => {
  497. "use strict";
  498. module.exports = require("next/dist/shared/lib/router/utils/parse-path.js");
  499. /***/ }),
  500. /***/ 91292:
  501. /***/ ((module) => {
  502. "use strict";
  503. module.exports = require("next/dist/shared/lib/router/utils/parse-relative-url.js");
  504. /***/ }),
  505. /***/ 34567:
  506. /***/ ((module) => {
  507. "use strict";
  508. module.exports = require("next/dist/shared/lib/router/utils/path-has-prefix.js");
  509. /***/ }),
  510. /***/ 80979:
  511. /***/ ((module) => {
  512. "use strict";
  513. module.exports = require("next/dist/shared/lib/router/utils/querystring.js");
  514. /***/ }),
  515. /***/ 93297:
  516. /***/ ((module) => {
  517. "use strict";
  518. module.exports = require("next/dist/shared/lib/router/utils/remove-trailing-slash.js");
  519. /***/ }),
  520. /***/ 36052:
  521. /***/ ((module) => {
  522. "use strict";
  523. module.exports = require("next/dist/shared/lib/router/utils/resolve-rewrites.js");
  524. /***/ }),
  525. /***/ 84226:
  526. /***/ ((module) => {
  527. "use strict";
  528. module.exports = require("next/dist/shared/lib/router/utils/route-matcher.js");
  529. /***/ }),
  530. /***/ 95052:
  531. /***/ ((module) => {
  532. "use strict";
  533. module.exports = require("next/dist/shared/lib/router/utils/route-regex.js");
  534. /***/ }),
  535. /***/ 59232:
  536. /***/ ((module) => {
  537. "use strict";
  538. module.exports = require("next/dist/shared/lib/utils.js");
  539. /***/ }),
  540. /***/ 71853:
  541. /***/ ((module) => {
  542. "use strict";
  543. module.exports = require("next/router");
  544. /***/ }),
  545. /***/ 16689:
  546. /***/ ((module) => {
  547. "use strict";
  548. module.exports = require("react");
  549. /***/ }),
  550. /***/ 20997:
  551. /***/ ((module) => {
  552. "use strict";
  553. module.exports = require("react/jsx-runtime");
  554. /***/ }),
  555. /***/ 82522:
  556. /***/ ((module) => {
  557. "use strict";
  558. module.exports = require("xstate");
  559. /***/ }),
  560. /***/ 44549:
  561. /***/ ((module) => {
  562. "use strict";
  563. module.exports = require("xstate/lib/actions");
  564. /***/ }),
  565. /***/ 66704:
  566. /***/ ((module) => {
  567. "use strict";
  568. module.exports = import("@radix-ui/react-tooltip");;
  569. /***/ }),
  570. /***/ 88813:
  571. /***/ ((module) => {
  572. "use strict";
  573. module.exports = import("firebase/compat/analytics");;
  574. /***/ }),
  575. /***/ 33773:
  576. /***/ ((module) => {
  577. "use strict";
  578. module.exports = import("firebase/compat/app");;
  579. /***/ }),
  580. /***/ 3590:
  581. /***/ ((module) => {
  582. "use strict";
  583. module.exports = import("react-toastify");;
  584. /***/ }),
  585. /***/ 63477:
  586. /***/ ((module) => {
  587. "use strict";
  588. module.exports = require("querystring");
  589. /***/ })
  590. };
  591. ;
  592. // load runtime
  593. var __webpack_require__ = require("../webpack-runtime.js");
  594. __webpack_require__.C(exports);
  595. var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
  596. var __webpack_exports__ = __webpack_require__.X(0, [11497,79165,7477,96270,24709,57933,61239,25869,50497,76410,79717,64564,21550,9581], () => (__webpack_exec__(2941)));
  597. module.exports = __webpack_exports__;
  598. })();
  599. //# sourceMappingURL=radio.js.map