diff --git a/app/src/App.tsx b/app/src/App.tsx index 12197d8..57cfbeb 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -4,7 +4,6 @@ import { Login } from './components/Auth/Login'; import { Layout } from './components/Layout/Layout'; import { CalendarList } from './components/Calendar/CalendarList'; import { CalendarDetail } from './components/Calendar/CalendarDetail'; -import { ChatInterface } from './components/Chat/ChatInterface'; import { authService } from './services/authService'; /** @@ -111,19 +110,10 @@ function App() { ) } /> + {/* Redirect old /chat route to calendars — chat is now a collapsible panel */} -
- -
- - ) : ( - - ) - } + element={} /> } /> diff --git a/app/src/components/Calendar/CalendarDetail.tsx b/app/src/components/Calendar/CalendarDetail.tsx index 01c2879..23a0e08 100644 --- a/app/src/components/Calendar/CalendarDetail.tsx +++ b/app/src/components/Calendar/CalendarDetail.tsx @@ -561,7 +561,7 @@ export function CalendarDetail() { const headerLabel = viewMode === 'month' ? formatMonthYear(currentDate) : formatWeekRange(currentDate); return ( -
+
{/* ── Toolbar ── */}
diff --git a/app/src/components/Chat/ChatInterface.tsx b/app/src/components/Chat/ChatInterface.tsx index cd61fe8..39db811 100644 --- a/app/src/components/Chat/ChatInterface.tsx +++ b/app/src/components/Chat/ChatInterface.tsx @@ -1,9 +1,7 @@ import { useState, useEffect, useRef } from 'react'; import type { ChatMessage, PendingAction } from '../../types'; import { chatService } from '../../services/chatService'; -import { conversationService } from '../../services/conversationService'; import { ApprovalModal } from '../Approval/ApprovalModal'; -import { ConversationSidebar } from './ConversationSidebar'; const INITIAL_MESSAGE: ChatMessage = { id: 'initial', @@ -18,8 +16,7 @@ export function ChatInterface() { const [isLoading, setIsLoading] = useState(false); const [pendingActions, setPendingActions] = useState([]); const [selectedAction, setSelectedAction] = useState(null); - const [isLoadingMessages, setIsLoadingMessages] = useState(false); - const [sidebarRefreshTrigger, setSidebarRefreshTrigger] = useState(0); + const [isLoadingMessages] = useState(false); const messagesEndRef = useRef(null); const [conversationId, setConversationId] = useState(undefined); @@ -39,33 +36,6 @@ export function ChatInterface() { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }; - const handleSelectConversation = async (selectedId: string) => { - if (selectedId === conversationId) return; - - setIsLoadingMessages(true); - try { - const backendMessages = await conversationService.getMessages(selectedId); - const chatMessages = conversationService.mapToChatMessages(backendMessages); - setMessages(chatMessages.length > 0 ? chatMessages : [INITIAL_MESSAGE]); - setConversationId(selectedId); - - // Fetch any outstanding pending actions for this conversation (survives refresh) - const fetchedActions = await chatService.fetchPendingActions(selectedId); - setPendingActions(fetchedActions); - setSelectedAction(fetchedActions.length > 0 ? fetchedActions[0] : null); - } catch (error) { - console.error('Failed to load conversation messages:', error); - const errorMsg: ChatMessage = { - id: `msg_${Date.now()}_err`, - role: 'assistant', - content: 'Failed to load conversation messages. Please try again.', - timestamp: new Date().toISOString(), - }; - setMessages([errorMsg]); - } finally { - setIsLoadingMessages(false); - } - }; const handleNewConversation = () => { setConversationId(undefined); @@ -94,8 +64,6 @@ export function ChatInterface() { const result = await chatService.sendMessage(userInput, conversationId); if (result.conversationId && !conversationId) { setConversationId(result.conversationId); - // Trigger sidebar refresh when a new conversation is created - setSidebarRefreshTrigger(prev => prev + 1); } setMessages(prev => [...prev, result.message]); @@ -173,22 +141,20 @@ export function ChatInterface() { return (
- -
-
-

Calendar Assistant

-

- Ask me to help manage your calendar -

+
+
+

Assistant

+
+
-
+
{isLoadingMessages && (
diff --git a/app/src/components/Layout/Layout.tsx b/app/src/components/Layout/Layout.tsx index dd1eab8..751d5e3 100644 --- a/app/src/components/Layout/Layout.tsx +++ b/app/src/components/Layout/Layout.tsx @@ -2,6 +2,7 @@ import { useState, useEffect } from 'react'; import type { ReactNode } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { authService } from '../../services/authService'; +import { ChatInterface } from '../Chat/ChatInterface'; import type { User } from '../../types'; interface LayoutProps { @@ -12,6 +13,7 @@ export function Layout({ children }: LayoutProps) { const navigate = useNavigate(); const location = useLocation(); const [showUserMenu, setShowUserMenu] = useState(false); + const [chatOpen, setChatOpen] = useState(false); const [user, setUser] = useState(null); useEffect(() => { @@ -27,51 +29,12 @@ export function Layout({ children }: LayoutProps) { return location.pathname === path || location.pathname.startsWith(path + '/'); }; - const navItems = [ - { - path: '/calendars', - label: 'Calendars', - icon: ( - - - - ), - }, - { - path: '/chat', - label: 'Assistant', - icon: ( - - - - ), - }, - ]; + const isCalendarDetail = location.pathname.startsWith('/calendar/'); return ( -
-