"use client"; import { FC, ReactNode } from "react"; import { Bill, BillingLocation } from "../lib/db-types"; import { useFormState } from "react-dom"; import { Main } from "./Main"; import { deleteBillById } from "../lib/actions/billActions"; import Link from "next/link"; import { useTranslations } from "next-intl"; export interface BillDeleteFormProps { bill: Bill, location: BillingLocation } export const BillDeleteForm:FC = ({ bill, location }) => { const { year, month } = location.yearMonth; const handleAction = deleteBillById.bind(null, location._id, bill._id, year, month); const [ state, dispatch ] = useFormState(handleAction, null); const t = useTranslations("bill-delete-form"); return(

{ t.rich("text", { bill_name:bill.name, location_name:location.name, strong: (chunks:ReactNode) => `${chunks}`, }) }

{t("cancel-button")}
) }