移除精选预览弹窗点赞操作

精选素材预览弹窗只保留点赞数展示

补充弹窗不展示点赞按钮的回归测试
This commit is contained in:
2026-07-07 18:37:58 +08:00
parent 446c6945ad
commit 5888219c95
2 changed files with 45 additions and 34 deletions
@@ -442,6 +442,51 @@ describe('CreationLandingView', () => {
).toBeTruthy();
});
it('does not show a like action in the featured asset preview modal', async () => {
const user = userEvent.setup();
listEditorProjectsMock.mockResolvedValueOnce(projectItems);
listPublicEditorProjectResourcesMock.mockResolvedValueOnce([
{
resourceId: 'resource-character',
projectId: 'project-newest',
showcaseId: 'showcase-character',
label: '角色英雄',
imageSrc: 'data:image/png;base64,character',
width: 512,
height: 512,
sourceType: 'generated',
prompt: 'character hero prompt',
actualPrompt: null,
model: 'character-model',
provider: 'provider',
taskId: 'task-1',
showcaseCategory: 'characters',
likeCount: 3,
generationCostMudPoints: 20,
},
]);
renderCreationLanding();
await user.click(screen.getByRole('tab', { name: '角色' }));
const likeButton = await screen.findByRole('button', {
name: '点赞:角色英雄',
});
const assetCard = likeButton.closest(
'.creation-landing__asset-card',
) as HTMLElement;
await user.click(
assetCard.querySelector(
'.creation-landing__asset-card-open',
) as HTMLElement,
);
const dialog = await screen.findByRole('dialog', { name: '角色英雄' });
expect(within(dialog).getByText('赞')).toBeTruthy();
expect(within(dialog).getByText('3')).toBeTruthy();
expect(within(dialog).queryByRole('button', { name: /点赞/ })).toBeNull();
});
it('opens a fullscreen asset preview modal with thumbnail navigation', async () => {
const user = userEvent.setup();
listEditorProjectsMock.mockResolvedValueOnce(projectItems);
@@ -322,18 +322,12 @@ function ShowcaseBundlePreview({ item }: { item: ShowcaseAssetItem }) {
function CreationShowcaseModal({
item,
activeIndex,
isLiked,
isLikePending,
onSelectIndex,
onToggleLike,
onClose,
}: {
item: ShowcaseAssetItem | null;
activeIndex: number;
isLiked: boolean;
isLikePending: boolean;
onSelectIndex: (index: number) => void;
onToggleLike: (item: ShowcaseAssetItem) => void;
onClose: () => void;
}) {
const safeActiveIndex = item
@@ -389,25 +383,6 @@ function CreationShowcaseModal({
</div>
) : null}
</dl>
{item.showcaseId ? (
<PlatformActionButton
tone={isLiked ? 'secondary' : 'primary'}
surface="platform"
size="sm"
disabled={isLikePending}
onClick={() => onToggleLike(item)}
>
<img
className="creation-landing__showcase-like-icon"
src={SHOWCASE_LIKE_ICON_SRC}
alt=""
aria-hidden="true"
/>
<span>
{isLikePending ? '处理中' : isLiked ? '已点赞' : '点赞'}
</span>
</PlatformActionButton>
) : null}
</div>
<div
className="creation-landing__showcase-thumbs"
@@ -1078,16 +1053,7 @@ export function CreationLandingView({
<CreationShowcaseModal
item={selectedShowcaseItem}
activeIndex={selectedShowcaseIndex}
isLiked={Boolean(
selectedShowcaseItem?.showcaseId &&
likedShowcaseIds.has(selectedShowcaseItem.showcaseId),
)}
isLikePending={Boolean(
selectedShowcaseItem?.showcaseId &&
pendingLikeShowcaseIds.has(selectedShowcaseItem.showcaseId),
)}
onSelectIndex={setSelectedShowcaseIndex}
onToggleLike={handleToggleShowcaseLike}
onClose={() => setSelectedShowcaseItem(null)}
/>
<UnifiedModal