From 14b5e248929c57ab58c1b1546f666db614c5c533 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Mon, 28 Apr 2025 16:14:35 -0700 Subject: [PATCH] Fix types Signed-off-by: Bryan Frimin --- .../frameworks/controls/Control.tsx | 26 +++++++++---------- .../policies/SignaturesModal.tsx | 20 -------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/apps/console/src/pages/organizations/frameworks/controls/Control.tsx b/apps/console/src/pages/organizations/frameworks/controls/Control.tsx index ffe43404e..c3c85776f 100644 --- a/apps/console/src/pages/organizations/frameworks/controls/Control.tsx +++ b/apps/console/src/pages/organizations/frameworks/controls/Control.tsx @@ -592,9 +592,9 @@ export function Control({ return policies.filter((policy) => { return ( !policySearchQuery || - policy.name?.toLowerCase().includes(policySearchQuery.toLowerCase()) || - (policy.content && - policy.content + policy.title?.toLowerCase().includes(policySearchQuery.toLowerCase()) || + (policy.description && + policy.description .toLowerCase() .includes(policySearchQuery.toLowerCase())) ); @@ -1092,18 +1092,18 @@ export function Control({ >
- {policy.name} + {policy.title}
- {policy.content && ( + {policy.description && (
- {policy.content} + {policy.description}
)} - {policy.reviewDate + {policy.updatedAt ? new Date( - policy.reviewDate + policy.updatedAt ).toLocaleDateString() : "Not set"} @@ -1202,16 +1202,16 @@ export function Control({ className="border-b hover:bg-invert-bg" > -
{policy.name}
- {policy.content && ( +
{policy.title}
+ {policy.description && (
- {policy.content} + {policy.description}
)} - {policy.reviewDate - ? new Date(policy.reviewDate).toLocaleDateString() + {policy.updatedAt + ? new Date(policy.updatedAt).toLocaleDateString() : "Not set"} diff --git a/apps/console/src/pages/organizations/policies/SignaturesModal.tsx b/apps/console/src/pages/organizations/policies/SignaturesModal.tsx index 702e5a067..2e70222c8 100644 --- a/apps/console/src/pages/organizations/policies/SignaturesModal.tsx +++ b/apps/console/src/pages/organizations/policies/SignaturesModal.tsx @@ -100,21 +100,6 @@ interface SignaturesModalProps { } | null; } -// Define the signature type based on the GraphQL response -// interface Signature { -// id: string; -// state: string; -// signedAt?: string | null; -// requestedAt: string; -// signedBy: { -// fullName: string; -// id: string; -// } | null; -// requestedBy: { -// fullName: string; -// } | null; -// } - export function SignaturesModal({ isOpen, onClose, @@ -126,10 +111,7 @@ export function SignaturesModal({ policyRef ); - // Safely access and extract version nodes const versionNodes = (data?.policyVersions?.edges?.map(edge => edge.node) || []); - - // Filter to just published versions and sort by version number const publishedVersions = versionNodes .filter(v => v.status === "PUBLISHED") .sort((a, b) => b.version - a.version); @@ -147,7 +129,6 @@ export function SignaturesModal({ const [commitRequestSignature] = useMutation(requestSignatureMutation); - // Load organization data when the modal opens and we have a valid version selected useEffect(() => { if (isOpen && organizationId && selectedVersionData?.status === "PUBLISHED") { loadQuery({ organizationId }); @@ -160,7 +141,6 @@ export function SignaturesModal({ return format(date, "h:mm a • MMM d, yyyy"); }; - // Safely type signatures as our defined Signature interface const signatures = selectedVersionData?.signatures?.edges?.map(edge => edge.node) || []; const handleRequestSignature = (personId: string) => {