diff --git a/components/MainUI/Init.tsx b/components/MainUI/Init.tsx index 932486d..95553bf 100644 --- a/components/MainUI/Init.tsx +++ b/components/MainUI/Init.tsx @@ -19,6 +19,7 @@ import TxError from "../SolanaPopups/TxError"; import InitializeGameAccount from "../SolanaPopups/Initialize"; import { extractKeywords, findRelatedEmojis } from "@/utils/emojiUtils"; import { callOpenRouterAPI, separateEmojisAndText } from "@/utils/reply"; +import type { Account } from "@ant-design/web3"; export type PageState = "chat" | "shop" | "info" | "user"; @@ -42,6 +43,7 @@ export default function Init({ const [isDialogOpen, setIsDialogOpen] = useState(true); const [emojisContent, setEmojisContent] = useState(""); //气泡表情内容 const [walletConnected, setWalletConnected] = useState(false); + const [address, setAddress] = useState(undefined); const { program } = useGameProgram(); const { publicKey } = usePublicKey(); @@ -318,6 +320,8 @@ export default function Init({ > { diff --git a/components/MainUI/SlideUI/UserPage.tsx b/components/MainUI/SlideUI/UserPage.tsx index ce48b54..c97c483 100644 --- a/components/MainUI/SlideUI/UserPage.tsx +++ b/components/MainUI/SlideUI/UserPage.tsx @@ -3,7 +3,6 @@ import { WindowContent } from "react95"; import Image from "next/image"; import { Page, WindowWrapper, Avatar } from "./styles"; import { useNavHeight } from "@/components/Root/navHeightContext"; - import { ConnectButton } from "@ant-design/web3"; import type { Account } from "@ant-design/web3"; import { showInitializeModal } from "@/utils/solana"; @@ -16,12 +15,16 @@ const pressStart2P = Press_Start_2P({ export default function UserPage({ userInfo, + address, + setAddress, gameAccount, solanaProvider, onWalletConnect, onWalletDisconnect, }: { userInfo: any; + address: Account | undefined; + setAddress: (address: Account | undefined) => void; gameAccount: any; solanaProvider: any; onWalletConnect: () => void; @@ -29,9 +32,6 @@ export default function UserPage({ }) { const { navHeight } = useNavHeight(); // 获取导航栏高度 - const [address, setAddress] = useState(undefined); - - // 处理钱包连接 const handleConnect = async () => { const res = await solanaProvider?.connect({}, false); const walletAddress = solanaProvider?.publicKey?.toString();