fix public work author display
This commit is contained in:
@@ -149,6 +149,7 @@ import {
|
||||
isWoodenFishGalleryEntry,
|
||||
type PlatformPublicGalleryCard,
|
||||
type PlatformWorldCardLike,
|
||||
resolvePlatformWorkAuthorDisplayName,
|
||||
resolvePlatformPublicWorkCode,
|
||||
resolvePlatformWorldCoverImage,
|
||||
resolvePlatformWorldCoverSlides,
|
||||
@@ -655,7 +656,7 @@ function WorldCard({
|
||||
const remixCount = getPlatformWorldRemixCount(entry);
|
||||
const likeCount = getPlatformWorldLikeCount(entry);
|
||||
const typeLabel = describePublicGalleryCardKind(entry);
|
||||
const authorName = resolvePublicEntryAuthorDisplayText(
|
||||
const authorName = resolvePlatformWorkAuthorDisplayName(
|
||||
entry,
|
||||
authorUsername,
|
||||
);
|
||||
@@ -1024,7 +1025,7 @@ function RecommendRuntimeMeta({
|
||||
}) {
|
||||
const likeCount = getPlatformWorldLikeCount(entry);
|
||||
const remixCount = getPlatformWorldRemixCount(entry);
|
||||
const authorName = resolvePublicEntryAuthorDisplayText(
|
||||
const authorName = resolvePlatformWorkAuthorDisplayName(
|
||||
entry,
|
||||
authorUsername,
|
||||
);
|
||||
@@ -1935,17 +1936,6 @@ function getPublicAuthorAvatarLabel(authorDisplayName: string) {
|
||||
return Array.from(authorDisplayName.trim() || '玩')[0] ?? '玩';
|
||||
}
|
||||
|
||||
function resolvePublicEntryAuthorDisplayText(
|
||||
entry: PlatformPublicGalleryCard,
|
||||
authorUsername?: string | null,
|
||||
) {
|
||||
if (isWoodenFishGalleryEntry(entry)) {
|
||||
return authorUsername?.trim() || entry.authorDisplayName.trim() || '玩家';
|
||||
}
|
||||
|
||||
return entry.authorDisplayName.trim() || '玩家';
|
||||
}
|
||||
|
||||
function getPlatformWorldLikeCount(entry: PlatformWorldCardLike) {
|
||||
return Math.max(0, Math.round(entry.likeCount ?? 0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user