Skip to content

Commit de7c32c

Browse files
committed
fix(mod/zora-nft-minter): fix button layout
1 parent 7c5ee47 commit de7c32c

File tree

2 files changed

+90
-74
lines changed

2 files changed

+90
-74
lines changed

.changeset/eleven-phones-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@mods/zora-nft-minter": minor
3+
---
4+
5+
fix: button layout

mods/zora-nft-minter/src/view.ts

Lines changed: 85 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,104 +8,115 @@ const view: ModElement[] = [
88
topLeftBadge: "{{embed.metadata.nft.collection.creator.username}}",
99
elements: [
1010
{
11-
type: "horizontal-layout",
11+
type: "vertical-layout",
1212
elements: [
1313
{
14-
type: "avatar",
15-
src: "{{api}}/nft-chain-logo?chain={{embed.metadata.nft.collection.chain}}",
16-
},
17-
{
18-
type: "text",
19-
label: "{{embed.metadata.nft.collection.name}}",
20-
},
21-
{
22-
if: {
23-
value: "{{user.wallet.address}}",
24-
match: {
25-
NOT: {
26-
equals: "",
27-
},
28-
},
29-
},
30-
then: {
31-
if: {
32-
value: "{{refs.mintTx.hash}}",
33-
match: {
34-
NOT: {
35-
equals: "",
14+
type: "horizontal-layout",
15+
elements: [
16+
{
17+
type: "horizontal-layout",
18+
elements: [
19+
{
20+
type: "avatar",
21+
src: "{{api}}/nft-chain-logo?chain={{embed.metadata.nft.collection.chain}}",
3622
},
37-
},
23+
{
24+
type: "text",
25+
label: "{{embed.metadata.nft.collection.name}}",
26+
},
27+
],
3828
},
39-
then: {
29+
{
4030
if: {
41-
value: "{{refs.mintTx.isSuccess}}",
31+
value: "{{user.wallet.address}}",
4232
match: {
43-
equals: "true",
33+
NOT: {
34+
equals: "",
35+
},
4436
},
4537
},
4638
then: {
47-
type: "link",
48-
label: "View NFT",
49-
url: "{{refs.txDataRequest.response.data.explorer.url}}/tx/{{refs.mintTx.hash}}",
50-
},
51-
else: {
5239
if: {
53-
value: "{{refs.mintTx.isSuccess}}",
40+
value: "{{refs.mintTx.hash}}",
5441
match: {
55-
equals: "false",
42+
NOT: {
43+
equals: "",
44+
},
5645
},
5746
},
5847
then: {
59-
type: "link",
60-
label: "Failed",
61-
variant: "link",
62-
url: "{{refs.txDataRequest.response.data.explorer.url}}/tx/{{refs.mintTx.hash}}",
63-
},
64-
else: {
65-
type: "horizontal-layout",
66-
elements: [
67-
{
48+
if: {
49+
value: "{{refs.mintTx.isSuccess}}",
50+
match: {
51+
equals: "true",
52+
},
53+
},
54+
then: {
55+
type: "link",
56+
label: "View NFT",
57+
url: "{{refs.txDataRequest.response.data.explorer.url}}/tx/{{refs.mintTx.hash}}",
58+
},
59+
else: {
60+
if: {
61+
value: "{{refs.mintTx.isSuccess}}",
62+
match: {
63+
equals: "false",
64+
},
65+
},
66+
then: {
6867
type: "link",
69-
label: "Confirming...",
68+
label: "Failed",
7069
variant: "link",
7170
url: "{{refs.txDataRequest.response.data.explorer.url}}/tx/{{refs.mintTx.hash}}",
7271
},
73-
{
74-
type: "circular-progress",
72+
else: {
73+
type: "horizontal-layout",
74+
elements: [
75+
{
76+
type: "link",
77+
label: "Confirming...",
78+
variant: "link",
79+
url: "{{refs.txDataRequest.response.data.explorer.url}}/tx/{{refs.mintTx.hash}}",
80+
},
81+
{
82+
type: "circular-progress",
83+
},
84+
],
7585
},
76-
],
86+
},
7787
},
78-
},
79-
},
80-
else: {
81-
type: "button",
82-
label: "Mint",
83-
onclick: {
84-
type: "GET",
85-
ref: "txDataRequest",
86-
url: "{{api}}/nft-minter?taker={{user.wallet.address}}&itemId={{embed.metadata.nft.collection.id}}/{{embed.metadata.nft.tokenId}}",
87-
onsuccess: {
88-
type: "SENDETHTRANSACTION",
89-
ref: "mintTx",
90-
txData: {
91-
from: "{{refs.txDataRequest.response.data.data.from}}",
92-
to: "{{refs.txDataRequest.response.data.data.to}}",
93-
value: "{{refs.txDataRequest.response.data.data.value}}",
94-
data: "{{refs.txDataRequest.response.data.data.data}}",
88+
else: {
89+
type: "button",
90+
label: "Mint",
91+
onclick: {
92+
type: "GET",
93+
ref: "txDataRequest",
94+
url: "{{api}}/nft-minter?taker={{user.wallet.address}}&itemId={{embed.metadata.nft.collection.id}}/{{embed.metadata.nft.tokenId}}",
95+
onsuccess: {
96+
type: "SENDETHTRANSACTION",
97+
ref: "mintTx",
98+
txData: {
99+
from: "{{refs.txDataRequest.response.data.data.from}}",
100+
to: "{{refs.txDataRequest.response.data.data.to}}",
101+
value:
102+
"{{refs.txDataRequest.response.data.data.value}}",
103+
data: "{{refs.txDataRequest.response.data.data.data}}",
104+
},
105+
chainId: "{{refs.txDataRequest.response.data.chainId}}",
106+
},
95107
},
96-
chainId: "{{refs.txDataRequest.response.data.chainId}}",
108+
},
109+
},
110+
else: {
111+
type: "button",
112+
label: "Mint",
113+
onclick: {
114+
type: "OPENLINK",
115+
url: "{{embed.metadata.nft.mintUrl}}",
97116
},
98117
},
99118
},
100-
},
101-
else: {
102-
type: "button",
103-
label: "Mint",
104-
onclick: {
105-
type: "OPENLINK",
106-
url: "{{embed.metadata.nft.mintUrl}}",
107-
},
108-
},
119+
],
109120
},
110121
],
111122
},

0 commit comments

Comments
 (0)