From 87724bb7b88352a2255337d358fc5dfc4f3cf5b3 Mon Sep 17 00:00:00 2001 From: Darren Clarke Date: Wed, 7 Aug 2024 15:25:53 +0200 Subject: [PATCH] Ticket edit updates --- apps/link/app/(main)/_components/Sidebar.tsx | 14 +- .../[overview]/_components/ZammadOverview.tsx | 2 +- .../[id]/@detail/_components/TicketDetail.tsx | 206 ++++++------ .../[id]/@edit/_components/TicketEdit.tsx | 315 +++++++----------- apps/link/app/_actions/tickets.ts | 100 +++--- apps/link/app/_components/CSRFProvider.tsx | 1 - apps/link/next.config.js | 1 + packages/ui/components/Button.tsx | 7 + packages/ui/components/TextField.tsx | 3 + 9 files changed, 297 insertions(+), 352 deletions(-) diff --git a/apps/link/app/(main)/_components/Sidebar.tsx b/apps/link/app/(main)/_components/Sidebar.tsx index f25ca14..c8c546e 100644 --- a/apps/link/app/(main)/_components/Sidebar.tsx +++ b/apps/link/app/(main)/_components/Sidebar.tsx @@ -151,7 +151,7 @@ const MenuItem = ({ } /> )} - {badge && badge > 0 ? ( + {open && badge && badge > 0 ? ( = ({ useEffect(() => { const fetchCounts = async () => { const counts = await getOverviewTicketCountsAction(); - console.log({ counts }); setOverviewCounts(counts); }; @@ -422,8 +421,9 @@ export const Sidebar: FC = ({ /> = ({ /> )} = ({ open={open} /> = ({ open={open} /> = ({ name }) => { fetchTickets(); - const interval = setInterval(fetchTickets, 20000); + const interval = setInterval(fetchTickets, 10000); return () => clearInterval(interval); }, [name]); diff --git a/apps/link/app/(main)/tickets/[id]/@detail/_components/TicketDetail.tsx b/apps/link/app/(main)/tickets/[id]/@detail/_components/TicketDetail.tsx index cb42fa3..bc6f6b7 100644 --- a/apps/link/app/(main)/tickets/[id]/@detail/_components/TicketDetail.tsx +++ b/apps/link/app/(main)/tickets/[id]/@detail/_components/TicketDetail.tsx @@ -61,113 +61,115 @@ export const TicketDetail: FC = ({ id }) => { const shouldRender = !!ticket && !!ticketArticles; return ( - shouldRender && ( - - - - - - - + {shouldRender && ( + <> + + + + + - {ticket.title} - - + {ticket.title} + + {`Ticket #${ticket.number} (created ${new Date( + ticket.createdAt, + ).toLocaleDateString()})`} + + + + + {ticketArticles.edges.map(({ node: article }: any) => ( + {`Ticket #${ticket.number} (created ${new Date( - ticket.createdAt, - ).toLocaleDateString()})`} - - - - - {ticketArticles.edges.map(({ node: article }: any) => ( - - ))} - - - - + ))} + + + - -