import { useState } from "react";
import ConversationList from "@/components/messaging/ConversationList";
import ChatView from "@/components/messaging/ChatView";

export default function HomeownerMessagesPage() {
  const [selectedPartnerId, setSelectedPartnerId] = useState<string | null>(null);
  const [partnerName, setPartnerName] = useState("");

  const handleSelectPartner = (id: string, name: string) => {
    setSelectedPartnerId(id);
    setPartnerName(name);
  };

  return (
    <div className="h-[calc(100vh-8rem)] flex rounded-lg border border-border bg-card overflow-hidden">
      <div className="w-80 shrink-0">
        <ConversationList
          selectedPartnerId={selectedPartnerId}
          onSelectPartner={handleSelectPartner}
        />
      </div>
      <ChatView partnerId={selectedPartnerId} partnerName={partnerName} />
    </div>
  );
}
