Skip to content

Commit 1cf39c7

Browse files
committed
feat(watchlist): load ExternalWatchlistSlider in CreateSlider
Fix issue where slider looks different between create and other views
1 parent 3dfaebc commit 1cf39c7

File tree

1 file changed

+36
-31
lines changed
  • src/components/Discover/CreateSlider

1 file changed

+36
-31
lines changed

src/components/Discover/CreateSlider/index.tsx

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Button from '@app/components/Common/Button';
22
import Tooltip from '@app/components/Common/Tooltip';
33
import { sliderTitles } from '@app/components/Discover/constants';
4+
import ExternalWatchlistSlider from '@app/components/Discover/ExternalWatchlistSlider';
45
import MediaSlider from '@app/components/MediaSlider';
56
import { WatchProviderSelector } from '@app/components/Selector';
67
import { encodeURIExtraParams } from '@app/hooks/useDiscover';
@@ -538,38 +539,42 @@ const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
538539
</div>
539540
{activeOption && values.title && values.data && (
540541
<div className="relative py-4">
541-
<MediaSlider
542-
sliderKey={`preview-${values.title}`}
543-
title={values.title}
544-
url={
545-
activeOption.type === DiscoverSliderType.EXTERNAL_WATCHLIST
546-
? values.data
547-
: activeOption?.dataUrl.replace(
548-
'$value',
549-
encodeURIExtraParams(values.data)
550-
)
551-
}
552-
extraParams={
553-
activeOption.type ===
554-
DiscoverSliderType.TMDB_MOVIE_STREAMING_SERVICES ||
555-
activeOption.type ===
556-
DiscoverSliderType.TMDB_TV_STREAMING_SERVICES
557-
? activeOption.params
558-
?.replace(
559-
'$regionValue',
560-
encodeURIExtraParams(values?.data.split(',')[0])
561-
)
562-
.replace(
563-
'$providersValue',
564-
encodeURIExtraParams(values?.data.split(',')[1])
542+
{activeOption.type === DiscoverSliderType.EXTERNAL_WATCHLIST ? (
543+
<ExternalWatchlistSlider
544+
sliderKey={`custom-slider-${values.title}`}
545+
title={values.title}
546+
url={values.data}
547+
/>
548+
) : (
549+
<MediaSlider
550+
sliderKey={`preview-${values.title}`}
551+
title={values.title}
552+
url={activeOption?.dataUrl.replace(
553+
'$value',
554+
encodeURIExtraParams(values.data)
555+
)}
556+
extraParams={
557+
activeOption.type ===
558+
DiscoverSliderType.TMDB_MOVIE_STREAMING_SERVICES ||
559+
activeOption.type ===
560+
DiscoverSliderType.TMDB_TV_STREAMING_SERVICES
561+
? activeOption.params
562+
?.replace(
563+
'$regionValue',
564+
encodeURIExtraParams(values?.data.split(',')[0])
565+
)
566+
.replace(
567+
'$providersValue',
568+
encodeURIExtraParams(values?.data.split(',')[1])
569+
)
570+
: activeOption.params?.replace(
571+
'$value',
572+
encodeURIExtraParams(values.data)
565573
)
566-
: activeOption.params?.replace(
567-
'$value',
568-
encodeURIExtraParams(values.data)
569-
)
570-
}
571-
onNewTitles={updateResultCount}
572-
/>
574+
}
575+
onNewTitles={updateResultCount}
576+
/>
577+
)}
573578
</div>
574579
)}
575580
</Form>

0 commit comments

Comments
 (0)