feat(mcp): add enabled count to panel info section

- Add enabledCount calculation using useMemo for performance
- Display format: "X MCP server(s) configured · Y enabled"
- Add i18n keys: mcp.enabledCount for zh and en
- Real-time updates when toggling server enabled status
This commit is contained in:
Jason
2025-10-12 12:16:15 +08:00
parent 664efc7456
commit 3bd70b9508
3 changed files with 8 additions and 1 deletions

View File

@@ -166,6 +166,11 @@ const McpPanel: React.FC<McpPanelProps> = ({ onClose, onNotify, appType }) => {
[servers],
);
const enabledCount = useMemo(
() => serverEntries.filter(([_, server]) => server.enabled).length,
[serverEntries],
);
const panelTitle =
appType === "claude" ? t("mcp.claudeTitle") : t("mcp.codexTitle");
@@ -205,7 +210,7 @@ const McpPanel: React.FC<McpPanelProps> = ({ onClose, onNotify, appType }) => {
{/* Info Section */}
<div className="flex-shrink-0 px-6 pt-4 pb-2">
<div className="text-sm text-gray-500 dark:text-gray-400">
{t("mcp.serverCount", { count: Object.keys(servers).length })}
{t("mcp.serverCount", { count: Object.keys(servers).length })} · {t("mcp.enabledCount", { count: enabledCount })}
</div>
</div>