"use client"; import { FC, ReactNode } from "react"; import { BillingLocation } from "../lib/db-types"; import { deleteLocationById } from "../lib/actions/locationActions"; import { useFormState } from "react-dom"; import { gotoUrl } from "../lib/actions/navigationActions"; import Link from "next/link"; import { useTranslations } from "next-intl"; export interface LocationDeleteFormProps { /** location which should be deleted */ location: BillingLocation } export const LocationDeleteForm:FC = ({ location }) => { const handleAction = deleteLocationById.bind(null, location._id, location.yearMonth); const [ state, dispatch ] = useFormState(handleAction, null); const t = useTranslations("location-delete-form"); const handleCancel = () => { gotoUrl(`/location/${location._id}/edit/`); }; return(

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

{t("cancel-button")}
); } export const LocationDeleteFormSkeleton:FC = () =>