|
8 | 8 | import dayjs from "dayjs"; |
9 | 9 | import { useCallback } from "react"; |
10 | 10 | import { Link } from "react-router"; |
| 11 | +import { WindowVirtualizer } from "virtua"; |
11 | 12 | import Loader from "@/components/Shared/Loader"; |
12 | 13 | import { EmptyState, ErrorMessage } from "@/components/Shared/UI"; |
13 | 14 | import useLoadMoreOnIntersect from "@/hooks/useLoadMoreOnIntersect"; |
@@ -60,29 +61,31 @@ const List = () => { |
60 | 61 | } |
61 | 62 |
|
62 | 63 | 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> |
73 | 76 | </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> |
74 | 85 | </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> |
86 | 89 | </div> |
87 | 90 | ); |
88 | 91 | }; |
|
0 commit comments