diff --git a/app/components/CapitalProjectsAccordionPanel.tsx b/app/components/CapitalProjectsAccordionPanel.tsx index c59f92c..e593d1b 100644 --- a/app/components/CapitalProjectsAccordionPanel.tsx +++ b/app/components/CapitalProjectsAccordionPanel.tsx @@ -1,4 +1,4 @@ -import { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Flex, HStack, Heading, IconButton } from "@nycplanning/streetscape" +import { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, Box, Text, Flex, HStack, Heading, IconButton, Stack } from "@nycplanning/streetscape" import { Agency, CapitalProject } from "~/gen"; import { CapitalProjectsList } from "./CapitalProjectsList"; import { ChevronLeftIcon } from "@chakra-ui/icons"; @@ -32,10 +32,8 @@ export const CapitalProjectsAccordionPanel = ({

- - {/*

sdlkfja;sdlkjf;sa

*/} - + {district} @@ -43,23 +41,16 @@ export const CapitalProjectsAccordionPanel = ({

- - - + -

sadlkfja;dsk

- - - - - +
diff --git a/app/components/CapitalProjectsList.tsx b/app/components/CapitalProjectsList.tsx index 7cdcc7d..f604790 100644 --- a/app/components/CapitalProjectsList.tsx +++ b/app/components/CapitalProjectsList.tsx @@ -1,14 +1,12 @@ -import { Box, Flex, Hide, FlexProps, VStack, HStack, IconButton, Link} from "@nycplanning/streetscape"; +import { Box, Flex, Hide, Text, VStack, HStack, IconButton, Link} from "@nycplanning/streetscape"; import { useState } from "react"; import { Agency, CapitalProject } from "~/gen"; -import { getYear, getMonth, compareAsc } from "date-fns"; +import { getYear, getMonth, compareAsc, format } from "date-fns"; import { CapitalProjectsListItem } from "./CapitalProjectsListItem"; import { Button } from "@chakra-ui/react"; -import { defineStyle, defineStyleConfig } from '@chakra-ui/react' import { ArrowLeftIcon, ArrowRightIcon, Icon } from "@chakra-ui/icons"; import { Pagination } from "./Pagination"; -import ReactPaginate from 'react-paginate'; -import { useSearchParams } from "@remix-run/react"; + export interface CapitalProjectsListProps { capitalProjects: Array; @@ -23,36 +21,8 @@ export const CapitalProjectsList = ({ capitalProjects, limit, offset, total, path, agencies, }: CapitalProjectsListProps) => { - const [searchParams] = useSearchParams(); - console.log(searchParams); - - function setSearchParamsString( - searchParams: URLSearchParams, - changes: Record, - ) { - const newSearchParams = new URLSearchParams(searchParams) - for (const [key, value] of Object.entries(changes)) { - if (value === undefined) { - newSearchParams.delete(key) - continue - } - newSearchParams.set(key, String(value)) - } - // Print string manually to avoid over-encoding the URL - // Browsers are ok with $ nowadays - // optional: return newSearchParams.toString() - return Array.from(newSearchParams.entries()) - .map(([key, value]) => - value ? `${key}=${encodeURIComponent(value)}` : key, - ) - .join("&") - } - const [isExpanded, setIsExpanded] = useState(false); - const numberOfPages = total / limit; - // Invoke when user click to request another page. - const getFiscalYearForDate = (date: Date): number => { const year = getYear(date); const month = getMonth(date); @@ -65,9 +35,23 @@ export const CapitalProjectsList = ({ : `FY${getFiscalYearForDate(minDate)}-FY${getFiscalYearForDate(maxDate)}`; }; - // const Pagination = () => + const currentDate = () => { + return `${format(new Date(), 'MM/dd/yyyy')}`; + } + return ( <> + + + Mapped Capital Projects as of {currentDate()} + + - {/* this should be a generic panel for project detail and list */} - - {/* we need a separate component for project list item */} + + - - {capitalProjects.map((capitalProject) => { - return ( - agency.initials === capitalProject.managingAgency, - )?.name } - yearRange={formatFiscalYearRange( - new Date(capitalProject.minDate), - new Date(capitalProject.maxDate), - )} - /> - ) - })} + + {capitalProjects.map((capitalProject) => { + return ( + agency.initials === capitalProject.managingAgency, + )?.name } + yearRange={formatFiscalYearRange( + new Date(capitalProject.minDate), + new Date(capitalProject.maxDate), + )} + /> + ) + })}