diff --git a/src/app/components/home/ModalSubmit.tsx b/src/app/components/home/ModalSubmit.tsx new file mode 100644 index 0000000..b5c063d --- /dev/null +++ b/src/app/components/home/ModalSubmit.tsx @@ -0,0 +1,37 @@ +import { useRouter } from "next/navigation"; + +const ModalSubmit = ({ + buttonDisabled, + porfolioName, + budget, + objective, +}: { + buttonDisabled: boolean; + porfolioName: string; + budget: string; + objective: string; +}) => { + const router = useRouter(); + function createPortfolio() { + // TODO: This will be a server action that will create a new portfolio in the database + // That endpoint will return a uuid which will be the new portfolio's id + const id = "f290f1ee-6c54-4b01-90e6-d701748f0851"; + + router.push( + `/portfolio/${id}?name=${porfolioName}&budget=${budget}&objective=${objective}` + ); + } + + return ( + + ); +}; + +export default ModalSubmit; diff --git a/src/app/components/portfolio/AddNew.tsx b/src/app/components/portfolio/AddNew.tsx new file mode 100644 index 0000000..7eb2a19 --- /dev/null +++ b/src/app/components/portfolio/AddNew.tsx @@ -0,0 +1,32 @@ +"use client"; + +import { Menu } from "@headlessui/react"; +import Link from "next/link"; + +export default function AddNew() { + return ( +
+ ); +} diff --git a/src/app/portfolio/[slug]/page.tsx b/src/app/portfolio/[slug]/page.tsx new file mode 100644 index 0000000..3fa8314 --- /dev/null +++ b/src/app/portfolio/[slug]/page.tsx @@ -0,0 +1,106 @@ +import AddNew from "../../components/portfolio/AddNew"; + +export default async function Page({ + params, + searchParams, +}: { + params: { slug: string }; + searchParams: { [key: string]: string | string[] | undefined }; +}) { + // 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", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0851", + title: "Portfolio 1", + budget: "£500k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0852", + title: "Portfolio 2", + budget: "150k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0853", + title: "Portfolio 3", + budget: "£1m", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0854", + title: "Portfolio 4", + budget: "£2m", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0855", + title: "Portfolio 5", + budget: "£25k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0856", + title: "Portfolio 6", + budget: "£10k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0857", + title: "Portfolio 7", + budget: "£33k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0858", + title: "Portfolio 8", + budget: "£670k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0859", + title: "Portfolio 9", + budget: "£240k", + }, + { + id: "d290f1ee-6c54-4b01-90e6-d701748f0860", + title: "Portfolio 10", + budget: "93k", + }, + ]; + const demo_id = "f290f1ee-6c54-4b01-90e6-d701748f0851"; + + console.log(params); + console.log(searchParams); + let page_config; + let pageName; + if (params.slug === demo_id) { + page_config = { + properties: [], + ...searchParams, + }; + pageName = searchParams.name; + } else { + page_config = Portfolios.filter((portfolio) => { + return portfolio.id == params.slug; + })[0]; + pageName = page_config.name; + } + + // 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 + + console.log(page_config); + + return ( + <> +