From f28a8953f108e0786547d9e5cc3b82de8ddc33b3 Mon Sep 17 00:00:00 2001 From: Julian Roeland Date: Tue, 10 Dec 2024 14:54:34 +0100 Subject: [PATCH] :ok_hand: - fix: pr fixes --- .../DestructionListAuditLog.tsx | 19 +++++++++++++++++-- .../DestructionListToolbar.tsx | 8 +------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/DestructionListAuditLog/DestructionListAuditLog.tsx b/frontend/src/components/DestructionListAuditLog/DestructionListAuditLog.tsx index 571146bf..0cae90b0 100644 --- a/frontend/src/components/DestructionListAuditLog/DestructionListAuditLog.tsx +++ b/frontend/src/components/DestructionListAuditLog/DestructionListAuditLog.tsx @@ -1,6 +1,8 @@ import { AttributeTable, DataGrid } from "@maykin-ui/admin-ui"; +import { useAuditLog } from "../../hooks"; import { AuditLogItem } from "../../lib/api/auditLog"; +import { DestructionList } from "../../lib/api/destructionLists"; import { formatDateAndTime } from "../../lib/format/date"; import { formatUser } from "../../lib/format/user"; @@ -19,10 +21,23 @@ export function DestructionListAuditLogHistory({ } export function DestructionListAuditLogDetails({ - readyForFirstReviewLogItem, + destructionList, }: { - readyForFirstReviewLogItem: AuditLogItem; + destructionList?: DestructionList; }) { + const logItemsReadyForFirstReview = useAuditLog( + destructionList, + "destruction_list_ready_for_first_review", + ); + const readyForFirstReviewLogItem = + logItemsReadyForFirstReview.length > 0 + ? logItemsReadyForFirstReview[0] + : null; + + if (!readyForFirstReviewLogItem) { + return null; + } + const extraData = readyForFirstReviewLogItem.extraData; const detailsObjectList = { "Record Manager": formatUser(readyForFirstReviewLogItem.user), diff --git a/frontend/src/components/DestructionListToolbar/DestructionListToolbar.tsx b/frontend/src/components/DestructionListToolbar/DestructionListToolbar.tsx index 4c22fe75..f3dc4ff9 100644 --- a/frontend/src/components/DestructionListToolbar/DestructionListToolbar.tsx +++ b/frontend/src/components/DestructionListToolbar/DestructionListToolbar.tsx @@ -44,10 +44,6 @@ export function DestructionListToolbar({ review, }: DestructionListToolbarProps) { const logItems = useAuditLog(destructionList); - const logItemsReadyForFirstReview = useAuditLog( - destructionList, - "destruction_list_ready_for_first_review", - ); const reviewResponse = useLatestReviewResponse(review); const properties = ( @@ -146,9 +142,7 @@ export function DestructionListToolbar({ - + ) : (