Skip to content

Commit

Permalink
Merge branch 'main' into webauthn
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglescode committed Dec 26, 2024
2 parents b173402 + d102f4a commit 0f23303
Show file tree
Hide file tree
Showing 22 changed files with 1,187 additions and 925 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { CardanoWallet, useWalletList } from "@meshsdk/react";
import { useEffect, useRef } from "react";

import { CardanoWallet, useWallet, useWalletList } from "@meshsdk/react";

import { getProvider } from "./mesh-wallet";

export default function ConnectBrowserWallet() {
const wallets = useWalletList();
const hasAvailableWallets = wallets.length > 0;

return (
<>
{hasAvailableWallets ? (
Expand Down
15 changes: 14 additions & 1 deletion apps/playground/src/components/site/navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useEffect, useRef, useState } from "react";
import { useRouter } from "next/router";
import {
Bars4Icon,
Expand All @@ -7,6 +7,9 @@ import {
SunIcon,
XMarkIcon,
} from "@heroicons/react/24/solid";
import toast from "react-hot-toast";

import { useWallet } from "@meshsdk/react";

import Icon from "~/components/icon";
import Link from "~/components/link";
Expand All @@ -29,6 +32,16 @@ export default function Navbar() {

const [query, setQuery] = useState<string>("");

const { connected } = useWallet();
const connectedRef = useRef(false);

useEffect(() => {
if (connected && !connectedRef.current) {
connectedRef.current = true;
toast("Wallet connected");
}
}, [connected]);

useEffect(() => {
setIsSSR(false);
}, []);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BrowserWallet } from "@meshsdk/core";
import { useWallet } from "@meshsdk/react";

import ConnectBrowserWallet from "~/components/cardano/connect-browser-wallet";
Expand Down
Loading

0 comments on commit 0f23303

Please sign in to comment.