收口首页与详情动作按钮

为 CopyFeedbackButton 增加 actionShape 共享能力
将拼图广场详情 hero 动作迁移到共享按钮组件
将智能创作首页与抽屉入口迁移到共享按钮组件
将绑定手机号身份提示块迁移到 PlatformSubpanel
同步更新 PlatformUiKit 收口文档与团队决策记录
This commit is contained in:
2026-06-10 15:57:58 +08:00
parent 7411b9a435
commit eb73ffb34d
10 changed files with 163 additions and 53 deletions

View File

@@ -1,6 +1,7 @@
/* @vitest-environment jsdom */
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { expect, test, vi } from 'vitest';
import { CreativeAgentHome } from './CreativeAgentHome';
@@ -45,3 +46,29 @@ test('CreativeAgentHome uses shared status message for home error', () => {
'border-[var(--platform-button-danger-border)]',
);
});
test('CreativeAgentHome reuses shared button chrome for drawer and reward actions', async () => {
const user = userEvent.setup();
renderHome();
const menuButton = screen.getByRole('button', { name: '打开侧边栏' });
const rewardButton = screen.getByRole('button', {
name: '搓闪应用 分1亿激励',
});
expect(menuButton.className).toContain('platform-icon-button');
expect(rewardButton.className).toContain('platform-button');
await user.click(menuButton);
expect(
screen.getByRole('button', { name: '开启新对话' }).className,
).toContain('platform-button');
expect(
screen.getByRole('button', { name: '我的创作' }).className,
).toContain('platform-button');
expect(screen.getByRole('button', { name: '账号' }).className).toContain(
'platform-icon-button',
);
});

View File

@@ -14,6 +14,7 @@ import {
import { useMemo, useState } from 'react';
import type { CreativeAgentInputPart } from '../../../packages/shared/src/contracts/creativeAgent';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformEmptyState } from '../common/PlatformEmptyState';
import { PlatformIconButton } from '../common/PlatformIconButton';
import { PlatformStatusMessage } from '../common/PlatformStatusMessage';
@@ -203,30 +204,31 @@ function CreativeAgentDrawer({
</header>
<div className="shrink-0 space-y-3 px-5">
<button
type="button"
<PlatformActionButton
onClick={() => {
onStartNewChat();
onClose();
}}
className="creative-agent-drawer__new-chat"
fullWidth
>
<MessageCircle className="h-5 w-5" />
<span></span>
</button>
</PlatformActionButton>
<button
type="button"
<PlatformActionButton
onClick={() => {
onOpenDrafts();
onClose();
}}
className="creative-agent-drawer__nav-row"
align="start"
fullWidth
>
<Bookmark className="h-5 w-5" />
<span></span>
<ChevronRight className="ml-auto h-4 w-4 opacity-55" />
</button>
</PlatformActionButton>
</div>
<div className="mt-5 min-h-0 flex-1 overflow-y-auto px-5 pb-5">
@@ -261,17 +263,16 @@ function CreativeAgentDrawer({
</div>
<footer className="flex shrink-0 items-center justify-between gap-3 px-5 py-5 pb-[max(1.15rem,env(safe-area-inset-bottom))]">
<button
type="button"
<PlatformIconButton
onClick={() => {
onOpenAccount();
onClose();
}}
className="creative-agent-drawer__avatar"
aria-label="账号"
>
<UserRound className="h-5 w-5" />
</button>
label="账号"
title="账号"
icon={<UserRound className="h-5 w-5" />}
/>
<div className="flex items-center gap-3">
<PlatformIconButton
onClick={() => {
@@ -331,15 +332,13 @@ export function CreativeAgentHome({
<div className="creative-agent-home platform-remap-surface">
<div className="creative-agent-home__backdrop" />
<header className="creative-agent-home__topbar">
<button
type="button"
<PlatformIconButton
onClick={() => setDrawerOpen(true)}
className="creative-agent-home__topbar-button"
aria-label="打开侧边栏"
label="打开侧边栏"
title="菜单"
>
<Menu className="h-6 w-6" />
</button>
icon={<Menu className="h-6 w-6" />}
/>
<RpgEntryBrandLogo className="creative-agent-home__brand" decorative />
</header>
@@ -358,15 +357,15 @@ export function CreativeAgentHome({
onClick={() => submitText(item.prompt)}
/>
))}
<button
type="button"
<PlatformActionButton
className="creative-agent-home__reward"
disabled={isBusy}
onClick={() => submitText('帮我做一个能马上分享的创意拼图。')}
shape="pill"
>
<Sparkles className="h-6 w-6" />
<span> 1亿</span>
</button>
</PlatformActionButton>
</div>
{error ? (