Skip to content

Commit

Permalink
add poap
Browse files Browse the repository at this point in the history
  • Loading branch information
backmeupplz committed Mar 8, 2024
1 parent c127203 commit 8237fbd
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 21 deletions.
8 changes: 7 additions & 1 deletion src/components/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ export default function FileUpload() {
<button
class="btn btn-active btn-primary"
onClick={uploadFile}
disabled={loading || !file || !network || !tokenAddress}
disabled={
loading ||
!file ||
!network ||
!tokenAddress ||
(network === 'poap' && !id)
}
>
{loading && '🤔 '}Upload!
</button>
Expand Down
54 changes: 34 additions & 20 deletions src/components/TokenSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useAccount } from 'wagmi'
import { useAtom, useAtomValue } from 'jotai'
import { zeroAddress } from 'viem'
import signatureAtom from 'atoms/signature'
import tokenAtom from 'atoms/token'

Expand All @@ -25,7 +26,14 @@ export default function () {
class="select select-bordered w-full"
value={token.network}
onChange={(e) =>
setToken({ ...token, network: e.currentTarget.value })
setToken({
...token,
address:
e.currentTarget.value === 'poap'
? zeroAddress
: token.address,
network: e.currentTarget.value,
})
}
>
<option selected>mainnet</option>
Expand All @@ -36,23 +44,27 @@ export default function () {
<option>poap</option>
</select>
</div>
<div className="flex flex-col">
<div class="label">
<span class="label-text">Contract address</span>
{token.network !== 'poap' && (
<div className="flex flex-col">
<div class="label">
<span class="label-text">Contract address</span>
</div>
<input
type="text"
placeholder="0x..."
class="input input-bordered w-full"
value={token.address}
onChange={(e) =>
setToken({ ...token, address: e.currentTarget.value })
}
/>
</div>
<input
type="text"
placeholder="0x..."
class="input input-bordered w-full"
value={token.address}
onChange={(e) =>
setToken({ ...token, address: e.currentTarget.value })
}
/>
</div>
)}
<div className="flex flex-col">
<div class="label">
<span class="label-text">Token ID</span>
<span class="label-text">
{token.network === 'poap' ? 'Event' : 'Token'} ID
</span>
</div>
<input
type="text"
Expand All @@ -61,11 +73,13 @@ export default function () {
placeholder="(empty)"
onChange={(e) => setToken({ ...token, id: e.currentTarget.value })}
/>
<div class="label">
<span class="label-text-alt">
(leave empty for ERC20, ERC721 and POAP)
</span>
</div>
{token.network !== 'poap' && (
<div class="label">
<span class="label-text-alt">
(leave empty for ERC20 and ERC721)
</span>
</div>
)}
</div>
</div>
</>
Expand Down

0 comments on commit 8237fbd

Please sign in to comment.