import { ChatBubbleLeftIcon } from '@heroicons/react/24/outline' import classNames from '~/lib/classNames' import StyledButton from '../StyledButton' import { router } from '@inertiajs/react' import { ChatSession } from '../../../types/chat' interface ChatSidebarProps { sessions: ChatSession[] activeSessionId: string | null onSessionSelect: (id: string) => void onNewChat: () => void onClearHistory: () => void isInModal?: boolean } export default function ChatSidebar({ sessions, activeSessionId, onSessionSelect, onNewChat, onClearHistory, isInModal = false, }: ChatSidebarProps) { return (
New Chat
{sessions.length === 0 ? (
No previous chats
) : (
{sessions.map((session) => ( ))}
)}
{sessions.length > 0 && (
Project Nomad Logo { if (isInModal) { window.open('/chat', '_blank') } else { router.visit('/home') } }} icon={isInModal ? 'ArrowTopRightOnSquareIcon' : 'HomeIcon'} variant="outline" size="sm" fullWidth > {isInModal ? 'Open in New Tab' : 'Back to Home'} { router.visit('/settings/models') }} icon="CircleStackIcon" variant="primary" size="sm" fullWidth > Models { router.visit('/knowledge-base') }} icon="AcademicCapIcon" variant="primary" size="sm" fullWidth > Knowledge Base Clear History
)}
) }