From f8095a90f5d963af09c2e048099877fb0c2342e4 Mon Sep 17 00:00:00 2001 From: David Rouyer Date: Tue, 3 Oct 2023 22:52:12 +0200 Subject: [PATCH] feat: rework detail panel (#482) * feat: rework details panel * chore: cleanup * chore: cleanup * chore: cleanup --- .../{activity-panel.tsx => activity.tsx} | 41 +------ .../src/components/infos/info-panel.tsx | 21 ++-- .../src/components/infos/info-summary.tsx | 60 ---------- ...d-tickets-panel.tsx => linked-tickets.tsx} | 6 +- .../src/components/infos/ticket-info.tsx | 37 ++++++ .../src/components/infos/user-info-panel.tsx | 71 ------------ .../src/components/infos/user-info.tsx | 77 +++++++++++++ ...ent.tsx => ticket-assignment-dropdown.tsx} | 73 ++++++------ .../tickets/ticket-change-status.tsx | 108 ------------------ .../src/components/tickets/ticket-header.tsx | 40 +++++-- .../tickets/ticket-status-dropdown.tsx | 87 ++++++++++++++ .../src/hooks/useReopenTicket.ts | 43 +++++++ .../src/hooks/useResolveTicket.ts | 43 +++++++ apps/customer-service/src/locales/en.json | 9 ++ apps/customer-service/src/locales/fr.json | 9 ++ 15 files changed, 401 insertions(+), 324 deletions(-) rename apps/customer-service/src/components/infos/{activity-panel.tsx => activity.tsx} (86%) delete mode 100644 apps/customer-service/src/components/infos/info-summary.tsx rename apps/customer-service/src/components/infos/{linked-tickets-panel.tsx => linked-tickets.tsx} (95%) create mode 100644 apps/customer-service/src/components/infos/ticket-info.tsx delete mode 100644 apps/customer-service/src/components/infos/user-info-panel.tsx create mode 100644 apps/customer-service/src/components/infos/user-info.tsx rename apps/customer-service/src/components/tickets/{ticket-change-assignment.tsx => ticket-assignment-dropdown.tsx} (76%) delete mode 100644 apps/customer-service/src/components/tickets/ticket-change-status.tsx create mode 100644 apps/customer-service/src/components/tickets/ticket-status-dropdown.tsx create mode 100644 apps/customer-service/src/hooks/useReopenTicket.ts create mode 100644 apps/customer-service/src/hooks/useResolveTicket.ts diff --git a/apps/customer-service/src/components/infos/activity-panel.tsx b/apps/customer-service/src/components/infos/activity.tsx similarity index 86% rename from apps/customer-service/src/components/infos/activity-panel.tsx rename to apps/customer-service/src/components/infos/activity.tsx index 63386bd4d..bbf86b708 100644 --- a/apps/customer-service/src/components/infos/activity-panel.tsx +++ b/apps/customer-service/src/components/infos/activity.tsx @@ -13,39 +13,7 @@ import { RelativeTime } from '~/components/ui/relative-time'; import { api } from '~/utils/api'; import { cn } from '~/utils/utils'; -const activity = [ - { - id: 1, - type: 'created', - author: { name: 'Leslie Alexander' }, - createdAt: '2023-01-23T10:32', - }, - { - id: 2, - type: 'assigned', - author: { name: 'Tom Cook' }, - createdAt: '2023-01-23T11:03', - }, - { - id: 3, - type: 'commented', - author: { - name: 'Sophie Radcliff', - avatarUrl: - 'https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', - }, - comment: 'Called client, they are not happy with the product.', - createdAt: '2023-01-23T15:56', - }, - { - id: 5, - type: 'resolved', - author: { name: 'Tom Cook' }, - createdAt: '2023-01-24T09:20', - }, -]; - -export const ActivityPanel: FC<{ +export const Activity: FC<{ ticketId: number; }> = ({ ticketId }) => { const { data: ticketActivitiesData } = api.ticketActivity.byTicketId.useQuery( @@ -53,13 +21,16 @@ export const ActivityPanel: FC<{ ticketId, } ); + return (