|
|
|
|
@ -1,7 +1,9 @@ |
|
|
|
|
import { Fragment } from 'react' |
|
|
|
|
import { Fragment, useMemo } from 'react' |
|
|
|
|
|
|
|
|
|
import { T9n } from 'features/T9n' |
|
|
|
|
import { InfiniteScroll } from 'features/InfiniteScroll' |
|
|
|
|
import { Loader } from 'features/Loader' |
|
|
|
|
import { isMobileDevice } from 'config/userAgent' |
|
|
|
|
|
|
|
|
|
import type { Props } from './hooks' |
|
|
|
|
import { useMatches } from './hooks' |
|
|
|
|
@ -22,6 +24,27 @@ export const Matches = (props: Props) => { |
|
|
|
|
}, |
|
|
|
|
} = useMatches(props) |
|
|
|
|
|
|
|
|
|
const mobileView = useMemo(() => ( |
|
|
|
|
isFetching ? ( |
|
|
|
|
<Loader color='white' /> |
|
|
|
|
) : ( |
|
|
|
|
<MatchesList |
|
|
|
|
as='grid' |
|
|
|
|
matches={broadcast} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
), [isFetching, broadcast]) |
|
|
|
|
|
|
|
|
|
const desktopView = useMemo(() => ( |
|
|
|
|
<> |
|
|
|
|
<MatchesList |
|
|
|
|
as='grid' |
|
|
|
|
matches={broadcast} |
|
|
|
|
/> |
|
|
|
|
{isFetching && <Loading><T9n t='loading' />...</Loading>} |
|
|
|
|
</> |
|
|
|
|
), [isFetching, broadcast]) |
|
|
|
|
|
|
|
|
|
if (isVideoSections) { |
|
|
|
|
return ( |
|
|
|
|
<Fragment> |
|
|
|
|
@ -46,11 +69,7 @@ export const Matches = (props: Props) => { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<InfiniteScroll fullPageScroll onFetchMore={fetchMoreMatches}> |
|
|
|
|
<MatchesList |
|
|
|
|
as='grid' |
|
|
|
|
matches={broadcast} |
|
|
|
|
/> |
|
|
|
|
{isFetching && <Loading><T9n t='loading' />...</Loading>} |
|
|
|
|
{isMobileDevice ? mobileView : desktopView} |
|
|
|
|
</InfiniteScroll> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|