|
1 | 1 | "use client" |
2 | 2 | import { SignMessage } from "@/components/sections/SignMessage" |
3 | 3 | import { Transactions } from "@/components/sections/Transactions/Transactions" |
| 4 | +import { useAccount } from "@starknet-react/core" |
| 5 | +import { useState } from "react" |
4 | 6 | import { Connect } from "./connect/Connect" |
5 | | -import { Flex } from "./ui/Flex" |
| 7 | +import { Header } from "./Header" |
6 | 8 | import { AccountStatus } from "./sections/AccountStatus" |
7 | 9 | import { AddToken } from "./sections/ERC20/AddToken" |
8 | 10 | import { Network } from "./sections/Network/Network" |
| 11 | +import { SectionButton } from "./sections/SectionButton" |
| 12 | +import { Section } from "./sections/types" |
9 | 13 |
|
10 | | -const StarknetDapp = () => ( |
11 | | - <Flex |
12 | | - flexDirection="column" |
13 | | - maxWidth="500px" |
14 | | - width="100%" |
15 | | - margin="0 auto" |
16 | | - gap="24px" |
17 | | - > |
18 | | - <AccountStatus /> |
19 | | - <Connect /> |
20 | | - <Transactions /> |
21 | | - <SignMessage /> |
22 | | - <Network /> |
23 | | - <AddToken /> |
24 | | - </Flex> |
25 | | -) |
| 14 | +const StarknetDapp = () => { |
| 15 | + const [section, setSection] = useState<Section | undefined>(undefined) |
| 16 | + const { isConnected } = useAccount() |
| 17 | + |
| 18 | + return ( |
| 19 | + <div className="flex full column"> |
| 20 | + <Header /> |
| 21 | + |
| 22 | + <div className="flex get-started-container"> |
| 23 | + <div className="flex column"> |
| 24 | + <h1 className="get-started-title">your</h1> |
| 25 | + <span className="get-started-subtitle"> |
| 26 | + Starknet utilizes the power of STARK technology to ensure |
| 27 | + computational integrity. |
| 28 | + </span> |
| 29 | + </div> |
| 30 | + |
| 31 | + <div className="status-grid-container"> |
| 32 | + <AccountStatus /> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | + |
| 36 | + <div className="flex sections-container"> |
| 37 | + <div className="flex full column sections-list"> |
| 38 | + <SectionButton |
| 39 | + section="Connection" |
| 40 | + setSection={setSection} |
| 41 | + selected={section === "Connection"} |
| 42 | + /> |
| 43 | + <SectionButton |
| 44 | + section="Transactions" |
| 45 | + setSection={setSection} |
| 46 | + selected={section === "Transactions"} |
| 47 | + disabled={!isConnected} |
| 48 | + /> |
| 49 | + <SectionButton |
| 50 | + section="Signing" |
| 51 | + setSection={setSection} |
| 52 | + selected={section === "Signing"} |
| 53 | + disabled={!isConnected} |
| 54 | + /> |
| 55 | + <SectionButton |
| 56 | + section="Network" |
| 57 | + setSection={setSection} |
| 58 | + selected={section === "Network"} |
| 59 | + disabled={!isConnected} |
| 60 | + /> |
| 61 | + <SectionButton |
| 62 | + section="ERC20" |
| 63 | + setSection={setSection} |
| 64 | + selected={section === "ERC20"} |
| 65 | + disabled={!isConnected} |
| 66 | + /> |
| 67 | + </div> |
| 68 | + |
| 69 | + <div className="flex full-flex"> |
| 70 | + {section === "Connection" && <Connect />} |
| 71 | + {section === "Transactions" && <Transactions />} |
| 72 | + {section === "Signing" && <SignMessage />} |
| 73 | + {section === "Network" && <Network />} |
| 74 | + {section === "ERC20" && <AddToken />} |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + ) |
| 79 | +} |
26 | 80 |
|
27 | 81 | export { StarknetDapp } |
0 commit comments