metis-desk/modules/companies/src/web/tickets/detail/ui/ticket-detail-dialog.tsx

34 lines
844 B
TypeScript

import { FormDialog } from "@repo/rdx-ui/components/form-dialog";
import type { ComponentProps } from "react";
import { useTranslation } from "react-i18next";
import { TicketDetail } from "./ticket-detail";
export function TicketDetailDialog({
currentView,
data,
onClose,
}: {
currentView: ComponentProps<typeof TicketDetail>["ticket"] | undefined;
data: ComponentProps<typeof TicketDetail>["data"] | undefined;
onClose: () => void;
}) {
const { t } = useTranslation("companies");
return (
<FormDialog
cancelLabel={t("cancel")}
onOpenChange={(value) => {
if (!value) {
onClose();
}
}}
open={Boolean(currentView)}
title={t("tickets.details")}
wide
>
{currentView && data && <TicketDetail data={data} ticket={currentView} />}
</FormDialog>
);
}