Skip to content

Commit e8a25d7

Browse files
committed
[Dashboard] replace chakra stats in accounts (#7188)
## Summary - swap chakra `SimpleGrid`, `Stat`, `Skeleton` for shadcn `StatCard` - use Tailwind grid utility classes ## Checklist - [x] `pnpm biome check --apply` - [x] `pnpm test` *(fails: spawn anvil ENOENT)* <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the `AccountsCount` component to replace the `Card` and `SimpleGrid` components from `@chakra-ui/react` with a new layout using `StatCard` from a different module, enhancing the presentation of the total accounts data. ### Detailed summary - Removed imports for `SimpleGrid`, `Skeleton`, `Stat`, `StatLabel`, and `StatNumber`. - Added import for `StatCard` from `../../overview/components/stat-card`. - Changed the layout from `SimpleGrid` and `Card` to a `div` with a grid layout. - Updated the rendering to use `StatCard` for displaying the total accounts. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated the accounts count display to use a new StatCard component with improved layout and styling for a more consistent and responsive user interface. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 44a7460 commit e8a25d7

File tree

1 file changed

+8
-16
lines changed
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/accounts/components

1 file changed

+8
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
"use client";
22

3-
import {
4-
SimpleGrid,
5-
Skeleton,
6-
Stat,
7-
StatLabel,
8-
StatNumber,
9-
} from "@chakra-ui/react";
103
import type { ThirdwebContract } from "thirdweb";
114
import { totalAccounts } from "thirdweb/extensions/erc4337";
125
import { useReadContract } from "thirdweb/react";
13-
import { Card } from "tw-components";
6+
import { StatCard } from "../../overview/components/stat-card";
147

158
type AccountsCountProps = {
169
contract: ThirdwebContract;
@@ -19,13 +12,12 @@ type AccountsCountProps = {
1912
export const AccountsCount: React.FC<AccountsCountProps> = ({ contract }) => {
2013
const totalAccountsQuery = useReadContract(totalAccounts, { contract });
2114
return (
22-
<SimpleGrid columns={{ base: 1, md: 3 }} spacing={{ base: 3, md: 6 }}>
23-
<Card as={Stat}>
24-
<StatLabel mb={{ base: 1, md: 0 }}>Total Accounts</StatLabel>
25-
<Skeleton isLoaded={totalAccountsQuery.isSuccess}>
26-
<StatNumber>{totalAccountsQuery.data?.toString()}</StatNumber>
27-
</Skeleton>
28-
</Card>
29-
</SimpleGrid>
15+
<div className="grid grid-cols-1 gap-3 md:grid-cols-3 md:gap-6">
16+
<StatCard
17+
label="Total Accounts"
18+
value={totalAccountsQuery.data?.toString() || "0"}
19+
isPending={totalAccountsQuery.isPending}
20+
/>
21+
</div>
3022
);
3123
};

0 commit comments

Comments
 (0)