From 4562a33926a7674cded530fec50a21fc0b305a5c Mon Sep 17 00:00:00 2001
From: infinite-persistence
Date: Tue, 15 Jun 2021 16:24:16 +0800
Subject: [PATCH] Lazy-load homepage categories
---
ui/page/home/view.jsx | 71 ++++++++++++++++++++++++++++---------------
1 file changed, 47 insertions(+), 24 deletions(-)
diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx
index 1c2c1b10e..0ccbf65d4 100644
--- a/ui/page/home/view.jsx
+++ b/ui/page/home/view.jsx
@@ -6,9 +6,11 @@ import React from 'react';
import Page from 'component/page';
import Button from 'component/button';
import ClaimTilesDiscover from 'component/claimTilesDiscover';
+import ClaimPreviewTile from 'component/claimPreviewTile';
import Icon from 'component/common/icon';
import I18nMessage from 'component/i18nMessage';
import LbcSymbol from 'component/common/lbc-symbol';
+import WaitUntilOnPage from 'component/common/wait-until-on-page';
import useGetLivestreams from 'effects/use-get-livestreams';
type Props = {
@@ -37,6 +39,48 @@ function HomePage(props: Props) {
showNsfw
);
+ function getRowElements(title, route, link, icon, help, options, index) {
+ const tilePlaceholder = (
+
+ {new Array(options.pageSize || 8).fill(1).map((x, i) => (
+
+ ))}
+
+ );
+ const claimTiles = ;
+
+ return (
+
+ {index !== 0 && title && typeof title === 'string' && (
+
+
+
+ )}
+
+ {index === 0 && <>{claimTiles}>}
+ {index !== 0 && (
+
+ {claimTiles}
+
+ )}
+
+ {(route || link) && (
+
+ )}
+
+ );
+ }
+
return (
{IS_WEB && DOMAIN === 'lbry.tv' && (
@@ -81,30 +125,9 @@ function HomePage(props: Props) {
)}
- {rowData.map(({ title, route, link, icon, help, options = {} }, index) => (
-
- {index !== 0 && title && typeof title === 'string' && (
-
-
-
- )}
-
-
- {(route || link) && (
-
- )}
-
- ))}
+ {rowData.map(({ title, route, link, icon, help, options = {} }, index) => {
+ return getRowElements(title, route, link, icon, help, options, index);
+ })}
);
}