Python
fix(memhub): prioritize memory list space
kristinhe2735d8693a18
diff --git a/memhub/apps/web/src/MemoryMap.test.tsx b/memhub/apps/web/src/MemoryMap.test.tsxindex b06e0b4..58b00d2 100644--- a/memhub/apps/web/src/MemoryMap.test.tsx+++ b/memhub/apps/web/src/MemoryMap.test.tsx@@ -186,18 +186,17 @@ it("OBS-19: Enter in the memory filter submits it; submitting it again re-reads"/>,);await act(async () => {});- await userEvent.click(screen.getByRole("button", { name: "刷新地图记忆" }));- expect(onRetry).toHaveBeenCalledTimes(1);+ expect(screen.queryByRole("button", { name: "刷新地图记忆" })).toBeNull();// Typing alone does not search; Enter submits the words.const input = screen.getByRole("textbox", { name: "筛选地图记忆" });await userEvent.type(input, "第一");expect(onQuery).not.toHaveBeenCalled();await userEvent.type(input, "{Enter}");expect(onQuery).toHaveBeenCalledWith("第一");- // Submitting the words already applied re-reads, like the refresh button.+ // Submitting the currently applied query re-reads without a separate row.await userEvent.clear(input);await userEvent.type(input, "{Enter}");- expect(onRetry).toHaveBeenCalledTimes(2);+ expect(onRetry).toHaveBeenCalledOnce();});it("searches only when 搜索 is pressed, not on every keystroke", async () => {@@ -510,6 +509,12 @@ it("D96: lists a memory by when its conversation happened, not when it was gener/共 519 条,第 2 \/ 6 页/,),).toBeTruthy();+ expect(screen.getAllByText(/共 519 条/)).toHaveLength(1);+ expect(+ screen+ .getByRole("navigation", { name: "地图记忆分页" })+ .classList.contains("map-pagination"),+ ).toBe(true);});it("names the SDK's no-source bucket 未识别来源, apart from a source under review", () => {diff --git a/memhub/apps/web/src/MemoryMap.tsx b/memhub/apps/web/src/MemoryMap.tsxindex 3527bec..46a97dc 100644--- a/memhub/apps/web/src/MemoryMap.tsx+++ b/memhub/apps/web/src/MemoryMap.tsx@@ -16,7 +16,6 @@ import {ChevronRight,FileText,Network,- RefreshCw,Search,X,} from "lucide-react";@@ -696,43 +695,17 @@ export function MemoryMap(props: Props) {</button>) : null}</form>- {library && (- <div className="map-list-heading" aria-live="polite">- <span>- {library.stale- ? library.page && library.page.total > 0- ? text(- "共 {count} 条 · 正在核对来源…",- { count: plain(library.page.total) },- library.page.total,- )- : text("正在核对来源…")- : library.failed- ? text("读取失败")- : library.loading && library.page?.total === 0- ? text("正在读取…")- : library.page- ? `${text(- "共 {count} 条",- { count: plain(library.page.total) },- library.page.total,- )}${refreshing ? text(" · 正在核对…") : ""}`- : text("正在读取…")}- </span>- {!library.stale && (- <button- type="button"- className="quiet map-tool"- aria-label={text("刷新地图记忆")}- title={text("刷新地图记忆")}- disabled={library.loading || hidden}- onClick={library.onRetry}- >- <RefreshCw size={16} aria-hidden="true" />- </button>- )}- </div>- )}+ {library && (library.loading || library.stale || library.failed) ? (+ <p className="map-list-status" aria-live="polite">+ {library.failed+ ? text("读取失败")+ : library.stale+ ? text("正在核对来源…")+ : refreshing && library.page?.total !== 0+ ? text("正在核对…")+ : text("正在读取…")}+ </p>+ ) : null}{!props.simplified && (<div className="map-groups"><button@@ -873,7 +846,7 @@ export function MemoryMap(props: Props) {!library.loading &&!library.failed &&!library.stale && (- <nav aria-label={text("地图记忆分页")} className="map-list-heading">+ <nav aria-label={text("地图记忆分页")} className="map-pagination"><buttontype="button"className="quiet map-tool"diff --git a/memhub/apps/web/src/core-visual.css b/memhub/apps/web/src/core-visual.cssindex a6b7098..9bb7882 100644--- a/memhub/apps/web/src/core-visual.css+++ b/memhub/apps/web/src/core-visual.css@@ -772,6 +772,31 @@ button.rail-button.active::before {text-overflow: ellipsis;white-space: nowrap;}+.map-pagination {+ display: flex;+ flex: none;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+ margin-top: auto;+ padding: 12px 6px 0;+ border-top: 1px solid var(--bd);+ color: var(--tx3);+ font-size: 12px;+}+.map-pagination > span {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.map-list-status {+ flex: none;+ margin: 0;+ padding: 4px;+ color: var(--tx3);+ font-size: 12px;+ line-height: 20px;+}.map-filter-notice {font-size: 12px;line-height: 1.65;diff --git a/memhub/apps/web/src/selected-memory.css b/memhub/apps/web/src/selected-memory.cssindex 0ddb708..e1fde08 100644--- a/memhub/apps/web/src/selected-memory.css+++ b/memhub/apps/web/src/selected-memory.css@@ -147,6 +147,8 @@outline-offset: 2px;}.r6-shell .r6-memory .map-memory-list {+ flex: 1 1 0;+ min-height: 0;margin: 0;padding: 0;}