隐藏历史图片名称
历史图片选择弹窗只展示缩略图和生成时间 历史素材兜底文案统一为历史素材 更新拼图历史图片展示口径文档 同步调整拼图历史图片选择流程测试
This commit is contained in:
@@ -6,10 +6,7 @@ import {
|
||||
puzzleAssetClient,
|
||||
type PuzzleHistoryAsset,
|
||||
} from '../../../services/puzzle-works/puzzleAssetClient';
|
||||
import {
|
||||
formatPuzzleHistoryAssetCreatedAt,
|
||||
getPuzzleHistoryAssetDisplayName,
|
||||
} from '../../../services/puzzle-works/puzzleHistoryAsset';
|
||||
import { formatPuzzleHistoryAssetCreatedAt } from '../../../services/puzzle-works/puzzleHistoryAsset';
|
||||
import { useAuthUi } from '../../auth/AuthUiContext';
|
||||
import { ResolvedAssetImage } from '../../ResolvedAssetImage';
|
||||
|
||||
@@ -116,30 +113,28 @@ export function PuzzleHistoryAssetPickerDialog({
|
||||
{!isLoading && assets.length > 0 ? (
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5">
|
||||
{assets.map((asset) => {
|
||||
const displayName = getPuzzleHistoryAssetDisplayName(
|
||||
asset.imageSrc,
|
||||
const createdAtText = formatPuzzleHistoryAssetCreatedAt(
|
||||
asset.createdAt,
|
||||
);
|
||||
return (
|
||||
<button
|
||||
key={asset.assetObjectId}
|
||||
type="button"
|
||||
disabled={isBusy}
|
||||
aria-label={`选择${createdAtText}的历史图片`}
|
||||
onClick={() => onSelect(asset)}
|
||||
className={`overflow-hidden rounded-[1.25rem] border bg-white/82 text-left transition hover:border-amber-300/70 hover:bg-white ${isBusy ? 'cursor-not-allowed opacity-55' : 'border-[var(--platform-subpanel-border)]'}`}
|
||||
>
|
||||
<div className="aspect-square overflow-hidden bg-[var(--platform-subpanel-fill)]">
|
||||
<ResolvedAssetImage
|
||||
src={asset.imageSrc}
|
||||
alt={displayName}
|
||||
alt=""
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1 px-4 py-4">
|
||||
<div className="truncate text-sm font-black text-[var(--platform-text-strong)]">
|
||||
{displayName}
|
||||
</div>
|
||||
<div className="px-4 py-3">
|
||||
<div className="text-xs leading-5 text-[var(--platform-text-base)]">
|
||||
{formatPuzzleHistoryAssetCreatedAt(asset.createdAt)}
|
||||
{createdAtText}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
@@ -344,11 +344,13 @@ test('puzzle workspace selects a history image from the upload card', async () =
|
||||
const picker = await screen.findByRole('dialog', {
|
||||
name: '选择历史图片',
|
||||
});
|
||||
expect(await within(picker).findByText('image.png')).toBeTruthy();
|
||||
expect(await within(picker).findByText(/2024\/04\/21/u)).toBeTruthy();
|
||||
expect(within(picker).queryByText('image.png')).toBeNull();
|
||||
expect(within(picker).queryByText('账号 user-1')).toBeNull();
|
||||
fireEvent.click(
|
||||
await within(picker).findByRole('button', { name: /image\.png/u }),
|
||||
await within(picker).findByRole('button', {
|
||||
name: /选择2024\/04\/21.*的历史图片/u,
|
||||
}),
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
@@ -622,7 +624,9 @@ test('puzzle workspace submits history image when AI redraw is off', async () =>
|
||||
name: '选择历史图片',
|
||||
});
|
||||
fireEvent.click(
|
||||
await within(picker).findByRole('button', { name: /image\.png/u }),
|
||||
await within(picker).findByRole('button', {
|
||||
name: /选择2024\/04\/21.*的历史图片/u,
|
||||
}),
|
||||
);
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole('dialog', { name: '选择历史图片' })).toBeNull();
|
||||
@@ -636,9 +640,9 @@ test('puzzle workspace submits history image when AI redraw is off', async () =>
|
||||
fireEvent.click(screen.getByRole('button', { name: /生成拼图游戏草稿/u }));
|
||||
|
||||
expect(onCreateFromForm).toHaveBeenCalledWith({
|
||||
seedText: '历史素材 · image.png',
|
||||
workDescription: '历史素材 · image.png',
|
||||
pictureDescription: '历史素材 · image.png',
|
||||
seedText: '历史素材',
|
||||
workDescription: '历史素材',
|
||||
pictureDescription: '历史素材',
|
||||
referenceImageSrc: '/generated-puzzle-assets/history/image.png',
|
||||
referenceImageSrcs: [],
|
||||
referenceImageAssetObjectId: 'asset-history-1',
|
||||
|
||||
Reference in New Issue
Block a user