fix(agents): 私有 tab 未解锁时隐藏搜索栏

私有广场只有在功能可用且校验过密码后才解锁;未解锁时展示门禁/解锁提示并
隐藏关键词/标签搜索栏(此时没有可筛选的列表)。TagSearchBar 按 tab key 重挂载,
切 tab 时内部关键词输入与展开状态随父级筛选一起重置。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
吉鑫升andClaude Opus 4.8 committed 2026-06-10 11:24:52 +08:00
1 parent d61aa853f1
commit 546dec67a1
1 file changed
+11 -1
@@ -112,6 +112,12 @@ export function AgentGallery() {
} }
}, [privateError, privatePassword]); }, [privateError, privatePassword]);
// The private tab is only "unlocked" once the feature is usable and a
// password has been verified. Until then we show the gate (or the lock
// prompt) and hide the keyword/tag search bar — there is no list to filter.
const privateUnlocked = privateFeatureUsable && !!privatePassword;
const showSearchBar = activeTab !== "private" || privateUnlocked;
const activeTotal = activeTab === "private" ? privateTotal : mainTotal; const activeTotal = activeTab === "private" ? privateTotal : mainTotal;
const setTabPage = (tab: "all" | "mine" | "private", page: number) => const setTabPage = (tab: "all" | "mine" | "private", page: number) =>
setPages((prev) => ({ ...prev, [tab]: page })); setPages((prev) => ({ ...prev, [tab]: page }));
@@ -359,12 +365,15 @@ export function AgentGallery() {
)} )}
</div> </div>
</div> </div>
{showSearchBar && (
<TagSearchBar <TagSearchBar
// Remount per tab so the internal keyword input / 展开 state also // Remount per tab so the internal keyword input / 展开 state also
// resets when the parent-owned filters are cleared on tab switch. // resets when the parent-owned filters are cleared on tab switch.
key={activeTab} key={activeTab}
targetType="agent" targetType="agent"
searching={activeTab === "private" ? isPrivateFetching : mainFetching} searching={
activeTab === "private" ? isPrivateFetching : mainFetching
}
onSearchChange={setSearch} onSearchChange={setSearch}
tagIds={tagIds} tagIds={tagIds}
onTagIdsChange={setTagIds} onTagIdsChange={setTagIds}
@@ -388,6 +397,7 @@ export function AgentGallery() {
</Select> </Select>
} }
/> />
)}
{publisher && ( {publisher && (
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="text-muted-foreground text-xs">筛选发布者:</span> <span className="text-muted-foreground text-xs">筛选发布者:</span>