Skip to content

Commit 5873a4e

Browse files
authored
Collins (#321)
* refactor: update project components and API for voting functionality - Adjust layout and styling in ProjectsPage and ProjectCard components. - Enhance ProjectSidebar to include crowdfund data and voting logic. - Implement new API methods for voting, retrieving votes, and removing votes. - Update types for vote handling in the API. - Clean up unused code and improve responsiveness across components. * chore: update project dependencies and enhance project details layout
1 parent 5aa1b5e commit 5873a4e

43 files changed

Lines changed: 7410 additions & 4232 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/(landing)/projects/[id]/milestone/[milestoneId]/page.tsx

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,64 @@ import MilstoneOverview from '@/components/project-details/project-milestone/mil
33
import MilestoneDetails from '@/components/project-details/project-milestone/milestone-details/MilestoneDetails';
44
import MilestoneLinks from '@/components/project-details/project-milestone/milestone-details/MilestoneLinks';
55
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
6+
import { getProjects } from '@/lib/api/project';
7+
import { CrowdfundingProject } from '@/lib/api/types';
68

79
interface MilestonePageProps {
810
params: Promise<{
9-
milestoneId: string; // This will be the milestone ID
11+
id: string; // Project ID
12+
milestoneId: string; // Milestone ID
1013
}>;
1114
}
1215

1316
const MilestonePage = async ({ params }: MilestonePageProps) => {
14-
const { milestoneId } = await params;
17+
const { id: projectId, milestoneId } = await params;
18+
19+
// Fetch project data
20+
let project: CrowdfundingProject | null = null;
21+
let milestone = null;
22+
23+
try {
24+
const projectResponse = await getProjects();
25+
if (projectResponse.projects) {
26+
// Find the specific project
27+
const foundProject = projectResponse.projects.find(
28+
(p: { id: string }) => p.id === projectId
29+
);
30+
project = foundProject
31+
? (foundProject as unknown as CrowdfundingProject)
32+
: null;
33+
34+
// Find the specific milestone
35+
milestone = project?.milestones?.find(
36+
(m: { _id: string }) => m._id === milestoneId
37+
);
38+
}
39+
} catch {
40+
// Handle error silently
41+
}
42+
43+
// If milestone not found, show error state
44+
if (!milestone) {
45+
return (
46+
<section className='mx-auto mt-5 flex max-w-[1440px] flex-col justify-center gap-5 px-5 py-5 md:flex-row md:justify-between md:gap-18 md:px-[50px] lg:px-[100px]'>
47+
<div className='w-full py-12 text-center'>
48+
<h1 className='mb-4 text-2xl font-bold text-white'>
49+
Milestone Not Found
50+
</h1>
51+
<p className='text-gray-400'>
52+
The requested milestone could not be found.
53+
</p>
54+
</div>
55+
</section>
56+
);
57+
}
1558

1659
return (
1760
<section className='mx-auto mt-5 flex max-w-[1440px] flex-col justify-center gap-5 px-5 py-5 md:flex-row md:justify-between md:gap-18 md:px-[50px] lg:px-[100px]'>
1861
<div className='w-full md:max-w-[500px]'>
19-
<MilstoneOverview />
62+
<MilstoneOverview project={project} milestone={milestone} />
2063
</div>
21-
{/* <div className=''> */}
2264
<Tabs defaultValue='details' className='w-full'>
2365
<div className='border-b border-gray-800 py-0'>
2466
<TabsList className='mb-0 h-auto w-fit justify-start gap-6 rounded-none bg-transparent p-0'>
@@ -37,13 +79,16 @@ const MilestonePage = async ({ params }: MilestonePageProps) => {
3779
</TabsList>
3880
</div>
3981
<TabsContent value='details'>
40-
<MilestoneDetails milestoneId={milestoneId} />
82+
<MilestoneDetails
83+
milestoneId={milestoneId}
84+
project={project}
85+
milestone={milestone}
86+
/>
4187
</TabsContent>
4288
<TabsContent value='links'>
43-
<MilestoneLinks />
89+
<MilestoneLinks project={project} milestone={milestone} />
4490
</TabsContent>
4591
</Tabs>
46-
{/* </div> */}
4792
</section>
4893
);
4994
};

app/(landing)/projects/[id]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ async function ProjectContent({ id }: { id: string }) {
7373
response.data.project,
7474
response.data.crowdfund
7575
);
76+
// Project data loaded successfully
7677
} else {
7778
throw new Error(response.message || 'Failed to fetch project');
7879
}
79-
} catch (err) {
80-
console.error('Error fetching project:', err);
80+
} catch {
8181
error = 'Failed to fetch project data';
8282
}
8383

@@ -86,7 +86,7 @@ async function ProjectContent({ id }: { id: string }) {
8686
}
8787

8888
return (
89-
<div className='mx-auto flex min-h-screen max-w-[1440px] flex-col space-y-[60px] overflow-x-hidden bg-[#030303] px-5 py-5 md:space-y-[80px] md:px-[50px] lg:px-[100px]'>
89+
<div className='mx-auto flex min-h-screen max-w-[1440px] flex-col space-y-[60px] bg-[#030303] px-5 py-5 md:space-y-[80px] md:px-[50px] lg:px-[100px]'>
9090
<div className='flex-1'>
9191
<ProjectLayout
9292
project={projectData.project}

app/(landing)/projects/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ProjectsClient from '@/components/project/ProjectsPage';
33

44
export default function ProjectsPage() {
55
return (
6-
<div className='relative mx-auto min-h-screen max-w-[1440px] bg-black px-5 py-5 md:px-[50px] lg:px-[100px]'>
6+
<div className='relative mx-auto min-h-screen max-w-[1440px] px-5 py-5 md:px-[50px] lg:px-[100px]'>
77
<ProjectPageHero />
88
<ProjectsClient />
99
</div>

app/globals.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,45 @@
1616
--color-gray-700: #787878;
1717
--color-gray-800: #484848;
1818
--color-gray-900: #2b2b2b;
19+
20+
/* Warning Colors */
21+
--color-warning-50: #fef6e7;
22+
--color-warning-75: #fbe2b7;
23+
--color-warning-100: #f7d394;
24+
--color-warning-200: #f7c164;
25+
--color-warning-300: #f5b546;
26+
--color-warning-400: #dd900d;
27+
--color-warning-500: #dd900d;
28+
--color-warning-600: #ad6f07;
29+
--color-warning-700: #865503;
30+
--color-warning-800: #664101;
31+
--color-warning-900: #523300;
32+
33+
/* Secondary Colors */
34+
--color-secondary-50: #e3effc;
35+
--color-secondary-75: #c6ddf7;
36+
--color-secondary-100: #b6d8ff;
37+
--color-secondary-200: #80bbff;
38+
--color-secondary-300: #3d89df;
39+
--color-secondary-400: #1671d9;
40+
--color-secondary-500: #0d5eba;
41+
--color-secondary-600: #034592;
42+
--color-secondary-700: #04326b;
43+
--color-secondary-800: #012657;
44+
--color-secondary-900: #001633;
45+
46+
/* Success Colors */
47+
--color-success-50: #e7f6ec;
48+
--color-success-75: #b5e3c4;
49+
--color-success-100: #91d6a8;
50+
--color-success-200: #5fc381;
51+
--color-success-300: #40b869;
52+
--color-success-400: #0f973d;
53+
--color-success-500: #099137;
54+
--color-success-600: #04802e;
55+
--color-success-700: #036b26;
56+
--color-success-800: #015b20;
57+
--color-success-900: #004617;
1958
}
2059
/* Custom scrollbar styles for comment modal */
2160
.custom-scrollbar {

components/EmptyState.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const EmptyState: React.FC<EmptyStateProps> = ({
8383
</p>
8484

8585
{/* Button or custom action */}
86-
{action ? (
86+
{action === false ? null : action ? (
8787
action
8888
) : (
8989
<button

components/Project-Page-Hero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Link from 'next/link';
77

88
export default function ProjectPageHero() {
99
return (
10-
<div className='relative min-h-screen overflow-hidden bg-black text-white'>
10+
<div className='relative min-h-screen overflow-hidden text-white'>
1111
<div className='pointer-events-none absolute inset-0'>
1212
<div className='absolute bottom-1/3 left-[220px] h-[393px] w-[476px] rounded-[476px] border-[20px] border-[#DBFFB7] opacity-[0.30px] mix-blend-overlay blur-[25px] md:block lg:!hidden' />
1313
<div

0 commit comments

Comments
 (0)