diff --git a/apps/web/src/styles.css b/apps/web/src/styles.css index 276f1bc..d445bf8 100644 --- a/apps/web/src/styles.css +++ b/apps/web/src/styles.css @@ -147,7 +147,7 @@ /* ---------- 按钮 ---------- */ .ops-btn { - @apply inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition; + @apply inline-flex shrink-0 items-center justify-center gap-1.5 whitespace-nowrap rounded-lg px-3 py-1.5 text-xs font-semibold transition; border: 1px solid transparent; cursor: pointer; } @@ -172,6 +172,7 @@ .ops-btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); } /* ---------- chip / badge ---------- */ + header button, header a { white-space: nowrap; } .ops-chip { @apply rounded-full px-2.5 py-1 text-[11px] font-medium transition; border: 1px solid var(--border); @@ -324,7 +325,7 @@ /* ---------- 顶栏环境切换器 ---------- */ .ops-envswitch { - @apply inline-flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-xs font-medium transition; + @apply inline-flex shrink-0 items-center gap-2 whitespace-nowrap rounded-lg px-2.5 py-1.5 text-xs font-medium transition; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); @@ -492,6 +493,27 @@ color: var(--accent-strong); } + /* ---------- 侧栏分段切换(接口/历史) ---------- */ + .side-seg { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 2px; + padding: 2px; + border-radius: 0.5rem; + background: var(--panel-3); + } + .side-seg-item { + @apply flex items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition; + color: var(--text-dim); + } + .side-seg-item:hover { color: var(--text); } + .side-seg-item.active { + background: var(--panel); + color: var(--accent-strong); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); + } + .side-seg-item .ops-count { margin-left: 2px; } + /* ---------- 方法 chip 着色 ---------- */ .ops-chip.ops-method-GET { background: color-mix(in srgb, var(--m-GET) 14%, transparent); color: var(--m-GET); } .ops-chip.ops-method-POST { background: color-mix(in srgb, var(--m-POST) 16%, transparent); color: var(--m-POST); } diff --git a/packages/ui/src/components/Sidebar.tsx b/packages/ui/src/components/Sidebar.tsx index a4b420f..d76681a 100644 --- a/packages/ui/src/components/Sidebar.tsx +++ b/packages/ui/src/components/Sidebar.tsx @@ -25,23 +25,68 @@ export function Sidebar() { const history = useWorkspace((s) => s.history); const clearHistory = useWorkspace((s) => s.clearHistory); const openTab = useWorkspace((s) => s.openTab); - const [showHistory, setShowHistory] = useState(true); + const [side, setSide] = useState<"api" | "history">("api"); const [menu, setMenu] = useState<{ x: number; y: number; items: MenuItem[] } | null>(null); const hitIds = useMemo(() => searchTree(collections, search), [collections, search]); return (