Merge remote-tracking branch 'origin/master' into codex/bark-battle

This commit is contained in:
kdletters
2026-05-22 05:12:29 +08:00
275 changed files with 29199 additions and 41360 deletions

View File

@@ -2,6 +2,10 @@ import type { BarkBattleWorkSummary } from '../../../packages/shared/src/contrac
import type { BigFishWorkSummary } from '../../../packages/shared/src/contracts/bigFishWorkSummary';
import type { BabyObjectMatchDraft } from '../../../packages/shared/src/contracts/edutainmentBabyObject';
import { BABY_OBJECT_MATCH_EDUTAINMENT_TAG } from '../../../packages/shared/src/contracts/edutainmentBabyObject';
import type {
JumpHopGalleryCardResponse,
JumpHopWorkProfileResponse,
} from '../../../packages/shared/src/contracts/jumpHop';
import type {
Match3DGeneratedBackgroundAsset,
Match3DGeneratedItemAsset,
@@ -25,6 +29,7 @@ import {
buildBabyObjectMatchPublicWorkCode,
buildBarkBattlePublicWorkCode,
buildBigFishPublicWorkCode,
buildJumpHopPublicWorkCode,
buildMatch3DPublicWorkCode,
buildPuzzlePublicWorkCode,
buildSquareHolePublicWorkCode,
@@ -44,6 +49,7 @@ export type PlatformWorldCardLike =
| PlatformMatch3DGalleryCard
| PlatformSquareHoleGalleryCard
| PlatformPuzzleGalleryCard
| PlatformJumpHopGalleryCard
| PlatformVisualNovelGalleryCard
| PlatformBarkBattleGalleryCard
| PlatformEdutainmentGalleryCard;
@@ -175,6 +181,30 @@ export type PlatformVisualNovelGalleryCard = {
updatedAt: string;
};
export type PlatformJumpHopGalleryCard = {
sourceType: 'jump-hop';
workId: string;
profileId: string;
sourceSessionId?: string | null;
publicWorkCode: string;
ownerUserId: string;
authorDisplayName: string;
worldName: string;
subtitle: string;
summaryText: string;
coverImageSrc: string | null;
themeTags: string[];
playCount?: number;
remixCount?: number;
likeCount?: number;
recentPlayCount7d?: number;
visibility: 'published';
publishedAt: string | null;
updatedAt: string;
difficulty?: string;
stylePreset?: string;
};
export type PlatformEdutainmentGalleryCard = {
sourceType: 'edutainment';
templateId: typeof EDUTAINMENT_BABY_OBJECT_MATCH_TEMPLATE_ID;
@@ -233,6 +263,7 @@ export type PlatformPublicGalleryCard =
| PlatformMatch3DGalleryCard
| PlatformSquareHoleGalleryCard
| PlatformPuzzleGalleryCard
| PlatformJumpHopGalleryCard
| PlatformVisualNovelGalleryCard
| PlatformBarkBattleGalleryCard
| PlatformEdutainmentGalleryCard;
@@ -273,6 +304,12 @@ export function isVisualNovelGalleryEntry(
return 'sourceType' in entry && entry.sourceType === 'visual-novel';
}
export function isJumpHopGalleryEntry(
entry: PlatformWorldCardLike,
): entry is PlatformJumpHopGalleryCard {
return 'sourceType' in entry && entry.sourceType === 'jump-hop';
}
export function isEdutainmentGalleryEntry(
entry: PlatformWorldCardLike,
): entry is PlatformEdutainmentGalleryCard {
@@ -426,6 +463,53 @@ export function mapVisualNovelWorkToPlatformGalleryCard(
};
}
export function mapJumpHopWorkToPlatformGalleryCard(
work: JumpHopGalleryCardResponse | JumpHopWorkProfileResponse,
): PlatformJumpHopGalleryCard {
const summary = 'summary' in work ? work.summary : work;
const difficulty = summary.difficulty;
const difficultyLabel =
difficulty === 'easy'
? '轻松节奏'
: difficulty === 'advanced'
? '进阶跳台'
: difficulty === 'challenge'
? '极限路线'
: '标准路线';
return {
sourceType: 'jump-hop',
workId: summary.workId,
profileId: summary.profileId,
sourceSessionId:
'sourceSessionId' in summary ? (summary.sourceSessionId ?? null) : null,
publicWorkCode:
'publicWorkCode' in summary && summary.publicWorkCode.trim()
? summary.publicWorkCode
: buildJumpHopPublicWorkCode(summary.profileId),
ownerUserId: summary.ownerUserId,
authorDisplayName:
'authorDisplayName' in summary ? summary.authorDisplayName : '玩家',
worldName: summary.workTitle,
subtitle: difficultyLabel,
summaryText: summary.workDescription,
coverImageSrc: summary.coverImageSrc ?? null,
themeTags:
summary.themeTags.length > 0
? summary.themeTags
: ['跳一跳', difficultyLabel],
playCount: summary.playCount ?? 0,
remixCount: 0,
likeCount: 0,
recentPlayCount7d: 0,
visibility: 'published',
publishedAt: summary.publishedAt ?? null,
updatedAt: summary.updatedAt,
difficulty,
stylePreset: summary.stylePreset,
};
}
export function mapBabyObjectMatchDraftToPlatformGalleryCard(
draft: BabyObjectMatchDraft,
): PlatformEdutainmentGalleryCard {
@@ -561,6 +645,10 @@ export function resolvePlatformWorldFallbackCoverImage(
return '/creation-type-references/visual-novel.webp';
}
if (isJumpHopGalleryEntry(entry)) {
return '/creation-type-references/jump-hop.webp';
}
if (isBigFishGalleryEntry(entry)) {
return '/creation-type-references/big-fish.webp';
}
@@ -728,6 +816,12 @@ export function buildPlatformWorldTags(entry: PlatformWorldCardLike) {
: ['视觉小说'];
}
if (isJumpHopGalleryEntry(entry)) {
return entry.themeTags.length > 0
? entry.themeTags.slice(0, 3)
: ['跳一跳'];
}
if (isEdutainmentGalleryEntry(entry)) {
return entry.themeTags.length > 0
? entry.themeTags.slice(0, 3)
@@ -826,6 +920,10 @@ export function resolvePlatformPublicWorkCode(
return entry.publicWorkCode;
}
if (isJumpHopGalleryEntry(entry)) {
return entry.publicWorkCode;
}
if (isEdutainmentGalleryEntry(entry)) {
return entry.publicWorkCode;
}