Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work on discover codebase #33

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.53.1",
"react-icons": "^5.3.0",
"react-moralis": "^1.4.2",
"react-toastify": "^10.0.5",
"tailwind-merge": "^2.3.0",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/app/[username]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ function HomePage({ params }) {
<h1 style={{ fontSize: "1.125rem", color: "#6B7280" }}>
{"0 Following"}
</h1>
<h1
{/* <h1
style={{
marginTop: "0.5rem",
fontSize: "1.125rem",
Expand All @@ -808,18 +808,18 @@ function HomePage({ params }) {
}}
>
Address
</h1>
<h1
</h1> */}
{/* <h1
style={{ fontSize: "1.125rem", color: "#6B7280" }}
className="truncate-wallet"
>
{address}
</h1>
</h1> */}
</div>
</div>
</div>

<div className="flex mt-10 text-gray-700">
<div className="flex mt-20 text-gray-700">
<button
id="myassets"
className={`text-lg hover:text-black hover:underline ${
Expand Down Expand Up @@ -1473,7 +1473,7 @@ function HomePage({ params }) {
<h1 style={{ fontSize: "1.125rem", color: "#6B7280" }}>
{"0 Following"}
</h1>
{/* <h1
<h1
style={{
marginTop: "0.5rem",
fontSize: "1.125rem",
Expand All @@ -1488,7 +1488,7 @@ function HomePage({ params }) {
className="truncate-wallet"
>
{walletAddress}
</h1> */}
</h1>
</div>
</div>
</div>
Expand Down
69 changes: 69 additions & 0 deletions src/app/nfts/[id]/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export async function generateMetadata({ params }) {
const baseUri = process.env.NEXT_PUBLIC_URI || "https://app.myriadflow.com";

// Fetch phygitals
const nftsRes = await fetch(
`${baseUri}/phygitals/all/554b4903-9a06-4031-98f4-48276c427f78`
);
const phygitals = await nftsRes.json();

// Format the NFT name from params
const nftName = params?.id
.replace(/-/g, " ")
.replace(/\b\w/g, (char) => char.toUpperCase());

// Find the matching NFT
const nft = phygitals.find((p) => p.name === nftName);

if (!nft) {
return {
title: "NFT Not Found",
};
}

// Get detailed NFT info
const nftDetailRes = await fetch(`${baseUri}/phygitals/${nft.id}`);
const nftDetail = await nftDetailRes.json();

const imageUrl = `https://nftstorage.link/ipfs/${nftDetail.image?.slice(7)}`;
const title = `${nftDetail.name} | MyriadFlow Discover`;
const description =
nftDetail.description ||
"Own the future of collecting! MyriadFlow Discover lets you buy, sell, and showcase unique phygital NFTs. Explore immersive VR experiences that bring your digital collectibles to life.";

return {
title,
description,
openGraph: {
title,
description,
images: [
{
url: imageUrl,
width: 1200,
height: 630,
alt: nftDetail.name,
},
],
type: "website",
url: `https://discover.myriadflow.com/nfts/${params.id}`,
},
twitter: {
card: "summary_large_image",
site: "@MyriadFlow",
title,
description,
images: [imageUrl],
},
other: {
"og:site_name": "MyriadFlow Discover",
"og:type": "website",
"twitter:domain": "discover.myriadflow.com",
"twitter:url": `https://discover.myriadflow.com/nfts/${params.id}`,
},
};
}

export default function NFTLayout({ children }) {
return children;
}
Loading