-
Notifications
You must be signed in to change notification settings - Fork 23
Add connect wallet page #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import { useState } from 'react' | ||
|
|
||
| import { useTranslation } from 'next-i18next' | ||
| import { serverSideTranslations } from 'next-i18next/serverSideTranslations' | ||
| import Image from 'next/image' | ||
|
|
||
| import SignForm from '../../components/SignForm' | ||
|
|
||
| export async function getServerSideProps(context) { | ||
| const { locale } = context | ||
| return { | ||
| props: { | ||
| ...(await serverSideTranslations(locale, ['common'])) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export default function ConnectWallet() { | ||
| const { t } = useTranslation('common') | ||
|
|
||
| const [account, setAccount] = useState(null) | ||
| const [signRequest, setSignRequest] = useState(null) | ||
| const [refreshPage, setRefreshPage] = useState('') | ||
| const [wcSession, setWcSession] = useState(null) | ||
|
|
||
| const handleWalletClick = (wallet) => { | ||
| setSignRequest({ | ||
| wallet: wallet, | ||
| redirectName: 'connect-wallet' | ||
| }) | ||
| } | ||
|
|
||
| return ( | ||
| <main className="content-center"> | ||
| <h1>{t('connect-wallet.title', 'Connect your crypto wallet')}</h1> | ||
| <p> | ||
| {t( | ||
| 'connect-wallet.description', | ||
| 'Connect your crypto wallet to the blockchain explorer to start exploring XRP Ledger.' | ||
| )} | ||
| </p> | ||
| <section className="mx-auto max-w-sm"> | ||
| <ul className="list-none flex flex-col gap-2"> | ||
| <li className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300"> | ||
| <span onClick={() => handleWalletClick('xaman')}> | ||
| <Image src="/images/wallets/xaman.png" alt="Xaman" width={24} height={24} /> | ||
| <span>Xaman</span> | ||
| </span> | ||
|
Comment on lines
+43
to
+48
|
||
| </li> | ||
| <li | ||
| onClick={() => handleWalletClick('crossmark')} | ||
| className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300" | ||
| > | ||
| <span> | ||
| <Image | ||
| src="/images/wallets/crossmark.png" | ||
| className="wallet-logo" | ||
| alt="Crossmark Wallet" | ||
| height={24} | ||
| width={24} | ||
| /> | ||
| Crossmark | ||
| </span> | ||
| </li> | ||
| <li className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300"> | ||
| <span onClick={() => handleWalletClick('gemwallet')}> | ||
| <Image | ||
| src="/images/wallets/gemwallet.svg" | ||
| className="wallet-logo" | ||
| alt="GemWallet" | ||
| height={24} | ||
| width={24} | ||
| /> | ||
| GemWallet | ||
| </span> | ||
| </li> | ||
| <li className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300"> | ||
| <span onClick={() => handleWalletClick('metamask')}> | ||
| <Image | ||
| src="/images/wallets/metamask.svg" | ||
| className="wallet-logo" | ||
| alt="Metamask Wallet" | ||
| height={24} | ||
| width={24} | ||
| /> | ||
| Metamask | ||
| </span> | ||
| </li> | ||
| <li className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300"> | ||
| <span onClick={() => handleWalletClick('ledgerwallet')}> | ||
| <Image | ||
| src="/images/wallets/ledgerwallet.svg" | ||
| className="wallet-logo" | ||
| alt="Ledger Wallet" | ||
| height={24} | ||
| width={24} | ||
| /> | ||
| Ledger | ||
| </span> | ||
| </li> | ||
| <li className="flex justify-center items-center gap-2 border-2 border-black p-2 hover:shadow-[4px_4px_0px_0px] transition-shadow duration-300"> | ||
| <span onClick={() => handleWalletClick('trezor')}> | ||
| <Image | ||
| src="/images/wallets/trezor.svg" | ||
| className="wallet-logo" | ||
| alt="Trezor Wallet" | ||
| height={24} | ||
| width={24} | ||
| /> | ||
| Trezor | ||
| </span> | ||
| </li> | ||
| </ul> | ||
| </section> | ||
| <SignForm | ||
| signRequest={signRequest} | ||
| setSignRequest={setSignRequest} | ||
| refreshPage={refreshPage} | ||
| setRefreshPage={setRefreshPage} | ||
| account={account} | ||
| setAccount={setAccount} | ||
| wcSession={wcSession} | ||
| setWcSession={setWcSession} | ||
| /> | ||
|
Comment on lines
+115
to
+124
|
||
| </main> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| .sign-in-form { | ||
| background: rgba(black, 0.6); | ||
| position: absolute; | ||
| position: fixed; | ||
| top: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ body.dark { | |
| .content-text, | ||
| .content-center, | ||
| .content-profile { | ||
| z-index: 1; | ||
| // z-index: 1; | ||
| position: relative; | ||
| } | ||
|
Comment on lines
99
to
104
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!signRequest) return nullis executed beforeafterSigning,onSignIn,afterSubmitExe, etc. are initialized, but theuseEffect([uuid])callback above references those bindings. In cases where the app rendersSignFormwith a UUID but nosignRequest(seepages/_app.jscondition(signRequest || isValidUUID(uuid))), this will cause a runtime error when the effect runs. Either avoid returning early in this way, or only return early when bothsignRequestanduuidare absent, and ensure any functions used by effects are defined before the return.