From 7d87473f666a814a6ebd4403a5d8565c85337c64 Mon Sep 17 00:00:00 2001 From: HussainKhanSherwani Date: Mon, 10 Feb 2025 17:07:15 +0500 Subject: [PATCH] removed extra spacing added icons --- .../[projectId]/reports/[reportType]/page.tsx | 23 +++++++-- .../projects/ProductDetailsPage.tsx | 50 +++++++------------ .../components/projects/ProjectInfoTable.tsx | 45 +++++++++++++++++ 3 files changed, 82 insertions(+), 36 deletions(-) create mode 100644 insights-ui/src/components/projects/ProjectInfoTable.tsx diff --git a/insights-ui/src/app/crowd-funding/projects/[projectId]/reports/[reportType]/page.tsx b/insights-ui/src/app/crowd-funding/projects/[projectId]/reports/[reportType]/page.tsx index 9f35d2d4b..d3d81f007 100644 --- a/insights-ui/src/app/crowd-funding/projects/[projectId]/reports/[reportType]/page.tsx +++ b/insights-ui/src/app/crowd-funding/projects/[projectId]/reports/[reportType]/page.tsx @@ -5,6 +5,7 @@ import remarkGfm from 'remark-gfm'; import { BreadcrumbsOjbect } from '@dodao/web-core/components/core/breadcrumbs/BreadcrumbsWithChevrons'; import { Metadata } from 'next'; import Breadcrumbs from '@/components/ui/Breadcrumbs'; +import { ProjectDetails, SpiderGraph } from '@/types/project/project'; export async function generateMetadata({ params }: { params: Promise<{ projectId: string; reportType: string }> }): Promise { const { projectId, reportType } = await params; @@ -63,9 +64,13 @@ export async function generateMetadata({ params }: { params: Promise<{ projectId export default async function ReportDetailPage({ params }: { params: Promise<{ projectId: string; reportType: string }> }) { const { projectId, reportType } = await params; - const res = await fetch(`${getBaseUrl()}/api/crowd-funding/projects/${projectId}/reports/${reportType}`); - const data: { reportDetail: string } = await res.json(); + const reportResponse = await fetch(`${getBaseUrl()}/api/crowd-funding/projects/${projectId}/reports/${reportType}`); + const reportData: { reportDetail: string } = await reportResponse.json(); + const projectResponse = await fetch(`${getBaseUrl()}/api/crowd-funding/projects/${projectId}`); + const projectData: { projectDetails: ProjectDetails; spiderGraph: SpiderGraph | {} } = await projectResponse.json(); + + const report = projectData.projectDetails.reports[reportType]; const breadcrumbs: BreadcrumbsOjbect[] = [ { name: projectId, @@ -89,7 +94,17 @@ export default async function ReportDetailPage({ params }: { params: Promise<{ p
- {data.reportDetail ? ( + {report.performanceChecklist?.length && ( +
    + {report.performanceChecklist.map((item, index) => ( +
  • + {item.score === 1 ? '✅' : '❌'} + {item.checklistItem} +
  • + ))} +
+ )} + {reportData.reportDetail ? ( <> , }} > - {data.reportDetail} + {reportData.reportDetail} ) : ( diff --git a/insights-ui/src/components/projects/ProductDetailsPage.tsx b/insights-ui/src/components/projects/ProductDetailsPage.tsx index 92b604b9f..ef984924c 100644 --- a/insights-ui/src/components/projects/ProductDetailsPage.tsx +++ b/insights-ui/src/components/projects/ProductDetailsPage.tsx @@ -1,11 +1,12 @@ import ProjectActionsDropdown from '@/components/projects/ProjectActionsDropdown'; import ReportActionsDropdown from '@/components/reports/ReportActionsDropdown'; -import { ProjectDetails, REPORT_TYPES_TO_DISPLAY, ReportInterfaceWithType, SpiderGraph, SpiderGraphPie } from '@/types/project/project'; +import { ProjectDetails, REPORT_TYPES_TO_DISPLAY, ReportInterfaceWithType, ReportType, SpiderGraph, SpiderGraphPie } from '@/types/project/project'; import { getReportName } from '@/util/report-utils'; import Link from 'next/link'; import React from 'react'; import RadarChart from '../ui/RadarChart'; import PrivateWrapper from '../auth/PrivateWrapper'; +import ProjectInfoTable from './ProjectInfoTable'; interface ProjectDetailPageProps { projectId: string; @@ -20,6 +21,16 @@ export default function ProjectDetailPage({ projectId, initialProjectDetails, pr type: r, }) ); + const reportIcons: { [key in ReportType]: string } = { + founder_and_team: '👨‍💼', // People/Team + market_opportunity: '📈', // Growth/Market + traction: '🚀', // Growth/Success + execution_and_speed: '⏱️', // Speed/Execution + valuation: '💰', // Finance/Value + financial_health: '📊', + [ReportType.GENERAL_INFO]: '', + [ReportType.RELEVANT_LINKS]: '', + }; const spiderGraph: SpiderGraph = Object.fromEntries( reports.map((report): [string, SpiderGraphPie] => { @@ -35,7 +46,7 @@ export default function ProjectDetailPage({ projectId, initialProjectDetails, pr console.log('projectDetails.reports', JSON.stringify(projectDetails.reports, null, 2)); return ( -
+
@@ -47,42 +58,17 @@ export default function ProjectDetailPage({ projectId, initialProjectDetails, pr
-
-
-
-
Crowd Funding Link
-
{initialProjectDetails.projectInfoInput.crowdFundingUrl}
-
-
-
Website Link
-
{initialProjectDetails.projectInfoInput.websiteUrl}
-
-
-
SEC Filing Link
-
{initialProjectDetails.projectInfoInput.secFilingUrl}
-
- {initialProjectDetails.projectInfoInput.additionalUrls && ( -
-
Additional Links
- {initialProjectDetails.projectInfoInput.additionalUrls.map((url, index) => ( -
- {url} -
- ))} -
- )} -
-
-
-
+ +
+
{REPORT_TYPES_TO_DISPLAY.map((reportType) => { const report = projectDetails.reports[reportType]; return (
-
diff --git a/insights-ui/src/components/projects/ProjectInfoTable.tsx b/insights-ui/src/components/projects/ProjectInfoTable.tsx new file mode 100644 index 000000000..887caa5ed --- /dev/null +++ b/insights-ui/src/components/projects/ProjectInfoTable.tsx @@ -0,0 +1,45 @@ +import React from 'react'; + +interface ProjectInfoInput { + crowdFundingUrl: string; + websiteUrl: string; + secFilingUrl: string; + additionalUrls?: string[]; +} + +interface ProjectInfoTableProps { + initialProjectDetails: { + projectInfoInput: ProjectInfoInput; + }; +} + +export default function ProjectInfoTable({ initialProjectDetails }: ProjectInfoTableProps) { + return ( +
+
+
+
Crowd Funding Link
+
{initialProjectDetails.projectInfoInput.crowdFundingUrl}
+
+
+
Website Link
+
{initialProjectDetails.projectInfoInput.websiteUrl}
+
+
+
SEC Filing Link
+
{initialProjectDetails.projectInfoInput.secFilingUrl}
+
+ {initialProjectDetails.projectInfoInput.additionalUrls && ( +
+
Additional Links
+ {initialProjectDetails.projectInfoInput.additionalUrls.map((url, index) => ( +
+ {url} +
+ ))} +
+ )} +
+
+ ); +}