refactor(desktop/renderer): centralize platform label and short-name lookup

Move the per-platform translation map out of HomeView/TasksView and the
titleCaseToken fallback out of PublishManagementView into shared helpers
on media-catalog. Single source of truth keeps renderer views consistent
with the binding catalog when new platforms ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 17:12:05 +08:00
parent 426e94dd6b
commit b59435dec5
4 changed files with 23 additions and 28 deletions
@@ -4,21 +4,12 @@ import { computed } from "vue";
import StatusBadge from "../components/StatusBadge.vue";
import SurfaceCard from "../components/SurfaceCard.vue";
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
import { formatRelativeTime, titleCaseToken } from "../lib/formatters";
import { formatRelativeTime } from "../lib/formatters";
import { translateDesktopPlatform } from "../lib/media-catalog";
import { taskTone } from "../lib/runtime-ui";
function translatePlatform(platform: string) {
const map: Record<string, string> = {
toutiaohao: "头条号",
bilibili: "哔哩哔哩",
xiaohongshu: "小红书",
douyin: "抖音",
kuaishou: "快手",
wechat_oa: "微信公众号",
baijiahao: "百家号",
zhihu: "知乎",
};
return map[platform?.toLowerCase()] || titleCaseToken(platform);
return translateDesktopPlatform(platform);
}
function translateTaskStatus(status: string) {