{/* Chat Input Container - matching the ChatPane style */}
();
@@ -30,7 +31,7 @@ export function ProjectView() {
const [activeTab, setActiveTab] = useState<'preview' | 'code'>('preview');
const [mobileView, setMobileView] = useState<'chat' | 'preview' | 'code'>('chat');
const [isAILoading, setIsAILoading] = useState(false);
- const [isProjectInfoOpen, setIsProjectInfoOpen] = useState(false);
+ const [isProjectDetailsOpen, setIsProjectDetailsOpen] = useState(false);
const [consoleMessages, setConsoleMessages] = useState([]);
const projectsManager = useProjectsManager();
const chatPaneRef = useRef(null);
@@ -64,6 +65,8 @@ export function ProjectView() {
setProject(projectData);
// Clear console messages when switching projects
setConsoleMessages([]);
+ // Also clear global console messages
+ clearConsoleMessages();
} catch (error) {
console.error('Failed to load project:', error);
} finally {
@@ -75,6 +78,22 @@ export function ProjectView() {
loadProject();
}, [loadProject]);
+ // Sync console messages with global state
+ const { messages: globalMessages } = useConsoleMessages();
+ useEffect(() => {
+ setConsoleMessages(globalMessages);
+ }, [globalMessages]);
+
+ // Reset view state when projectId changes
+ useEffect(() => {
+ if (projectId) {
+ // Reset to preview tab if the new project is previewable, otherwise code
+ setActiveTab(isPreviewable ? 'preview' : 'code');
+ // Reset mobile view to chat when switching projects
+ setMobileView('chat');
+ }
+ }, [projectId, isPreviewable]);
+
// Switch away from preview mode if project is not previewable
useEffect(() => {
if (mobileView === 'preview' && !isPreviewable) {
@@ -156,7 +175,7 @@ export function ProjectView() {
@@ -178,6 +197,7 @@ export function ProjectView() {
projectId={project.id}
projectName={project.name}
onNewChat={handleNewChat}
+ onProjectDetails={() => setIsProjectDetailsOpen(true)}
isLoading={isAILoading}
isBuildLoading={build.isPending}
onFirstInteraction={handleFirstInteraction}
@@ -303,12 +323,12 @@ export function ProjectView() {
- {/* Project Info Dialog */}
+ {/* Project Details Dialog */}
{project && (
-