Files
Genarrative/src/services/appTitle.ts
T
kdletters 09fec601b1 完善官网 SEO 地基与精确路由
补充 robots、sitemap、SEO 元信息、结构化数据与首页语义内容
统一三套 Nginx 与 Pingora 的 62 条 SPA 路由和真实 404 行为
新增路由一致性检查、网关测试并同步技术文档与项目记忆
2026-07-10 12:14:44 +08:00

82 lines
3.2 KiB
TypeScript

import type { SelectionStage } from '../components/platform-entry';
import { setHostAppTitle } from './host-bridge/hostBridge';
const APP_TITLE_BRAND = '陶泥儿';
export const APP_HOME_TITLE =
'陶泥儿 Genarrative|游戏美术AI创作工具与美术Agent工作台';
const APP_TITLE_BY_SELECTION_STAGE: Partial<Record<SelectionStage, string>> = {
'agent-workspace': 'RPG 创作',
'baby-love-drawing-runtime': '宝贝爱画',
'baby-object-match-generating': '宝贝识物生成中',
'baby-object-match-result': '宝贝识物结果',
'baby-object-match-runtime': '宝贝识物',
'baby-object-match-workspace': '宝贝识物创作',
'bark-battle-generating': '汪汪声浪生成中',
'bark-battle-result': '汪汪声浪结果',
'bark-battle-runtime': '汪汪声浪',
'bark-battle-workspace': '汪汪声浪创作',
'big-fish-agent-workspace': '大鱼吃小鱼创作',
'big-fish-generating': '大鱼吃小鱼生成中',
'big-fish-result': '大鱼吃小鱼结果',
'big-fish-runtime': '大鱼吃小鱼',
'creative-agent-workspace': '创意 Agent',
'custom-world-generating': 'RPG 生成中',
'custom-world-result': 'RPG 结果',
'creation-home': APP_HOME_TITLE,
detail: '世界详情',
'jump-hop-gallery-detail': '跳一跳详情',
'jump-hop-generating': '跳一跳生成中',
'jump-hop-result': '跳一跳结果',
'jump-hop-runtime': '跳一跳',
'jump-hop-workspace': '跳一跳创作',
'match3d-agent-workspace': '抓大鹅创作',
'match3d-generating': '抓大鹅生成中',
'match3d-result': '抓大鹅结果',
'match3d-runtime': '抓大鹅',
platform: APP_HOME_TITLE,
'profile-feedback': '反馈与投诉',
'puzzle-agent-workspace': '拼图创作',
'puzzle-clear-generating': '拼消消生成中',
'puzzle-clear-result': '拼消消结果',
'puzzle-clear-runtime': '拼消消',
'puzzle-clear-workspace': '拼消消创作',
'puzzle-gallery-detail': '拼图详情',
'puzzle-generating': '拼图生成中',
'puzzle-onboarding': '拼图教学',
'puzzle-result': '拼图结果',
'puzzle-runtime': '拼图',
'square-hole-agent-workspace': '方洞挑战创作',
'square-hole-generating': '方洞挑战生成中',
'square-hole-result': '方洞挑战结果',
'square-hole-runtime': '方洞挑战',
'visual-novel-agent-workspace': '视觉小说创作',
'visual-novel-gallery-detail': '视觉小说详情',
'visual-novel-generating': '视觉小说生成中',
'visual-novel-result': '视觉小说结果',
'visual-novel-runtime': '视觉小说',
'wooden-fish-generating': '敲木鱼生成中',
'wooden-fish-result': '敲木鱼结果',
'wooden-fish-runtime': '敲木鱼',
'wooden-fish-workspace': '敲木鱼创作',
'work-detail': '作品详情',
};
export function resolveAppTitleForSelectionStage(stage: SelectionStage) {
const title = APP_TITLE_BY_SELECTION_STAGE[stage] ?? APP_TITLE_BRAND;
if (title === APP_TITLE_BRAND || title === APP_HOME_TITLE) {
return title;
}
return `${title} - ${APP_TITLE_BRAND}`;
}
export function syncAppTitle(title: string) {
const normalizedTitle = title.trim() || APP_TITLE_BRAND;
if (typeof document !== 'undefined') {
document.title = normalizedTitle;
}
void setHostAppTitle({ title: normalizedTitle });
}