WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 7b92ae3

Browse files
authored
perf: window rewards list (#6090)
1 parent d7b8a19 commit 7b92ae3

File tree

1 file changed

+24
-21
lines changed
  • apps/web/src/components/Settings/Rewards

1 file changed

+24
-21
lines changed

apps/web/src/components/Settings/Rewards/List.tsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
import dayjs from "dayjs";
99
import { useCallback } from "react";
1010
import { Link } from "react-router";
11+
import { WindowVirtualizer } from "virtua";
1112
import Loader from "@/components/Shared/Loader";
1213
import { EmptyState, ErrorMessage } from "@/components/Shared/UI";
1314
import useLoadMoreOnIntersect from "@/hooks/useLoadMoreOnIntersect";
@@ -60,29 +61,31 @@ const List = () => {
6061
}
6162

6263
return (
63-
<div className="flex flex-col divide-y divide-gray-200 dark:divide-gray-700">
64-
{tokenRewards.map((distribution) => (
65-
<div
66-
className="flex items-center justify-between p-5"
67-
key={distribution.txHash}
68-
>
69-
<div className="flex items-center space-x-2">
70-
<GiftIcon className="size-4 text-gray-500 dark:text-gray-200" />
71-
<div>
72-
Received <b>{Number(distribution.amount.value).toFixed(4)}</b>
64+
<div className="virtual-divider-list-window">
65+
<WindowVirtualizer>
66+
{tokenRewards.map((distribution) => (
67+
<div
68+
className="flex items-center justify-between p-5"
69+
key={distribution.txHash}
70+
>
71+
<div className="flex items-center space-x-2">
72+
<GiftIcon className="size-4 text-gray-500 dark:text-gray-200" />
73+
<div>
74+
Received <b>{Number(distribution.amount.value).toFixed(4)}</b>
75+
</div>
7376
</div>
77+
<Link
78+
className="text-gray-500 text-sm dark:text-gray-200"
79+
rel="noreferrer noopener"
80+
target="_blank"
81+
to={`${BLOCK_EXPLORER_URL}/tx/${distribution.txHash}`}
82+
>
83+
{dayjs(distribution.timestamp).format("MMM D, YYYY h:mm A")}
84+
</Link>
7485
</div>
75-
<Link
76-
className="text-gray-500 text-sm dark:text-gray-200"
77-
rel="noreferrer noopener"
78-
target="_blank"
79-
to={`${BLOCK_EXPLORER_URL}/tx/${distribution.txHash}`}
80-
>
81-
{dayjs(distribution.timestamp).format("MMM D, YYYY h:mm A")}
82-
</Link>
83-
</div>
84-
))}
85-
{hasMore && <span ref={loadMoreRef} />}
86+
))}
87+
{hasMore && <span ref={loadMoreRef} />}
88+
</WindowVirtualizer>
8689
</div>
8790
);
8891
};

0 commit comments

Comments
 (0)