-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1346 from near/develop
2x weekly promotion of develop to main
- Loading branch information
Showing
21 changed files
with
1,279 additions
and
44 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Flex, Text } from '@near-pagoda/ui'; | ||
import Image from 'next/image'; | ||
|
||
type FT = { | ||
decimals: number; | ||
icon: string; | ||
name: string; | ||
symbol: string; | ||
total_supply: string; | ||
}; | ||
|
||
const FTPreview = ({ token }: { token: FT }) => { | ||
return ( | ||
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}> | ||
<Text size="text-xl">{token.name}</Text> | ||
<Image src={token.icon} alt={token.name} width={50} height={50} /> | ||
<Text> | ||
{(BigInt(token.total_supply) / BigInt(10 ** token.decimals)).toString()} {token.symbol} | ||
</Text> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default FTPreview; |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Flex, Text } from '@near-pagoda/ui'; | ||
import { useContext, useEffect, useState } from 'react'; | ||
|
||
import type { NFT } from '@/utils/types'; | ||
|
||
import { NftImage } from '../NTFImage'; | ||
import { NearContext } from '../wallet-selector/WalletSelector'; | ||
|
||
const NFTPreview = ({ nft }: { nft: NFT }) => { | ||
const [infoNft, setInfoNft] = useState<NFT | undefined>(undefined); | ||
const { wallet } = useContext(NearContext); | ||
useEffect(() => { | ||
if (!wallet) return; | ||
const fetchNftInfo = async () => { | ||
setInfoNft( | ||
await wallet.viewMethod({ | ||
contractId: nft.contract_id, | ||
method: 'nft_token', | ||
args: { token_id: nft.token_id }, | ||
}), | ||
); | ||
}; | ||
fetchNftInfo(); | ||
}, [nft, wallet]); | ||
|
||
return ( | ||
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}> | ||
<Text size="text-xl">{infoNft?.metadata?.title}</Text> | ||
<NftImage nft={infoNft} /> | ||
<Text>{infoNft?.metadata?.description}</Text> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default NFTPreview; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Flex, Text } from '@near-pagoda/ui'; | ||
import Image from 'next/image'; | ||
|
||
import NearIconSvg from '@/assets/images/near-icon.svg'; | ||
|
||
const NearPreview = ({ amount }: { amount: string }) => { | ||
return ( | ||
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}> | ||
<Text size="text-xl">NEAR</Text> | ||
<Image src={NearIconSvg} alt="NEAR" width={50} height={50} /> | ||
<Text>{amount} NEAR</Text> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default NearPreview; |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Flex } from '@near-pagoda/ui'; | ||
import Image from 'next/image'; | ||
import styled from 'styled-components'; | ||
|
||
import Meteor from '@/assets/images/meteor.svg'; | ||
import MyNearWallet from '@/assets/images/my_near_wallet.png'; | ||
import { networkId } from '@/config'; | ||
|
||
const StyledButton = styled.a` | ||
background-color: #1e2030; | ||
color: #fff; | ||
border: none; | ||
border-radius: 25px; | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transition: background-color 0.3s; | ||
&:hover { | ||
background-color: #101124; | ||
} | ||
`; | ||
|
||
const WalletButton = styled(StyledButton)` | ||
background-color: #212529; | ||
text-decoration: none; | ||
&:hover { | ||
background-color: #11111c; | ||
} | ||
`; | ||
|
||
const Wallets = ({ url }: { url: string }) => { | ||
// https://docs.keypom.xyz/docs/next/keypom-sdk/Core/modules#supportedlinkdropclaimpages | ||
const meteorWalletUrl = 'https://wallet.meteorwallet.app/linkdrop/'; | ||
const myNearWalletUrl = | ||
networkId === 'testnet' ? 'https://testnet.mynearwallet.com/linkdrop/' : 'https://app.mynearwallet.com/linkdrop/'; | ||
|
||
return ( | ||
<Flex stack style={{ paddingTop: '1rem' }} gap="m"> | ||
<WalletButton href={`${meteorWalletUrl}${url}`} target="_blank"> | ||
<Image height={20} alt="Mintbase Logo" src={Meteor} /> | ||
<span style={{ textDecoration: 'none', marginLeft: '1rem' }}>Meteor Wallet</span> | ||
</WalletButton> | ||
<WalletButton href={`${myNearWalletUrl}${url}`} target="_blank"> | ||
<Image height={19} alt="My Near Wallet Logo" src={MyNearWallet} /> | ||
<span style={{ textDecoration: 'none', marginLeft: '1rem' }}>My Near Wallet</span> | ||
</WalletButton> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default Wallets; |
Oops, something went wrong.