From bfcbb3a9e556ebf4f08855085710f64e9c7160e9 Mon Sep 17 00:00:00 2001 From: MH4GF Date: Mon, 16 Dec 2024 15:06:55 +0900 Subject: [PATCH] feat: LeftPane now shows the number of tables currently being displayed --- frontend/.changeset/few-socks-jam.md | 6 ++++++ .../ERDRenderer/LeftPane/TableCounter/TableCounter.tsx | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 frontend/.changeset/few-socks-jam.md diff --git a/frontend/.changeset/few-socks-jam.md b/frontend/.changeset/few-socks-jam.md new file mode 100644 index 00000000..6c0957d8 --- /dev/null +++ b/frontend/.changeset/few-socks-jam.md @@ -0,0 +1,6 @@ +--- +"@liam-hq/erd-core": patch +"@liam-hq/cli": patch +--- + +LeftPane now shows the number of tables currently being displayed diff --git a/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableCounter/TableCounter.tsx b/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableCounter/TableCounter.tsx index 615f0235..963314b5 100644 --- a/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableCounter/TableCounter.tsx +++ b/frontend/packages/erd-core/src/components/ERDRenderer/LeftPane/TableCounter/TableCounter.tsx @@ -1,13 +1,12 @@ import { Table2 } from '@liam-hq/ui' +import { useNodes } from '@xyflow/react' import type { FC } from 'react' -import { useDBStructureStore } from '../../../../stores' import styles from './TableCounter.module.css' export const TableCounter: FC = () => { - const { tables } = useDBStructureStore() - const allCount = Object.keys(tables).length - // TODO: Implement filtering - const visibleCount = allCount + const nodes = useNodes() + const allCount = nodes.length + const visibleCount = nodes.filter((node) => !node.hidden).length return (