diff --git a/app/(landing)/projects/[id]/milestone/[milestoneId]/page.tsx b/app/(landing)/projects/[id]/milestone/[milestoneId]/page.tsx index ed19d5772..233e73089 100644 --- a/app/(landing)/projects/[id]/milestone/[milestoneId]/page.tsx +++ b/app/(landing)/projects/[id]/milestone/[milestoneId]/page.tsx @@ -3,22 +3,64 @@ import MilstoneOverview from '@/components/project-details/project-milestone/mil import MilestoneDetails from '@/components/project-details/project-milestone/milestone-details/MilestoneDetails'; import MilestoneLinks from '@/components/project-details/project-milestone/milestone-details/MilestoneLinks'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { getProjects } from '@/lib/api/project'; +import { CrowdfundingProject } from '@/lib/api/types'; interface MilestonePageProps { params: Promise<{ - milestoneId: string; // This will be the milestone ID + id: string; // Project ID + milestoneId: string; // Milestone ID }>; } const MilestonePage = async ({ params }: MilestonePageProps) => { - const { milestoneId } = await params; + const { id: projectId, milestoneId } = await params; + + // Fetch project data + let project: CrowdfundingProject | null = null; + let milestone = null; + + try { + const projectResponse = await getProjects(); + if (projectResponse.projects) { + // Find the specific project + const foundProject = projectResponse.projects.find( + (p: { id: string }) => p.id === projectId + ); + project = foundProject + ? (foundProject as unknown as CrowdfundingProject) + : null; + + // Find the specific milestone + milestone = project?.milestones?.find( + (m: { _id: string }) => m._id === milestoneId + ); + } + } catch { + // Handle error silently + } + + // If milestone not found, show error state + if (!milestone) { + return ( +
+
+

+ Milestone Not Found +

+

+ The requested milestone could not be found. +

+
+
+ ); + } return (
- +
- {/*
*/}
@@ -37,13 +79,16 @@ const MilestonePage = async ({ params }: MilestonePageProps) => {
- + - +
- {/*
*/}
); }; diff --git a/app/(landing)/projects/[id]/page.tsx b/app/(landing)/projects/[id]/page.tsx index e1aee744d..f260ab0be 100644 --- a/app/(landing)/projects/[id]/page.tsx +++ b/app/(landing)/projects/[id]/page.tsx @@ -73,11 +73,11 @@ async function ProjectContent({ id }: { id: string }) { response.data.project, response.data.crowdfund ); + // Project data loaded successfully } else { throw new Error(response.message || 'Failed to fetch project'); } - } catch (err) { - console.error('Error fetching project:', err); + } catch { error = 'Failed to fetch project data'; } @@ -86,7 +86,7 @@ async function ProjectContent({ id }: { id: string }) { } return ( -
+
+
diff --git a/app/globals.css b/app/globals.css index ce48e5a7b..2fef9035b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -16,6 +16,45 @@ --color-gray-700: #787878; --color-gray-800: #484848; --color-gray-900: #2b2b2b; + + /* Warning Colors */ + --color-warning-50: #fef6e7; + --color-warning-75: #fbe2b7; + --color-warning-100: #f7d394; + --color-warning-200: #f7c164; + --color-warning-300: #f5b546; + --color-warning-400: #dd900d; + --color-warning-500: #dd900d; + --color-warning-600: #ad6f07; + --color-warning-700: #865503; + --color-warning-800: #664101; + --color-warning-900: #523300; + + /* Secondary Colors */ + --color-secondary-50: #e3effc; + --color-secondary-75: #c6ddf7; + --color-secondary-100: #b6d8ff; + --color-secondary-200: #80bbff; + --color-secondary-300: #3d89df; + --color-secondary-400: #1671d9; + --color-secondary-500: #0d5eba; + --color-secondary-600: #034592; + --color-secondary-700: #04326b; + --color-secondary-800: #012657; + --color-secondary-900: #001633; + + /* Success Colors */ + --color-success-50: #e7f6ec; + --color-success-75: #b5e3c4; + --color-success-100: #91d6a8; + --color-success-200: #5fc381; + --color-success-300: #40b869; + --color-success-400: #0f973d; + --color-success-500: #099137; + --color-success-600: #04802e; + --color-success-700: #036b26; + --color-success-800: #015b20; + --color-success-900: #004617; } /* Custom scrollbar styles for comment modal */ .custom-scrollbar { diff --git a/components/EmptyState.tsx b/components/EmptyState.tsx index bd33ff5c1..3a5350416 100644 --- a/components/EmptyState.tsx +++ b/components/EmptyState.tsx @@ -83,7 +83,7 @@ const EmptyState: React.FC = ({

{/* Button or custom action */} - {action ? ( + {action === false ? null : action ? ( action ) : (