Skip to content

Commit 45a2811

Browse files
authored
Merge pull request #106 from defikids/dashboard-family-member-count
Dashboard family member count
2 parents 25e1e03 + 23996f1 commit 45a2811

File tree

4 files changed

+27
-37
lines changed

4 files changed

+27
-37
lines changed

app/parent-dashboard/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const Parent: React.FC = () => {
4242

4343
const [childKey, setChildKey] = useState<number>(0);
4444
const [childrenLoading, setChildrenLoading] = useState(false);
45-
const [children, setChildren] = useState([]);
45+
const [children, setChildren] = useState<string[]>([]);
4646
// const [stakeContract, setStakeContract] = useState<StakeContract>();
4747
const [familyDetails, setFamilyDetails] = useState({} as User);
4848

@@ -320,7 +320,7 @@ const Parent: React.FC = () => {
320320
bg={useColorModeValue("gray.100", "gray.900")}
321321
borderRadius={isMobileSize ? "0" : "10px"}
322322
>
323-
<FamilyStatistics />
323+
<FamilyStatistics members={userDetails.children || []} />
324324
</GridItem>
325325
</Grid>
326326
</Flex>

src/components/ExpandedDashboardMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const ExpandedDashboardMenu = ({
4545
onOpenAirdropModal,
4646
}: {
4747
familyDetails: User;
48-
children: User[];
48+
children: string[];
4949
onAddChildOpen: () => void;
5050
setSelectedTab: (tab: ParentDashboardTabs) => void;
5151
onToggleCollapsedMenu: () => void;

src/components/parentDashboard/ButtonMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ButtonMenu = ({
2828
onOpenNetworkModal: () => void;
2929
onOpenMembersTableModal: () => void;
3030
onOpenAirdropModal: () => void;
31-
children?: User[];
31+
children?: string[];
3232
}) => {
3333
const { userDetails } = useAuthStore(
3434
(state) => ({

src/components/parentDashboard/FamilyStatistics.tsx

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,42 @@
1-
import { Fragment } from "react";
21
import {
32
Container,
43
Flex,
5-
Stack,
6-
VStack,
7-
Icon,
8-
Divider,
94
useColorModeValue,
10-
Avatar,
115
Text,
126
Heading,
13-
Button,
14-
Badge,
157
Grid,
168
GridItem,
179
} from "@chakra-ui/react";
18-
import { SlOptions } from "react-icons/sl";
1910

2011
interface Notification {
2112
title: string;
2213
value: string;
2314
unit: string;
2415
}
2516

26-
const stats: Notification[] = [
27-
{
28-
title: "Members",
29-
value: "3",
30-
unit: "",
31-
},
32-
{
33-
title: "Currently Staked",
34-
value: "31,573",
35-
unit: "ETH",
36-
},
37-
{
38-
title: "Rewards Earned",
39-
value: "5",
40-
unit: "ETH",
41-
},
42-
{
43-
title: "Custom Contracts",
44-
value: "7",
45-
unit: "",
46-
},
47-
];
48-
49-
const FamilyStatistics = () => {
17+
const FamilyStatistics = ({ members }: { members: string[] }) => {
18+
const stats: Notification[] = [
19+
{
20+
title: "Members",
21+
value: members.length.toString(),
22+
unit: "",
23+
},
24+
{
25+
title: "Currently Staked",
26+
value: "31,573",
27+
unit: "ETH",
28+
},
29+
{
30+
title: "Rewards Earned",
31+
value: "5",
32+
unit: "ETH",
33+
},
34+
{
35+
title: "Custom Contracts",
36+
value: "7",
37+
unit: "",
38+
},
39+
];
5040
return (
5141
<Container maxW="5xl" bg={useColorModeValue("gray.100", "gray.900")}>
5242
<Flex justify="space-between" my="1rem" align="center">

0 commit comments

Comments
 (0)