From c1597ca10fcfd708121d25b9715269aec055f3de Mon Sep 17 00:00:00 2001 From: MarcosPierasNL <pieras.marcos@gmail.com> Date: Wed, 18 Sep 2024 15:33:09 +0200 Subject: [PATCH] fix: schema pill stats --- .../lib/schema/pills/nodes/entity/SchemaEntityPill.tsx | 7 +++---- .../lib/schema/pills/nodes/relation/SchemaRelationPill.tsx | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/shared/lib/schema/pills/nodes/entity/SchemaEntityPill.tsx b/libs/shared/lib/schema/pills/nodes/entity/SchemaEntityPill.tsx index c4fb7f010..054e019b4 100644 --- a/libs/shared/lib/schema/pills/nodes/entity/SchemaEntityPill.tsx +++ b/libs/shared/lib/schema/pills/nodes/entity/SchemaEntityPill.tsx @@ -14,7 +14,6 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc const viewport = useViewport(); const schemaStats = useSchemaStats(); - const ref = useRef<HTMLDivElement>(null); /** * adds drag functionality in order to be able to drag the entityNode to the schema @@ -39,13 +38,13 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc const tooltipX = useMemo(() => { if (ref.current == null || openPopupLocation == null) return -1; const rect = ref.current.getBoundingClientRect(); - return rect.x - openPopupLocation.x + (rect.width / 2); + return rect.x - openPopupLocation.x + rect.width / 2; }, [viewport.x, openPopupLocation]); const tooltipY = useMemo(() => { if (ref.current == null || openPopupLocation == null) return -1; const rect = ref.current.getBoundingClientRect(); - return rect.y - openPopupLocation.y + (rect.height / 2); + return rect.y - openPopupLocation.y + rect.height / 2; }, [viewport.y, openPopupLocation]); return ( @@ -83,7 +82,7 @@ export const SchemaEntityPill = React.memo(({ id, selected, data }: NodeProps<Sc }, {} as Record<string, string>, )} - numberOfElements={schemaStats.nodeStats[data.name]?.count} + numberOfElements={schemaStats.nodes.stats[data.name]?.count} /> </VisualizationTooltip> </div> diff --git a/libs/shared/lib/schema/pills/nodes/relation/SchemaRelationPill.tsx b/libs/shared/lib/schema/pills/nodes/relation/SchemaRelationPill.tsx index 738baaad3..8413a3c29 100644 --- a/libs/shared/lib/schema/pills/nodes/relation/SchemaRelationPill.tsx +++ b/libs/shared/lib/schema/pills/nodes/relation/SchemaRelationPill.tsx @@ -94,7 +94,7 @@ export const SchemaRelationPill = React.memo(({ id, selected, data, ...props }: : {} } connections={{ from: data.from, to: data.to }} - numberOfElements={schemaStats.edgeStats[data.collection]?.count} + numberOfElements={schemaStats.edges.stats[data.collection]?.count} /> </VisualizationTooltip> </div> -- GitLab