fix(chat): move toolbar to Header and add New Session button
- 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
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
* Header Component
|
||||
* Top navigation bar with page title
|
||||
* 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> = {
|
||||
@@ -16,13 +18,15 @@ const pageTitles: Record<string, string> = {
|
||||
|
||||
export function Header() {
|
||||
const location = useLocation();
|
||||
|
||||
// Get current page title
|
||||
const currentTitle = pageTitles[location.pathname] || 'ClawX';
|
||||
|
||||
const isChatPage = location.pathname === '/chat';
|
||||
|
||||
return (
|
||||
<header className="flex h-14 items-center border-b bg-background px-6">
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user