diff --git a/src/packages/shared-types/opensearch/main/transforms/new-submission.ts b/src/packages/shared-types/opensearch/main/transforms/new-submission.ts index 7c85bf57ed..cfcea05744 100644 --- a/src/packages/shared-types/opensearch/main/transforms/new-submission.ts +++ b/src/packages/shared-types/opensearch/main/transforms/new-submission.ts @@ -54,9 +54,10 @@ export const transform = (id: string) => { changedDate: getDateStringOrNullFromEpoc(data.changedDate), subject: null, description: null, - makoChangedDate: !!data.timestamp - ? new Date(data.timestamp).toISOString() - : null, + makoChangedDate: + typeof data.timestamp === "number" + ? new Date(data.timestamp).toISOString() + : null, // ---------- }; } else { @@ -72,9 +73,10 @@ export const transform = (id: string) => { submitterName: data.submitterName === "-- --" ? null : data.submitterName, origin: "OneMAC", - makoChangedDate: !!data.timestamp - ? new Date(data.timestamp).toISOString() - : null, + makoChangedDate: + typeof data.timestamp === "number" + ? new Date(data.timestamp).toISOString() + : null, }; } }); diff --git a/src/packages/shared-types/opensearch/main/transforms/remove-appk-child.ts b/src/packages/shared-types/opensearch/main/transforms/remove-appk-child.ts index f71b91dcc7..6556688a92 100644 --- a/src/packages/shared-types/opensearch/main/transforms/remove-appk-child.ts +++ b/src/packages/shared-types/opensearch/main/transforms/remove-appk-child.ts @@ -5,7 +5,8 @@ export const transform = (id: string) => { return { id, appkParentId: null, - makoChangedDate: !!data.timestamp + appkParent: true, + makoChangedDate: data.timestamp ? new Date(data.timestamp).toISOString() : null, }; diff --git a/src/services/ui/src/features/package/index.tsx b/src/services/ui/src/features/package/index.tsx index b85b122777..779990fd0a 100644 --- a/src/services/ui/src/features/package/index.tsx +++ b/src/services/ui/src/features/package/index.tsx @@ -35,21 +35,6 @@ export const DetailsContent: FC<{ id: string }> = ({ id }) => { if (isLoading) return ; if (!data?._source) return ; if (error) return ; - const title = - (() => { - switch (data._source.authority) { - case Authority["1915b"]: - case Authority["1915c"]: - case undefined: // Some TEs have no authority - if (data._source.appkParent) - return "Appendix K Amendment Package Details"; - else if (data._source.actionType == "Extend") - return "Temporary Extension Request Details"; - else return undefined; - default: - return undefined; - } - })() || `${data._source.authority} Package Details`; return (
@@ -61,7 +46,7 @@ export const DetailsContent: FC<{ id: string }> = ({ id }) => {
- +
diff --git a/src/services/ui/src/features/package/package-activity/index.tsx b/src/services/ui/src/features/package/package-activity/index.tsx index a41abd42f4..c07e84ca2f 100644 --- a/src/services/ui/src/features/package/package-activity/index.tsx +++ b/src/services/ui/src/features/package/package-activity/index.tsx @@ -11,8 +11,8 @@ import { import * as Table from "@/components"; import { BLANK_VALUE } from "@/consts"; import { usePackageActivities, useAttachmentService } from "./hook"; -import { Link } from "@/components/Routing"; import { attachmentTitleMap } from "shared-types"; +import { Link } from "react-router-dom"; // id, attachments, hook const AttachmentDetails: FC<{ @@ -54,8 +54,7 @@ export const PA_AppkParentRemovedChild: FC = ( return (
{props.appkChildId} @@ -72,8 +71,7 @@ export const PA_AppkChildRemovedFromParent: FC<

Removed from:

{props.appkParentId} diff --git a/src/services/ui/src/features/package/package-details/index.tsx b/src/services/ui/src/features/package/package-details/index.tsx index 80e5ed1e19..f2d0c99797 100644 --- a/src/services/ui/src/features/package/package-details/index.tsx +++ b/src/services/ui/src/features/package/package-details/index.tsx @@ -6,13 +6,14 @@ import { submissionDetails, } from "./hooks"; -import { FC } from "react"; +import { FC, useMemo } from "react"; import { DetailSectionItem } from "./hooks"; import { useGetUser } from "@/api/useGetUser"; import { AppK } from "./appk"; import { cn } from "@/utils"; -import { usePackageDetailsCache } from ".."; +import { Authority } from "shared-types"; +import { ItemResult } from "shared-types/opensearch/main"; export const DetailItemsGrid: FC<{ displayItems: DetailSectionItem[]; @@ -41,24 +42,39 @@ export const DetailItemsGrid: FC<{ ); }; -export const PackageDetails: FC<{ - title: string; -}> = (props) => { - const { data } = usePackageDetailsCache(); +type PackageDetailsProps = { + itemResult: ItemResult; +}; + +export const PackageDetails = ({ itemResult }: PackageDetailsProps) => { + const title = useMemo(() => { + const { _source: source } = itemResult; + + switch (source.authority) { + case Authority["1915b"]: + case Authority["1915c"]: + case undefined: // Some TEs have no authority + if (source.appkParent) return "1915(c) Appendix K Package Details"; + if (source.actionType == "Extend") + return "Temporary Extension Request Details"; + } + + return `${source.authority} Package Details`; + }, [itemResult]); return ( - +

- +