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:
@@ -4,21 +4,12 @@ import { DesktopOutlined, LinkOutlined, ClockCircleOutlined, AlertOutlined } fro
|
||||
|
||||
import StatusBadge from "../components/StatusBadge.vue";
|
||||
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
|
||||
import { formatClock, formatRelativeTime, titleCaseToken } from "../lib/formatters";
|
||||
import { formatClock, formatRelativeTime } from "../lib/formatters";
|
||||
import { translateDesktopPlatform } from "../lib/media-catalog";
|
||||
import { healthTone } 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 blockedAccountLabel(account: { authState: string; authReason: string | null }) {
|
||||
|
||||
Reference in New Issue
Block a user