Skip to content

Commit

Permalink
refactor: button
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Feb 14, 2024
1 parent b43a056 commit 54018bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export function ButtonRoot({
content={children}
data-value={value}
/>,
<meta property={`fc:frame:button:${index}:action`} content={action} />,
<meta property={`fc:frame:button:${index}:target`} content={target} />,
action !== 'post' && (
<meta property={`fc:frame:button:${index}:action`} content={action} />
),
target && (
<meta property={`fc:frame:button:${index}:target`} content={target} />
),
] as unknown as HtmlEscapedString
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/getIntentState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getIntentState(
if (!intents) return state
if (buttonIndex) {
const buttonIntents = intents.filter((intent) =>
intent?.props.property.match(/fc:frame:button:\d$/),
intent?.props?.property?.match(/fc:frame:button:\d$/),
)
const intent = buttonIntents[buttonIndex - 1]
state.buttonValue = intent.props['data-value']
Expand Down

0 comments on commit 54018bc

Please sign in to comment.