重构作品分享链路
统一发布分享弹窗为作品分享卡片 支持下载分享卡与小程序九宫切图保存 小程序复制链接改为可直达作品详情的 web-view 路径 修复本地 dev Rust 构建绕过损坏 sccache 补充分享链路与 dev 启动文档和测试
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { createMiniGameDraftGenerationState } from '../../services/miniGameDraftGenerationProgress';
|
||||
import {
|
||||
resolveMiniGameGenerationProgressTickState,
|
||||
} from './PlatformEntryFlowShellImpl';
|
||||
import { createMiniGameDraftGenerationState } from '../../services/miniGameDraftGenerationProgress';
|
||||
} from './platformGenerationProgressTickState';
|
||||
|
||||
describe('resolveMiniGameGenerationProgressTickState', () => {
|
||||
test('returns jump hop and wooden fish generation states for progress ticking', () => {
|
||||
|
||||
@@ -382,6 +382,7 @@ import { UnifiedModal } from '../common/UnifiedModal';
|
||||
import { resolveCreativeAgentTargetSelectionStage } from '../creative-agent/creativeAgentViewModel';
|
||||
import {
|
||||
buildCreationWorkShelfItems,
|
||||
CREATION_WORK_KIND_FALLBACK_COVER,
|
||||
type CreationWorkShelfItem,
|
||||
isPersistedBarkBattleDraftGenerating,
|
||||
isPersistedPuzzleDraftGenerating,
|
||||
@@ -389,6 +390,7 @@ import {
|
||||
} from '../custom-world-home/creationWorkShelf';
|
||||
import {
|
||||
buildPlatformPublicGalleryCardKey,
|
||||
describePublicGalleryCardKind,
|
||||
isBarkBattleGalleryEntry,
|
||||
isBigFishGalleryEntry,
|
||||
isCustomWorldGalleryEntry,
|
||||
@@ -412,6 +414,8 @@ import {
|
||||
mapWoodenFishWorkToPlatformGalleryCard,
|
||||
type PlatformPublicGalleryCard,
|
||||
resolvePlatformPublicWorkCode,
|
||||
resolvePlatformWorldCoverImage,
|
||||
resolvePlatformWorldFallbackCoverImage,
|
||||
} from '../rpg-entry/rpgEntryWorldPresentation';
|
||||
import { useRpgCreationAgentOperationPolling } from '../rpg-entry/useRpgCreationAgentOperationPolling';
|
||||
import { useRpgCreationEnterWorld } from '../rpg-entry/useRpgCreationEnterWorld';
|
||||
@@ -471,6 +475,7 @@ import {
|
||||
type PlatformErrorDialogPayload,
|
||||
} from './PlatformErrorDialog';
|
||||
import { PlatformFeedbackView } from './PlatformFeedbackView';
|
||||
import { resolveMiniGameGenerationProgressTickState } from './platformGenerationProgressTickState';
|
||||
import { buildPlatformRecommendedEntries } from './platformRecommendation';
|
||||
import {
|
||||
PlatformTaskCompletionDialog,
|
||||
@@ -523,31 +528,6 @@ type PuzzleBackgroundCompileTask = {
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
type MiniGameGenerationProgressTickStateMap = Partial<
|
||||
Record<MiniGameDraftGenerationKind, MiniGameDraftGenerationState | null>
|
||||
>;
|
||||
|
||||
export function resolveMiniGameGenerationProgressTickState(
|
||||
selectionStage: SelectionStage,
|
||||
states: MiniGameGenerationProgressTickStateMap,
|
||||
) {
|
||||
const stageKindMap: Partial<
|
||||
Record<SelectionStage, MiniGameDraftGenerationKind>
|
||||
> = {
|
||||
'puzzle-generating': 'puzzle',
|
||||
'big-fish-generating': 'big-fish',
|
||||
'square-hole-generating': 'square-hole',
|
||||
'match3d-generating': 'match3d',
|
||||
'baby-object-match-generating': 'baby-object-match',
|
||||
'jump-hop-generating': 'jump-hop',
|
||||
'puzzle-clear-generating': 'puzzle-clear',
|
||||
'wooden-fish-generating': 'wooden-fish',
|
||||
};
|
||||
const kind = stageKindMap[selectionStage];
|
||||
|
||||
return kind ? (states[kind] ?? null) : null;
|
||||
}
|
||||
|
||||
type PuzzleDetailReturnTarget = {
|
||||
tab: PlatformHomeTab;
|
||||
};
|
||||
@@ -5274,6 +5254,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
title: entry.worldName,
|
||||
publicWorkCode,
|
||||
stage: resolveRecommendEntryShareStage(entry),
|
||||
workTypeLabel: describePublicGalleryCardKind(entry),
|
||||
coverImageSrc: resolvePlatformWorldCoverImage(entry),
|
||||
fallbackCoverImageSrc: resolvePlatformWorldFallbackCoverImage(entry),
|
||||
});
|
||||
},
|
||||
[openPublishShareModal],
|
||||
@@ -5302,6 +5285,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
title: galleryEntry?.worldName || profileName,
|
||||
publicWorkCode,
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: 'RPG世界',
|
||||
coverImageSrc: galleryEntry?.coverImageSrc ?? null,
|
||||
fallbackCoverImageSrc: CREATION_WORK_KIND_FALLBACK_COVER.rpg,
|
||||
});
|
||||
},
|
||||
[openPublishShareModal, platformBootstrap],
|
||||
@@ -6022,6 +6008,12 @@ export function PlatformEntryFlowShellImpl({
|
||||
response.session.sessionId,
|
||||
),
|
||||
stage: 'big-fish-runtime',
|
||||
workTypeLabel: '大鱼吃小鱼',
|
||||
coverImageSrc:
|
||||
response.session.assetSlots.find(
|
||||
(slot) => slot.status === 'ready' && slot.assetUrl?.trim(),
|
||||
)?.assetUrl ?? null,
|
||||
fallbackCoverImageSrc: CREATION_WORK_KIND_FALLBACK_COVER['big-fish'],
|
||||
});
|
||||
}
|
||||
if (payload.action !== 'big_fish_compile_draft') {
|
||||
@@ -6745,6 +6737,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
galleryDetail.item.profileId,
|
||||
),
|
||||
stage: 'puzzle-gallery-detail',
|
||||
workTypeLabel: '拼图',
|
||||
coverImageSrc: galleryDetail.item.coverImageSrc,
|
||||
fallbackCoverImageSrc: CREATION_WORK_KIND_FALLBACK_COVER.puzzle,
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -9300,6 +9295,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
title: publishedWithAssets.title,
|
||||
publicWorkCode,
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '汪汪声浪',
|
||||
coverImageSrc: publishedWithAssets.uiBackgroundImageSrc ?? null,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['bark-battle'],
|
||||
});
|
||||
} catch (error) {
|
||||
setBarkBattleError(
|
||||
@@ -9428,6 +9427,13 @@ export function PlatformEntryFlowShellImpl({
|
||||
response.publicWorkCode ||
|
||||
buildBabyObjectMatchPublicWorkCode(response.draft.profileId),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '宝贝识物',
|
||||
coverImageSrc:
|
||||
response.draft.visualPackage?.assets[0]?.imageSrc ??
|
||||
response.draft.itemAssets[0]?.imageSrc ??
|
||||
null,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['baby-object-match'],
|
||||
});
|
||||
} catch (error) {
|
||||
setBabyObjectMatchError(
|
||||
@@ -9664,6 +9670,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
publishedResponse.work.summary.profileId,
|
||||
),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '视觉小说',
|
||||
coverImageSrc: publishedResponse.work.summary.coverImageSrc,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['visual-novel'],
|
||||
});
|
||||
} catch (error) {
|
||||
setVisualNovelError(
|
||||
@@ -10252,6 +10262,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
response.item.summary.profileId,
|
||||
),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '跳一跳',
|
||||
coverImageSrc: response.item.summary.coverImageSrc,
|
||||
fallbackCoverImageSrc: CREATION_WORK_KIND_FALLBACK_COVER['jump-hop'],
|
||||
});
|
||||
} catch (error) {
|
||||
setJumpHopError(
|
||||
@@ -10679,6 +10692,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
title: response.item.summary.workTitle || '拼消消',
|
||||
publicWorkCode,
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '拼消消',
|
||||
coverImageSrc: response.item.summary.coverImageSrc,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['puzzle-clear'],
|
||||
});
|
||||
} catch (error) {
|
||||
setPuzzleClearError(
|
||||
@@ -11213,6 +11230,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
response.item.summary.profileId,
|
||||
),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '敲木鱼',
|
||||
coverImageSrc: response.item.summary.coverImageSrc,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['wooden-fish'],
|
||||
});
|
||||
} catch (error) {
|
||||
setWoodenFishError(
|
||||
@@ -18510,6 +18531,13 @@ export function PlatformEntryFlowShellImpl({
|
||||
normalizedProfile.profileId,
|
||||
),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '抓大鹅',
|
||||
coverImageSrc:
|
||||
normalizedProfile.coverImageSrc ??
|
||||
normalizedProfile.backgroundImageSrc ??
|
||||
null,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER.match3d,
|
||||
});
|
||||
}}
|
||||
onStartTestRun={(profile, options) => {
|
||||
@@ -18972,6 +19000,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
profile.profileId,
|
||||
),
|
||||
stage: 'work-detail',
|
||||
workTypeLabel: '方洞挑战',
|
||||
coverImageSrc: profile.coverImageSrc ?? null,
|
||||
fallbackCoverImageSrc:
|
||||
CREATION_WORK_KIND_FALLBACK_COVER['square-hole'],
|
||||
});
|
||||
}}
|
||||
onStartTestRun={(profile) => {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type {
|
||||
MiniGameDraftGenerationKind,
|
||||
MiniGameDraftGenerationState,
|
||||
} from '../../services/miniGameDraftGenerationProgress';
|
||||
import type { SelectionStage } from './platformEntryTypes';
|
||||
|
||||
type MiniGameGenerationProgressTickStateMap = Partial<
|
||||
Record<MiniGameDraftGenerationKind, MiniGameDraftGenerationState | null>
|
||||
>;
|
||||
|
||||
export function resolveMiniGameGenerationProgressTickState(
|
||||
selectionStage: SelectionStage,
|
||||
states: MiniGameGenerationProgressTickStateMap,
|
||||
) {
|
||||
const stageKindMap: Partial<
|
||||
Record<SelectionStage, MiniGameDraftGenerationKind>
|
||||
> = {
|
||||
'puzzle-generating': 'puzzle',
|
||||
'big-fish-generating': 'big-fish',
|
||||
'square-hole-generating': 'square-hole',
|
||||
'match3d-generating': 'match3d',
|
||||
'baby-object-match-generating': 'baby-object-match',
|
||||
'jump-hop-generating': 'jump-hop',
|
||||
'puzzle-clear-generating': 'puzzle-clear',
|
||||
'wooden-fish-generating': 'wooden-fish',
|
||||
};
|
||||
const kind = stageKindMap[selectionStage];
|
||||
|
||||
return kind ? (states[kind] ?? null) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user