Skip to content

Commit

Permalink
Added message when wallet connected
Browse files Browse the repository at this point in the history
  • Loading branch information
pindaroso committed Oct 10, 2024
1 parent 1d7763d commit 5859c6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function RootLayout({
{children}
<Toaster
toastOptions={{
className: 'bg-secondary text-primary',
className: 'dark:bg-secondary bg-secondary dark:text-primary',
position: 'bottom-left',
duration: 10_000,
style: {
Expand Down
13 changes: 11 additions & 2 deletions packages/app/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ export default function Home() {

const [blockNumber, setBlockNumber] = useState<number | null>(null)
const [balance, setBalance] = useState<number | null>(null)
const [network, setNetwork] = useState<string>(defaultNetwork)
const [networkActive, setNetworkActive] = useState<boolean>(false)
const [network, setNetwork] = useState(defaultNetwork)
const [networkActive, setNetworkActive] = useState(false)
const [walletConnected, setWalletConnected] = useState(false)

useEffect(() => {
if (publicKey && !walletConnected) {
setWalletConnected(true)
toast.success('Wallet connected')
}
}, [publicKey])

useEffect(() => {
const conn = new Connection(endpoint, 'confirmed')
Expand Down Expand Up @@ -135,6 +143,7 @@ export default function Home() {
onClick={(e) => {
e.preventDefault()
disconnect()
setWalletConnected(false)
setBalance(null)
}}
>
Expand Down
1 change: 0 additions & 1 deletion packages/app/src/components/airdrop-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Button } from '@/components/ui/button'

export const AirdropButton: FC = () => {
const { publicKey } = useWallet()

const { endpoint } = useWalletContext()

const onClick = useCallback(async () => {
Expand Down

0 comments on commit 5859c6d

Please sign in to comment.