diff --git a/src/app/components/portfolio/AddNew.tsx b/src/app/components/portfolio/AddNew.tsx index 55b0888..5a3bafd 100644 --- a/src/app/components/portfolio/AddNew.tsx +++ b/src/app/components/portfolio/AddNew.tsx @@ -1,90 +1,111 @@ "use client"; -import { - NavigationMenuContent, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuTrigger, -} from "@/app/shadcn_components/ui/navigation-menu"; -import { useRouter } from "next/navigation"; + +import { Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react"; + import { TableCellsIcon, DocumentMagnifyingGlassIcon, + ChevronDownIcon, + DocumentPlusIcon, } from "@heroicons/react/24/outline"; -import * as React from "react"; import { cn } from "@/lib/utils"; +import { useRouter } from "next/navigation"; +import { Dispatch, SetStateAction, useState } from "react"; -const ListItem = React.forwardRef< - React.ElementRef<"a">, - React.ComponentPropsWithoutRef<"a"> ->(({ className, title, children, ...props }, ref) => { - return ( -
  • - - -
    {title}
    -
    - {children} -
    -
    -
    -
  • - ); -}); -ListItem.displayName = "ListItem"; +interface AddNewProps { + portfolioId: string; + isUploadCsvOpen: boolean; + setIsUploadCsvOpen: Dispatch>; +} -export default function AddNewDropDown({ +export default function AddNew({ portfolioId, isUploadCsvOpen, setIsUploadCsvOpen, - isRemoteAssessmentOpen, - setIsRemoteAssessmentOpen, -}: { - portfolioId: string; - isUploadCsvOpen: boolean; - setIsUploadCsvOpen: React.Dispatch>; - isRemoteAssessmentOpen: boolean; - setIsRemoteAssessmentOpen: React.Dispatch>; -}) { - function handleClickUploadCSV() { - setIsUploadCsvOpen(!isUploadCsvOpen); - } - +}: AddNewProps) { const router = useRouter(); + const [loadingRemote, setLoadingRemote] = useState(false); - function handleClickRemoteAssessment() { + function handleRemoteAssessment() { + setLoadingRemote(true); router.push(`/portfolio/${portfolioId}/remote-assessment`); } return ( - - + + + New Property - - -
      - -
      - Remote - Assessment -
      - Run a remote assessment for a single unit -
      - -
      - File Import -
      - Upload a excel or csv file, containing multiple units -
      -
    -
    - + +
    + + +
    + {/* Remote Assessment */} + + {({ active }) => ( + + )} + + + {/* CSV Upload */} + + {({ active }) => ( + + )} + +
    +
    +
    ); } diff --git a/src/app/components/portfolio/Toolbar.tsx b/src/app/components/portfolio/Toolbar.tsx index 4d16b46..6f3af36 100644 --- a/src/app/components/portfolio/Toolbar.tsx +++ b/src/app/components/portfolio/Toolbar.tsx @@ -2,17 +2,18 @@ import { Cog6ToothIcon, - BuildingOfficeIcon, ChartBarIcon, HomeModernIcon, - RocketLaunchIcon, + BuildingOffice2Icon, } from "@heroicons/react/24/outline"; import { NavigationMenu, NavigationMenuItem, NavigationMenuList, + NavigationMenuViewport, } from "@/app/shadcn_components/ui/navigation-menu"; import AddNewDropDown from "./AddNew"; +import YourProjectsDropdown from "./YourProjectsDropdown"; import UploadCsvModal from "@/app/portfolio/[slug]/components/UploadCsvModal"; import { ScenarioSelect } from "@/app/db/schema/recommendations"; import { useState } from "react"; @@ -28,12 +29,11 @@ export function Toolbar({ portfolioId, scenarios }: ToolbarProps) { const router = useRouter(); const pathname = usePathname(); const [modalIsOpen, setModalIsOpen] = useState(false); - const [isRemoteAssessmentOpen, setIsRemoteAssessmentOpen] = useState(false); const navItems = [ { label: "Portfolio", - icon: BuildingOfficeIcon, + icon: BuildingOffice2Icon, match: (p: string) => p === `/portfolio/${portfolioId}`, href: `/portfolio/${portfolioId}`, }, @@ -50,13 +50,9 @@ export function Toolbar({ portfolioId, scenarios }: ToolbarProps) { p.startsWith(`/portfolio/${portfolioId}/decent-homes`), href: `/portfolio/${portfolioId}/decent-homes`, }, - { - label: "Your Projects", - icon: RocketLaunchIcon, - match: (p: string) => - p.startsWith(`/portfolio/${portfolioId}/your-projects`), - href: `/portfolio/${portfolioId}/your-projects/plan`, - }, + ]; + + const SettingsItems = [ { label: "Settings", icon: Cog6ToothIcon, @@ -66,46 +62,75 @@ export function Toolbar({ portfolioId, scenarios }: ToolbarProps) { ]; return ( - - - {navItems.map(({ label, icon: Icon, href, match }) => { - const isActive = match(pathname); + <> + + + {navItems.map(({ label, icon: Icon, href, match }) => { + const isActive = match(pathname); - return ( - - - - ); - })} +
    + + {label} +
    + +
    + ); + })} + + + {SettingsItems.map(({ label, icon: Icon, href, match }) => { + const isActive = match(pathname); - - + return ( + + + + ); + })} + + + + - + ); } diff --git a/src/app/components/portfolio/YourProjectsDropdown.tsx b/src/app/components/portfolio/YourProjectsDropdown.tsx new file mode 100644 index 0000000..467cd26 --- /dev/null +++ b/src/app/components/portfolio/YourProjectsDropdown.tsx @@ -0,0 +1,102 @@ +"use client"; + +import { Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react"; + +import { + ChevronDownIcon, + ArrowTrendingUpIcon, + CalendarDaysIcon, + RocketLaunchIcon, +} from "@heroicons/react/24/outline"; + +import { cn } from "@/lib/utils"; +import { useRouter } from "next/navigation"; + +export default function YourProjectsDropdown({ + portfolioId, +}: { + portfolioId: string; +}) { + const router = useRouter(); + function handlePlanClick(portfolioId: string) { + router.push(`/portfolio/${portfolioId}/your-projects/plan`); + } + function handleLiveTrackingClick(portfolioId: string) { + router.push(`/portfolio/${portfolioId}/your-projects/live`); + } + + return ( + + + + Your Projects + + + + +
    + {/* Plans */} + + {({ active }) => ( + + )} + + + {/* Live Tracking */} + + {({ active }) => ( + + )} + +
    +
    +
    + ); +} diff --git a/src/app/globals.css b/src/app/globals.css index 7c2a88d..3b98d12 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -2,8 +2,6 @@ @tailwind components; @tailwind utilities; - - /* 🌞 Light Theme (raw HSL values) */ :root { --background: 0 0% 100%; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index c5f03c0..1ead4c1 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -49,11 +49,11 @@ export default async function RootLayout({ return ( - +