feat: 新增接口一览页 /interface,滚动信息区域收窄
- 新页面 /interface:按用途分组的接口表(方法 / 路径 / 说明 / 权限), 用库里的 Card + Table + Tag 排;服务端 SPA 路由加入该路径 - 侧边栏「查看接口」不再直接打开 /api/projects 的原始 JSON,改指到该页面 - 页头滚动信息宽度上限 720px(原来铺满,约减少 1/3)
This commit is contained in:
@@ -18,6 +18,7 @@ import { ItemEditor } from './components/content/ItemEditor'
|
||||
import { PosterGrid } from './components/content/PosterGrid'
|
||||
import { SectionCard } from './components/content/SectionCard'
|
||||
import { SiteHeader } from './components/header/SiteHeader'
|
||||
import { ApiDocs } from './components/api/ApiDocs'
|
||||
import { GroupMark } from './components/common/GroupMark'
|
||||
import { LoginDialog } from './components/auth/LoginDialog'
|
||||
import { ProfileCard } from './components/sidebar/ProfileCard'
|
||||
@@ -59,9 +60,11 @@ type Route =
|
||||
| { kind: 'home' }
|
||||
| { kind: 'group'; key: string }
|
||||
| { kind: 'item'; key: string; itemId: string }
|
||||
| { kind: 'api' }
|
||||
|
||||
function parseRoute(pathname: string): Route {
|
||||
const segments = pathname.split('/').filter(Boolean)
|
||||
if (segments[0] === 'interface') return { kind: 'api' }
|
||||
if (
|
||||
(segments[0] === 'g' || segments[0] === 'c') &&
|
||||
segments[1] !== undefined
|
||||
@@ -358,7 +361,7 @@ export default function AppNext() {
|
||||
}, [manage.groups])
|
||||
|
||||
const activeKey =
|
||||
route.kind === 'home'
|
||||
route.kind === 'home' || route.kind === 'api'
|
||||
? 'home'
|
||||
: route.kind === 'group'
|
||||
? `g:${route.key}`
|
||||
@@ -740,6 +743,7 @@ export default function AppNext() {
|
||||
)}
|
||||
|
||||
{route.kind === 'home' && renderHome()}
|
||||
{route.kind === 'api' && <ApiDocs />}
|
||||
{route.kind === 'group' && renderGroupPage(route.key)}
|
||||
{route.kind === 'item' && renderItemPage(route.key, route.itemId)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user