{"version":3,"file":"index-6e0aae70.js","sources":["../../../FE_DEV/src/containers/NotificationModal/index.tsx"],"sourcesContent":["import {\n\tfaChevronLeft,\n\tfaChevronRight,\n} from '@fortawesome/free-solid-svg-icons'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { ReactNode, useEffect, useState } from 'react'\nimport { createPortal } from 'react-dom'\nimport './index.scss'\nimport { LocalStorageHelper } from '@/utils/local-storage-helper'\nimport { IHeader } from '@/models/IHeader'\nimport { INotification } from '@/models/INotification'\n\ninterface ModalProps {\n\tisOpen: boolean\n\tonClose: () => void\n\tchildren: ReactNode\n}\n\nconst Modal: React.FC = ({ isOpen, onClose, children }) => {\n\tif (!isOpen) return null\n\n\treturn createPortal(\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t{children}\n\t\t\t
\n\t\t
,\n\t\tdocument.getElementById('modal-root') as HTMLDivElement,\n\t)\n}\n\ninterface NotificationProps {\n\tisMobile: boolean,\n\tbackToMenu: () => void\n}\n\nexport default function NotificaitonsModal({ isMobile, backToMenu }: NotificationProps) {\n\tconst [modalVisibility, setmodalVisibility] = useState(false)\n\tconst [notifications, setNotifications] = useState([])\n\tconst [loading, setLoading] = useState(false)\n\n\tconst closeModal = () => {\n\t\tsetmodalVisibility(false)\n\t}\n\n\tconst backToMenuHandler = () => {\n\t\tbackToMenu();\n\t\tsetmodalVisibility(false)\n\t}\n\n\tconst onNotificationsOpen = async () => {\n\t\tsetmodalVisibility(true)\n\t\tconst header = LocalStorageHelper.getItem('header-info')\n\t\tif (header?.memberId) {\n\t\t\tconst notifications = LocalStorageHelper.getItem(\n\t\t\t\t`notifications-${header.memberId}`,\n\t\t\t)\n\t\t\tif (notifications === undefined || notifications === null) {\n\t\t\t\tsetLoading(true)\n\t\t\t\tsetNotifications(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 1,\n\t\t\t\t\t\t\tname: 'TAKE TRAINING',\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'You’ve got outstanding training for working with children. ',\n\t\t\t\t\t\t\turl: '/',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 2,\n\t\t\t\t\t\t\tname: 'FIND OUT MORE',\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Arcu sit sit urna porttitor aliquam odio. Tempor viverra cursus laoreet mi. Enim amet dignissim.',\n\t\t\t\t\t\t\turl: '/',\n\t\t\t\t\t\t},\n\t\t\t\t\t], // get notifications from api\n\t\t\t\t)\n\t\t\t\tsetLoading(false)\n\t\t\t} else {\n\t\t\t\tsetNotifications(notifications ?? [])\n\t\t\t}\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tif (modalVisibility) {\n\t\t\tdocument.body.classList.add('overflow-hidden')\n\t\t} else {\n\t\t\tdocument.body.classList.remove('overflow-hidden')\n\t\t}\n\t}, [modalVisibility])\n\n\treturn (\n\t\t
\n\t\t\t{isMobile ? (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tNotifications\n\t\t\t\t\n\t\t\t) : (\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t)}\n\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

Notifications

\n\t\t\t\t\t\t
\n\t\t\t\t\t\t{loading && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tLoading...\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!loading &&\n\t\t\t\t\t\t\tnotifications &&\n\t\t\t\t\t\t\tnotifications?.map((notification) => (\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t

{notification.description}

\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t\t\t\t\t\t{notification.name}\n\t\t\t\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t{!loading && notifications?.length == 0 && (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\tNo notifications\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t)\n}\n"],"names":["Modal","isOpen","onClose","children","createPortal","jsxs","jsx","NotificaitonsModal","isMobile","backToMenu","modalVisibility","setmodalVisibility","useState","notifications","setNotifications","loading","setLoading","closeModal","backToMenuHandler","onNotificationsOpen","header","LocalStorageHelper","useEffect","FontAwesomeIcon","faChevronLeft","notification","faChevronRight"],"mappings":"kTAkBA,MAAMA,EAA8B,CAAC,CAAE,OAAAC,EAAQ,QAAAC,EAAS,SAAAC,KAClDF,EAEEG,EAAA,aACNC,EAAC,UAAQ,CAAA,UAAU,6CAClB,SAAA,CAACC,EAAA,MAAA,CAAI,UAAU,SAAU,CAAA,EACxBA,EAAA,MAAA,CAAI,UAAU,uDACb,SAAAH,CACF,CAAA,CAAA,EACD,EACA,SAAS,eAAe,YAAY,CAAA,EATjB,KAkBrB,SAAwBI,EAAmB,CAAE,SAAAC,EAAU,WAAAC,GAAiC,CACvF,KAAM,CAACC,EAAiBC,CAAk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