复用项目页错误提示组件

项目页读取失败提示改为复用 PlatformStatusMessage

删除项目页局部错误提示视觉样式

补充项目页错误状态测试和 TRACKING 记录
This commit is contained in:
2026-06-14 02:26:59 +08:00
parent 83ebda4dc2
commit 53b12b4cda
4 changed files with 21 additions and 9 deletions

View File

@@ -67,6 +67,18 @@ describe('ProjectGalleryView', () => {
expect(onOpenProject).toHaveBeenCalledWith('editor-project-1');
});
it('renders project loading errors through the shared status message', async () => {
listEditorProjectsMock.mockRejectedValueOnce(new Error('读取项目失败'));
render(<ProjectGalleryView onOpenProject={vi.fn()} />);
const alert = await screen.findByRole('alert');
expect(alert.textContent).toContain('读取项目失败');
expect(alert.className).toContain('platform-status-message');
expect(alert.className).toContain('project-gallery__error');
});
it('renames and deletes a project from the hover menu', async () => {
listEditorProjectsMock.mockResolvedValueOnce(projectItems);
renameEditorProjectMock.mockResolvedValueOnce({

View File

@@ -24,6 +24,7 @@ import {
PlatformFloatingMenuItem,
} from '../common/PlatformFloatingMenu';
import { PlatformIconButton } from '../common/PlatformIconButton';
import { PlatformStatusMessage } from '../common/PlatformStatusMessage';
import { PlatformTextField } from '../common/PlatformTextField';
import { UnifiedModal } from '../common/UnifiedModal';
@@ -307,9 +308,14 @@ export function ProjectGalleryView({ onOpenProject }: ProjectGalleryViewProps) {
</header>
{errorMessage ? (
<div className="project-gallery__error" role="alert">
<PlatformStatusMessage
tone="error"
surface="platform"
className="project-gallery__error"
role="alert"
>
{errorMessage}
</div>
</PlatformStatusMessage>
) : null}
{isLoading ? (