{"version":3,"sources":["modules/app_sigo/components/MyPage/Types/Slug.tsx"],"names":["configUI","Topic","BlogPost","LandingPage","PageWithSlug","props","requestFirst","slug","window","location","pathname","slice","setLoading","HApi","apiPost","url","data","Slug","then","response","Data","setData","setReady","catch","error","getContentType","state","HUtils","get","getDataByKey","key","value","setState","loading","ready","newData","renderContent","contentType","uiType","slugInfo","metaDataInfo","to","type","isLoading","moreConfig","customLoading","WrapLoading","className","viewBox","cx","cy","r","fill","this","Wrap","classnames","id","React","Component","styled","div"],"mappings":"kPAQMA,EAAW,CACfC,MAAO,mBACPC,SAAU,kBACVC,YAAa,mBAQTC,E,kDACJ,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IAcRC,aAAe,WACb,IAAMC,EAAOC,OAAOC,SAASC,SAASC,MAAM,GAC5C,EAAKC,YAAW,GACZL,GACFM,IAAKC,QAAQ,CACXC,IAAK,0CACLC,KAAM,CACJC,KAAMV,KAIPW,MAAK,SAAAC,GACJ,EAAKP,YAAW,GAChB,IAAMI,EAAI,OAAGG,QAAH,IAAGA,OAAH,EAAGA,EAAUC,KACnBJ,EACF,EAAKK,QAAQL,GAEb,EAAKK,QAAQ,IAEf,EAAKC,UAAS,MAEfC,OAAM,SAAAC,GACL,EAAKF,UAAS,GACd,EAAKV,YAAW,OAtCL,EA0CnBa,eAAiB,WACf,IAAQT,EAAS,EAAKU,MAAdV,KACR,OAAOW,SAAOC,IAAIZ,EAAM,kCA5CP,EA8CnBa,aAAe,SAAAC,GACb,IAAQd,EAAS,EAAKU,MAAdV,KACR,OAAOW,SAAOC,IAAIZ,EAAMc,IAhDP,EAkDnBlB,WAAa,SAAAmB,GACX,EAAKC,SAAS,CACZC,QAASF,KApDM,EAuDnBT,SAAW,SAAAS,GACT,EAAKC,SAAS,CACZE,MAAOH,KAzDQ,EA4DnBV,QAAU,SAAAc,GACR,EAAKH,SAAS,CACZhB,KAAMmB,KA9DS,EAiEnBC,cAAgB,WACd,MAA2B,EAAKV,MAAxBO,EAAR,EAAQA,QAASC,EAAjB,EAAiBA,MACXG,EAAc,EAAKR,aAAa,iCAClCS,EAAM,OAAGtC,QAAH,IAAGA,OAAH,EAAGA,EAAWqC,GAClBE,EAAW,EAAKV,aAAa,sBAC7BW,EAAe,EAAKX,aAAa,0BACnCb,EAAY,GAQhB,OANEA,EADkB,aAAhBqB,EACK,EAAKR,aAAa,iBACA,gBAAhBQ,EACF,EAAKR,aAAa,eAElB,EAAKA,aAAa,SAEtBQ,GAAeH,EACX,cAAC,IAAD,CAAUO,GAAI,SAGrB,cAAC,IAAD,CACEC,KAAK,WACLC,UAAWV,EACXW,WAAY,CACVC,cAAe,WACb,OACE,cAACC,EAAD,UACE,qBAAKC,UAAU,aAAaC,QAAQ,YAApC,SACE,wBACED,UAAU,OACVE,GAAG,KACHC,GAAG,KACHC,EAAE,KACFC,KAAK,OACL,eAAa,YAd3B,SAsBE,cAAC,IAAD,CACEV,KAAMJ,EACNtB,KAAMA,EACNuB,SAAUA,EACVC,aAAcA,OA3GpB,EAAKd,MAAQ,CACXO,SAAS,EACTC,OAAO,EACPlB,KAAM,IALS,E,qDAQnB,WACEqC,KAAK/C,iB,kCAGP,c,oBAsGA,WACE,IAAM+B,EAAcgB,KAAKxB,aAAa,iCAClCS,EAAM,OAAGtC,QAAH,IAAGA,OAAH,EAAGA,EAAWqC,GACxB,OACE,cAACiB,EAAD,CAAMP,UAAWQ,IAAW,cAAejB,EAAS,GAAK,aAAzD,SACE,qBAAKkB,GAAG,UAAR,SAAmBH,KAAKjB,wB,GAxHLqB,IAAMC,WA6H3BJ,EAAOK,IAAOC,IAAV,qYAuBJd,EAAca,IAAOC,IAAV,0JAQFxD","file":"static/js/287.3bbb2626.chunk.js","sourcesContent":["import { HLink, HUtils } from \"@macashipo/mlib\"\r\nimport classnames from \"classnames\"\r\nimport React from \"react\"\r\nimport { Redirect } from \"react-router-dom\"\r\nimport { MyUI } from \"src/core/components\"\r\nimport { HApi } from \"src/core/helpers\"\r\nimport styled from \"styled-components\"\r\n\r\nconst configUI = {\r\n Topic: \"sg_topic_content\",\r\n BlogPost: \"sg_blog_content\",\r\n LandingPage: \"sg_landing_page\",\r\n}\r\ninterface IProps {}\r\ninterface IState {\r\n loading: boolean\r\n ready: boolean\r\n data: any\r\n}\r\nclass PageWithSlug extends React.Component {\r\n constructor(props) {\r\n super(props)\r\n this.state = {\r\n loading: false,\r\n ready: false,\r\n data: {},\r\n }\r\n }\r\n componentDidMount() {\r\n this.requestFirst()\r\n // window.document.body.classList.add(\"home\")\r\n }\r\n componentWillUnmount() {\r\n // window.document.body.classList.remove(\"home\")\r\n }\r\n requestFirst = () => {\r\n const slug = window.location.pathname.slice(1)\r\n this.setLoading(true)\r\n if (slug) {\r\n HApi.apiPost({\r\n url: \"DashboardForWebsite/GetListDataWithSlug\",\r\n data: {\r\n Slug: slug,\r\n // Slug: \"thue-xe-tu-lai-tai-Bà Rịa - Vũng Tàu-18-10-2024 12-27-29\",\r\n },\r\n })\r\n .then(response => {\r\n this.setLoading(false)\r\n const data = response?.Data\r\n if (data) {\r\n this.setData(data)\r\n } else {\r\n this.setData({})\r\n }\r\n this.setReady(true)\r\n })\r\n .catch(error => {\r\n this.setReady(true)\r\n this.setLoading(false)\r\n })\r\n }\r\n }\r\n getContentType = () => {\r\n const { data } = this.state\r\n return HUtils.get(data, \"ExtraData.SlugInfo.EntityName\")\r\n }\r\n getDataByKey = key => {\r\n const { data } = this.state\r\n return HUtils.get(data, key)\r\n }\r\n setLoading = value => {\r\n this.setState({\r\n loading: value,\r\n })\r\n }\r\n setReady = value => {\r\n this.setState({\r\n ready: value,\r\n })\r\n }\r\n setData = newData => {\r\n this.setState({\r\n data: newData,\r\n })\r\n }\r\n renderContent = () => {\r\n const { loading, ready } = this.state\r\n const contentType = this.getDataByKey(\"ExtraData.SlugInfo.EntityName\")\r\n let uiType = configUI?.[contentType]\r\n const slugInfo = this.getDataByKey(\"ExtraData.SlugInfo\")\r\n const metaDataInfo = this.getDataByKey(\"ExtraData.MetaDataInfo\")\r\n let data: any = {}\r\n if (contentType === \"BlogPost\") {\r\n data = this.getDataByKey(\"Data.BlogPost\")\r\n } else if (contentType === \"LandingPage\") {\r\n data = this.getDataByKey(\"LandingPage\")\r\n } else {\r\n data = this.getDataByKey(\"Data\")\r\n }\r\n if (!contentType && ready) {\r\n return \r\n }\r\n return (\r\n {\r\n return (\r\n \r\n \r\n \r\n \r\n \r\n )\r\n },\r\n }}\r\n >\r\n \r\n \r\n )\r\n }\r\n render() {\r\n const contentType = this.getDataByKey(\"ExtraData.SlugInfo.EntityName\")\r\n let uiType = configUI?.[contentType]\r\n return (\r\n \r\n
{this.renderContent()}
\r\n
\r\n )\r\n }\r\n}\r\nconst Wrap = styled.div`\r\n height: 100%;\r\n & > div {\r\n height: 100%;\r\n & .myui-wrap-content {\r\n height: 100%;\r\n }\r\n }\r\n #share-like {\r\n margin-bottom: 10px;\r\n }\r\n &.not-found {\r\n flex: 1;\r\n & > div,\r\n & > div > div,\r\n & > div > div > div {\r\n height: 100%;\r\n }\r\n & > div > div > div {\r\n background-size: inherit !important;\r\n }\r\n }\r\n`\r\nconst WrapLoading = styled.div`\r\n position: relative;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n height: 100%;\r\n width: 100%;\r\n`\r\nexport default PageWithSlug\r\n"],"sourceRoot":""}