feat: show work description in review workspace

This commit is contained in:
江林铖 2026-08-11 13:34:11 +08:00
parent 17d45352d3
commit d2afa2bfe7
2 changed files with 34 additions and 0 deletions

View File

@ -903,6 +903,19 @@ export function WorkReviewReviewerWorkspace({
</div>
</div>
)}
<section
className="shrink-0 border-b border-[#dfe5ee] bg-[#f8fafc] px-3 py-3 sm:px-4"
aria-labelledby="work-review-description-title"
>
<div className="grid gap-1 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-start sm:gap-4">
<h2 id="work-review-description-title" className="text-[12px] font-bold leading-5 text-[#344054]">
作品说明
</h2>
<p className="max-h-24 overflow-y-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[#526173] [overflow-wrap:anywhere]">
{project.description?.trim() || '未填写作品说明'}
</p>
</div>
</section>
<div className="relative min-h-0 flex-1 overflow-hidden">
<div
ref={comparisonRef}

View File

@ -63,6 +63,27 @@ const projectWithReference: WorkReviewProject = {
}
describe('WorkReviewReviewerWorkspace', () => {
test('shows the submitted work description above the image workspace', () => {
render(
<WorkReviewReviewerWorkspace
project={{
...project,
description: '用于测试新版视觉主图。\n重点关注标题层级与产品卖点。',
}}
onSubmitReview={jest.fn()}
/>,
)
const description = screen.getByText((_, element) => (
element?.tagName === 'P'
&& element.textContent === '用于测试新版视觉主图。\n重点关注标题层级与产品卖点。'
))
expect(screen.getByRole('heading', { name: '作品说明' })).toBeInTheDocument()
expect(description).toHaveClass('whitespace-pre-wrap', 'break-words')
expect(description.compareDocumentPosition(screen.getAllByText('作品图片')[0]))
.toBe(Node.DOCUMENT_POSITION_FOLLOWING)
})
test('keeps mobile box selection under app control and recovers after a cancelled gesture', async () => {
window.PointerEvent = MouseEvent as typeof PointerEvent
const user = userEvent.setup()