Limit stats numbers

This commit is contained in:
Mihovil Ilakovac 2023-08-23 16:40:05 +02:00
parent d59f02add2
commit d7c564043c

View File

@ -103,6 +103,10 @@ export function Stats() {
: []; : [];
}, [stats, stats?.projects, filterOutExampleApps, filterOutKnownUsers]); }, [stats, stats?.projects, filterOutExampleApps, filterOutKnownUsers]);
const limitedFilteredStats = useMemo(() => {
return filteredStats.slice(0, 1000);
}, [filteredStats]);
if (isLoading) { if (isLoading) {
return <p>Loading</p>; return <p>Loading</p>;
} }
@ -271,7 +275,7 @@ export function Stats() {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{filteredStats.map((stat) => ( {limitedFilteredStats.map((stat) => (
<tr className="bg-white border-b" key={stat.id}> <tr className="bg-white border-b" key={stat.id}>
<th <th
scope="row" scope="row"
@ -334,6 +338,11 @@ export function Stats() {
))} ))}
</tbody> </tbody>
</table> </table>
{filteredStats.length > limitedFilteredStats.length && (
<div className="relative px-6 py-3 bg-gray-50 text-sm text-slate-500 text-center">
Showing only the latest 1000 projects
</div>
)}
</div> </div>
</> </>
)} )}