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:
@@ -14,8 +14,8 @@ import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
|
||||
import StatusBadge from "../components/StatusBadge.vue";
|
||||
import { useDesktopRuntime } from "../composables/useDesktopRuntime";
|
||||
import { formatDateTime, formatRelativeTime, titleCaseToken } from "../lib/formatters";
|
||||
import { desktopPublishMediaCatalog } from "../lib/media-catalog";
|
||||
import { formatDateTime, formatRelativeTime } from "../lib/formatters";
|
||||
import { desktopPlatformShortName, desktopPublishMediaCatalog, translateDesktopPlatform } from "../lib/media-catalog";
|
||||
import { normalizePublisherErrorMessage } from "../../shared/publisher-errors";
|
||||
|
||||
const PAGE_SIZE = 10;
|
||||
@@ -52,7 +52,7 @@ function platformMeta(platform: string) {
|
||||
}
|
||||
|
||||
function translatePlatform(platform: string) {
|
||||
return platformMeta(platform)?.label || titleCaseToken(platform);
|
||||
return platformMeta(platform)?.label || translateDesktopPlatform(platform);
|
||||
}
|
||||
|
||||
function platformLogo(platform: string): string | null {
|
||||
@@ -64,7 +64,7 @@ function platformAccent(platform: string): string {
|
||||
}
|
||||
|
||||
function platformShortName(platform: string): string {
|
||||
return platformMeta(platform)?.shortName ?? titleCaseToken(platform).slice(0, 1);
|
||||
return platformMeta(platform)?.shortName ?? desktopPlatformShortName(platform);
|
||||
}
|
||||
|
||||
function statusLabel(status: DesktopTaskInfo["status"]): string {
|
||||
|
||||
Reference in New Issue
Block a user