|
|
@ -2,6 +2,7 @@ import Button from '@app/components/Common/Button';
|
|
|
|
import Tooltip from '@app/components/Common/Tooltip';
|
|
|
|
import Tooltip from '@app/components/Common/Tooltip';
|
|
|
|
import { sliderTitles } from '@app/components/Discover/constants';
|
|
|
|
import { sliderTitles } from '@app/components/Discover/constants';
|
|
|
|
import MediaSlider from '@app/components/MediaSlider';
|
|
|
|
import MediaSlider from '@app/components/MediaSlider';
|
|
|
|
|
|
|
|
import { WatchProviderSelector } from '@app/components/Selector';
|
|
|
|
import { encodeURIExtraParams } from '@app/hooks/useDiscover';
|
|
|
|
import { encodeURIExtraParams } from '@app/hooks/useDiscover';
|
|
|
|
import type {
|
|
|
|
import type {
|
|
|
|
TmdbCompanySearchResponse,
|
|
|
|
TmdbCompanySearchResponse,
|
|
|
@ -55,7 +56,7 @@ type CreateOption = {
|
|
|
|
dataUrl: string;
|
|
|
|
dataUrl: string;
|
|
|
|
params?: string;
|
|
|
|
params?: string;
|
|
|
|
titlePlaceholderText: string;
|
|
|
|
titlePlaceholderText: string;
|
|
|
|
dataPlaceholderText: string;
|
|
|
|
dataPlaceholderText?: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
|
|
|
|
const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
|
|
|
@ -276,6 +277,20 @@ const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
|
|
|
|
titlePlaceholderText: intl.formatMessage(messages.slidernameplaceholder),
|
|
|
|
titlePlaceholderText: intl.formatMessage(messages.slidernameplaceholder),
|
|
|
|
dataPlaceholderText: intl.formatMessage(messages.providetmdbsearch),
|
|
|
|
dataPlaceholderText: intl.formatMessage(messages.providetmdbsearch),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
type: DiscoverSliderType.TMDB_MOVIE_STREAMING_SERVICES,
|
|
|
|
|
|
|
|
title: intl.formatMessage(sliderTitles.tmdbmoviestreamingservices),
|
|
|
|
|
|
|
|
dataUrl: '/api/v1/discover/movies',
|
|
|
|
|
|
|
|
params: 'watchRegion=$regionValue&watchProviders=$providersValue',
|
|
|
|
|
|
|
|
titlePlaceholderText: intl.formatMessage(messages.slidernameplaceholder),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
type: DiscoverSliderType.TMDB_TV_STREAMING_SERVICES,
|
|
|
|
|
|
|
|
title: intl.formatMessage(sliderTitles.tmdbtvstreamingservices),
|
|
|
|
|
|
|
|
dataUrl: '/api/v1/discover/tv',
|
|
|
|
|
|
|
|
params: 'watchRegion=$regionValue&watchProviders=$providersValue',
|
|
|
|
|
|
|
|
titlePlaceholderText: intl.formatMessage(messages.slidernameplaceholder),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -417,6 +432,40 @@ const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DiscoverSliderType.TMDB_MOVIE_STREAMING_SERVICES:
|
|
|
|
|
|
|
|
dataInput = (
|
|
|
|
|
|
|
|
<WatchProviderSelector
|
|
|
|
|
|
|
|
type={'movie'}
|
|
|
|
|
|
|
|
region={slider?.data?.split(',')[0]}
|
|
|
|
|
|
|
|
activeProviders={
|
|
|
|
|
|
|
|
slider?.data
|
|
|
|
|
|
|
|
?.split(',')[1]
|
|
|
|
|
|
|
|
.split('|')
|
|
|
|
|
|
|
|
.map((v) => Number(v)) ?? []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
onChange={(region, providers) => {
|
|
|
|
|
|
|
|
setFieldValue('data', `${region},${providers.join('|')}`);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DiscoverSliderType.TMDB_TV_STREAMING_SERVICES:
|
|
|
|
|
|
|
|
dataInput = (
|
|
|
|
|
|
|
|
<WatchProviderSelector
|
|
|
|
|
|
|
|
type={'tv'}
|
|
|
|
|
|
|
|
region={slider?.data?.split(',')[0]}
|
|
|
|
|
|
|
|
activeProviders={
|
|
|
|
|
|
|
|
slider?.data
|
|
|
|
|
|
|
|
?.split(',')[1]
|
|
|
|
|
|
|
|
.split('|')
|
|
|
|
|
|
|
|
.map((v) => Number(v)) ?? []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
onChange={(region, providers) => {
|
|
|
|
|
|
|
|
setFieldValue('data', `${region},${providers.join('|')}`);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
dataInput = (
|
|
|
|
dataInput = (
|
|
|
|
<Field
|
|
|
|
<Field
|
|
|
@ -488,10 +537,25 @@ const CreateSlider = ({ onCreate, slider }: CreateSliderProps) => {
|
|
|
|
'$value',
|
|
|
|
'$value',
|
|
|
|
encodeURIExtraParams(values.data)
|
|
|
|
encodeURIExtraParams(values.data)
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
extraParams={activeOption.params?.replace(
|
|
|
|
extraParams={
|
|
|
|
'$value',
|
|
|
|
activeOption.type ===
|
|
|
|
encodeURIExtraParams(values.data)
|
|
|
|
DiscoverSliderType.TMDB_MOVIE_STREAMING_SERVICES ||
|
|
|
|
)}
|
|
|
|
activeOption.type ===
|
|
|
|
|
|
|
|
DiscoverSliderType.TMDB_TV_STREAMING_SERVICES
|
|
|
|
|
|
|
|
? activeOption.params
|
|
|
|
|
|
|
|
?.replace(
|
|
|
|
|
|
|
|
'$regionValue',
|
|
|
|
|
|
|
|
encodeURIExtraParams(values?.data.split(',')[0])
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.replace(
|
|
|
|
|
|
|
|
'$providersValue',
|
|
|
|
|
|
|
|
encodeURIExtraParams(values?.data.split(',')[1])
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: activeOption.params?.replace(
|
|
|
|
|
|
|
|
'$value',
|
|
|
|
|
|
|
|
encodeURIExtraParams(values.data)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
onNewTitles={updateResultCount}
|
|
|
|
onNewTitles={updateResultCount}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|