fix(agents): 私有 tab 未解锁时隐藏搜索栏
私有广场只有在功能可用且校验过密码后才解锁;未解锁时展示门禁/解锁提示并 隐藏关键词/标签搜索栏(此时没有可筛选的列表)。TagSearchBar 按 tab key 重挂载, 切 tab 时内部关键词输入与展开状态随父级筛选一起重置。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d61aa853f1
commit
546dec67a1
1 file changed
+39
-29
@@ -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,35 +365,39 @@ export function AgentGallery() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<TagSearchBar
|
{showSearchBar && (
|
||||||
// Remount per tab so the internal keyword input / 展开 state also
|
<TagSearchBar
|
||||||
// resets when the parent-owned filters are cleared on tab switch.
|
// Remount per tab so the internal keyword input / 展开 state also
|
||||||
key={activeTab}
|
// resets when the parent-owned filters are cleared on tab switch.
|
||||||
targetType="agent"
|
key={activeTab}
|
||||||
searching={activeTab === "private" ? isPrivateFetching : mainFetching}
|
targetType="agent"
|
||||||
onSearchChange={setSearch}
|
searching={
|
||||||
tagIds={tagIds}
|
activeTab === "private" ? isPrivateFetching : mainFetching
|
||||||
onTagIdsChange={setTagIds}
|
}
|
||||||
actions={
|
onSearchChange={setSearch}
|
||||||
<Select value={sort} onValueChange={(v) => setSort(v as AgentSort)}>
|
tagIds={tagIds}
|
||||||
<SelectTrigger
|
onTagIdsChange={setTagIds}
|
||||||
className="h-9 w-full gap-2 px-3 text-xs sm:w-[148px]"
|
actions={
|
||||||
title="排序"
|
<Select value={sort} onValueChange={(v) => setSort(v as AgentSort)}>
|
||||||
>
|
<SelectTrigger
|
||||||
<ArrowDownUpIcon className="text-muted-foreground size-3.5" />
|
className="h-9 w-full gap-2 px-3 text-xs sm:w-[148px]"
|
||||||
<SelectValue />
|
title="排序"
|
||||||
</SelectTrigger>
|
>
|
||||||
<SelectContent position="popper" side="bottom" sideOffset={4}>
|
<ArrowDownUpIcon className="text-muted-foreground size-3.5" />
|
||||||
<SelectItem value="time_desc">最新创建</SelectItem>
|
<SelectValue />
|
||||||
<SelectItem value="time_asc">最早创建</SelectItem>
|
</SelectTrigger>
|
||||||
<SelectItem value="updated_desc">最近更新</SelectItem>
|
<SelectContent position="popper" side="bottom" sideOffset={4}>
|
||||||
<SelectItem value="updated_asc">最早更新</SelectItem>
|
<SelectItem value="time_desc">最新创建</SelectItem>
|
||||||
<SelectItem value="name_asc">名称 A-Z</SelectItem>
|
<SelectItem value="time_asc">最早创建</SelectItem>
|
||||||
<SelectItem value="name_desc">名称 Z-A</SelectItem>
|
<SelectItem value="updated_desc">最近更新</SelectItem>
|
||||||
</SelectContent>
|
<SelectItem value="updated_asc">最早更新</SelectItem>
|
||||||
</Select>
|
<SelectItem value="name_asc">名称 A-Z</SelectItem>
|
||||||
}
|
<SelectItem value="name_desc">名称 Z-A</SelectItem>
|
||||||
/>
|
</SelectContent>
|
||||||
|
</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>
|
||||||
|
|||||||
Reference in new issue
Block a user