新增「原版与二创对比」页与路由登记(含 nginx×3 + Pingora allowlist)
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
- 新增路由 /games/compare(stage game-compare):STAGE_ROUTE_ENTRIES + SelectionStage 类型 + 壳层 lazy 引入/导航回调/渲染分支 + 页面标题,四处同批登记 - 三份 nginx SPA allowlist(deploy/nginx/genarrative.conf、deploy/nginx/genarrative-dev-http.conf、deploy/container/nginx.conf)与 Pingora MAIN_SPA_PATHS 同步放行 /games/compare(保持既有排序):check:nginx-spa-routes 18 SPA routes、check:pingora-route-parity 均绿 - 对比页左右两侧各自取数与降级:任一侧不可读(不存在/未公开/已软删除)或没有可玩版本时只降级那一侧,另一侧照常;显示标题、作者与代际;桌面左右并排、窄屏上下堆叠 - iframe 复用游玩页同一份嵌入:抽出 GamePlayFrame(sandbox=allow-scripts、allow=fullscreen、referrerPolicy=no-referrer、.game-player-frame),游玩页改为渲染它,不再存在第二套嵌入逻辑 - 入口:二创作品详情页在存在父作品时给出「与原版对比」;族谱节点仅在其父作品可见时给出同一入口 - 测试:对比页两侧渲染与 iframe 复用属性、单侧降级后另一侧照常;详情页入口(有/无父作品);族谱节点入口(父可见才出现);路由与标题登记;壳层「族谱节点→对比页」导航与对比 stage 渲染 - 顺手:按 eslint 自动修复两个文件的 import 排序
This commit is contained in:
@@ -120,6 +120,11 @@ const GameLineagePage = lazy(async () => {
|
||||
return { default: module.GameLineagePage };
|
||||
});
|
||||
|
||||
const GameComparePage = lazy(async () => {
|
||||
const module = await import('../game-distribution/GameComparePage');
|
||||
return { default: module.GameComparePage };
|
||||
});
|
||||
|
||||
type ActiveRailButtonProps = {
|
||||
active: boolean;
|
||||
emphasized?: boolean;
|
||||
@@ -565,6 +570,29 @@ export function PlatformEntryFlowShellImpl({
|
||||
setSelectionStage('games', { path: '/games' });
|
||||
}, [setSelectionStage]);
|
||||
|
||||
/** 打开「原版与二创对比」:左侧原版(父作品)、右侧二创(当前作品)。 */
|
||||
const openGameCompare = useCallback(
|
||||
(leftGameId: string, rightGameId: string) => {
|
||||
const params = new URLSearchParams({
|
||||
left: leftGameId,
|
||||
right: rightGameId,
|
||||
});
|
||||
const path = `/games/compare?${params.toString()}`;
|
||||
setSelectionStage('game-compare', { path });
|
||||
},
|
||||
[setSelectionStage],
|
||||
);
|
||||
|
||||
/** 对比页同理:原生返回优先,兜底回广场。 */
|
||||
const backFromGameCompare = useCallback(() => {
|
||||
if (hasAppHistoryBackEntry()) {
|
||||
window.history.back();
|
||||
return;
|
||||
}
|
||||
replaceAppHistoryPath('/games');
|
||||
setSelectionStage('games', { path: '/games' });
|
||||
}, [setSelectionStage]);
|
||||
|
||||
/**
|
||||
* 详情页可能从广场或「我的游戏」进入,返回优先走浏览器原生返回,这样能回到
|
||||
* 用户真正的来源页;直接打开详情链接等没有可回退的应用内历史时再兜底回广场。
|
||||
@@ -699,6 +727,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
const isGamesStage =
|
||||
selectionStage === 'games' ||
|
||||
selectionStage === 'game-detail' ||
|
||||
selectionStage === 'game-compare' ||
|
||||
selectionStage === 'game-play' ||
|
||||
selectionStage === 'game-mine' ||
|
||||
selectionStage === 'game-lineage' ||
|
||||
@@ -713,6 +742,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
);
|
||||
const gameId = gameSearchParams.get('id');
|
||||
const lineageHighlightGameId = gameSearchParams.get('from');
|
||||
const compareLeftGameId = gameSearchParams.get('left');
|
||||
const compareRightGameId = gameSearchParams.get('right');
|
||||
const creatorConnectionTab = gameSearchParams.get('tab');
|
||||
const publishGameId = gameSearchParams.get('game');
|
||||
const avatarUrl = authUi?.user?.avatarUrl?.trim() || null;
|
||||
@@ -1005,6 +1036,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
onBack={backFromGameDetail}
|
||||
onPlay={openGamePlay}
|
||||
onOpenLineage={openGameLineage}
|
||||
onOpenCompare={openGameCompare}
|
||||
/>
|
||||
) : selectionStage === 'game-lineage' ? (
|
||||
<GameLineagePage
|
||||
@@ -1012,6 +1044,14 @@ export function PlatformEntryFlowShellImpl({
|
||||
highlightGameId={lineageHighlightGameId}
|
||||
onBack={backFromGameLineage}
|
||||
onOpenDetail={openGameDetail}
|
||||
onOpenCompare={openGameCompare}
|
||||
/>
|
||||
) : selectionStage === 'game-compare' ? (
|
||||
<GameComparePage
|
||||
leftGameId={compareLeftGameId}
|
||||
rightGameId={compareRightGameId}
|
||||
onBack={backFromGameCompare}
|
||||
onOpenDetail={openGameDetail}
|
||||
/>
|
||||
) : (
|
||||
<GamePlayPage gameId={gameId} onBack={backFromGamePlay} />
|
||||
|
||||
Reference in New Issue
Block a user