Skip to content

Commit

Permalink
fix(components): update attribute tabs style
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Jul 31, 2023
1 parent 28001db commit 3904650
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.vscode/launch.json

# dependencies
node_modules
.DS_Store
Expand Down
19 changes: 10 additions & 9 deletions packages/components/src/views/MainView/rightSiderBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,22 @@ const RightSiderbar = () => {
);
}, [result, tagConfigList]);

const labelToolLen = useMemo(
() => config?.tools?.filter((tool) => labelTool.includes(tool.tool as EToolName)).length,
[config?.tools],
);
const attributeTab = useMemo(() => {
const labelToolLen = config?.tools?.filter((tool) => labelTool.includes(tool.tool as EToolName)).length;
const count = graphicResult?.reduce((acc, cur) => {
return acc + cur.result.length;
}, 0);

if (!labelToolLen) {
return null;
}

return (
<div className="rightTab">
<p>标注结果</p>
<span className="innerWord">{count}</span>
</div>
);
}, [config?.tools, graphicResult]);
}, [graphicResult]);

return (
<div className={`${sidebarCls}`} ref={sideRef}>
Expand All @@ -102,9 +101,11 @@ const RightSiderbar = () => {
</Tabs.TabPane>
)}

<Tabs.TabPane forceRender tab={attributeTab} key="2">
<AttributeResult />
</Tabs.TabPane>
{labelToolLen && (
<Tabs.TabPane forceRender tab={attributeTab} key="2">
<AttributeResult />
</Tabs.TabPane>
)}

{textConfig && textConfig.length > 0 && (
<Tabs.TabPane forceRender tab={textTab} key="3">
Expand Down

0 comments on commit 3904650

Please sign in to comment.