From d32c37b336faaff7afe2e79cd5630d997d34fed4 Mon Sep 17 00:00:00 2001 From: Andrei Dekterev Date: Thu, 17 Mar 2022 19:49:05 +0700 Subject: [PATCH] fix(#1701): fix conflicts --- .../components/FinishedMatch/helpers.tsx | 137 ------------------ .../components/FinishedMatch/hooks/index.tsx | 53 ------- .../FinishedMatch/hooks/useChapters.tsx | 46 ------ .../FinishedMatch/hooks/useEpisodes.tsx | 69 --------- .../components/FinishedMatch/styled.tsx | 27 ---- .../MatchPage/components/LiveMatch/index.tsx | 1 + src/features/MatchPage/index.tsx | 5 - .../store/hooks/usePlayerClickHandler.tsx | 25 ++++ src/features/StreamPlayer/hooks/index.tsx | 8 +- src/features/TournamentsPopup/index.tsx | 2 +- src/requests/getMatchPlaylists.tsx | 15 +- src/requests/index.tsx | 1 - 12 files changed, 35 insertions(+), 354 deletions(-) delete mode 100644 src/features/MatchPage/components/FinishedMatch/helpers.tsx delete mode 100644 src/features/MatchPage/components/FinishedMatch/hooks/index.tsx delete mode 100644 src/features/MatchPage/components/FinishedMatch/hooks/useChapters.tsx delete mode 100644 src/features/MatchPage/components/FinishedMatch/hooks/useEpisodes.tsx delete mode 100644 src/features/MatchPage/components/FinishedMatch/styled.tsx create mode 100644 src/features/MatchPopup/store/hooks/usePlayerClickHandler.tsx diff --git a/src/features/MatchPage/components/FinishedMatch/helpers.tsx b/src/features/MatchPage/components/FinishedMatch/helpers.tsx deleted file mode 100644 index 9639a342..00000000 --- a/src/features/MatchPage/components/FinishedMatch/helpers.tsx +++ /dev/null @@ -1,137 +0,0 @@ -import map from 'lodash/map' -import last from 'lodash/last' -import uniq from 'lodash/uniq' -import filter from 'lodash/filter' -import reduce from 'lodash/reduce' -import concat from 'lodash/concat' -import orderBy from 'lodash/orderBy' -import isEmpty from 'lodash/isEmpty' -import groupBy from 'lodash/groupBy' - -import type { - Videos, - Episodes, - Episode, -} from 'requests' - -import type { Chapters, Urls } from 'features/MultiSourcePlayer/types' - -import type { PlaylistOption } from '../../types' -import { FULL_GAME_KEY } from '../../helpers/buildPlaylists' - -const getUniquePeriods = (videos: Videos) => uniq(map(videos, ({ period }) => period)) - -type Video = { - duration: number, - period: number, - urls: Urls, -} - -const getVideoByPeriod = (videos: Videos, period: number) => { - const videosWithSamePeriod = filter(videos, { period }) - if (isEmpty(videosWithSamePeriod)) return null - - const urls = reduce( - videosWithSamePeriod, - (acc: Urls, video) => ({ - ...acc, - [video.quality]: video.url, - }), - {}, - ) - const [video] = videosWithSamePeriod - return { - duration: video.duration, - period: video.period, - urls, - } -} - -const getVideoByPeriods = (videos: Videos, periods: Array) => ( - reduce( - periods, - (acc: Array