import { useTranslation } from 'react-i18next'; import SessionProviderLogo from '../../../SessionProviderLogo'; import type { AppTab, Project, ProjectSession } from '../../../../types/app'; type MainContentTitleProps = { activeTab: AppTab; selectedProject: Project; selectedSession: ProjectSession | null; shouldShowTasksTab: boolean; }; function getTabTitle(activeTab: AppTab, shouldShowTasksTab: boolean, t: (key: string) => string) { if (activeTab === 'files') { return t('mainContent.projectFiles'); } if (activeTab === 'git') { return t('tabs.git'); } if (activeTab === 'tasks' && shouldShowTasksTab) { return 'TaskMaster'; } return 'Project'; } function getSessionTitle(session: ProjectSession): string { if (session.__provider === 'cursor') { return (session.name as string) || 'Untitled Session'; } return (session.summary as string) || 'New Session'; } export default function MainContentTitle({ activeTab, selectedProject, selectedSession, shouldShowTasksTab, }: MainContentTitleProps) { const { t } = useTranslation(); const showSessionIcon = activeTab === 'chat' && Boolean(selectedSession); const showChatNewSession = activeTab === 'chat' && !selectedSession; return (
{showSessionIcon && (
)}
{activeTab === 'chat' && selectedSession ? (

{getSessionTitle(selectedSession)}

{selectedProject.displayName}
) : showChatNewSession ? (

{t('mainContent.newSession')}

{selectedProject.displayName}
) : (

{getTabTitle(activeTab, shouldShowTasksTab, t)}

{selectedProject.displayName}
)}
); }