feat: copy share url button and frames to mini app in cli text

This commit is contained in:
veganbeef
2025-05-09 14:08:06 -07:00
parent 08091fc206
commit 5fe54a80da
6 changed files with 59 additions and 42 deletions

View File

@@ -34,6 +34,7 @@ export default function Demo(
const [isContextOpen, setIsContextOpen] = useState(false);
const [txHash, setTxHash] = useState<string | null>(null);
const [sendNotificationResult, setSendNotificationResult] = useState("");
const [copied, setCopied] = useState(false);
const { address, isConnected } = useAccount();
const chainId = useChainId();
@@ -289,6 +290,22 @@ export default function Demo(
Send notification
</Button>
</div>
<div className="mb-4">
<Button
onClick={async () => {
if (context?.user?.fid) {
const shareUrl = `${process.env.NEXT_PUBLIC_URL}/share/${context.user.fid}`;
await navigator.clipboard.writeText(shareUrl);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
}
}}
disabled={!context?.user?.fid}
>
{copied ? "Copied!" : "Copy share URL"}
</Button>
</div>
</div>
<div>