Reply type fixes
This commit is contained in:
parent
7071f0c64a
commit
79653705fe
3 changed files with 16 additions and 9 deletions
|
|
@ -16,7 +16,7 @@ interface ArticleCreateDialogProps {
|
|||
ticketID: string;
|
||||
open: boolean;
|
||||
closeDialog: () => void;
|
||||
kind: "reply" | "note";
|
||||
kind: string;
|
||||
}
|
||||
|
||||
export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
|
||||
|
|
@ -26,8 +26,8 @@ export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
|
|||
kind,
|
||||
}) => {
|
||||
const [body, setBody] = useState("");
|
||||
const backgroundColor = kind === "reply" ? "#1982FC" : "#FFB620";
|
||||
const color = kind === "reply" ? "white" : "black";
|
||||
const backgroundColor = kind === "note" ? "#FFB620" : "#1982FC";
|
||||
const color = kind === "note" ? "black" : "white";
|
||||
const { fetcher } = useSWRConfig();
|
||||
const createArticle = async () => {
|
||||
await fetcher({
|
||||
|
|
@ -37,7 +37,7 @@ export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
|
|||
input: {
|
||||
article: {
|
||||
body,
|
||||
type: kind === "note" ? "note" : "phone",
|
||||
type: kind,
|
||||
internal: kind === "note",
|
||||
},
|
||||
},
|
||||
|
|
@ -51,7 +51,7 @@ export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
|
|||
<Dialog open={open} maxWidth="sm" fullWidth>
|
||||
<DialogContent>
|
||||
<TextField
|
||||
label={kind === "reply" ? "Write reply" : "Write internal note"}
|
||||
label={kind === "note" ? "Write internal note" : "Write reply"}
|
||||
multiline
|
||||
rows={10}
|
||||
fullWidth
|
||||
|
|
@ -92,7 +92,7 @@ export const ArticleCreateDialog: FC<ArticleCreateDialogProps> = ({
|
|||
}}
|
||||
onClick={createArticle}
|
||||
>
|
||||
{kind === "reply" ? "Send Reply" : "Save Note"}
|
||||
{kind === "note" ? "Save Note" : "Send Reply"}
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -45,8 +45,16 @@ export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
|
|||
|
||||
const ticket = ticketData?.ticket;
|
||||
const ticketArticles = ticketArticlesData?.ticketArticles;
|
||||
const externalArticles = ticketArticles?.edges.filter(
|
||||
({ node: article }: any) => !article.internal,
|
||||
);
|
||||
const mostRecentExternalArticle = externalArticles?.length
|
||||
? externalArticles[externalArticles.length - 1].node
|
||||
: null;
|
||||
const mostRecentExternalArticleKind =
|
||||
mostRecentExternalArticle?.type?.name ?? "phone";
|
||||
const [dialogOpen, setDialogOpen] = useState(false);
|
||||
const [articleKind, setArticleKind] = useState<"reply" | "note">("reply");
|
||||
const [articleKind, setArticleKind] = useState("phone");
|
||||
const closeDialog = () => setDialogOpen(false);
|
||||
|
||||
const shouldRender =
|
||||
|
|
@ -139,7 +147,7 @@ export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
|
|||
mt: 2,
|
||||
}}
|
||||
onClick={() => {
|
||||
setArticleKind("reply");
|
||||
setArticleKind(mostRecentExternalArticleKind);
|
||||
setDialogOpen(true);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ export default withAuth(
|
|||
const path = parsedURL.pathname;
|
||||
console.log({ p: parsedURL.pathname });
|
||||
if (noAuthPaths.some((p: string) => path.startsWith(p))) {
|
||||
console.log({ a: "no auth" });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue