-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Custom Wallet Option on Labs (#2283)
Co-authored-by: tomiir <[email protected]> Co-authored-by: enesozturk <[email protected]>
- Loading branch information
1 parent
712252d
commit eee91c9
Showing
8 changed files
with
132 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import { | ||
Button, | ||
Drawer, | ||
DrawerBody, | ||
DrawerCloseButton, | ||
DrawerContent, | ||
DrawerHeader, | ||
DrawerOverlay, | ||
Input, | ||
Link, | ||
Stack, | ||
Text, | ||
useDisclosure | ||
} from '@chakra-ui/react' | ||
import { useState, type ChangeEvent } from 'react' | ||
import { CUSTOM_WALLET } from '../utils/ConstantsUtil' | ||
|
||
interface Props { | ||
controls: ReturnType<typeof useDisclosure> | ||
} | ||
|
||
export function CustomWallet({ controls }: Props) { | ||
const [customWallet, setCustomWallet] = useState({ | ||
id: 'custom', | ||
name: '', | ||
image_url: '', | ||
mobile_link: '', | ||
desktop_link: '', | ||
webapp_link: '' | ||
}) | ||
|
||
function handleCustomWallet() { | ||
localStorage.setItem(CUSTOM_WALLET, JSON.stringify(customWallet)) | ||
location.reload() | ||
} | ||
|
||
function handleChange(e: ChangeEvent<HTMLInputElement>) { | ||
setCustomWallet(prev => ({ ...prev, [e.target.name]: e.target.value })) | ||
} | ||
|
||
const { isOpen, onClose } = controls | ||
|
||
return ( | ||
<Drawer isOpen={isOpen} placement="right" onClose={onClose} size="md"> | ||
<DrawerOverlay /> | ||
<DrawerContent> | ||
<DrawerCloseButton /> | ||
<DrawerHeader>Add a Custom Wallet</DrawerHeader> | ||
<Text pt="2" fontSize="sm" padding={6}> | ||
Add a custom wallet to the modal. This feature is for wallets that are under the Explorer | ||
submission process.{' '} | ||
<Link | ||
isExternal | ||
color="blue.500" | ||
href="https://docs.walletconnect.com/cloud/explorer-submission#how-do-we-test-wallets" | ||
> | ||
Learn more. | ||
</Link> | ||
</Text> | ||
<DrawerBody> | ||
<Stack spacing={4}> | ||
<Input | ||
name="name" | ||
value={customWallet.name} | ||
onChange={handleChange} | ||
variant="outline" | ||
placeholder="Name" | ||
/> | ||
<Input | ||
name="image_url" | ||
value={customWallet.image_url} | ||
onChange={handleChange} | ||
variant="outline" | ||
placeholder="Image URL" | ||
/> | ||
<Input | ||
name="mobile_link" | ||
value={customWallet.mobile_link} | ||
onChange={handleChange} | ||
variant="outline" | ||
placeholder="Mobile Linking (Optional)" | ||
/> | ||
<Input | ||
name="desktop_link" | ||
value={customWallet.desktop_link} | ||
onChange={handleChange} | ||
variant="outline" | ||
placeholder="Desktop Linking (Optional)" | ||
/> | ||
<Input | ||
name="webapp_link" | ||
value={customWallet.webapp_link} | ||
onChange={handleChange} | ||
variant="outline" | ||
placeholder="Webapp Linking (Optional)" | ||
/> | ||
<Button onClick={handleCustomWallet}>Add Wallet</Button> | ||
</Stack> | ||
</DrawerBody> | ||
</DrawerContent> | ||
</Drawer> | ||
) | ||
} |
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