feat(workspace): replace supported platform count with bound media account count
The "platforms" stat tile was a constant (5) that never reflected what the tenant actually had set up. Drop SupportedPlatformCount from the workspace overview API/domain/shared-types and have admin-web compute a bound media account count from the desktop accounts list, filtered through a new isMediaPublishAccount helper that excludes deleted rows and AI-only platforms (yuanbao/kimi/wenxin/deepseek/doubao/qwen). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { resolveApiURL } from "@/lib/api";
|
||||
import { resolveAccountCheckedAt, resolveAccountHealth } from "@/lib/desktop-account-runtime";
|
||||
import {
|
||||
getPublishPlatformMeta,
|
||||
isMediaPublishAccount,
|
||||
isPublishPlatformId,
|
||||
normalizePublishPlatformId,
|
||||
} from "@/lib/publish-platforms";
|
||||
@@ -65,7 +66,7 @@ export function buildPublishAccountCards(
|
||||
|
||||
return accounts
|
||||
.filter((account) => {
|
||||
if (account.deleted_at) {
|
||||
if (!isMediaPublishAccount(account)) {
|
||||
return false;
|
||||
}
|
||||
const platformId = normalizePublishPlatformId(account.platform);
|
||||
|
||||
@@ -25,9 +25,19 @@ const platformCatalog: Record<string, Omit<PublishPlatformOption, "accountLabel"
|
||||
dongchedi: { id: "dongchedi", name: "懂车帝", shortName: "懂", accent: "#fadb14" },
|
||||
};
|
||||
|
||||
const aiPlatformIds = new Set(["yuanbao", "kimi", "wenxin", "deepseek", "doubao", "qwen"]);
|
||||
|
||||
export function isAIPlatformId(platformId?: string | null): boolean {
|
||||
return aiPlatformIds.has(normalizePublishPlatformId(platformId));
|
||||
}
|
||||
|
||||
export function isPublishPlatformId(platformId?: string | null): boolean {
|
||||
const normalized = normalizePublishPlatformId(platformId);
|
||||
return Boolean(normalized) && normalized in platformCatalog;
|
||||
return Boolean(normalized) && !isAIPlatformId(normalized) && normalized in platformCatalog;
|
||||
}
|
||||
|
||||
export function isMediaPublishAccount(account: DesktopAccountInfo): boolean {
|
||||
return !account.deleted_at && isPublishPlatformId(account.platform);
|
||||
}
|
||||
|
||||
export function getPublishPlatformMeta(platformId: string): Omit<PublishPlatformOption, "accountLabel" | "bound"> {
|
||||
|
||||
Reference in New Issue
Block a user