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AAU,KACR,KAAKM,EAAAA,EAAAA,MAAcpC,EACjB,OAGF,MAAM+C,EAAWC,aAAY,KACvBnB,IACFoB,EAAAA,EAAAA,KACGpB,GACAc,IAA8C,IAADO,EAC5C1B,EAAqB,OAAJmB,QAAI,IAAJA,GAAY,QAARO,EAAJP,EAAME,cAAM,IAAAK,OAAR,EAAJA,EAAe,GAAG,GAGzC,GACCC,EAAAA,GAAgBC,gBAEnB,MAAO,KACLL,GAAYM,cAAcN,EAAS,CACpC,GACA,CAACrC,KAGF/B,EAAAA,EAAAA,KAAC2E,EAAAA,EAAQ,CACPC,QAAS3D,EACT4D,OAAQ9D,EACR+D,SACE1D,GAAmBC,GACjBrB,EAAAA,EAAAA,KAAA,WAEAA,EAAAA,EAAAA,KAACW,EAAAA,EAAmC,IAGxCoE,WAAY,CACVrC,iBACAX,UACAC,aACAE,UACAY,qBACAzB,YACAuB,kBAIR,C","sources":["elements/CasinoTournaments/views/TournamentSingleView/Desktop/Skeleton.tsx","elements/CasinoTournaments/views/TournamentSingleView/index.tsx"],"sourcesContent":["import { ReactElement } from 'react';\nimport 'newcomponents/Shared/LeaderBoardCustomTab/index.less';\nimport 'newcomponents/Shared/LeaderBoardCustomTab/LeaderBoardRow/index.less';\nimport { Skeleton } from 'newcomponents/UI/Skeleton';\nimport './style.less';\n\nconst CustomSkeleton = (\n  <Skeleton title={{ style: { width: '100%' } }} paragraph={true} active />\n);\n\nexport const SidebarSkeleton = (): ReactElement => (\n  <div className=\"tabsWrapper tabsWrapper--notIsCasino\">\n    <div className=\"sidebarRow\">{CustomSkeleton}</div>\n    <div className=\"sidebarRow\">{CustomSkeleton}</div>\n    <div className=\"sidebarRow\">{CustomSkeleton}</div>\n  </div>\n);\n\nexport const DesktopTournamentSingleViewSkeleton = (): ReactElement => {\n  return (\n    <>\n      <div className=\"tournamentSingleView__banner tournamentSingleView__banner__img tournamentSingleView__banner__skeleton\">\n        <Skeleton.Image\n          style={{\n            width: '100%',\n            height: 450\n          }}\n        />\n      </div>\n      <div className=\"tournamentSingleView__infoContainer\">\n        <div className=\"tournamentSingleView__infoContainer__mainSection\">\n          <div className=\"tournamentSingleView__infoContainer__mainSection__tournamentInfo\">\n            <Skeleton\n              title={{ style: { width: '100%' } }}\n              paragraph={true}\n              active\n            />\n          </div>\n          <div className=\"tournamentSingleView__infoContainer__mainSection__tournamentInfo\">\n            <Skeleton\n              title={{ style: { width: '100%' } }}\n              paragraph={true}\n              active\n            />\n          </div>\n          <div className=\"tournamentSingleView__infoContainer__mainSection__subSection\">\n            {CustomSkeleton}\n          </div>\n        </div>\n        <SidebarSkeleton />\n      </div>\n    </>\n  );\n};\n","import { ReactElement, useEffect, useState } from 'react';\nimport { useSelector } from 'react-redux';\nimport { useLocation } from 'react-router-dom';\nimport { timeoutDuration } from 'utils/constants/dateInfo/time-numbers';\nimport { lazy } from 'utils/generic/lazy';\nimport { isMobile } from 'utils/is-mobile';\nimport {\n  CasinoTournamentsType,\n  ETournamentProductTypeIds,\n  TournamentPlayerList\n} from 'interfaces/casino-data';\nimport {\n  getTournament,\n  getTournamentStats\n} from 'services/casino/casino-tournaments';\nimport { DesktopTournamentSingleViewSkeleton } from './Desktop/Skeleton';\nimport { Viewport } from 'components/Viewport';\nimport { useMounted } from 'hooks/useMounted';\nimport { useSearchParams } from 'hooks/useSearchParams';\nimport {\n  getCachedTournamentsData,\n  getTournamentActiveProductTypeId\n} from 'store/selectors/casino-data';\nimport { getIsLoggedIn, getUser } from 'store/selectors/user-data';\n\nconst { MobileTournamentSingleView } = lazy(\n  () =>\n    import(\n      /* webpackChunkName: \"mobile-casino-tournaments-single\" */ './Mobile'\n    )\n);\n\nconst { DesktopTournamentSingleView } = lazy(\n  () =>\n    import(\n      /* webpackChunkName: \"desktop-casino-tournaments-single\" */ './Desktop'\n    )\n);\n\ntype Props = {\n  notNeedSkeleton?: boolean;\n  fromIndex?: boolean;\n};\n\nexport const TournamentSingleView = function ({\n  notNeedSkeleton,\n  fromIndex\n}: Props): ReactElement {\n  const tournaments = useSelector(getCachedTournamentsData);\n  const activeProductTypeId = useSelector(getTournamentActiveProductTypeId);\n\n  const queries = useSearchParams();\n  const { mounted } = useMounted();\n  const [visible, setVisible] = useState(false);\n  const [loading, setLoading] = useState(true);\n  const location = useLocation();\n  const user = useSelector(getUser);\n  const isLoggedIn = useSelector(getIsLoggedIn);\n  const [tournamentData, setTournamentData] =\n    useState<CasinoTournamentsType | null>(null);\n\n  const [topPlayerList, setTopPlayerList] =\n    useState<TournamentPlayerList | null>(null);\n\n  const isSportsTournament =\n    tournamentData?.ProductTypeId === ETournamentProductTypeIds.SPORT;\n\n  const tournamentId = queries.tournamentId;\n\n  useEffect(() => {\n    document.documentElement.scrollTop = 0;\n    document.body.scrollTop = 0;\n  }, []);\n\n  useEffect(() => {\n    if (\n      !user.pending &&\n      !notNeedSkeleton &&\n      (isMobile() || !fromIndex) &&\n      tournamentId\n    ) {\n      setVisible(true);\n\n      if (activeProductTypeId && tournaments[activeProductTypeId].length) {\n        const tournament = tournaments[activeProductTypeId].find(\n          item => item.Id === +tournamentId\n        );\n\n        if (tournament) {\n          setTournamentData(tournament);\n        }\n      }\n\n      setLoading(true);\n      getTournament(\n        +tournamentId,\n        (data: { result: CasinoTournamentsType }) => {\n          if (!mounted.current) {\n            return;\n          }\n\n          setLoading(false);\n          setTournamentData(data.result);\n        }\n      );\n    } else if (tournamentData) {\n      setTournamentData(null);\n    }\n\n    if (!tournamentId && visible) {\n      setVisible(false);\n    }\n  }, [location.search, !!user.pending, isLoggedIn]);\n\n  useEffect(() => {\n    if (!isMobile() && fromIndex) {\n      return;\n    }\n\n    const interval = setInterval(() => {\n      if (tournamentId) {\n        getTournamentStats(\n          +tournamentId,\n          (data: { result: [TournamentPlayerList] }) => {\n            setTopPlayerList(data?.result?.[0]);\n          }\n        );\n      }\n    }, timeoutDuration.DURATION_30000);\n\n    return () => {\n      interval && clearInterval(interval);\n    };\n  }, [visible]);\n\n  return (\n    <Viewport\n      desktop={DesktopTournamentSingleView}\n      mobile={MobileTournamentSingleView}\n      fallback={\n        notNeedSkeleton || fromIndex ? (\n          <div />\n        ) : (\n          <DesktopTournamentSingleViewSkeleton />\n        )\n      }\n      innerProps={{\n        tournamentData,\n        visible,\n        setVisible,\n        loading,\n        isSportsTournament,\n        fromIndex,\n        topPlayerList\n      }}\n    />\n  );\n};\n"],"names":["CustomSkeleton","_jsx","Skeleton","title","style","width","paragraph","active","SidebarSkeleton","_jsxs","className","children","DesktopTournamentSingleViewSkeleton","_Fragment","Image","height","MobileTournamentSingleView","lazy","DesktopTournamentSingleView","TournamentSingleView","_ref","notNeedSkeleton","fromIndex","tournaments","useSelector","getCachedTournamentsData","activeProductTypeId","getTournamentActiveProductTypeId","queries","useSearchParams","mounted","useMounted","visible","setVisible","useState","loading","setLoading","location","useLocation","user","getUser","isLoggedIn","getIsLoggedIn","tournamentData","setTournamentData","topPlayerList","setTopPlayerList","isSportsTournament","ProductTypeId","ETournamentProductTypeIds","SPORT","tournamentId","useEffect","document","documentElement","scrollTop","body","pending","isMobile","length","tournament","find","item","Id","getTournament","data","current","result","search","interval","setInterval","getTournamentStats","_data$result","timeoutDuration","DURATION_30000","clearInterval","Viewport","desktop","mobile","fallback","innerProps"],"sourceRoot":""}