-
Notifications
You must be signed in to change notification settings - Fork 4
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 #2201 from zeitgeistpm/web3-wallet-update
Web 3 Wallet Update - Custom Modal
- Loading branch information
Showing
22 changed files
with
908 additions
and
993 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
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Image from "next/image"; | ||
|
||
interface WalletIconProps { | ||
extensionName: string; | ||
logoAlt: string; | ||
logoSrc: string; | ||
onClick?: () => void; | ||
hasError?: boolean; | ||
error?: any; | ||
className?: string; | ||
} | ||
|
||
const WalletIcon = ({ | ||
logoAlt, | ||
logoSrc, | ||
extensionName, | ||
onClick, | ||
hasError, | ||
error, | ||
className, | ||
}: WalletIconProps) => { | ||
return ( | ||
<button | ||
key={extensionName} | ||
className="flex flex-1 cursor-pointer flex-row items-center justify-center rounded-md border bg-mystic py-1 hover:bg-gray-100" | ||
onClick={onClick} | ||
> | ||
<Image | ||
className={`center ${className}`} | ||
width={32} | ||
height={32} | ||
alt={logoAlt} | ||
src={logoSrc} | ||
/> | ||
{hasError && ( | ||
<div className="ml-auto w-ztg-275 text-ztg-12-120 text-vermilion"> | ||
{error.type === "NoAccounts" && | ||
"No accounts on this wallet. Please add account in wallet extension."} | ||
{error.type === "InteractionDenied" && | ||
"Not allowed to interact with extension. Please change permission settings."} | ||
</div> | ||
)} | ||
</button> | ||
); | ||
}; | ||
|
||
export default WalletIcon; |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import WalletIcon from "components/account/WalletIcon"; | ||
import useWeb3Wallet from "lib/hooks/useWeb3Wallet"; | ||
import { useState } from "react"; | ||
|
||
const Web3wallet = () => { | ||
const { loginGoogle, loginTwitter, loginDiscord, loginEmail } = | ||
useWeb3Wallet(); | ||
const [email, setEmail] = useState<string>(""); | ||
|
||
return ( | ||
<div> | ||
<h3 className="mb-4 text-lg font-bold">Social</h3> | ||
<div className="grid grid-cols-3 gap-x-6 gap-y-4"> | ||
<WalletIcon | ||
logoAlt="google" | ||
logoSrc="/icons/google-g.svg" | ||
extensionName="web3auth" | ||
onClick={loginGoogle} | ||
/> | ||
<WalletIcon | ||
logoAlt="twitter" | ||
logoSrc="/icons/x-logo.svg" | ||
extensionName="web3auth" | ||
className="px-1 invert" | ||
onClick={loginTwitter} | ||
/> | ||
<WalletIcon | ||
logoAlt="discord" | ||
logoSrc="/icons/discord.svg" | ||
extensionName="web3auth" | ||
onClick={loginDiscord} | ||
/> | ||
<div className="col-span-3 grid grid-cols-3 gap-x-6"> | ||
<h3 className="col-span-3 mb-4 text-lg font-bold">Email</h3> | ||
<input | ||
type="text" | ||
placeholder="Enter email for passwordless login" | ||
className="col-span-2 rounded-md border px-2 py-1 leading-8 placeholder:text-xs focus:outline-none focus:ring-1 focus:ring-ztg-blue" | ||
value={email} | ||
onChange={(e) => setEmail(e.target.value)} | ||
/> | ||
<button | ||
className="col-span-1 rounded-md bg-ztg-blue py-1 leading-8 text-white hover:bg-black" | ||
onClick={() => loginEmail(email)} | ||
> | ||
Submit | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Web3wallet; |
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
Oops, something went wrong.