import { ChevronDown, Plus } from 'lucide-react'; import type { TFunction } from 'i18next'; import { Button } from '../../../../shared/view/ui'; import type { Project, ProjectSession, SessionProvider } from '../../../../types/app'; import type { SessionWithProvider } from '../../types/types'; import SidebarSessionItem from './SidebarSessionItem'; type SidebarProjectSessionsProps = { project: Project; isExpanded: boolean; sessions: SessionWithProvider[]; selectedSession: ProjectSession | null; initialSessionsLoaded: boolean; isLoadingSessions: boolean; currentTime: Date; editingSession: string | null; editingSessionName: string; onEditingSessionNameChange: (value: string) => void; onStartEditingSession: (sessionId: string, initialName: string) => void; onCancelEditingSession: () => void; onSaveEditingSession: (projectName: string, sessionId: string, summary: string, provider: SessionProvider) => void; onProjectSelect: (project: Project) => void; onSessionSelect: (session: SessionWithProvider, projectName: string) => void; onDeleteSession: ( projectName: string, sessionId: string, sessionTitle: string, provider: SessionProvider, ) => void; onLoadMoreSessions: (project: Project) => void; onNewSession: (project: Project) => void; t: TFunction; }; function SessionListSkeleton() { return ( <> {Array.from({ length: 3 }).map((_, index) => (
))} ); } export default function SidebarProjectSessions({ project, isExpanded, sessions, selectedSession, initialSessionsLoaded, isLoadingSessions, currentTime, editingSession, editingSessionName, onEditingSessionNameChange, onStartEditingSession, onCancelEditingSession, onSaveEditingSession, onProjectSelect, onSessionSelect, onDeleteSession, onLoadMoreSessions, onNewSession, t, }: SidebarProjectSessionsProps) { if (!isExpanded) { return null; } const hasSessions = sessions.length > 0; const hasMoreSessions = project.sessionMeta?.hasMore === true; return (
{!initialSessionsLoaded ? ( ) : !hasSessions && !isLoadingSessions ? (

{t('sessions.noSessions')}

) : ( sessions.map((session) => ( )) )} {hasSessions && hasMoreSessions && ( )}
); }