"use client"; import { useEffect, useState } from "react"; import { db } from "@/lib/firebase/config"; import { doc, onSnapshot } from "firebase/firestore"; import { CollectorChecklist } from "./collector-checklist"; import { ExtractionReviewChecklist } from "./extraction-review-checklist"; import { ExtractionResults } from "./extraction-results"; import { CollectorActions } from "./collector-actions"; import { ProjectConfigGenerator } from "./project-config-generator"; interface PhaseSidebarProps { projectId: string; projectName?: string; className?: string; } export function PhaseSidebar({ projectId, projectName, className }: PhaseSidebarProps) { const [currentPhase, setCurrentPhase] = useState("collector"); const [projectNameState, setProjectNameState] = useState(projectName || ""); useEffect(() => { if (!projectId) return; const unsubscribe = onSnapshot( doc(db, "projects", projectId), (snapshot) => { if (snapshot.exists()) { const data = snapshot.data(); const phase = data?.currentPhase || "collector"; setCurrentPhase(phase); setProjectNameState(data?.name || data?.productName || ""); } } ); return () => unsubscribe(); }, [projectId]); return (
{/* Top: Show checklist based on current phase */} {currentPhase === "collector" && ( )} {(currentPhase === "extraction_review" || currentPhase === "analyzed") && ( )} {/* Bottom: Phase-specific content */}
{currentPhase === "collector" && ( <>

Quick Actions

)} {(currentPhase === "extraction_review" || currentPhase === "analyzed") && (

Review the extracted insights in the chat area above.

)} {currentPhase === "vision" && ( <>

Vision Phase

Defining your product vision and MVP...

)} {currentPhase === "mvp" && ( <>

MVP Planning

Planning your minimum viable product...

)}
); }