refactor: 收口公开详情点赞意图

This commit is contained in:
2026-06-04 00:27:34 +08:00
parent 8c54d40b9c
commit 872d741fdc
6 changed files with 131 additions and 28 deletions

View File

@@ -81,6 +81,25 @@ export type PlatformPublicWorkDetailOpenStrategy =
export type PlatformPublicWorkActionMode = 'edit' | 'remix';
export type PlatformPublicWorkLikeIntent =
| {
type: 'like-big-fish';
profileId: string;
}
| {
type: 'like-puzzle';
profileId: string;
}
| {
type: 'like-rpg-gallery';
ownerUserId: string;
profileId: string;
}
| {
type: 'unsupported';
errorMessage: string;
};
export type PlatformPublicWorkDetailOpenDecision =
| {
type: 'blocked';
@@ -455,6 +474,58 @@ export function resolvePlatformPublicWorkActionMode(
: 'remix';
}
export function resolvePlatformPublicWorkLikeIntent(
entry: PlatformPublicGalleryCard,
): PlatformPublicWorkLikeIntent {
if (isBigFishGalleryEntry(entry)) {
return {
type: 'like-big-fish',
profileId: entry.profileId,
};
}
if (isPuzzleGalleryEntry(entry)) {
return {
type: 'like-puzzle',
profileId: entry.profileId,
};
}
if (isEdutainmentGalleryEntry(entry)) {
return {
type: 'unsupported',
errorMessage: '宝贝识物点赞将在后续版本开放。',
};
}
if (isBarkBattleGalleryEntry(entry)) {
return {
type: 'unsupported',
errorMessage: '汪汪声浪点赞将在后续版本开放。',
};
}
if (isSquareHoleGalleryEntry(entry)) {
return {
type: 'unsupported',
errorMessage: '方洞挑战点赞将在后续版本开放。',
};
}
if (isVisualNovelGalleryEntry(entry)) {
return {
type: 'unsupported',
errorMessage: '视觉小说点赞将在后续版本开放。',
};
}
return {
type: 'like-rpg-gallery',
ownerUserId: entry.ownerUserId,
profileId: entry.profileId,
};
}
export function resolvePlatformPublicWorkDetailOpenDecision(
entry: PlatformPublicGalleryCard,
deps: PlatformPublicWorkDetailOpenDecisionDeps = {},