-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: show sample dapps to connect (only once)
- Loading branch information
Showing
7 changed files
with
77 additions
and
29 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -15,7 +15,3 @@ | |
top: var(--space-3); | ||
right: var(--space-3); | ||
} | ||
|
||
.divider { | ||
margin: 0 calc(-1 * var(--space-4)); | ||
} |
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,6 +1,6 @@ | ||
.icon { | ||
color: #3a99fb; | ||
width: 40px; | ||
font-size: 50px; | ||
} | ||
|
||
.errorBadge { | ||
|
56 changes: 56 additions & 0 deletions
56
src/components/walletconnect/WcSessionList/WcNoSessions.tsx
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,56 @@ | ||
import ExternalLink from '@/components/common/ExternalLink' | ||
import useSafeInfo from '@/hooks/useSafeInfo' | ||
import useLocalStorage from '@/services/local-storage/useLocalStorage' | ||
import { Typography } from '@mui/material' | ||
import { useCallback, useEffect } from 'react' | ||
|
||
const SAMPLE_DAPPS = [ | ||
{ name: 'Zerion', icon: '/images/common/nft-zerion.svg', url: 'https://app.zerion.io/connect-wallet' }, | ||
{ name: 'Zapper', icon: '/images/common/nft-zapper.svg', url: 'https://zapper.xyz/' }, | ||
{ name: 'OpenSea', icon: '/images/common/nft-opensea.svg', url: 'https://opensea.io/' }, | ||
] | ||
|
||
const LS_KEY = 'native_wc_dapps' | ||
|
||
const WcSampleDapps = ({ onUnload }: { onUnload: () => void }) => { | ||
// Only show the sample dApps list once | ||
useEffect(() => { | ||
return onUnload | ||
}, [onUnload]) | ||
|
||
return ( | ||
<Typography variant="body2" display="flex" justifyContent="space-between" alignItems="center" mt={3}> | ||
{SAMPLE_DAPPS.map((item) => ( | ||
<ExternalLink href={item.url} key={item.url} noIcon px={1}> | ||
<img src={item.icon} alt={item.name} width={32} height={32} /> | ||
<Typography variant="body2" ml={1}> | ||
{item.name} | ||
</Typography> | ||
</ExternalLink> | ||
))} | ||
</Typography> | ||
) | ||
} | ||
|
||
const WcNoSessions = () => { | ||
const { safeLoaded } = useSafeInfo() | ||
const [showDapps = true, setShowDapps] = useLocalStorage<boolean>(LS_KEY) | ||
|
||
const onUnload = useCallback(() => { | ||
setShowDapps(false) | ||
}, [setShowDapps]) | ||
|
||
const sampleDapps = showDapps && safeLoaded && <WcSampleDapps onUnload={onUnload} /> | ||
|
||
return ( | ||
<> | ||
<Typography variant="body2" textAlign="center" color="text.secondary"> | ||
No dApps are connected yet.{sampleDapps ? ' Try one of these:' : ''} | ||
</Typography> | ||
|
||
{sampleDapps} | ||
</> | ||
) | ||
} | ||
|
||
export default WcNoSessions |
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