Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
"use client";

import {
SimpleGrid,
Skeleton,
Stat,
StatLabel,
StatNumber,
} from "@chakra-ui/react";
import type { ThirdwebContract } from "thirdweb";
import { totalAccounts } from "thirdweb/extensions/erc4337";
import { useReadContract } from "thirdweb/react";
import { Card } from "tw-components";
import { StatCard } from "../../overview/components/stat-card";

type AccountsCountProps = {
contract: ThirdwebContract;
Expand All @@ -19,13 +12,12 @@ type AccountsCountProps = {
export const AccountsCount: React.FC<AccountsCountProps> = ({ contract }) => {
const totalAccountsQuery = useReadContract(totalAccounts, { contract });
return (
<SimpleGrid columns={{ base: 1, md: 3 }} spacing={{ base: 3, md: 6 }}>
<Card as={Stat}>
<StatLabel mb={{ base: 1, md: 0 }}>Total Accounts</StatLabel>
<Skeleton isLoaded={totalAccountsQuery.isSuccess}>
<StatNumber>{totalAccountsQuery.data?.toString()}</StatNumber>
</Skeleton>
</Card>
</SimpleGrid>
<div className="grid grid-cols-1 gap-3 md:grid-cols-3 md:gap-6">
<StatCard
label="Total Accounts"
value={totalAccountsQuery.data?.toString() || "0"}
isPending={totalAccountsQuery.isPending}
/>
</div>
);
};
Loading