Skip to content

Commit

Permalink
feat: show wallet icon
Browse files Browse the repository at this point in the history
  • Loading branch information
beeman committed Mar 8, 2024
1 parent 5d35a7f commit d57daca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
18 changes: 17 additions & 1 deletion web/src/app/app-layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import { Group } from '@mantine/core'
import { useDisclosure } from '@mantine/hooks'
import { UiHeader, UiHeaderLink, UiLayout, UiThemeSwitch } from '@pubkey-ui/core'
import { ReactNode } from 'react'
import { WalletIcon } from './features/solana/solana-provider'

export function AppLayout({ children, links }: { children: ReactNode; links: UiHeaderLink[] }) {
const [opened, { toggle }] = useDisclosure(false)
return (
<UiLayout header={<UiHeader opened={opened} toggle={toggle} links={links} profile={<UiThemeSwitch />} />}>
<UiLayout
header={
<UiHeader
opened={opened}
toggle={toggle}
links={links}
profile={
<Group>
<UiThemeSwitch />
<WalletIcon />
</Group>
}
/>
}
>
{children}
</UiLayout>
)
Expand Down
3 changes: 2 additions & 1 deletion web/src/app/features/solana/solana-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnchorProvider } from '@coral-xyz/anchor'
import { WalletModalProvider, WalletMultiButton } from '@pubkeyapp/wallet-adapter-mantine-ui'
import { WalletModalProvider, WalletMultiButton, WalletMultiIcon } from '@pubkeyapp/wallet-adapter-mantine-ui'
import { WalletError } from '@solana/wallet-adapter-base'
import {
AnchorWallet,
Expand All @@ -13,6 +13,7 @@ import { clusterApiUrl } from '@solana/web3.js'
import { ReactNode, useCallback } from 'react'

export const WalletButton = WalletMultiButton
export const WalletIcon = WalletMultiIcon

export function SolanaProvider({ children }: { children: ReactNode }) {
const endpoint = clusterApiUrl('devnet')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function useTransactionListener(reference: PublicKey) {
}
console.error('Unknown error', e)
}
}, 500)
}, 1000)
return () => {
clearInterval(interval)
}
Expand Down

0 comments on commit d57daca

Please sign in to comment.