Skip to content

Commit da64b3d

Browse files
authored
Merge pull request #71 from TTMordred/hungphanne
Add DappRadar API routes and TrendingNFTs component for NFT data fetching and display
2 parents ea2758a + 6ab251d commit da64b3d

8 files changed

Lines changed: 823 additions & 74 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { NextResponse } from 'next/server';
2+
3+
export async function GET(request: Request) {
4+
const { searchParams } = new URL(request.url);
5+
const chain = searchParams.get('chain') || 'ethereum';
6+
const API_KEY = process.env.REACT_APP_DAPPRADAR_API_KEY;
7+
8+
try {
9+
const nftResponse = await fetch(`https://apis.dappradar.com/v2/nfts/collections?range=24h&sort=sales&order=desc&chain=${chain}&resultsPerPage=10`, {
10+
headers: {
11+
accept: 'application/json',
12+
'x-api-key': API_KEY || '',
13+
},
14+
}
15+
);
16+
17+
18+
// Check if any request failed.
19+
if (!nftResponse.ok) {
20+
return NextResponse.json(
21+
{
22+
error: `Returned an error: dapps(${nftResponse.status}))`,
23+
},
24+
{ status: 404 }
25+
);
26+
}
27+
28+
const nftData = await nftResponse.json();
29+
30+
return NextResponse.json({
31+
nfts: nftData,
32+
});
33+
} catch (error: any) {
34+
return NextResponse.json(
35+
{ error: error.message || 'Internal server error' },
36+
{ status: 500 }
37+
);
38+
}
39+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// api/dappradar/route.ts
2+
import { NextResponse } from 'next/server';
3+
4+
export async function GET(request: Request) {
5+
const { searchParams } = new URL(request.url);
6+
const chain = searchParams.get('chain') || 'ethereum';
7+
const API_KEY = process.env.REACT_APP_DAPPRADAR_API_KEY;
8+
9+
try {
10+
const [dappsResponse, gamesResponse, marketplaceResponse] = await Promise.all([
11+
fetch(`https://apis.dappradar.com/v2/dapps/top/uaw?chain=${chain}&range=7d&top=10`, {
12+
headers: {
13+
accept: 'application/json',
14+
'x-api-key': API_KEY || '',
15+
},
16+
}),
17+
fetch(`https://apis.dappradar.com/v2/dapps/top/balance?chain=${chain}&category=games&range=24h&top=10`, {
18+
headers: {
19+
accept: 'application/json',
20+
'x-api-key': API_KEY || '',
21+
},
22+
}),
23+
fetch(`https://apis.dappradar.com/v2/dapps/top/transactions?chain=${chain}&category=marketplaces&range=24h&top=10`, {
24+
headers: {
25+
accept: 'application/json',
26+
'x-api-key': API_KEY || '',
27+
},
28+
}),
29+
]);
30+
31+
// Check if any request failed.
32+
if (!dappsResponse.ok || !gamesResponse.ok || !marketplaceResponse.ok) {
33+
return NextResponse.json(
34+
{
35+
error: `One or more endpoints returned an error: dapps(${dappsResponse.status}), game(${gamesResponse.status}), arketplace(${marketplaceResponse.status})`,
36+
},
37+
{ status: 404 }
38+
);
39+
}
40+
41+
const dappsData = await dappsResponse.json();
42+
const gamesData = await gamesResponse.json();
43+
const marketplacesData = await marketplaceResponse.json();
44+
45+
return NextResponse.json({
46+
dapps: dappsData,
47+
games: gamesData,
48+
marketplaces: marketplacesData,
49+
});
50+
} catch (error: any) {
51+
return NextResponse.json(
52+
{ error: error.message || 'Internal server error' },
53+
{ status: 500 }
54+
);
55+
}
56+
}

app/globals.css

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,7 @@
224224
animation: appear 2s forwards;
225225
}
226226

227-
nav a::after {
228-
@apply content-[""] h-[3px] w-0 bg-white absolute left-0 bottom-0 transition-all duration-500;
229-
}
230-
231-
nav a:hover::after {
232-
@apply w-full;
233-
}
227+
234228

235229
/* ======================================
236230
* Mobile Menu

app/page.tsx

Lines changed: 70 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import React, { useState, useEffect } from 'react';
44
import Image from 'next/image';
55
import { FaFacebookF, FaGithub, FaLinkedinIn } from 'react-icons/fa';
66
import ParticlesBackground from '@/components/ParticlesBackground';
7-
import EthPriceLine from '@/components/EthPriceLine';
7+
import EthPriceLine from '@/components/home/EthPriceLine';
8+
import CryptoPathExplorer from '@/components/home/CryptoExplorer';
9+
import TrendingProjects from '@/components/home/TrendingProjects';
10+
import TrendingNFTCollections from '@/components/home/TrendingNFTs';
811
import FAQ from './FAQ';
912
import AOS from 'aos';
1013
import 'aos/dist/aos.css';
@@ -19,94 +22,94 @@ type Language = 'en' | 'vi';
1922
// Translation object
2023
const translations = {
2124
en: {
22-
vietnamPremierCrypto: "Vietnam's Premier Crypto Platform",
23-
joinAllInOne: "Join the all-in-one crypto ",
24-
appInVietnam: "app in Vietnam",
25+
vietnamPremierCrypto: "Vietnam's Premier Blockchain Explorer",
26+
joinAllInOne: "Your all-in-one crypto ",
27+
appInVietnam: "transaction explorer",
2528
emailPlaceholder: "Your Email Address...",
2629
signUpSuccess: "Sign Up Successfully!",
2730
processing: "Processing...",
2831
tryCryptoPath: "Try CryptoPath",
29-
tradeLikePro: "Trade like ",
30-
aPro: "a pro",
31-
getLowestFees: "Get the lowest fees, fastest transactions, powerful APIs, and more",
32-
oneApplication: "One Application. ",
33-
infinitePotential: "Infinite Potential",
34-
exploreNFTMarketplace: "Explore the world's best NFT marketplace, DEX, and wallets supporting all your favorite chains.",
35-
exploreDecentralized: "Explore decentralized applications and experience cutting-edge blockchain technology.",
36-
exchange: "Exchange",
37-
web3: "Web3",
38-
accompanyingYou: "Accompanying You ",
39-
everyStep: "Every Step of the Way",
40-
fromCryptoTransactions: "From cryptocurrency transactions to your first NFT purchase, CryptoPath will guide you through the entire process.",
41-
believeInYourself: "Believe in yourself and never stop learning.",
32+
tradeLikePro: "Track transactions ",
33+
aPro: "like never before",
34+
getLowestFees: "Real-time transaction monitoring, comprehensive analytics, and powerful visualization tools",
35+
oneApplication: "One Platform. ",
36+
infinitePotential: "Complete Insights",
37+
exploreNFTMarketplace: "Track real-time cryptocurrency transactions, monitor market trends, and analyze blockchain metrics with our comprehensive dashboard.",
38+
exploreDecentralized: "Explore detailed transaction histories, wallet analytics, and network statistics with our powerful blockchain explorer.",
39+
exchange: "Analytics",
40+
web3: "Explorer",
41+
accompanyingYou: "Your Gateway to ",
42+
everyStep: "Blockchain Data",
43+
fromCryptoTransactions: "From real-time transaction tracking to comprehensive market analysis, CryptoPath provides you with all the tools you need to understand blockchain activity.",
44+
believeInYourself: "Make informed decisions with data-driven insights.",
4245
meetTheTeam: "Meet the ",
4346
team: "Team",
44-
willingToListen: "We are always willing to listen to everyone!",
45-
whatIsCryptoPath: "What is ",
47+
willingToListen: "Dedicated to building the best blockchain explorer!",
48+
whatIsCryptoPath: "Why ",
4649
cryptoPath: "CryptoPath?",
47-
hearFromTopIndustry: "Hear from top industry leaders to understand",
48-
whyCryptoPathIsFavorite: "why CryptoPath is everyone's favorite application.",
50+
hearFromTopIndustry: "A powerful blockchain explorer that helps you",
51+
whyCryptoPathIsFavorite: "track, analyze, and understand cryptocurrency transactions.",
4952
learnMore: "Learn More",
50-
whatIsCryptocurrency: "What is Cryptocurrency?",
51-
explainingNewCurrency: "Explaining the \"new currency of the world\"",
52-
redefiningSystem: "Redefining the system",
53-
welcomeToWeb3: "Welcome to Web3",
54-
whatIsBlockchain: "What is Blockchain?",
55-
understandBlockchain: "Understand how Blockchain works",
53+
whatIsCryptocurrency: "Real-Time Analytics",
54+
explainingNewCurrency: "Track market trends and transaction flows",
55+
redefiningSystem: "Transaction Explorer",
56+
welcomeToWeb3: "Monitor blockchain activity in real-time",
57+
whatIsBlockchain: "Network Statistics",
58+
understandBlockchain: "Comprehensive blockchain metrics and insights",
5659
trustedBy: "Trusted",
57-
industryLeaders: "by industry leaders",
58-
testimonialText: "\"CryptoPath is an amazing platform for tracking transactions. I can't even picture what the world would be like without it\"",
60+
industryLeaders: "by crypto enthusiasts",
61+
testimonialText: "\"CryptoPath provides the most comprehensive and user-friendly blockchain explorer I've ever used. The real-time analytics and transaction tracking are invaluable.\"",
5962
founderOf: "Founder of CryptoPath",
60-
readyToStart: "Ready to start your crypto journey?",
61-
joinThousands: "Join thousands of Vietnamese users who are already trading, investing, and earning with CryptoPath.",
62-
downloadNow: "Download Now",
63+
readyToStart: "Ready to explore the blockchain?",
64+
joinThousands: "Join thousands of users who are already using CryptoPath to track and analyze cryptocurrency transactions.",
65+
downloadNow: "Start Exploring",
6366
pleaseEnterEmail: "Please enter your email address",
6467
pleaseEnterValidEmail: "Please enter a valid email address",
6568
errorOccurred: "An error occurred while registering!",
6669
registrationSuccessful: "Registration successful! Please check your email."
6770
},
6871
vi: {
69-
vietnamPremierCrypto: "Nền tảng Crypto hàng đầu Việt Nam",
70-
joinAllInOne: "Tham gia ứng dụng crypto ",
71-
appInVietnam: "tất cả trong một ở Việt Nam",
72+
vietnamPremierCrypto: "Nền Tảng Khám Phá Blockchain Hàng Đầu Việt Nam",
73+
joinAllInOne: "Nền tảng theo dõi giao dịch ",
74+
appInVietnam: "tiền điện tử toàn diện",
7275
emailPlaceholder: "Địa chỉ Email của bạn...",
7376
signUpSuccess: "Đăng ký thành công!",
7477
processing: "Đang xử lý...",
7578
tryCryptoPath: "Dùng thử CryptoPath",
76-
tradeLikePro: "Giao dịch như ",
77-
aPro: "chuyên gia",
78-
getLowestFees: "Nhận phí thấp nhất, giao dịch nhanh nhất, API mạnh mẽ nhiều hơn nữa",
79-
oneApplication: "Một ứng dụng. ",
80-
infinitePotential: "Tiềm năng vô hạn",
81-
exploreNFTMarketplace: "Khám phá thị trường NFT, DEX tốt nhất thế giới ví hỗ trợ tất cả các chuỗi yêu thích của bạn.",
82-
exploreDecentralized: "Khám phá các ứng dụng phi tập trung trải nghiệm công nghệ blockchain tiên tiến.",
83-
exchange: "Sàn giao dịch",
84-
web3: "Web3",
85-
accompanyingYou: "Đồng hành cùng bạn ",
86-
everyStep: "trong từng bước đi",
87-
fromCryptoTransactions: "Từ giao dịch tiền điện tử đến việc mua NFT đầu tiên, CryptoPath sẽ hướng dẫn bạn qua toàn bộ quá trình.",
88-
believeInYourself: "Hãy tin vào chính mình và không ngừng học hỏi.",
79+
tradeLikePro: "Theo dõi giao dịch ",
80+
aPro: "theo cách mới",
81+
getLowestFees: "Giám sát giao dịch thời gian thực, phân tích toàn diện công cụ trực quan mạnh mẽ",
82+
oneApplication: "Một nền tảng. ",
83+
infinitePotential: "Thông tin đầy đủ",
84+
exploreNFTMarketplace: "Theo dõi giao dịch tiền điện tử thời gian thực, giám sát xu hướng thị trường phân tích các chỉ số blockchain với bảng điều khiển toàn diện của chúng tôi.",
85+
exploreDecentralized: "Khám phá lịch sử giao dịch chi tiết, phân tích ví thống kê mạng lưới với công cụ khám phá blockchain mạnh mẽ của chúng tôi.",
86+
exchange: "Phân tích",
87+
web3: "Khám phá",
88+
accompanyingYou: "Cổng thông tin ",
89+
everyStep: "Blockchain của bạn",
90+
fromCryptoTransactions: "Từ theo dõi giao dịch thời gian thực đến phân tích thị trường toàn diện, CryptoPath cung cấp cho bạn tất cả các công cụ cần thiết để hiểu hoạt động blockchain.",
91+
believeInYourself: "Đưa ra quyết định dựa trên dữ liệu thực tế.",
8992
meetTheTeam: "Gặp gỡ ",
9093
team: "Đội ngũ",
91-
willingToListen: "Chúng tôi luôn sẵn sàng lắng nghe mọi người!",
92-
whatIsCryptoPath: "CryptoPath ",
93-
cryptoPath: "là gì?",
94-
hearFromTopIndustry: "Lắng nghe từ các nhà lãnh đạo hàng đầu trong ngành để hiểu",
95-
whyCryptoPathIsFavorite: "tại sao CryptoPath là ứng dụng yêu thích của mọi người.",
94+
willingToListen: "Luôn nỗ lực xây dựng nền tảng khám phá blockchain tốt nhất!",
95+
whatIsCryptoPath: "Tại sao chọn ",
96+
cryptoPath: "CryptoPath?",
97+
hearFromTopIndustry: "Một công cụ khám phá blockchain mạnh mẽ giúp bạn",
98+
whyCryptoPathIsFavorite: "theo dõi, phân tích và hiểu các giao dịch tiền điện tử.",
9699
learnMore: "Tìm hiểu thêm",
97-
whatIsCryptocurrency: "Tiền điện tử là gì?",
98-
explainingNewCurrency: "Giải thích về \"đồng tiền mới của thế giới\"",
99-
redefiningSystem: "Định nghĩa lại hệ thống",
100-
welcomeToWeb3: "Chào mừng đến với Web3",
101-
whatIsBlockchain: "Blockchain là gì?",
102-
understandBlockchain: "Hiểu cách Blockchain hoạt động",
100+
whatIsCryptocurrency: "Phân tích thời gian thực",
101+
explainingNewCurrency: "Theo dõi xu hướng thị trường và luồng giao dịch",
102+
redefiningSystem: "Khám phá giao dịch",
103+
welcomeToWeb3: "Giám sát hoạt động blockchain theo thời gian thực",
104+
whatIsBlockchain: "Thống kê mạng lưới",
105+
understandBlockchain: "Số liệu và thông tin blockchain toàn diện",
103106
trustedBy: "Được tin dùng",
104-
industryLeaders: "bởi các nhà lãnh đạo ngành",
105-
testimonialText: "\"CryptoPath là một nền tảng tuyệt vời để theo dõi giao dịch. Tôi thậm chí không thể tưởng tượng thế giới sẽ như thế nào nếu không có nó\"",
107+
industryLeaders: "bởi cộng đồng crypto",
108+
testimonialText: "\"CryptoPath cung cấp công cụ khám phá blockchain toàn diện và thân thiện nhất mà tôi từng sử dụng. Phân tích thời gian thực và theo dõi giao dịch là vô giá.\"",
106109
founderOf: "Nhà sáng lập CryptoPath",
107-
readyToStart: "Sẵn sàng bắt đầu hành trình tiền điện tử của bạn?",
108-
joinThousands: "Tham gia cùng hàng nghìn người dùng Việt Nam đang giao dịch, đầu tưkiếm tiền với CryptoPath.",
109-
downloadNow: "Tải xuống ngay",
110+
readyToStart: "Sẵn sàng khám phá blockchain?",
111+
joinThousands: "Tham gia cùng hàng nghìn người dùng đang sử dụng CryptoPath để theo dõiphân tích giao dịch tiền điện tử.",
112+
downloadNow: "Bắt đầu khám phá",
110113
pleaseEnterEmail: "Vui lòng nhập địa chỉ email của bạn",
111114
pleaseEnterValidEmail: "Vui lòng nhập địa chỉ email hợp lệ",
112115
errorOccurred: "Đã xảy ra lỗi khi đăng ký!",
@@ -238,6 +241,7 @@ const HomePage = () => {
238241
<div className="relative font-sans">
239242
<ParticlesBackground />
240243
<EthPriceLine/>
244+
<CryptoPathExplorer language={language}/>
241245
<div className="relative z-10 bg-transparent">
242246
{/* Description Section */}
243247
<div className="min-h-screen w-full flex items-center" data-aos="fade-up">
@@ -288,7 +292,7 @@ const HomePage = () => {
288292
</div>
289293

290294
<PartnerBar />
291-
295+
<TrendingProjects />
292296
{/* Trade Like a Pro Section */}
293297
<div className="min-h-screen w-full flex items-center" data-aos="fade-up">
294298
<div className="container mx-auto px-4 py-12 text-center" data-aos="fade-up">
@@ -352,7 +356,7 @@ const HomePage = () => {
352356
</div>
353357
</div>
354358
</div>
355-
359+
<TrendingNFTCollections />
356360
{/* Evolution Illustration Section */}
357361
<div className="container mx-auto px-4 py-12 text-center" data-aos="fade-up">
358362
<h1 className="text-4xl font-bold mb-4">{t.accompanyingYou}<span className="text-[#F5B056]">{t.everyStep}</span></h1>

0 commit comments

Comments
 (0)