diff --git a/examples/_dev/src/index.tsx b/examples/_dev/src/index.tsx index 8f07882d..f4f9f4b0 100644 --- a/examples/_dev/src/index.tsx +++ b/examples/_dev/src/index.tsx @@ -86,23 +86,17 @@ app.frame('/action', ({ buttonValue, inputText }) => { } }) -app.frame('/buttons', ({ buttonValue }) => { +app.frame('/buttons', (context) => { + const { buttonValue } = context return { image: ( -
- {buttonValue ?? ''} -
+
{buttonValue ?? ''}
), intents: [ - , Link, diff --git a/src/components/Button.tsx b/src/components/Button.tsx index a1ce46c3..05c3586b 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -23,6 +23,7 @@ export function ButtonRoot({ , , diff --git a/src/dev/components.tsx b/src/dev/components.tsx index 662ee9ac..ced5f014 100644 --- a/src/dev/components.tsx +++ b/src/dev/components.tsx @@ -177,6 +177,7 @@ function Button(props: ButtonProps) { index: '${index}', open: false, target: ${target ? `'${target}'` : undefined}, + url: ${type === 'link' && target ? `'${target}'` : undefined}, }`, } const leavingAppPrompt = ( @@ -187,11 +188,10 @@ function Button(props: ButtonProps) { {...{ '@click.outside': 'open = false', '@keyup.escape': 'open = false', - 'x-trap.noscroll': 'open', }} >

Leaving Warpcast

-
{target}
+

If you connect your wallet and the site is malicious, you may lose funds. @@ -208,7 +208,7 @@ function Button(props: ButtonProps) { class="bg-er border-er rounded-md w-full text-sm text-white font-bold py-1" target="_blank" type="button" - x-on:click={`open = false; window.open(target, '_blank');`} + x-on:click={`open = false; window.open(url, '_blank');`} >

I Understand
@@ -235,6 +235,7 @@ function Button(props: ButtonProps) { class={buttonClass} type="button" x-on:click={` + if (open) return fetch(baseUrl + '/dev/redirect', { method: 'POST', body: JSON.stringify({ @@ -246,12 +247,15 @@ function Button(props: ButtonProps) { 'Content-Type': 'application/json', }, }) - .then(res => { + .then(async (res) => { console.log(res) - target = 'https://example.com' + const json = await res.json() + // TODO: show error + if (!json.success) return + url = json.redirectUrl open = true }) - .catch(error => console.log(error)) + .catch((error) => console.log(error)) `} >
{innerHtml}
@@ -709,6 +713,13 @@ export function Style() { scrollbar-color: var(--br) transparent; scrollbar-width: thin; } + + .line-clamp-2 { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + } ` return