Livestream category improvements #7115

Merged
infinite-persistence merged 15 commits from ip/category.livestream into master 2021-09-24 16:26:22 +02:00
2 changed files with 13 additions and 2 deletions
Showing only changes of commit 48073d411b - Show all commits

View file

@ -16,6 +16,7 @@ const SORT_OLD = 'old';
type Props = { type Props = {
uris: Array<string>, uris: Array<string>,
prefixUris?: Array<string>,
header: Node | boolean, header: Node | boolean,
headerAltControls: Node, headerAltControls: Node,
loading: boolean, loading: boolean,
@ -49,6 +50,7 @@ export default function ClaimList(props: Props) {
const { const {
activeUri, activeUri,
uris, uris,
prefixUris,
headerAltControls, headerAltControls,
loading, loading,
persistedStorageKey, persistedStorageKey,
@ -75,10 +77,15 @@ export default function ClaimList(props: Props) {
} = props; } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
// Exclude prefix uris in these results variables. We don't want to show
// anything if the search failed or timed out.
const timedOut = uris === null; const timedOut = uris === null;
const urisLength = (uris && uris.length) || 0; const urisLength = (uris && uris.length) || 0;
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || []; const tileUris = (prefixUris || []).concat(uris);
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? tileUris : tileUris.slice().reverse())) || [];
const noResultMsg = searchInLanguage const noResultMsg = searchInLanguage
? __('No results. Contents may be hidden by the Language filter.') ? __('No results. Contents may be hidden by the Language filter.')
: __('No results'); : __('No results');
@ -117,7 +124,7 @@ export default function ClaimList(props: Props) {
return tileLayout && !header ? ( return tileLayout && !header ? (
<section className="claim-grid"> <section className="claim-grid">
{urisLength > 0 && {urisLength > 0 &&
uris.map((uri) => ( tileUris.map((uri) => (
<ClaimPreviewTile <ClaimPreviewTile
key={uri} key={uri}
uri={uri} uri={uri}

View file

@ -18,6 +18,7 @@ import { useIsLargeScreen } from 'effects/use-screensize';
type Props = { type Props = {
uris: Array<string>, uris: Array<string>,
prefixUris?: Array<string>,
name?: string, name?: string,
type: string, type: string,
pageSize?: number, pageSize?: number,
@ -135,6 +136,7 @@ function ClaimListDiscover(props: Props) {
injectedItem, injectedItem,
feeAmount, feeAmount,
uris, uris,
prefixUris,
tileLayout, tileLayout,
hideFilters = false, hideFilters = false,
claimIds, claimIds,
@ -569,6 +571,7 @@ function ClaimListDiscover(props: Props) {
tileLayout tileLayout
loading={loading} loading={loading}
uris={renderUris} uris={renderUris}
prefixUris={prefixUris}
onScrollBottom={handleScrollBottom} onScrollBottom={handleScrollBottom}
page={page} page={page}
pageSize={dynamicPageSize} pageSize={dynamicPageSize}
@ -601,6 +604,7 @@ function ClaimListDiscover(props: Props) {
type={type} type={type}
loading={loading} loading={loading}
uris={renderUris} uris={renderUris}
prefixUris={prefixUris}
onScrollBottom={handleScrollBottom} onScrollBottom={handleScrollBottom}
page={page} page={page}
pageSize={dynamicPageSize} pageSize={dynamicPageSize}