补齐共享 UI 组件库与展示页交互 (#202)
Project CI / Backend tests (push) Successful in 8m31s
Project CI / Repository checks (push) Successful in 14m14s
Project CI / Frontend tests (push) Successful in 13m2s
Project CI / Native shell tests (push) Successful in 21m30s

## 变更内容

- 新增基于 shadcn open-code 模式的共享 UI canonical 组件、样式与导出。
- 新增 `/components` 共享组件展示页,并覆盖平台组件、Token、状态和移动端布局。
- 补齐平台展示页的筛选、排序、上传预览、标签、开关和异步状态交互。
- 修复排序导致预览主题变化、筛选弹窗误关闭和入口状态不更新的问题。
- 同步网站与客户端构建别名、依赖、路由测试和项目文档。

## 验证

- `npm run test -- src/components/shared-components/SharedComponentsShowcasePage.test.tsx`
- `npm run typecheck`
- `npm run check:encoding`
- `npm run build:raw`
- `git diff --check`
- pre-push 门禁通过

Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/202
Co-authored-by: kdletters <kdletters@qq.com>
Co-committed-by: kdletters <kdletters@qq.com>
This commit was merged in pull request #202.
This commit is contained in:
2026-08-31 14:10:44 +08:00
committed by 段舒康
parent cc6211fd41
commit c5200c7d45
113 changed files with 8576 additions and 2556 deletions
+14
View File
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
matchAppRoute,
resolveAppRoute,
shouldUseRecommendationRouteLoading,
} from './activeAppRoutes';
@@ -13,6 +14,19 @@ describe('matchAppRoute', () => {
expect(matchAppRoute('/creation/rpg')).toEqual({ kind: 'platform' });
expect(matchAppRoute('/runtime/puzzle')).toEqual({ kind: 'platform' });
});
it('exposes the framework-free shared component showcase', () => {
expect(matchAppRoute('/components')).toEqual({
kind: 'shared-components',
});
expect(matchAppRoute('/components/')).toEqual({
kind: 'shared-components',
});
expect(matchAppRoute('/design-system')).toEqual({
kind: 'shared-components',
});
expect(resolveAppRoute('/components').kind).toBe('shared-components');
});
});
describe('shouldUseRecommendationRouteLoading', () => {
+26 -5
View File
@@ -6,9 +6,13 @@ type AppRouteComponent = LazyExoticComponent<
ComponentType<Record<string, unknown>>
>;
export type AppRouteMatch = {
kind: 'platform';
};
export type AppRouteMatch =
| {
kind: 'platform';
}
| {
kind: 'shared-components';
};
export type ResolvedAppRoute = {
kind: AppRouteMatch['kind'];
@@ -20,16 +24,33 @@ export type ResolvedAppRoute = {
const PlatformApp = lazy(
() => import('../AuthenticatedApp'),
) as AppRouteComponent;
const SharedComponentsShowcasePage = lazy(
() => import('../components/shared-components/SharedComponentsShowcasePage'),
) as AppRouteComponent;
export function shouldUseRecommendationRouteLoading() {
return false;
}
export function matchAppRoute(_pathname = ''): AppRouteMatch {
export function matchAppRoute(pathname = ''): AppRouteMatch {
const normalizedPath = pathname.trim().toLowerCase().replace(/\/+$/u, '');
if (normalizedPath === '/components' || normalizedPath === '/design-system') {
return { kind: 'shared-components' };
}
return { kind: 'platform' };
}
export function resolveAppRoute(_pathname = ''): ResolvedAppRoute {
export function resolveAppRoute(pathname = ''): ResolvedAppRoute {
if (matchAppRoute(pathname).kind === 'shared-components') {
return {
kind: 'shared-components',
loadingEyebrow: '正在载入共享组件',
loadingText: '正在加载组件展示页',
Component: SharedComponentsShowcasePage,
};
}
return {
kind: 'platform',
loadingEyebrow: '正在载入平台',