diff --git a/app/ui/MonthLocationList.tsx b/app/ui/MonthLocationList.tsx index eb484a1..01b3584 100644 --- a/app/ui/MonthLocationList.tsx +++ b/app/ui/MonthLocationList.tsx @@ -7,7 +7,7 @@ import { MonthCard } from "./MonthCard"; import Pagination from "./Pagination"; import { LocationCard } from "./LocationCard"; import { BillingLocation, YearMonth } from "../lib/db-types"; -import { useParams, useRouter, useSearchParams } from "next/navigation"; +import { useRouter, useSearchParams } from "next/navigation"; const getNextYearMonth = (yearMonth:YearMonth) => { const {year, month} = yearMonth; @@ -77,11 +77,15 @@ export const MonthLocationList:React.FC = ({ monthsArray.map(([monthKey, { yearMonth, locations, monthlyExpense }], monthIx) => { - locations.map((location, ix) => ) + yearMonth.month === expandedMonth ? + locations.map((location, ix) => ) + : null } { - // show AddLocationButton as a last item in the first month - monthIx === 0 ? : null + yearMonth.month === expandedMonth ? + // show AddLocationButton as a last item in the first month + (monthIx === 0 ? : null) + : null } )