- Move ChatToolbar (session selector, refresh, thinking toggle) from the Chat page body into the Header component, so controls appear at the same level as the "Chat" title - Add New Session button (+) to create a fresh conversation - Add newSession action to chat store - Header conditionally renders ChatToolbar only on /chat route - Chat page fills full content area without duplicate toolbar
33 lines
949 B
TypeScript
33 lines
949 B
TypeScript
/**
|
|
* Header Component
|
|
* Top navigation bar with page title and page-specific controls.
|
|
* On the Chat page, shows session selector, refresh, thinking toggle, and new session.
|
|
*/
|
|
import { useLocation } from 'react-router-dom';
|
|
import { ChatToolbar } from '@/pages/Chat/ChatToolbar';
|
|
|
|
// Page titles mapping
|
|
const pageTitles: Record<string, string> = {
|
|
'/': 'Dashboard',
|
|
'/chat': 'Chat',
|
|
'/channels': 'Channels',
|
|
'/skills': 'Skills',
|
|
'/cron': 'Cron Tasks',
|
|
'/settings': 'Settings',
|
|
};
|
|
|
|
export function Header() {
|
|
const location = useLocation();
|
|
const currentTitle = pageTitles[location.pathname] || 'ClawX';
|
|
const isChatPage = location.pathname === '/chat';
|
|
|
|
return (
|
|
<header className="flex h-14 items-center justify-between border-b bg-background px-6">
|
|
<h2 className="text-lg font-semibold">{currentTitle}</h2>
|
|
|
|
{/* Chat-specific controls */}
|
|
{isChatPage && <ChatToolbar />}
|
|
</header>
|
|
);
|
|
}
|