From 48073d411bae7db97f4750d37d7b58c7cdaa1bf5 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Fri, 17 Sep 2021 17:20:39 +0800 Subject: [PATCH] ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover This will be initially used to append livestreams at the top. --- ui/component/claimList/view.jsx | 11 +++++++++-- ui/component/claimListDiscover/view.jsx | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ui/component/claimList/view.jsx b/ui/component/claimList/view.jsx index 30153d28f..bdfd5450a 100644 --- a/ui/component/claimList/view.jsx +++ b/ui/component/claimList/view.jsx @@ -16,6 +16,7 @@ const SORT_OLD = 'old'; type Props = { uris: Array, + prefixUris?: Array, header: Node | boolean, headerAltControls: Node, loading: boolean, @@ -49,6 +50,7 @@ export default function ClaimList(props: Props) { const { activeUri, uris, + prefixUris, headerAltControls, loading, persistedStorageKey, @@ -75,10 +77,15 @@ export default function ClaimList(props: Props) { } = props; 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 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 ? __('No results. Contents may be hidden by the Language filter.') : __('No results'); @@ -117,7 +124,7 @@ export default function ClaimList(props: Props) { return tileLayout && !header ? (
{urisLength > 0 && - uris.map((uri) => ( + tileUris.map((uri) => ( , + prefixUris?: Array, name?: string, type: string, pageSize?: number, @@ -135,6 +136,7 @@ function ClaimListDiscover(props: Props) { injectedItem, feeAmount, uris, + prefixUris, tileLayout, hideFilters = false, claimIds, @@ -569,6 +571,7 @@ function ClaimListDiscover(props: Props) { tileLayout loading={loading} uris={renderUris} + prefixUris={prefixUris} onScrollBottom={handleScrollBottom} page={page} pageSize={dynamicPageSize} @@ -601,6 +604,7 @@ function ClaimListDiscover(props: Props) { type={type} loading={loading} uris={renderUris} + prefixUris={prefixUris} onScrollBottom={handleScrollBottom} page={page} pageSize={dynamicPageSize}