From 753c8fd87ebc3661bdebc0062957f4f2f4ae3c75 Mon Sep 17 00:00:00 2001 From: Vladyslav Dalechyn Date: Sat, 12 Oct 2024 20:58:43 +0300 Subject: [PATCH] fat: mini app button (#500) * feat: mini-app deeplink * chore: changesets --- .changeset/sixty-olives-fold.md | 5 +++++ src/components/Button.tsx | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .changeset/sixty-olives-fold.md diff --git a/.changeset/sixty-olives-fold.md b/.changeset/sixty-olives-fold.md new file mode 100644 index 00000000..1e535f4b --- /dev/null +++ b/.changeset/sixty-olives-fold.md @@ -0,0 +1,5 @@ +--- +"frog": patch +--- + +Added a `Button.MiniApp` to deeplink to a mini-app. diff --git a/src/components/Button.tsx b/src/components/Button.tsx index d8688355..b652d094 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -6,6 +6,7 @@ export const buttonPrefix = { addComposerAction: '_b', link: '_l', mint: '_m', + miniApp: '_n', redirect: '_r', reset: '_c', transaction: '_t', @@ -90,6 +91,33 @@ export function ButtonLink({ ] as unknown as HtmlEscapedString } +export type ButtonMiniAppProps = ButtonProps & { + href: string + prompt?: boolean +} + +ButtonMiniApp.__type = 'button' +export function ButtonMiniApp({ + children, + // @ts-ignore - private + index = 1, + href, + prompt, +}: ButtonMiniAppProps) { + return [ + , + , + , + ] as unknown as HtmlEscapedString +} + export type ButtonMintProps = ButtonProps & { target: string } @@ -214,6 +242,7 @@ export function ButtonSignature({ export const Button = Object.assign(ButtonRoot, { AddCastAction: ButtonAddCastAction, Link: ButtonLink, + MiniApp: ButtonMiniApp, Mint: ButtonMint, Redirect: ButtonRedirect, Reset: ButtonReset,