-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: drop
RouteOptions
for composer action, add state
- Loading branch information
Showing
6 changed files
with
44 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,19 @@ | ||
import { Button, Frog } from 'frog' | ||
import { Frog } from 'frog' | ||
|
||
import { vars } from './ui.js' | ||
|
||
export const app = new Frog({ | ||
ui: { vars }, | ||
title: 'Composer Action', | ||
}) | ||
.frame('/', (c) => | ||
c.res({ | ||
image: ( | ||
<div | ||
tw="flex" | ||
style={{ | ||
alignItems: 'center', | ||
background: 'linear-gradient(to right, #432889, #17101F)', | ||
backgroundSize: '100% 100%', | ||
flexDirection: 'column', | ||
flexWrap: 'nowrap', | ||
height: '100%', | ||
justifyContent: 'center', | ||
textAlign: 'center', | ||
width: '100%', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
color: 'white', | ||
fontSize: 60, | ||
fontStyle: 'normal', | ||
letterSpacing: '-0.025em', | ||
lineHeight: 1.4, | ||
marginTop: 30, | ||
padding: '0 120px', | ||
whiteSpace: 'pre-wrap', | ||
}} | ||
> | ||
Add Composer Action | ||
</div> | ||
</div> | ||
), | ||
intents: [ | ||
<Button.AddComposerAction action="/action"> | ||
Add Action | ||
</Button.AddComposerAction>, | ||
], | ||
}), | ||
) | ||
.composerAction( | ||
'/action', | ||
async (c) => { | ||
console.log( | ||
`Composer Action to ${JSON.stringify(c.actionData.castId)} from ${ | ||
c.actionData.fid | ||
}`, | ||
) | ||
if (Math.random() > 0.5) return c.error({ message: 'Action failed :(' }) | ||
return c.res({ | ||
url: 'https://somewhere.com/some-form', | ||
}) | ||
}, | ||
{ | ||
name: 'Super Form', | ||
icon: 'log', | ||
description: 'This composer action will do something with the cast!', | ||
}, | ||
}).composerAction('/', async (c) => { | ||
console.log( | ||
`Composer Action call ${JSON.stringify(c.actionData, null, 2)} from ${ | ||
c.actionData.fid | ||
}`, | ||
) | ||
if (Math.random() > 0.5) return c.error({ message: 'Action failed :(' }) | ||
return c.res({ | ||
title: 'Some Composer Action', | ||
url: 'https://somewhere.com/some-form', | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters