import { useLocation } from 'react-router-dom';
import { Sidebar } from './Sidebar';
import { MiddlePanel } from './MiddlePanel';
import { ToastContainer } from '@/components/ui/Toast';
import { useToast } from '@/hooks/useToast';

export function AppLayout({ children }: { children: React.ReactNode }) {
  const { pathname } = useLocation();
  const isChat = pathname.startsWith('/chat');
  const { toasts, dismiss } = useToast();

  return (
    <div className="h-screen flex bg-white text-zinc-900 overflow-hidden">
      <Sidebar />
      {isChat && <MiddlePanel />}
      <main className="flex-1 flex flex-col min-w-0 bg-gradient-to-br from-zinc-50/50 to-white">
        {children}
      </main>
      <ToastContainer toasts={toasts} dismiss={dismiss} />
    </div>
  );
}
