From 8c0903393cf2cb2a929ba70a8ab6ddcc4cba0574 Mon Sep 17 00:00:00 2001 From: sct Date: Sat, 2 Jan 2021 08:33:24 +0000 Subject: [PATCH] fix(holiday): remove special holiday slider --- src/components/Discover/Holiday/index.tsx | 70 -------------------- src/components/Discover/index.tsx | 81 ++++------------------- src/pages/discover/holiday.tsx | 9 --- 3 files changed, 12 insertions(+), 148 deletions(-) delete mode 100644 src/components/Discover/Holiday/index.tsx delete mode 100644 src/pages/discover/holiday.tsx diff --git a/src/components/Discover/Holiday/index.tsx b/src/components/Discover/Holiday/index.tsx deleted file mode 100644 index 319101946..000000000 --- a/src/components/Discover/Holiday/index.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React, { useContext } from 'react'; -import { useSWRInfinite } from 'swr'; -import type { MovieResult } from '../../../../server/models/Search'; -import ListView from '../../Common/ListView'; -import { LanguageContext } from '../../../context/LanguageContext'; -import Header from '../../Common/Header'; - -interface SearchResult { - page: number; - totalResults: number; - totalPages: number; - results: MovieResult[]; -} - -const Holiday: React.FC = () => { - const { locale } = useContext(LanguageContext); - const { data, error, size, setSize } = useSWRInfinite( - (pageIndex: number, previousPageData: SearchResult | null) => { - if (previousPageData && pageIndex + 1 > previousPageData.totalPages) { - return null; - } - - return `/api/v1/discover/keyword/207317/movies?page=${ - pageIndex + 1 - }&language=${locale}`; - }, - { - initialSize: 3, - } - ); - - const isLoadingInitialData = !data && !error; - const isLoadingMore = - isLoadingInitialData || - (size > 0 && data && typeof data[size - 1] === 'undefined'); - - const fetchMore = () => { - setSize(size + 1); - }; - - if (error) { - return
{error}
; - } - - const titles = data?.reduce( - (a, v) => [...a, ...v.results], - [] as MovieResult[] - ); - - const isEmpty = !isLoadingInitialData && titles?.length === 0; - const isReachingEnd = - isEmpty || (data && data[data.length - 1]?.results.length < 20); - - return ( - <> -
Happy Holidays!
- 0) - } - isReachingEnd={isReachingEnd} - onScrollBottom={fetchMore} - /> - - ); -}; - -export default Holiday; diff --git a/src/components/Discover/index.tsx b/src/components/Discover/index.tsx index 7790150f9..5377970d0 100644 --- a/src/components/Discover/index.tsx +++ b/src/components/Discover/index.tsx @@ -63,12 +63,6 @@ const Discover: React.FC = () => { } = useSWR( `/api/v1/discover/movies/upcoming?language=${locale}` ); - const { - data: holUpcomingData, - error: holUpcomingError, - } = useSWR( - `/api/v1/discover/keyword/207317/movies?language=${locale}` - ); const { data: trendingData, error: trendingError } = useSWR( `/api/v1/discover/trending?language=${locale}` @@ -87,9 +81,9 @@ const Discover: React.FC = () => { return ( <> -
+
-
+
@@ -108,10 +102,10 @@ const Discover: React.FC = () => { /> ))} /> -
+
- + @@ -146,61 +140,10 @@ const Discover: React.FC = () => { placeholder={} emptyMessage={intl.formatMessage(messages.nopending)} /> - {/* Special Temporary Slider */} - - ( - - ))} - /> - {/* End Special Temporary Slider */} -