"use client"; import { FC } from "react"; import { formatYearMonth } from "../lib/format"; import { YearMonth } from "../lib/db-types"; import { formatCurrency } from "../lib/formatStrings"; import { redirect, useParams, useRouter } from "next/navigation"; export interface MonthCardProps { yearMonth: YearMonth, children?: React.ReactNode, monthlyExpense:number, expanded?:boolean } export const MonthCard:FC = ({ yearMonth, children, monthlyExpense, expanded }) => { const router = useRouter(); // setting the `month` will activate the accordion belonging to that month const handleChange = (event:any) => router.push(`/?year=${yearMonth.year}&month=${yearMonth.month}`) return(
{`${formatYearMonth(yearMonth)}`} { monthlyExpense>0 ?

Total monthly expenditure: { formatCurrency(monthlyExpense) }

: null }
{children}
) };