Skip to content

Commit

Permalink
Showed NFT Images
Browse files Browse the repository at this point in the history
  • Loading branch information
Jikugodwill committed Sep 6, 2024
1 parent 8ad1a02 commit 7e1983a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
34 changes: 24 additions & 10 deletions widget/components/NFT/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
const { href } = VM.require("buildhub.near/widget/lib.url") || {
href: () => {},
};
const Card = ({ data }) => {
if (!data) {
return "Loading";
}
const size = "100%";
return (
<div className="d-flex flex-column gap-1 w-15 p-3">
<Link
to={`{config_index}?page=product&contractId=${data.nft_contract_id}&metadataId=${data?.metadata_id}`}
target="_blank"
<a
href={href({
widgetSrc: "${config_account}/widget/Index",
params: {
page: "product",
contractId: data?.nft_contract_id,
metadataId: data?.metadata_id,
},
})}
>
<Widget
src="{alias_MOB}/widget/NftImage"
src="${alias_MOB}/widget/NftImage"
props={{
nft: {
tokenId: data?.token_id,
contractId: data?.nft_contract_id,
},
style: {
width: size,
height: size,
height: "300px",
objectFit: "cover",
minWidth: size,
minHeight: size,
Expand All @@ -27,12 +40,11 @@ const Card = ({ data }) => {
"https://ipfs.near.social/ipfs/bafkreihdiy3ec4epkkx7wc4wevssruen6b7f3oep5ylicnpnyyqzayvcry",
}}
/>
</Link>
</a>
<button
disabled={!accountId}
// disabled={!accountId}
onClick={() => {
if (!accountId) return;
buy(priceYocto, data?.token_id, data?.nft_contract_id);
//add this NFT as json object to the connect user's social DB account
}}
style={{
border: "1px solid black",
Expand All @@ -42,8 +54,10 @@ const Card = ({ data }) => {
cursor: "pointer",
}}
>
Buy {priceNear} N
Add to cart
</button>
</div>
);
};

return <Card {...props} />;
8 changes: 4 additions & 4 deletions widget/components/NFT/Details.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { isDarkModeOn, data, NftCount, listingCount } = props;
const { buyToken } = VM.require(
"${config_account}/widget/Mintbase.NFT.modules"
"${alias_GENADROP}/widget/Mintbase.NFT.modules"
);

const { buyTokenAsADao } = VM.require(
"${config_account}/widget/Mintbase.utils.sdk"
"${alias_GENADROP}/widget/Mintbase.utils.sdk"
) || { buyTokenAsADao: () => {} };

const { href } = VM.require("buildhub.near/widget/lib.url") || {
Expand Down Expand Up @@ -424,7 +424,7 @@ return !data ? (
<small>Contract</small>
<Link
to={href({
widgetSrc: "${config_account}/widget/Mintbase.App.Index",
widgetSrc: "${alias_GENADROP}/widget/Mintbase.App.Index",
params: {
page: "contract",
accountId: data?.nft_contract_id,
Expand All @@ -438,7 +438,7 @@ return !data ? (
<small>Owner</small>
<Link
to={href({
widgetSrc: "${config_account}/widget/Mintbase.App.Index",
widgetSrc: "${alias_GENADROP}/widget/Mintbase.App.Index",
params: {
page: "human",
accountId: data?.owner,
Expand Down
2 changes: 1 addition & 1 deletion widget/page/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const home = ({ storeId }) => {
</div>
</>
) : (
<h5>The store has no listed NFTs yet.</h5>
<h5>There's nothing to show yet.</h5>
)}
</Root>
);
Expand Down

0 comments on commit 7e1983a

Please sign in to comment.