import { Button, Card, Icon, Space, Tag, Text, Title } from '@stash/ui' import type { Project } from '../../api' /** * 本地服务面板:连接状态、项目数、访问地址,以及两个操作入口。 * 只读展示 + 触发刷新,不负责导航。 */ type ServicePanelProps = { projects: Project[] live: boolean refreshing: boolean onRefresh: () => void /** 打开接口一览:走站内路由,不整页刷新 */ onOpenApi: () => void } export function ServicePanel({ projects, live, refreshing, onRefresh, onOpenApi, }: ServicePanelProps) { const host = typeof window === 'undefined' ? '-' : window.location.host return ( 本地服务 {live ? '已连接' : '未连接'}
项目数 {projects.length} 访问地址 {host}
{ // 无修饰键时接管点击,走站内路由,只换右侧内容;按住修饰键仍可新标签打开 if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return event.preventDefault() onOpenApi() }} > 查看接口
) }