diff --git a/packages/ui/src/components/chat/ChatContainer.tsx b/packages/ui/src/components/chat/ChatContainer.tsx index 6d70418e..3b2fc7a7 100644 --- a/packages/ui/src/components/chat/ChatContainer.tsx +++ b/packages/ui/src/components/chat/ChatContainer.tsx @@ -21,7 +21,8 @@ import { OverlayScrollbar } from '@/components/ui/OverlayScrollbar'; import { Icon } from "@/components/icon/Icon"; import type { PermissionRequest } from '@/types/permission'; import type { QuestionRequest } from '@/types/question'; -import { cn } from '@/lib/utils'; +import { cn, formatDirectoryName } from '@/lib/utils'; +import { useProjectsStore } from '@/stores/useProjectsStore'; import { collectVisibleSessionIdsForBlockingRequests, flattenBlockingRequests, @@ -329,6 +330,11 @@ const ReadOnlyPromptBanner: React.FC = () => { ); }; +const getProjectDisplayLabel = (project: { label?: string; path: string }): string => { + const label = project.label?.trim(); + return label || formatDirectoryName(project.path); +}; + type ChatContainerProps = { autoOpenDraft?: boolean; readOnly?: boolean; @@ -341,6 +347,8 @@ export const ChatContainer: React.FC = ({ autoOpenDraft = tr const openNewSessionDraft = useSessionUIStore((s) => s.openNewSessionDraft); const setCurrentSession = useSessionUIStore((s) => s.setCurrentSession); const newSessionDraft = useSessionUIStore((s) => s.newSessionDraft); + const projects = useProjectsStore((s) => s.projects); + const activeProjectId = useProjectsStore((s) => s.activeProjectId); // Sync actions const sync = useSync(); @@ -522,6 +530,16 @@ export const ChatContainer: React.FC = ({ autoOpenDraft = tr const draftOpen = Boolean(newSessionDraft?.open); const isDesktopExpandedInput = isExpandedInput && !isMobile; const messageListRef = React.useRef(null); + const draftProjectLabel = React.useMemo(() => { + const selectedProject = newSessionDraft?.selectedProjectId + ? projects.find((project) => project.id === newSessionDraft.selectedProjectId) ?? null + : null; + const activeProject = activeProjectId + ? projects.find((project) => project.id === activeProjectId) ?? null + : null; + const project = selectedProject ?? activeProject ?? projects[0] ?? null; + return project ? getProjectDisplayLabel(project) : null; + }, [activeProjectId, newSessionDraft?.selectedProjectId, projects]); const parentSession = React.useMemo(() => { if (!currentSessionId) return null; @@ -769,12 +787,23 @@ export const ChatContainer: React.FC = ({ autoOpenDraft = tr if (!currentSessionId && draftOpen) { return (
+ {isMobile && !isDesktopExpandedInput ? ( +
+

+ {draftProjectLabel + ? t('chat.emptyState.draftTitleWithProject', { project: draftProjectLabel }) + : t('chat.emptyState.draftTitle')} +

+
+ ) : null}
{promptReadOnly ? : } diff --git a/packages/ui/src/components/chat/ChatInput.tsx b/packages/ui/src/components/chat/ChatInput.tsx index 640c2533..f72799de 100644 --- a/packages/ui/src/components/chat/ChatInput.tsx +++ b/packages/ui/src/components/chat/ChatInput.tsx @@ -3787,7 +3787,7 @@ const ChatInputComponent: React.FC = ({ onOpenSettings, scrollTo )} style={isMobile && inputBarOffset > 0 ? { marginBottom: `${inputBarOffset}px` } : undefined} > - {newSessionDraftOpen && !isDesktopExpanded ? ( + {newSessionDraftOpen && !isDesktopExpanded && !isMobile ? (

{draftProjectLabel