File tree Expand file tree Collapse file tree 20 files changed +3159
-3168
lines changed Expand file tree Collapse file tree 20 files changed +3159
-3168
lines changed Original file line number Diff line number Diff line change 1
1
NEXT_PUBLIC_API_URL = " http://localhost:3001/api"
2
2
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = " "
3
3
NEXT_PUBLIC_URL = " http://localhost:3000"
4
- NEXT_PUBLIC_HOST = " localhost:3000"
4
+ NEXT_PUBLIC_HOST = " localhost:3000"
5
+ NEXT_PUBLIC_EXPERIMENTAL_MODS = " false"
Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ import {
13
13
} from "@mod-protocol/farcaster" ;
14
14
import { CreationMod , RichEmbed } from "@mod-protocol/react" ;
15
15
import { useEditor , EditorContent } from "@mod-protocol/react-editor" ;
16
- import { creationMods , defaultRichEmbedMod } from "@mod-protocol/mod-registry" ;
16
+ import {
17
+ creationMods ,
18
+ creationModsExperimental ,
19
+ defaultRichEmbedMod ,
20
+ } from "@mod-protocol/mod-registry" ;
17
21
import {
18
22
Embed ,
19
23
EthPersonalSignActionResolverInit ,
@@ -201,7 +205,14 @@ export default function EditorExample() {
201
205
} }
202
206
>
203
207
< PopoverTrigger > </ PopoverTrigger >
204
- < ModsSearch mods = { creationMods } onSelect = { setCurrentMod } />
208
+ < ModsSearch
209
+ mods = {
210
+ process . env . NEXT_PUBLIC_EXPERIMENTAL_MODS === "true"
211
+ ? creationModsExperimental
212
+ : creationMods
213
+ }
214
+ onSelect = { setCurrentMod }
215
+ />
205
216
< PopoverContent className = "w-[400px] ml-2" align = "start" >
206
217
< div className = "space-y-4" >
207
218
< h4 className = "font-medium leading-none" > { currentMod ?. name } </ h4 >
Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ import {
6
6
SendEthTransactionActionResolverEvents ,
7
7
SendEthTransactionActionResolverInit ,
8
8
} from "@mod-protocol/core" ;
9
- import { richEmbedMods , defaultRichEmbedMod } from "@mod-protocol/mod-registry" ;
9
+ import {
10
+ richEmbedMods ,
11
+ defaultRichEmbedMod ,
12
+ richEmbedModsExperimental ,
13
+ } from "@mod-protocol/mod-registry" ;
10
14
import { RichEmbed } from "@mod-protocol/react" ;
11
15
import { renderers } from "@mod-protocol/react-ui-shadcn/dist/renderers" ;
12
16
import {
@@ -77,7 +81,11 @@ export function Embeds(props: { embeds: Array<Embed> }) {
77
81
key = { i }
78
82
renderers = { renderers }
79
83
defaultRichEmbedMod = { defaultRichEmbedMod }
80
- mods = { richEmbedMods }
84
+ mods = {
85
+ process . env . NEXT_PUBLIC_EXPERIMENTAL_MODS === "true"
86
+ ? richEmbedModsExperimental
87
+ : richEmbedMods
88
+ }
81
89
resolvers = { {
82
90
onSendEthTransactionAction,
83
91
} }
Original file line number Diff line number Diff line change @@ -77,10 +77,10 @@ export default function Page() {
77
77
</ div >
78
78
< div className = "flex md:flex-row gap-10 flex-col container" >
79
79
< div className = "flex flex-col md:w-1/2" >
80
- < h2 className = "text-xl" > Mod Editor </ h2 >
80
+ < h2 className = "text-xl" > Creation Mods </ h2 >
81
81
< h3 className = "my-2" >
82
82
An open source library for Farcaster cast creation supporting
83
- Mods
83
+ Mods. Try pressing the plus icon
84
84
</ h3 >
85
85
< div className = "max-w-lg" >
86
86
< EditorExample />
@@ -100,7 +100,7 @@ export default function Page() {
100
100
</ div >
101
101
</ div >
102
102
< div className = "flex flex-col md:w-1/2" >
103
- < h2 className = "text-xl" > Embed renderers </ h2 >
103
+ < h2 className = "text-xl" > Rich-embed Mods </ h2 >
104
104
< h3 className = "mb-2 mt-2" > NFT Mod with native minting</ h3 >
105
105
< Cast cast = { dummyCastData [ 4 ] } />
106
106
< h3 className = "mb-2 mt-4" > Video Mod</ h3 >
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import upload from "./upload";
6
6
7
7
const manifest : ModManifest = {
8
8
slug : "infura-ipfs-upload" ,
9
- name : "Add image" ,
9
+ name : "Upload image to IPFS " ,
10
10
custodyAddress : "furlong.eth" ,
11
11
logo : "https://i.imgur.com/ptsz1Ig.png" ,
12
12
custodyGithubUsername : "davidfurlong" ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import upload from "./upload";
6
6
7
7
const manifest : ModManifest = {
8
8
slug : "livepeer-video" ,
9
- name : "Add video" ,
9
+ name : "Upload video" ,
10
10
custodyAddress : "furlong.eth" ,
11
11
logo : "https://i.imgur.com/UeuTxpI.png" ,
12
12
custodyGithubUsername : "davidfurlong" ,
Original file line number Diff line number Diff line change 1
1
import { ModElement } from "@mod-protocol/core" ;
2
2
3
- const loading : ModElement [ ] = [
4
- {
5
- type : "horizontal-layout" ,
6
- onload : {
7
- ref : "pollResults" ,
8
- type : "GET" ,
9
- url : "{{api}}/render-poll" ,
10
- searchParams : {
11
- embedUrl : "{{embed}}" ,
12
- fid : "{{user.farcaster.fid}}" ,
13
- endDate :
14
- "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.endDate}}" ,
15
- } ,
16
- onsuccess : "#results" ,
17
- onerror : "#error" ,
18
- onloading : "#loading" ,
3
+ const loading : ModElement = {
4
+ type : "horizontal-layout" ,
5
+ onload : {
6
+ ref : "pollResults" ,
7
+ type : "GET" ,
8
+ url : "{{api}}/render-poll" ,
9
+ searchParams : {
10
+ embedUrl : "{{embed}}" ,
11
+ fid : "{{user.farcaster.fid}}" ,
12
+ endDate :
13
+ "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.endDate}}" ,
19
14
} ,
15
+ onsuccess : "#results" ,
16
+ onerror : "#error" ,
20
17
} ,
21
- ] ;
18
+ } ;
22
19
23
20
export default loading ;
Original file line number Diff line number Diff line change 1
1
import { ModManifest } from "@mod-protocol/core" ;
2
2
import view from "./view" ;
3
- import loading from "./loading" ;
4
3
import error from "./error" ;
5
4
import results from "./results" ;
6
- import vote from "./vote" ;
7
5
8
6
const manifest : ModManifest = {
9
7
slug : "render-poll" ,
@@ -16,10 +14,7 @@ const manifest: ModManifest = {
16
14
permissions : [ "farcaster.messagereply.create" , "user.farcaster.fid" ] ,
17
15
elements : {
18
16
"#error" : error ,
19
- "#view" : view ,
20
- "#vote" : vote ,
21
17
"#results" : results ,
22
- "#loading" : loading ,
23
18
} ,
24
19
} ;
25
20
Original file line number Diff line number Diff line change 1
1
import { ModConditionalElement } from "@mod-protocol/core" ;
2
+ import vote from "./vote" ;
3
+ import loading from "./loading" ;
2
4
3
5
const rendering : ModConditionalElement [ ] = [
4
6
{
@@ -21,8 +23,8 @@ const rendering: ModConditionalElement[] = [
21
23
greaterThan : "{{date.now.iso}}" ,
22
24
} ,
23
25
} ,
24
- then : "# loading" ,
25
- else : "# vote" ,
26
+ then : loading ,
27
+ else : vote ,
26
28
} ,
27
29
] ,
28
30
} ,
Original file line number Diff line number Diff line change 1
1
import { ModElement } from "@mod-protocol/core" ;
2
2
3
- const vote : ModElement [ ] = [
4
- {
5
- type : "vertical-layout" ,
6
- elements : [
7
- {
8
- type : "button" ,
9
- onclick : {
10
- ref : "choice1" ,
11
- type : "ADDREPLY" ,
12
- text : "1." ,
13
- onsuccess : "#results" ,
14
- } ,
15
- label : "Choice 1" ,
3
+ const vote : ModElement = {
4
+ type : "vertical-layout" ,
5
+ elements : [
6
+ {
7
+ type : "text" ,
8
+ label : "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.question}}" ,
9
+ } ,
10
+ {
11
+ type : "button" ,
12
+ variant : "secondary" ,
13
+ onclick : {
14
+ ref : "choice1" ,
15
+ type : "ADDREPLY" ,
16
+ text : "1." ,
17
+ onsuccess : "#results" ,
16
18
} ,
17
- {
18
- type : "button" ,
19
- onclick : {
20
- ref : "choice1" ,
21
- type : "ADDREPLY" ,
22
- text : "2." ,
23
- onsuccess : "#results" ,
19
+ label : "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice1}}" ,
20
+ } ,
21
+ {
22
+ type : "button" ,
23
+ variant : "secondary" ,
24
+ onclick : {
25
+ ref : "choice2" ,
26
+ type : "ADDREPLY" ,
27
+ text : "2." ,
28
+ onsuccess : "#results" ,
29
+ } ,
30
+ label : "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice2}}" ,
31
+ } ,
32
+ {
33
+ if : {
34
+ value :
35
+ "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice3}}" ,
36
+ match : {
37
+ NOT : {
38
+ equals : "" ,
39
+ } ,
24
40
} ,
25
- label : "Choice 2" ,
26
41
} ,
27
- {
42
+ then : {
28
43
type : "button" ,
44
+ variant : "secondary" ,
29
45
onclick : {
30
- ref : "choice1 " ,
46
+ ref : "choice3 " ,
31
47
type : "ADDREPLY" ,
32
48
text : "3." ,
33
49
onsuccess : "#results" ,
34
50
} ,
35
- label : "Choice 3 (optional)" ,
51
+ label :
52
+ "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice3}}" ,
53
+ } ,
54
+ } ,
55
+ {
56
+ if : {
57
+ value :
58
+ "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice4}}" ,
59
+ match : {
60
+ NOT : {
61
+ equals : "" ,
62
+ } ,
63
+ } ,
36
64
} ,
37
- {
65
+ then : {
38
66
type : "button" ,
67
+ variant : "secondary" ,
39
68
onclick : {
40
- ref : "choice1 " ,
69
+ ref : "choice4 " ,
41
70
type : "ADDREPLY" ,
42
71
text : "4." ,
43
72
onsuccess : "#results" ,
44
73
} ,
45
- label : "Choice 4 (optional)" ,
74
+ label :
75
+ "{{embed.metadata.json-ld.WebPage[0].mod:model.payload.choice4}}" ,
46
76
} ,
47
- ] ,
48
- } ,
49
- ] ;
77
+ } ,
78
+ ] ,
79
+ } ;
50
80
51
81
export default vote ;
You can’t perform that action at this time.
0 commit comments