diff --git a/bin/init.js b/bin/init.js index 1206eda..7141f85 100644 --- a/bin/init.js +++ b/bin/init.js @@ -347,7 +347,7 @@ export async function init() { "@farcaster/frame-sdk": ">=0.0.31 <1.0.0", "@farcaster/frame-wagmi-connector": ">=0.0.19 <1.0.0", "@farcaster/mini-app-solana": ">=0.0.17 <1.0.0", - "@neynar/react": "^1.2.2", + "@neynar/react": "^1.2.5", "@radix-ui/react-label": "^2.1.1", "@solana/wallet-adapter-react": "^0.15.38", "@tanstack/react-query": "^5.61.0", diff --git a/package.json b/package.json index 7a14132..ad33a78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/create-farcaster-mini-app", - "version": "1.4.0", + "version": "1.4.1", "type": "module", "private": false, "access": "public", diff --git a/src/app/providers.tsx b/src/app/providers.tsx index 7b5160a..56c2f1f 100644 --- a/src/app/providers.tsx +++ b/src/app/providers.tsx @@ -18,7 +18,7 @@ export function Providers({ session, children }: { session: Session | null, chil return ( - + {children} diff --git a/src/components/Demo.tsx b/src/components/Demo.tsx index 0ae0372..16216e7 100644 --- a/src/components/Demo.tsx +++ b/src/components/Demo.tsx @@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import { signIn, signOut, getCsrfToken } from "next-auth/react"; import sdk, { SignIn as SignInCore, + type Haptics, } from "@farcaster/frame-sdk"; import { useAccount, @@ -52,13 +53,17 @@ export default function Demo( added, notificationDetails, actions, + setInitialTab, + setActiveTab, + currentTab, + haptics, } = useMiniApp(); const [isContextOpen, setIsContextOpen] = useState(false); - const [activeTab, setActiveTab] = useState('home'); const [txHash, setTxHash] = useState(null); const [sendNotificationResult, setSendNotificationResult] = useState(""); const [copied, setCopied] = useState(false); const [neynarUser, setNeynarUser] = useState(null); + const [hapticIntensity, setHapticIntensity] = useState('medium'); const { address, isConnected } = useAccount(); const chainId = useChainId(); @@ -66,6 +71,13 @@ export default function Demo( const solanaWallet = useSolanaWallet(); const { publicKey: solanaPublicKey } = solanaWallet; + // Set initial tab to home on page load + useEffect(() => { + if (isSDKLoaded) { + setInitialTab('home'); + } + }, [isSDKLoaded, setInitialTab]); + useEffect(() => { console.log("isSDKLoaded", isSDKLoaded); console.log("context", context); @@ -226,7 +238,7 @@ export default function Demo(

{title}

- {activeTab === 'home' && ( + {currentTab === 'home' && (

Put your content here!

@@ -235,7 +247,7 @@ export default function Demo(
)} - {activeTab === 'actions' && ( + {currentTab === 'actions' && (
actions.openUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ")} className="w-full">Open Link - - @@ -280,10 +290,39 @@ export default function Demo( > {copied ? "Copied!" : "Copy share URL"} + +
+ + + +
)} - {activeTab === 'context' && ( + {currentTab === 'context' && (

Context

@@ -294,7 +333,7 @@ export default function Demo(
)} - {activeTab === 'wallet' && USE_WALLET && ( + {currentTab === 'wallet' && USE_WALLET && (
{address && (
@@ -389,7 +428,7 @@ export default function Demo(
)} -
); diff --git a/src/components/ui/Share.tsx b/src/components/ui/Share.tsx index 8cb1b0e..d58ec9e 100644 --- a/src/components/ui/Share.tsx +++ b/src/components/ui/Share.tsx @@ -97,7 +97,7 @@ export function ShareButton({ buttonText, cast, className = '', isLoading = fals parent: cast.parent, channelKey: cast.channelKey, close: cast.close, - }, 'share-button'); + }); } catch (error) { console.error('Failed to share:', error); } finally {