Refine Agent sidebar icons and manual expansion
This commit is contained in:
1 parent
a340c0fd94
commit
ad1d2f261d
7 files changed
+221
-20
No files matched your search
@@ -31,7 +31,7 @@ export function MainLayout() {
|
||||
const isCloudAgents = activeModule === 'cloud_agents';
|
||||
|
||||
const handleSidebarPeekChange = useCallback((open: boolean, source: SidebarPeekSource) => {
|
||||
if (!sidebarCollapsed) return;
|
||||
if (!sidebarCollapsed || isCloudAgents) return;
|
||||
|
||||
const sources = sidebarPeekSourcesRef.current;
|
||||
if (sources[source] === open) return;
|
||||
@@ -55,19 +55,20 @@ export function MainLayout() {
|
||||
setSidebarPeekOpen(false);
|
||||
sidebarPeekCloseTimerRef.current = null;
|
||||
}, SIDEBAR_PEEK_CLOSE_DELAY_MS);
|
||||
}, [sidebarCollapsed]);
|
||||
}, [sidebarCollapsed, isCloudAgents]);
|
||||
|
||||
useEffect(() => {
|
||||
sidebarPeekSourcesRef.current = { toggle: false, focus: false, sidebar: false, titlebar: false };
|
||||
// This transient state mirrors the external persisted sidebar preference;
|
||||
// reset it when that preference changes so a stale preview cannot reopen.
|
||||
// reset it on preference changes and both edges of the Agents boundary so
|
||||
// a previous module's preview or timer cannot reopen the manual-only sidebar.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setSidebarPeekOpen(false);
|
||||
if (sidebarPeekCloseTimerRef.current) {
|
||||
clearTimeout(sidebarPeekCloseTimerRef.current);
|
||||
sidebarPeekCloseTimerRef.current = null;
|
||||
}
|
||||
}, [sidebarCollapsed]);
|
||||
}, [sidebarCollapsed, isCloudAgents]);
|
||||
|
||||
useEffect(() => () => {
|
||||
if (sidebarPeekCloseTimerRef.current) clearTimeout(sidebarPeekCloseTimerRef.current);
|
||||
@@ -83,8 +84,8 @@ export function MainLayout() {
|
||||
workspaceLayout={isChatWorkspace}
|
||||
overlay={isPaintingModule}
|
||||
showSidebarControls={!isCanvasWorkspace}
|
||||
sidebarPeekOpen={isCanvasWorkspace ? false : sidebarPeekOpen}
|
||||
onSidebarPeekChange={isCanvasWorkspace ? undefined : handleSidebarPeekChange}
|
||||
sidebarPeekOpen={isCanvasWorkspace || isCloudAgents ? false : sidebarPeekOpen}
|
||||
onSidebarPeekChange={isCanvasWorkspace || isCloudAgents ? undefined : handleSidebarPeekChange}
|
||||
/>
|
||||
|
||||
{/* Below the title bar: sidebar + content */}
|
||||
@@ -93,8 +94,8 @@ export function MainLayout() {
|
||||
workspaceLayout={isChatWorkspace}
|
||||
hideOnCompact={isCanvasWorkspace}
|
||||
forceExpanded={isCanvasWorkspace}
|
||||
sidebarPeekOpen={isCanvasWorkspace ? false : sidebarPeekOpen}
|
||||
onSidebarPeekChange={isCanvasWorkspace ? undefined : handleSidebarPeekChange}
|
||||
sidebarPeekOpen={isCanvasWorkspace || isCloudAgents ? false : sidebarPeekOpen}
|
||||
onSidebarPeekChange={isCanvasWorkspace || isCloudAgents ? undefined : handleSidebarPeekChange}
|
||||
/>
|
||||
<main
|
||||
data-testid="main-content"
|
||||
|
||||
@@ -6,15 +6,16 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Bot,
|
||||
BotMessageSquare,
|
||||
Cpu,
|
||||
ChevronRight,
|
||||
FolderKanban,
|
||||
Gamepad2,
|
||||
LogOut,
|
||||
Plus,
|
||||
RadioTower,
|
||||
Settings as SettingsIcon,
|
||||
UserCircle2,
|
||||
Waypoints,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||
@@ -505,13 +506,17 @@ export function Sidebar({
|
||||
<button type="button" aria-label="我的智能体" onClick={() => navigate('/cloud-agents?view=mine')}
|
||||
aria-current={location.pathname === '/cloud-agents' ? 'page' : undefined}
|
||||
className={cn('flex min-h-10 w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm font-semibold hover:bg-surface-tertiary', location.pathname === '/cloud-agents' && 'bg-brand-soft', sidebarCollapsed && 'justify-center px-0')}>
|
||||
<Bot className="h-4 w-4 shrink-0 text-brand" />
|
||||
<span aria-hidden="true" className="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-[#e2d7ef] bg-[#f2ebfa] text-[#785b9b]">
|
||||
<BotMessageSquare className="h-5 w-5" strokeWidth={1.8} />
|
||||
</span>
|
||||
{!sidebarCollapsed && <span>我的智能体</span>}
|
||||
</button>
|
||||
<button type="button" aria-label="渠道" onClick={() => navigate('/cloud-agents/channels')}
|
||||
aria-current={location.pathname.startsWith('/cloud-agents/channels') ? 'page' : undefined}
|
||||
className={cn('mt-1 flex min-h-10 w-full items-center gap-2 rounded-lg px-2 py-2 text-left text-sm font-semibold hover:bg-surface-tertiary', location.pathname.startsWith('/cloud-agents/channels') && 'bg-brand-soft', sidebarCollapsed && 'justify-center px-0')}>
|
||||
<RadioTower className="h-4 w-4 shrink-0 text-brand" />
|
||||
<span aria-hidden="true" className="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-[#d7e4ec] bg-[#edf4fa] text-[#55788e]">
|
||||
<Waypoints className="h-5 w-5" strokeWidth={1.8} />
|
||||
</span>
|
||||
{!sidebarCollapsed && <span>渠道</span>}
|
||||
</button>
|
||||
</div> : <div data-testid="sidebar-robot-navigation" className="px-2 py-3">
|
||||
|
||||
@@ -76,6 +76,5 @@ export function ConfigurationFields({ slug, value, disabled, onChange, section =
|
||||
onCreated={kb => { change('knowledges', [...new Set([...value.knowledges, kb.kb_id])]); setRefresh(v => v + 1); }} /></div>}
|
||||
</fieldset>;
|
||||
})}
|
||||
<p className="text-xs leading-5 text-muted-foreground">未选择的资源不会开放给此智能体。通过微信或 API 使用时也遵循本配置。</p>
|
||||
</div>;
|
||||
}
|
||||
Reference in new issue
Block a user