Skip to content

Commit 28f161e

Browse files
committed
fix: update teh explore
1 parent 01c1273 commit 28f161e

2 files changed

Lines changed: 84 additions & 157 deletions

File tree

components/landing-page/Explore.tsx

Lines changed: 83 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import { cn } from '@/lib/utils';
44
import { ArrowRight } from 'lucide-react';
55
import Image from 'next/image';
66
import { useState, useRef, useEffect } from 'react';
7+
import ProjectCard from './project/ProjectCard';
78

8-
interface Projects {
9+
interface ExploreProject {
910
id: string;
1011
daysToDeadline?: number;
11-
status: string;
12+
status: 'Validation' | 'Funding' | 'Funded' | 'Completed';
1213
projectImg: string;
1314
currentAmount?: number;
1415
targetAmount?: number;
@@ -17,16 +18,27 @@ interface Projects {
1718
milestonesCompleted?: number;
1819
totalMilestones?: number;
1920
milestonesRejected?: number;
21+
creatorName: string;
22+
creatorLogo: string;
23+
projectImage: string;
24+
projectTitle: string;
25+
projectDescription: string;
2026
}
2127

22-
const projects: Projects[] = [
28+
const projects: ExploreProject[] = [
2329
{
2430
id: '1',
2531
status: 'Validation',
2632
currentVotes: 28,
2733
targetVotes: 100,
2834
daysToDeadline: 43,
2935
projectImg: '/landing/explore/project-placeholder-1.png',
36+
creatorName: 'Alice Johnson',
37+
creatorLogo: '/landing/explore/creator-1.png',
38+
projectImage: '/landing/explore/project-placeholder-1.png',
39+
projectTitle: 'DeFi Protocol Innovation',
40+
projectDescription:
41+
'Building the next generation of decentralized finance protocols with enhanced security and efficiency.',
3042
},
3143
{
3244
id: '2',
@@ -35,6 +47,12 @@ const projects: Projects[] = [
3547
targetAmount: 300000,
3648
daysToDeadline: 15,
3749
projectImg: '/landing/explore/project-placeholder-2.png',
50+
creatorName: 'Bob Smith',
51+
creatorLogo: '/landing/explore/creator-2.png',
52+
projectImage: '/landing/explore/project-placeholder-2.png',
53+
projectTitle: 'NFT Marketplace Platform',
54+
projectDescription:
55+
'Creating a comprehensive NFT marketplace with advanced trading features and community tools.',
3856
},
3957
{
4058
id: '3',
@@ -43,6 +61,12 @@ const projects: Projects[] = [
4361
totalMilestones: 6,
4462
milestonesRejected: 1,
4563
projectImg: '/landing/explore/project-placeholder-3.png',
64+
creatorName: 'Carol Davis',
65+
creatorLogo: '/landing/explore/creator-3.png',
66+
projectImage: '/landing/explore/project-placeholder-3.png',
67+
projectTitle: 'Blockchain Education Platform',
68+
projectDescription:
69+
'Educational platform for blockchain technology with interactive courses and certifications.',
4670
},
4771
{
4872
id: '4',
@@ -51,6 +75,12 @@ const projects: Projects[] = [
5175
totalMilestones: 6,
5276
daysToDeadline: 3,
5377
projectImg: '/landing/explore/project-placeholder-4.png',
78+
creatorName: 'David Wilson',
79+
creatorLogo: '/landing/explore/creator-4.png',
80+
projectImage: '/landing/explore/project-placeholder-4.png',
81+
projectTitle: 'DAO Governance Tool',
82+
projectDescription:
83+
'Advanced governance tools for decentralized autonomous organizations with voting mechanisms.',
5484
},
5585
{
5686
id: '5',
@@ -59,6 +89,12 @@ const projects: Projects[] = [
5989
targetAmount: 300000,
6090
daysToDeadline: 15,
6191
projectImg: '/landing/explore/project-placeholder-2.png',
92+
creatorName: 'Eva Brown',
93+
creatorLogo: '/landing/explore/creator-5.png',
94+
projectImage: '/landing/explore/project-placeholder-2.png',
95+
projectTitle: 'Web3 Social Network',
96+
projectDescription:
97+
'Decentralized social networking platform with user-owned data and content monetization.',
6298
},
6399
{
64100
id: '6',
@@ -67,6 +103,12 @@ const projects: Projects[] = [
67103
targetVotes: 100,
68104
daysToDeadline: 43,
69105
projectImg: '/landing/explore/project-placeholder-1.png',
106+
creatorName: 'Frank Miller',
107+
creatorLogo: '/landing/explore/creator-6.png',
108+
projectImage: '/landing/explore/project-placeholder-1.png',
109+
projectTitle: 'Cross-Chain Bridge Protocol',
110+
projectDescription:
111+
'Secure and efficient cross-chain bridge for seamless asset transfers between blockchains.',
70112
},
71113
];
72114

@@ -91,58 +133,6 @@ export default function Explore() {
91133
}
92134
}, [activeTab]);
93135

94-
const getProgressInfo = (project: Projects) => {
95-
if (project.status === 'Validation') {
96-
return {
97-
current: project.currentVotes,
98-
total: project.targetVotes,
99-
unit: 'Votes',
100-
percentage:
101-
project.currentVotes && project.targetVotes
102-
? (project.currentVotes / project.targetVotes) * 100
103-
: 0,
104-
};
105-
}
106-
107-
if (project.status === 'Funding') {
108-
return {
109-
current:
110-
project.currentAmount && project.targetAmount
111-
? `${project.currentAmount / 1000}k/${project.targetAmount / 1000} USDC`
112-
: 'N/A',
113-
total: null,
114-
unit: 'Raised',
115-
percentage:
116-
project.currentAmount && project.targetAmount
117-
? (project.currentAmount / project.targetAmount) * 100
118-
: 0,
119-
};
120-
}
121-
122-
if (project.status === 'Completed') {
123-
return {
124-
current: project.milestonesCompleted,
125-
total: project.totalMilestones,
126-
unit: 'Milestones Submitted',
127-
percentage:
128-
project.milestonesCompleted && project.totalMilestones
129-
? (project.milestonesCompleted / project.totalMilestones) * 100
130-
: 0,
131-
rejected: project.milestonesRejected,
132-
};
133-
}
134-
135-
return {
136-
current: project.milestonesCompleted,
137-
total: project.totalMilestones,
138-
unit: 'Milestones Submitted',
139-
percentage:
140-
project.milestonesCompleted && project.totalMilestones
141-
? (project.milestonesCompleted / project.totalMilestones) * 100
142-
: 0,
143-
};
144-
};
145-
146136
return (
147137
<section className='relative flex flex-col items-center justify-center text-white'>
148138
<div className='flex flex-col items-center gap-6 text-center'>
@@ -177,107 +167,44 @@ export default function Explore() {
177167
</div>
178168
</div>
179169

180-
<div className='mt-10 grid w-full max-w-6xl grid-cols-1 gap-6 px-4 md:grid-cols-2 md:px-6 lg:grid-cols-3 xl:px-0'>
181-
{projects.map(project => {
182-
const progressInfo = getProgressInfo(project);
183-
184-
return (
185-
<div
186-
className='max-w-md space-y-5 rounded-xl border border-[#2B2B2B] bg-[#030303] p-4'
187-
key={project.id}
188-
>
189-
{/* Top */}
190-
<div className='flex items-center justify-between'>
191-
<div className='flex items-center gap-2'>
192-
<Image
193-
src='/landing/explore/profile-head.svg'
194-
alt='Profile Head'
195-
width={24}
196-
height={24}
197-
className='aspect-auto rounded-full'
198-
/>
199-
<p className='text-sm text-[#B5B5B5]'>Creator Name</p>
200-
</div>
201-
202-
<div className='flex items-center gap-2'>
203-
<p className='rounded-sm border border-[#645D5D] bg-[#E4DBDB] p-1 text-xs font-semibold text-[#645D5D]'>
204-
Category
205-
</p>
206-
<p
207-
className={cn(
208-
'rounded-sm border border-[#99FF2D] bg-[#A7F950]/8 p-1 text-xs font-semibold text-[#36F94D]',
209-
project.status === 'Validation' &&
210-
'border-[#AD6F07] bg-[#FBE2B7] text-[#AD6F07]',
211-
project.status === 'Funding' &&
212-
'border-[#034592] bg-[#C6DDF7] text-[#034592]',
213-
project.status === 'Completed' &&
214-
'border-[#04802E] bg-[#B5E3C4] text-[#04802E]'
215-
)}
216-
>
217-
{project.status}
218-
</p>
219-
</div>
220-
</div>
221-
222-
{/* Middle */}
223-
<div className='flex gap-4'>
224-
<Image
225-
src={project.projectImg}
226-
alt='Project Image'
227-
width={80}
228-
height={90}
229-
className='aspect-square rounded-lg'
230-
/>
231-
<div className='space-y-2'>
232-
<p className='font-semibold'>Bitmed</p>
233-
<p className='text-sm'>
234-
To build a secure, transparent, and trusted digital health
235-
ecosystem powered by Sonic blockchain for 280M lives in
236-
Indonesia.
237-
</p>
238-
</div>
239-
</div>
240-
241-
{/* Bottom */}
242-
<div className='flex flex-col space-y-2'>
243-
<div className='flex items-center justify-between'>
244-
<p className='flex items-center gap-1 text-sm'>
245-
<span>
246-
{progressInfo.total
247-
? `${progressInfo.current}/${progressInfo.total}`
248-
: progressInfo.current}
249-
</span>
250-
<span className='text-xs text-[#B5B5B5]'>
251-
{progressInfo.unit}
252-
</span>
253-
</p>
254-
{project.daysToDeadline && (
255-
<p
256-
className={cn(
257-
'text-sm',
258-
project.daysToDeadline >= 40 && 'text-[#5FC381]',
259-
project.daysToDeadline < 40 && 'text-[#F5B546]',
260-
project.daysToDeadline < 10 && 'text-[#E26E6A]'
261-
)}
262-
>
263-
{project.daysToDeadline} days to deadline
264-
</p>
265-
)}
266-
{progressInfo.rejected && (
267-
<p className='text-sm text-[#E26E6A]'>
268-
{progressInfo.rejected} milestones rejected
269-
</p>
270-
)}
271-
</div>
272-
<progress
273-
value={progressInfo.percentage || 0}
274-
max={100}
275-
className='h-3 w-full rounded-full [&::-webkit-progress-bar]:rounded-full [&::-webkit-progress-bar]:bg-[#A7F950]/8 [&::-webkit-progress-value]:rounded-full [&::-webkit-progress-value]:bg-gradient-to-r [&::-webkit-progress-value]:from-[#A7F950]/30 [&::-webkit-progress-value]:to-[#A7F950]'
276-
></progress>
277-
</div>
278-
</div>
279-
);
280-
})}
170+
<div className='mt-10 grid w-fit grid-cols-1 gap-6 px-4 md:grid-cols-2 md:px-6 lg:grid-cols-3 xl:px-0'>
171+
{projects.map(project => (
172+
<ProjectCard
173+
key={project.id}
174+
deadlineInDays={project.daysToDeadline || 0}
175+
votes={
176+
project.currentVotes && project.targetVotes
177+
? {
178+
current: project.currentVotes,
179+
goal: project.targetVotes,
180+
}
181+
: undefined
182+
}
183+
funding={
184+
project.currentAmount && project.targetAmount
185+
? {
186+
current: project.currentAmount,
187+
goal: project.targetAmount,
188+
currency: 'USDC',
189+
}
190+
: undefined
191+
}
192+
milestones={
193+
project.milestonesCompleted && project.totalMilestones
194+
? {
195+
current: project.milestonesCompleted,
196+
goal: project.totalMilestones,
197+
}
198+
: undefined
199+
}
200+
status={project.status}
201+
creatorName={project.creatorName}
202+
creatorLogo={project.creatorLogo}
203+
projectImage={project.projectImage}
204+
projectTitle={project.projectTitle}
205+
projectDescription={project.projectDescription}
206+
/>
207+
))}
281208
</div>
282209

283210
{/* Footer */}

components/landing-page/blog/BlogSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,4 @@ const BlogSection = () => {
242242
);
243243
};
244244

245-
export default BlogSection;
245+
export default BlogSection;

0 commit comments

Comments
 (0)