-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from argentlabs/develop
updated ui
- Loading branch information
Showing
48 changed files
with
1,857 additions
and
830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
"use client" | ||
|
||
import { StarknetDapp } from "@/components/StarknetDapp" | ||
import { Flex } from "@/components/ui/Flex" | ||
import { connectors } from "@/connectors" | ||
import { CHAIN_ID } from "@/constants" | ||
import { mainnet, sepolia } from "@starknet-react/chains" | ||
import { publicProvider, StarknetConfig } from "@starknet-react/core" | ||
import { constants } from "starknet" | ||
|
||
/* TODO: update ui */ | ||
|
||
export default function Home() { | ||
const chains = [ | ||
CHAIN_ID === constants.NetworkName.SN_MAIN ? mainnet : sepolia, | ||
] | ||
const chains = [mainnet, sepolia] | ||
const providers = publicProvider() | ||
|
||
return ( | ||
<Flex flexDirection="column" className="demo-dapp-container"> | ||
{/* eslint-disable @typescript-eslint/no-explicit-any */} | ||
<div className="flex flex-col h-screen"> | ||
<StarknetConfig | ||
chains={chains} | ||
provider={providers} | ||
/* TODO: wait for starknet-react to update Connector interface */ | ||
connectors={connectors as any} | ||
connectors={connectors} | ||
> | ||
<StarknetDapp /> | ||
</StarknetConfig> | ||
{/* eslint-enable @typescript-eslint/no-explicit-any */} | ||
</Flex> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { isMainnet, toHexChainid } from "@/helpers/chainId" | ||
import { formatTruncatedAddress } from "@/helpers/formatAddress" | ||
import { useAccount, useBalance, useStarkProfile } from "@starknet-react/core" | ||
import { AvatarIcon } from "./icons/AvatarIcon" | ||
import { LogoIcon } from "./icons/LogoIcon" | ||
import { WalletIcon } from "./icons/WalletIcon" | ||
import { ExternalIcon } from "./icons/ExternalIcon" | ||
import { HeaderConnectButton } from "@/components/HeaderConnectButton" | ||
import Image from "next/image" | ||
|
||
const Header = () => { | ||
const { address, isConnected, chainId } = useAccount() | ||
|
||
const { data: balance } = useBalance({ | ||
address: address, | ||
}) | ||
|
||
const { data } = useStarkProfile({ address }) | ||
|
||
const hexChainId = toHexChainid(chainId) | ||
|
||
return ( | ||
<> | ||
<div className="flex p-5 md:pt-[32px] md:px-[116px] md:pb-[16px] bg-black"> | ||
<div className="flex w-full lg:max-w-[1180px] lg:mx-auto"> | ||
<div className="flex items-center w-full"> | ||
<div className="flex items-center gap-1"> | ||
<div className="w-10 h-10"> | ||
<LogoIcon /> | ||
</div> | ||
<h1 className="font-normal text-md md:text-xl leading-6 mt-0.5 text-nowrap"> | ||
Demo dapp | ||
</h1> | ||
</div> | ||
<div className="flex flex-1 w-full" /> | ||
|
||
{isConnected && ( | ||
<div className="flex border-col rounded-md md:rounded-lg gap-3 p-2 md:p-3 border border-solid border-charcoal font-medium text-sm md:text-base text-nowrap"> | ||
<div className="hidden md:flex items-center gap-2"> | ||
<WalletIcon /> | ||
{balance | ||
? balance?.formatted.length > 7 | ||
? `${balance.formatted.slice(0, 7)} ETH` | ||
: `${balance?.formatted} ETH` | ||
: "0 ETH"} | ||
</div> | ||
<div className="border-solid border-l-[1px] border-charcoal -my-1 mx-0 hidden md:flex" /> | ||
<div | ||
className="flex cursor-pointer items-center gap-2" | ||
onClick={() => | ||
window.open( | ||
isMainnet(hexChainId) | ||
? `https://voyager.online/contract/${address}` | ||
: `https://sepolia.voyager.online/contract/${address}`, | ||
"_blank", | ||
) | ||
} | ||
> | ||
{data?.profilePicture ? ( | ||
<Image | ||
alt="generic_profile" | ||
width={20} | ||
height={20} | ||
className="w-6 h-6" | ||
src={data?.profilePicture} | ||
/> | ||
) : ( | ||
<AvatarIcon /> | ||
)} | ||
{formatTruncatedAddress(address || "")} | ||
<ExternalIcon /> | ||
</div> | ||
</div> | ||
)} | ||
{!isConnected && <HeaderConnectButton />} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export { Header } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useConnect } from "@starknet-react/core" | ||
import { StarknetkitConnector, useStarknetkitConnectModal } from "starknetkit" | ||
|
||
const HeaderConnectButton = () => { | ||
const { connectAsync, connectors } = useConnect() | ||
|
||
const { starknetkitConnectModal } = useStarknetkitConnectModal({ | ||
connectors: connectors as StarknetkitConnector[], | ||
}) | ||
|
||
return ( | ||
<> | ||
<button | ||
className="px-12 bg-gradient-to-r from-nebula-from to-nebula-to text-white rounded-lg" | ||
onClick={async () => { | ||
const { connector } = await starknetkitConnectModal() | ||
if (!connector) { | ||
// or throw error | ||
return | ||
} | ||
await connectAsync({ connector }) | ||
}} | ||
> | ||
Connect wallet | ||
</button> | ||
</> | ||
) | ||
} | ||
|
||
export { HeaderConnectButton } |
Oops, something went wrong.