diff --git a/src/app/components/portfolio/Toolbar.tsx b/src/app/components/portfolio/Toolbar.tsx index 0d6226a..7fcae07 100644 --- a/src/app/components/portfolio/Toolbar.tsx +++ b/src/app/components/portfolio/Toolbar.tsx @@ -50,7 +50,7 @@ export function Toolbar({ portfolioId, scenarios }: ToolbarProps) { } function handleClickProgressReport() { - router.push(`/portfolio/${portfolioId}/reports`); + router.push(`/portfolio/${portfolioId}/live-projects`); } const [modalIsOpen, setModalIsOpen] = useState(false); diff --git a/src/app/portfolio/[slug]/(portfolio)/live-projects/Report.tsx b/src/app/portfolio/[slug]/(portfolio)/live-projects/Report.tsx index b2726c1..91bad8b 100644 --- a/src/app/portfolio/[slug]/(portfolio)/live-projects/Report.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/live-projects/Report.tsx @@ -9,7 +9,10 @@ interface ReportsProps { deals: Record[]; } -export default function Reports({ deals }: ReportsProps) { +// ๐ŸŸฉ Stage mapping: โ€œMajor Condition Issuesโ€ = dealstage 3061261536 +const MAJOR_CONDITION_STAGE_ID = "3061261536"; + +export default function LiveTracker({ deals }: ReportsProps) { const [openTable, setOpenTable] = useState<{ stage: string; data: any[]; @@ -39,46 +42,120 @@ export default function Reports({ deals }: ReportsProps) { const [currentProjectCode, setCurrentProjectCode] = useState(projectCodes[0]); const currentDeals = groupedDeals[currentProjectCode]; + // ๐Ÿ”น Compute overall summary (across all projects) + const totalProperties = deals.length; + const majorConditionDeals = deals.filter( + (d) => d.dealstage === MAJOR_CONDITION_STAGE_ID + ); + const majorIssues = majorConditionDeals.length; + const majorPercent = ((majorIssues / totalProperties) * 100).toFixed(1); + + // ๐Ÿ”น Click handlers + const handleTotalClick = () => { + console.log("Opening all deals (global)"); + handleOpenTable("All Properties", deals); + }; + + const handleMajorClick = () => { + console.log("Opening all Major Condition Issues (global)"); + handleOpenTable("Major Condition Issues", majorConditionDeals); + }; + return ( -
-{/* ๐Ÿ”น Centered Dropdown Selector for Projects */} -
-

- Select Project -

+
+ {/* ๐Ÿ”น Global Overview Row */} +
+

+ ๐ŸŒ Global Portfolio Overview +

-
- +
+ {/* Total Properties */} + - {/* Custom dropdown arrow */} -
- โ–ผ -
-
-
+ {/* Major Condition Issues */} + - {/* Charts */} -
-
- -
-
- + {/* Project Dropdown Selector */} +
+ +
+ + + {/* Custom dropdown arrow */} +
+ โ–ผ +
+
+
-
- Showing project {currentProjectCode} + {/* ๐Ÿ”น Project-Level Section */} +
+

+ ๐Ÿ“Š Project-Level Insights +

+

+ Showing data for{" "} + + {currentProjectCode} + +

+ +
+
+ +
+
+ +
+
{/* ๐Ÿ”น Modal Table */} diff --git a/src/app/portfolio/[slug]/(portfolio)/live-projects/page.tsx b/src/app/portfolio/[slug]/(portfolio)/live-projects/page.tsx index db8e31c..08a5a3b 100644 --- a/src/app/portfolio/[slug]/(portfolio)/live-projects/page.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/live-projects/page.tsx @@ -5,6 +5,7 @@ import { surveyDB } from "../../../../db/surveyDB/connection"; import { hubspotDealData } from "../../../../db/schema/crm/hubspot_deal_table"; import { eq } from "drizzle-orm"; import Reports from "./Report"; +import LiveTracker from "./Report"; const Demo = async () => { const user = await getServerSession(AuthOptions); @@ -25,7 +26,7 @@ const Demo = async () => { return ( <> - + ); };