diff --git a/package.json b/package.json
index c663c1c..2465531 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"react-transition-group": "^4.3.0",
+ "react-virtualized": "^9.22.2",
"simple-markdown": "^0.7.2",
"xmlrpc": "^1.3.2"
},
diff --git a/src/app/UserItemsPage.js b/src/app/UserItemsPage.js
index b4c0d81..0a3ecde 100644
--- a/src/app/UserItemsPage.js
+++ b/src/app/UserItemsPage.js
@@ -17,6 +17,7 @@ import {
Portal,
Wrap,
VStack,
+ useBreakpointValue,
useToast,
} from "@chakra-ui/core";
import {
@@ -30,6 +31,7 @@ import {
import gql from "graphql-tag";
import { useHistory, useParams } from "react-router-dom";
import { useQuery, useLazyQuery, useMutation } from "@apollo/client";
+import { AutoSizer, Grid, WindowScroller } from "react-virtualized";
import SimpleMarkdown from "simple-markdown";
import DOMPurify from "dompurify";
@@ -37,7 +39,6 @@ import HangerSpinner from "./components/HangerSpinner";
import { Heading1, Heading2, Heading3 } from "./util";
import ItemCard, {
ItemBadgeList,
- ItemCardList,
ItemKindBadge,
YouOwnThisBadge,
YouWantThisBadge,
@@ -234,7 +235,13 @@ function UserItemsPage() {
{isCurrentUser ? "Items you own" : `Items ${data.user.username} owns`}
-
+
{listsOfOwnedItems.map((closetList) => (
)}
{sortedItems.length > 0 ? (
-
+
{sortedItems.map((item) => (
))}
-
+
) : (
This list is empty!
)}
@@ -462,6 +469,51 @@ function ClosetList({ closetList, isCurrentUser, showHeading }) {
);
}
+function VirtualizedItemCardList({ children }) {
+ const columnCount = useBreakpointValue({ base: 1, md: 2, lg: 3 });
+ const rowCount = Math.ceil(children.length / columnCount);
+
+ return (
+
+ {({ width }) => (
+
+ {({
+ height,
+ isScrolling,
+ onChildScroll,
+ scrollTop,
+ registerChild,
+ }) => (
+
+ (
+ 0 ? "6" : "0"}
+ >
+ {children[rowIndex * columnCount + columnIndex]}
+
+ )}
+ columnCount={columnCount}
+ columnWidth={width / columnCount}
+ rowCount={rowCount}
+ rowHeight={100}
+ width={width}
+ height={height}
+ autoHeight
+ isScrolling={isScrolling}
+ onScroll={onChildScroll}
+ scrollTop={scrollTop}
+ />
+
+ )}
+
+ )}
+
+ );
+}
+
const unsafeMarkdownRules = {
autolink: SimpleMarkdown.defaultRules.autolink,
br: SimpleMarkdown.defaultRules.br,
diff --git a/src/app/components/ItemCard.js b/src/app/components/ItemCard.js
index ddfcc13..8ad92b2 100644
--- a/src/app/components/ItemCard.js
+++ b/src/app/components/ItemCard.js
@@ -22,6 +22,7 @@ function ItemCard({ item, badges, ...props }) {