diff --git a/src/app/components/portfolio/AddNew.tsx b/src/app/components/portfolio/AddNew.tsx index f38cb40..32cf000 100644 --- a/src/app/components/portfolio/AddNew.tsx +++ b/src/app/components/portfolio/AddNew.tsx @@ -2,27 +2,30 @@ import { Menu } from "@headlessui/react"; import Link from "next/link"; +import { PlusIcon, TableCellsIcon } from "@heroicons/react/24/outline"; export default function AddNew({ portfolioId }: { portfolioId: string }) { return ( - +
Add New
+ Add Unit diff --git a/src/app/portfolio/[slug]/page.tsx b/src/app/portfolio/[slug]/page.tsx index 181199c..cf8ed0a 100644 --- a/src/app/portfolio/[slug]/page.tsx +++ b/src/app/portfolio/[slug]/page.tsx @@ -1,86 +1,158 @@ +import { PencilSquareIcon, HomeIcon } from "@heroicons/react/24/outline"; import AddNew from "../../components/portfolio/AddNew"; +function EmptyPropertyState() { + return ( +
+
+

+ Click on Add new to start adding properties to your Portfolio + +

+
+
+ ); +} + export default async function Page({ params, searchParams, }: { params: { slug: string }; - searchParams: { [key: string]: string | string[] | undefined }; + searchParams: { [key: string]: string | string[] | undefined | number }; }) { // This is temp until we retrieve this data from the frontend // TODO: Update the objects to contains objective + any other required information const Portfolios = [ { id: "f290f1ee-6c54-4b01-90e6-d701748f0851", + properties: [], }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0851", title: "Portfolio 1", - budget: "£500k", + budget: 500000, + properties: [], + co2Reduction: 5.4, + totalWorksHours: 45, + totalValueIncrease: 500000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0852", title: "Portfolio 2", - budget: "150k", + budget: 150000, + properties: [], + co2Reduction: 9.0, + totalWorksHours: 30, + totalValueIncrease: 150000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0853", title: "Portfolio 3", - budget: "£1m", + budget: 1000000, + properties: [], + co2Reduction: 15.4, + totalWorksHours: 100, + totalValueIncrease: 1000000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0854", title: "Portfolio 4", - budget: "£2m", + budget: 2000000, + properties: [], + co2Reduction: 3.8, + totalWorksHours: 150, + totalValueIncrease: 2000000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0855", title: "Portfolio 5", - budget: "£25k", + budget: 25000, + properties: [], + co2Reduction: 1.9, + totalWorksHours: 15, + totalValueIncrease: 25000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0856", title: "Portfolio 6", - budget: "£10k", + budget: 10000, + properties: [], + co2Reduction: 1.4, + totalWorksHours: 10, + totalValueIncrease: 10000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0857", title: "Portfolio 7", - budget: "£33k", + budget: 33000, + properties: [], + co2Reduction: 10.4, + totalWorksHours: 25, + totalValueIncrease: 33000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0858", title: "Portfolio 8", - budget: "£670k", + budget: 670000, + properties: [], + co2Reduction: 4.5, + totalWorksHours: 65, + totalValueIncrease: 670000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0859", title: "Portfolio 9", - budget: "£240k", + budget: 240000, + properties: [], + co2Reduction: 8.4, + totalWorksHours: 40, + totalValueIncrease: 240000 * 1.2, }, { id: "d290f1ee-6c54-4b01-90e6-d701748f0860", title: "Portfolio 10", - budget: "93k", + budget: 93000, + properties: [], + co2Reduction: 5.4, + totalWorksHours: 18, + totalValueIncrease: 93000 * 1.2, }, ]; const demo_id = "f290f1ee-6c54-4b01-90e6-d701748f0851"; let page_config; let pageName; + let budget; + let co2Reduction: number; + let totalWorksHours: number; + let totalValueIncrease: number; if (params.slug === demo_id) { page_config = { properties: [], ...searchParams, }; pageName = searchParams.name; + budget = searchParams.budget; + co2Reduction = 0; + totalWorksHours = 0; + totalValueIncrease = 0; } else { page_config = Portfolios.filter((portfolio) => { return portfolio.id == params.slug; })[0]; pageName = page_config.title; + budget = page_config.budget; + co2Reduction = page_config.co2Reduction as number; + totalWorksHours = page_config.totalWorksHours as number; + totalValueIncrease = page_config.totalValueIncrease as number; } + // TODO: Put this back in for demo + // const properties = page_config.properties; + + const properties: [] = []; + // TODO: Add the porfolio summary information on the left // Add an empty state for when there are no properties // Create populated state for when there are properties @@ -88,11 +160,38 @@ export default async function Page({ return ( <>
-

Portfolio: {pageName}

+

Portfolio: {pageName}

-
-
+
+
+

Portfolio Summary

+
    +
  • + Budget: {budget || "Not Set"} + +
  • +
  • + Number of properties: {properties.length} +
  • +
  • + Annual Co2 Savings: {co2Reduction} tonnes +
  • +
  • + Total Works Time: {totalWorksHours} hours +
  • +
  • + Total Value Increase: £{totalValueIncrease} +
  • +
  • + Annual Value Increase: £{totalValueIncrease} +
  • +
+
+
+ {properties ? : "Implement me"} +
+