Skip to content

Commit

Permalink
👌 - fix: pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Roeland committed Dec 10, 2024
1 parent 660ca7f commit f28a895
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
<Grid>
Expand Down Expand Up @@ -146,9 +142,7 @@ export function DestructionListToolbar({
<DestructionListAuditLogHistory logItems={logItems} />
</Tab>
<Tab id="details" label="Details">
<DestructionListAuditLogDetails
readyForFirstReviewLogItem={logItemsReadyForFirstReview[0]}
/>
<DestructionListAuditLogDetails destructionList={destructionList} />
</Tab>
</Tabs>
) : (
Expand Down

0 comments on commit f28a895

Please sign in to comment.