"use client"; import { FC, useState } from "react"; import { Grid, Button, Dialog, DialogActions, DialogContent, TextField, } from "@mui/material"; import { useSWRConfig } from "swr"; import { updateTicketMutation } from "@/app/_graphql/updateTicketMutation"; interface ArticleCreateDialogProps { ticketID: string; open: boolean; closeDialog: () => void; kind: "reply" | "note"; } export const ArticleCreateDialog: FC = ({ ticketID, open, closeDialog, kind, }) => { const [body, setBody] = useState(""); const backgroundColor = kind === "reply" ? "#1982FC" : "#FFB620"; const color = kind === "reply" ? "white" : "black"; const { fetcher } = useSWRConfig(); const createArticle = async () => { await fetcher({ document: updateTicketMutation, variables: { ticketId: `gid://zammad/Ticket/${ticketID}`, input: { article: { body, type: kind === "note" ? "note" : "phone", internal: kind === "note", }, }, }, }); closeDialog(); setBody(""); }; return ( setBody(e.target.value)} /> ); };