Skip to content

Commit 1ead811

Browse files
committed
feat: Add WalletInformation section
1 parent 9e1ad7a commit 1ead811

File tree

8 files changed

+49
-100
lines changed

8 files changed

+49
-100
lines changed

src/components/account/Overview.tsx

Lines changed: 0 additions & 87 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/account/profile/Profile.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ProfileSection from './ProfileSection';
22
import PublicProfile from './PublicProfile';
3+
import WalletInformation from './WalletInformation';
34

45
export default function Profile() {
56
return (
@@ -8,10 +9,8 @@ export default function Profile() {
89
<PublicProfile />
910
</ProfileSection>
1011

11-
<ProfileSection title="Account">
12-
<div>PersonalInformation</div>
13-
{/* TODO: USDC Balance */}
14-
{/* <PersonalInformation /> */}
12+
<ProfileSection title="Wallet">
13+
<WalletInformation />
1514
</ProfileSection>
1615
</div>
1716
);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { config } from '@lib/config';
2+
import { BlockchainContextType, useBlockchainContext } from '@lib/contexts/blockchain';
3+
import { fBI } from '@lib/utils';
4+
import { DetailsCard } from '@shared/cards/DetailsCard';
5+
import ProfileRow from '@shared/ProfileRow';
6+
import { useEffect, useState } from 'react';
7+
import ProfileSectionWrapper from './ProfileSectionWrapper';
8+
9+
export default function WalletInformation() {
10+
const { fetchErc20Balance } = useBlockchainContext() as BlockchainContextType;
11+
12+
const [usdcBalance, setUsdcBalance] = useState<bigint>(0n);
13+
14+
// Init
15+
useEffect(() => {
16+
fetchErc20Balance(config.usdcContractAddress).then((balance) => {
17+
setUsdcBalance(balance);
18+
});
19+
}, []);
20+
21+
return (
22+
<ProfileSectionWrapper>
23+
{/* Account */}
24+
<div className="col gap-2">
25+
<DetailsCard>
26+
<div className="col gap-4 sm:gap-1.5">
27+
<ProfileRow label="$USDC Balance" value={fBI(usdcBalance, 6)} />
28+
</div>
29+
</DetailsCard>
30+
</div>
31+
</ProfileSectionWrapper>
32+
);
33+
}

src/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ layer(base);
112112
@apply text-sm font-medium;
113113
}
114114

115+
.section-title {
116+
@apply flex min-h-[28px] items-center text-[17px] font-semibold;
117+
}
118+
115119
/* Scrollbar */
116120
*::-webkit-scrollbar {
117121
width: 8px;

src/pages/Account.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import BurnReport from '@components/account/BurnReport';
2-
import Invoicing from '@components/account/Invoicing';
2+
import Invoicing from '@components/account/invoicing/Invoicing';
33
import Profile from '@components/account/profile/Profile';
44
import { routePath } from '@lib/routes/route-paths';
55
import CustomTabs from '@shared/CustomTabs';
@@ -9,14 +9,14 @@ import { RiBillLine, RiFireLine } from 'react-icons/ri';
99
import { useNavigate } from 'react-router-dom';
1010

1111
function Account() {
12-
const [selectedTab, setSelectedTab] = useState<'profile' | 'invoicing' | 'burn-report'>('profile');
12+
const [selectedTab, setSelectedTab] = useState<'invoicing' | 'profile' | 'burn-report'>('invoicing');
1313
const navigate = useNavigate();
1414

1515
useEffect(() => {
1616
const params = new URLSearchParams(window.location.search);
1717
const tab = params.get('tab');
1818

19-
if (tab && (tab === 'profile' || tab === 'invoicing' || tab === 'burn-report')) {
19+
if (tab && (tab === 'invoicing' || tab === 'profile' || tab === 'burn-report')) {
2020
setSelectedTab(tab);
2121
}
2222
}, [window.location.search]);
@@ -25,16 +25,16 @@ function Account() {
2525
<div className="col w-full flex-1 gap-5">
2626
<CustomTabs
2727
tabs={[
28-
{
29-
key: 'profile',
30-
title: 'Profile',
31-
icon: <CgProfile />,
32-
},
3328
{
3429
key: 'invoicing',
3530
title: 'Invoicing',
3631
icon: <RiBillLine />,
3732
},
33+
{
34+
key: 'profile',
35+
title: 'Profile',
36+
icon: <CgProfile />,
37+
},
3838
{
3939
key: 'burn-report',
4040
title: 'Burn Report',
@@ -51,8 +51,8 @@ function Account() {
5151
}}
5252
/>
5353

54-
{selectedTab === 'profile' && <Profile />}
5554
{selectedTab === 'invoicing' && <Invoicing />}
55+
{selectedTab === 'profile' && <Profile />}
5656
{selectedTab === 'burn-report' && <BurnReport />}
5757
</div>
5858
);

0 commit comments

Comments
 (0)