收口创作中心积分领取按钮
将作品卡积分激励领取按钮迁移到 PlatformActionButton 保留积分激励按钮紧凑布局和移动端跨列样式 补充领取按钮公共组件和 CSS 覆盖断言 更新 PlatformUiKit 文档和 Hermes 决策记录
This commit is contained in:
@@ -547,7 +547,14 @@ test('creation hub shows puzzle point incentive and claims without opening card'
|
||||
expect(screen.getByLabelText('积分激励总数 2.5 泥点')).toBeTruthy();
|
||||
expect(screen.getByLabelText('待领取积分 1 泥点')).toBeTruthy();
|
||||
|
||||
await user.click(screen.getByRole('button', { name: '领取积分' }));
|
||||
const claimButton = screen.getByRole('button', { name: '领取积分' });
|
||||
|
||||
expect(claimButton.className).toContain('platform-button');
|
||||
expect(claimButton.className).toContain(
|
||||
'creation-work-card-incentive__button',
|
||||
);
|
||||
|
||||
await user.click(claimButton);
|
||||
|
||||
expect(onClaimPuzzlePointIncentive).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ profileId: 'puzzle-profile-incentive' }),
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
import { PlatformActionButton } from '../common/PlatformActionButton';
|
||||
import { PlatformPillBadge } from '../common/PlatformPillBadge';
|
||||
import { CustomWorldCoverArtwork } from '../CustomWorldCoverArtwork';
|
||||
import {
|
||||
@@ -736,8 +737,9 @@ export function CustomWorldWorkCard({
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
<PlatformActionButton
|
||||
tone="secondary"
|
||||
size="xxs"
|
||||
disabled={!canClaimPointIncentive || pointIncentiveBusy}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
@@ -749,7 +751,7 @@ export function CustomWorldWorkCard({
|
||||
className="creation-work-card-incentive__button"
|
||||
>
|
||||
{pointIncentiveBusy ? '领取中' : '领取积分'}
|
||||
</button>
|
||||
</PlatformActionButton>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -2784,7 +2784,7 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
}
|
||||
|
||||
.creation-work-card-incentive__metric,
|
||||
.creation-work-card-incentive__button {
|
||||
.creation-work-card-incentive__button.platform-button {
|
||||
min-width: 0;
|
||||
border: 1px solid color-mix(in srgb, #6b7cff 22%, transparent);
|
||||
border-radius: 0.5rem;
|
||||
@@ -2820,7 +2820,7 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.creation-work-card-incentive__button {
|
||||
.creation-work-card-incentive__button.platform-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -2836,12 +2836,12 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
opacity 180ms ease;
|
||||
}
|
||||
|
||||
.creation-work-card-incentive__button:hover:not(:disabled) {
|
||||
.creation-work-card-incentive__button.platform-button:hover:not(:disabled) {
|
||||
transform: translateY(-1px);
|
||||
border-color: color-mix(in srgb, #6b7cff 44%, transparent);
|
||||
}
|
||||
|
||||
.creation-work-card-incentive__button:disabled {
|
||||
.creation-work-card-incentive__button.platform-button:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.52;
|
||||
}
|
||||
@@ -5081,7 +5081,7 @@ html[data-mobile-keyboard-open='true'] .platform-mobile-bottom-dock {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.creation-work-card-incentive__button {
|
||||
.creation-work-card-incentive__button.platform-button {
|
||||
grid-column: 1 / -1;
|
||||
min-height: 2.34rem;
|
||||
padding: 0 0.48rem;
|
||||
|
||||
@@ -114,6 +114,29 @@ describe('index stylesheet unread dots', () => {
|
||||
expect(block).toContain('var(--platform-cool-bg)');
|
||||
expect(block).not.toContain('background: transparent;');
|
||||
});
|
||||
|
||||
it('keeps the creation shelf point incentive action button compact', () => {
|
||||
const css = readIndexCss();
|
||||
const surfaceBlock = getCssBlock(
|
||||
css,
|
||||
'.creation-work-card-incentive__button.platform-button',
|
||||
);
|
||||
const compactButtonBlock = getCssBlock(
|
||||
css,
|
||||
'.creation-work-card-incentive__button.platform-button {\n display: inline-flex;',
|
||||
);
|
||||
const mobileQueryIndex = css.indexOf('@media (max-width: 639px)');
|
||||
const mobileSelectorIndex = css.indexOf(
|
||||
'.creation-work-card-incentive__button.platform-button',
|
||||
mobileQueryIndex,
|
||||
);
|
||||
|
||||
expect(surfaceBlock).toContain('border: 1px solid');
|
||||
expect(surfaceBlock).toContain('background: color-mix(');
|
||||
expect(compactButtonBlock).toContain('min-height: 2.55rem;');
|
||||
expect(compactButtonBlock).toContain('font-size: 0.68rem;');
|
||||
expect(mobileSelectorIndex).toBeGreaterThanOrEqual(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('index stylesheet draft mobile cards', () => {
|
||||
|
||||
Reference in New Issue
Block a user