From e2ef4b005de4e3efad89220e7d200993c5c1c6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 3 Dec 2025 16:03:24 +0400 Subject: [PATCH] Fix some unexpected any MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- .../trustCenter/TrustCenterAuditsCard.tsx | 15 ++-- .../trustCenter/TrustCenterDocumentsCard.tsx | 15 ++-- .../trustCenter/TrustCenterFilesCard.tsx | 18 ++--- .../src/hooks/graph/TrustCenterAccessGraph.ts | 31 ++++---- .../trustCenter/TrustCenterAccessTab.tsx | 75 +++++-------------- packages/ui/src/Atoms/Textarea/Textarea.tsx | 3 +- packages/ui/src/Molecules/Field/Field.tsx | 12 +-- 7 files changed, 68 insertions(+), 101 deletions(-) diff --git a/apps/console/src/components/trustCenter/TrustCenterAuditsCard.tsx b/apps/console/src/components/trustCenter/TrustCenterAuditsCard.tsx index ce9102971..709b5984f 100644 --- a/apps/console/src/components/trustCenter/TrustCenterAuditsCard.tsx +++ b/apps/console/src/components/trustCenter/TrustCenterAuditsCard.tsx @@ -94,7 +94,7 @@ export function TrustCenterAuditsCard(props: Props) { {audits.map((audit, index) => ( @@ -116,23 +116,24 @@ export function TrustCenterAuditsCard(props: Props) { } function AuditRow(props: { - audit: TrustCenterAuditsCardFragment$key; + auditFragmentRef: TrustCenterAuditsCardFragment$key; onChangeVisibility: (auditId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => void; disabled?: boolean; }) { - const audit = useFragment(trustCenterAuditFragment, props.audit); + const { auditFragmentRef, onChangeVisibility, disabled } = props; + const audit = useFragment(trustCenterAuditFragment, auditFragmentRef); const organizationId = useOrganizationId(); const { __ } = useTranslate(); const [optimisticValue, setOptimisticValue] = useState(null); const { isAuthorized } = use(PermissionsContext); const canUpdate = organizationId ? isAuthorized("TrustCenter", "updateTrustCenter") : false; - const handleValueChange = useCallback((value: string | {}) => { + const handleValueChange = useCallback((value: string) => { const stringValue = typeof value === 'string' ? value : ''; const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC"; setOptimisticValue(typedValue); - props.onChangeVisibility(audit.id, typedValue); - }, [audit.id, props.onChangeVisibility]); + onChangeVisibility(audit.id, typedValue); + }, [audit.id, onChangeVisibility]); useEffect(() => { if (optimisticValue && audit.trustCenterVisibility === optimisticValue) { @@ -167,7 +168,7 @@ function AuditRow(props: { type="select" value={currentValue} onValueChange={handleValueChange} - disabled={props.disabled || !canUpdate} + disabled={disabled || !canUpdate} className="w-[105px]" > {visibilityOptions.map((option) => ( diff --git a/apps/console/src/components/trustCenter/TrustCenterDocumentsCard.tsx b/apps/console/src/components/trustCenter/TrustCenterDocumentsCard.tsx index 422ffbef2..ea3a0b73a 100644 --- a/apps/console/src/components/trustCenter/TrustCenterDocumentsCard.tsx +++ b/apps/console/src/components/trustCenter/TrustCenterDocumentsCard.tsx @@ -98,7 +98,7 @@ export function TrustCenterDocumentsCard(props: Props) { {documents.map((document, index) => ( @@ -121,23 +121,24 @@ export function TrustCenterDocumentsCard(props: Props) { } function DocumentRow(props: { - document: TrustCenterDocumentsCardFragment$key; + documentFragmentRef: TrustCenterDocumentsCardFragment$key; onChangeVisibility: (documentId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => void; disabled?: boolean; }) { - const document = useFragment(trustCenterDocumentFragment, props.document); + const { documentFragmentRef, onChangeVisibility, disabled } = props; + const document = useFragment(trustCenterDocumentFragment, documentFragmentRef); const organizationId = useOrganizationId(); const { __ } = useTranslate(); const [optimisticValue, setOptimisticValue] = useState(null); const { isAuthorized } = use(PermissionsContext); const canUpdate = isAuthorized("TrustCenter", "updateTrustCenter"); - const handleValueChange = useCallback((value: string | {}) => { + const handleValueChange = useCallback((value: string) => { const stringValue = typeof value === 'string' ? value : ''; const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC"; setOptimisticValue(typedValue); - props.onChangeVisibility(document.id, typedValue); - }, [document.id, props.onChangeVisibility]); + onChangeVisibility(document.id, typedValue); + }, [document.id, onChangeVisibility]); useEffect(() => { if (optimisticValue && document.trustCenterVisibility === optimisticValue) { @@ -167,7 +168,7 @@ function DocumentRow(props: { type="select" value={currentValue} onValueChange={handleValueChange} - disabled={props.disabled || !canUpdate} + disabled={disabled || !canUpdate} className="w-[105px]" > {visibilityOptions.map((option) => ( diff --git a/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx b/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx index fbc421978..a04b614ff 100644 --- a/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx +++ b/apps/console/src/components/trustCenter/TrustCenterFilesCard.tsx @@ -145,18 +145,18 @@ function FileRow(props: { onDelete: (id: string) => void; disabled?: boolean; }) { - const file = props.file; + const { file, onChangeVisibility, onEdit, onDelete, disabled } = props; const { __ } = useTranslate(); const [optimisticValue, setOptimisticValue] = useState(null); const { isAuthorized } = use(PermissionsContext); const canUpdate = isAuthorized("TrustCenter", "updateTrustCenter"); - const handleValueChange = useCallback((value: string | {}) => { + const handleValueChange = useCallback((value: string) => { const stringValue = typeof value === 'string' ? value : ''; const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC"; setOptimisticValue(typedValue); - props.onChangeVisibility(file.id, typedValue); - }, [file.id, props.onChangeVisibility]); + onChangeVisibility(file.id, typedValue); + }, [file.id, onChangeVisibility]); useEffect(() => { if (optimisticValue && file.trustCenterVisibility === optimisticValue) { @@ -182,7 +182,7 @@ function FileRow(props: { type="select" value={currentValue} onValueChange={handleValueChange} - disabled={props.disabled || !canUpdate} + disabled={disabled || !canUpdate} className="w-[105px]" > {visibilityOptions.map((option) => ( @@ -208,8 +208,8 @@ function FileRow(props: {