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

Nfc_and_Marketplace #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 marketplace/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_TW_CLIENT_ID=97295388ebf67e9450b04bdb7038beac
38 changes: 38 additions & 0 deletions marketplace/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies

/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions marketplace/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
7 changes: 7 additions & 0 deletions marketplace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
copy of .env.example and name is as .env

bun i

bun run dev


Binary file added marketplace/bun.lockb
Binary file not shown.
4 changes: 4 additions & 0 deletions marketplace/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
34 changes: 34 additions & 0 deletions marketplace/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "marketplace-template",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/next-js": "^2.2.0",
"@chakra-ui/react": "^2.8.2",
"@chakra-ui/theme-tools": "^2.1.2",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@tanstack/react-query": "^5.44.0",
"blo": "^1.2.0",
"framer-motion": "^11.2.10",
"next": "14.2.4",
"react": "^18",
"react-dom": "^18",
"react-icons": "^5.2.1",
"thirdweb": "^5.28.0"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"postcss": "^8",
"typescript": "^5"
}
}
Binary file added marketplace/public/erc20-icons/usdc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added marketplace/public/erc20-icons/usdt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added marketplace/public/native-token-icons/avax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added marketplace/public/native-token-icons/eth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added marketplace/public/native-token-icons/matic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import MarketplaceProvider from "@/hooks/useMarketplaceContext";
import type { ReactNode } from "react";

export default function MarketplaceLayout({
children,
params,
}: {
children: ReactNode;
params: { contractAddress: string; chainId: string };
}) {
return (
<MarketplaceProvider
chainId={params.chainId}
contractAddress={params.contractAddress}
>
{children}
</MarketplaceProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

import { Collection } from "@/components/collection-page/Collection";

export default function CollectionPage() {
return <Collection />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use client";

import { Token } from "@/components/token-page/TokenPage";

export default function ListingPage({
params,
}: {
params: { tokenId: string };
}) {
const { tokenId } = params;
if (!tokenId) {
throw new Error("Missing listingId");
}
return <Token tokenId={BigInt(tokenId)} />;
}
Binary file added marketplace/src/app/favicon.ico
Binary file not shown.
28 changes: 28 additions & 0 deletions marketplace/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { Metadata } from "next";
import { Providers } from "@/components/shared/Providers";
import { Navbar } from "@/components/shared/Navbar";
import { AutoConnect } from "thirdweb/react";
import { client } from "@/consts/client";

export const metadata: Metadata = {
title: "Marketplace",
description: "",
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body style={{ paddingBottom: "100px" }}>
<Providers>
<AutoConnect client={client} />
<Navbar />
{children}
</Providers>
</body>
</html>
);
}
53 changes: 53 additions & 0 deletions marketplace/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"use client";

import { NFT_CONTRACTS } from "@/consts/nft_contracts";
import { Link } from "@chakra-ui/next-js";
import {
Box,
Card,
CardBody,
CardHeader,
Flex,
Heading,
Image,
Stack,
StackDivider,
Text,
} from "@chakra-ui/react";

export default function Home() {
return (
<Flex>
<Box mt="24px" m="auto">
<Flex direction="column" gap="4">
<Heading ml="20px" mt="40px">
Trending collections
</Heading>
<Flex
direction="row"
wrap="wrap"
mt="20px"
gap="5"
justifyContent="space-evenly"
>
{NFT_CONTRACTS.map((item) => (
<Link
_hover={{ textDecoration: "none" }}
w={300}
h={400}
key={item.address}
href={`/collection/${item.chain.id.toString()}/${item.address}`}
>
<Image src={item.thumbnailUrl} />
<Text fontSize="large" mt="10px">
{item.title}
</Text>
</Link>
))}
</Flex>
</Flex>
</Box>
</Flex>
);
}

30 changes: 30 additions & 0 deletions marketplace/src/app/profile/[addressOrENS]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { ProfileSection } from "@/components/profile-page/Profile";
import { useResolveENSAddress } from "@/hooks/useResolveENSAddress";
import { Box, Text } from "@chakra-ui/react";
import { notFound } from "next/navigation";
import { isAddress } from "thirdweb/utils";

export default function PublicProfilePage({
params,
}: {
params: { addressOrENS: string };
}) {
const { addressOrENS } = params;
const isValidEvmAddress = isAddress(addressOrENS);
const { data: resolvedAddress, isLoading } = useResolveENSAddress({
text: addressOrENS,
enabled: !isValidEvmAddress,
});
if (isLoading) {
return (
<Box>
<Text>Loading...</Text>
</Box>
);
}
if (!isValidEvmAddress && !resolvedAddress) return notFound();
const address = isValidEvmAddress ? addressOrENS : resolvedAddress!;
return <ProfileSection address={address} />;
}
13 changes: 13 additions & 0 deletions marketplace/src/app/profile/jsnfc.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"folders": [
{
"name": "jsnfc",
"path": "../../../../../jsnfc"
},
{
"name": "VaultX",
"path": "../../../.."
}
],
"settings": {}
}
26 changes: 26 additions & 0 deletions marketplace/src/app/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use client";

import { ProfileSection } from "@/components/profile-page/Profile";
import { client } from "@/consts/client";
import { Box, Flex, Heading } from "@chakra-ui/react";
import { useEffect } from "react";
import { useActiveAccount, useConnectModal } from "thirdweb/react";

export default function ProfilePage() {
const account = useActiveAccount();
const { connect } = useConnectModal();
useEffect(() => {
if (!account) {
connect({ client });
}
}, [account, connect]);
if (!account)
return (
<Box>
<Flex>
<Heading m="auto">Log in to continue</Heading>
</Flex>
</Box>
);
return <ProfileSection address={account.address} />;
}
Loading