SurfSense/surfsense_web/components/chat/ChatPannel/ChatPanelView.tsx

50 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-10-22 15:35:44 +02:00
"use client";
2025-10-22 15:14:38 +02:00
import { Pencil, Podcast } from "lucide-react";
2025-10-22 15:35:44 +02:00
import { useContext } from "react";
import { cn } from "@/lib/utils";
import { chatInterfaceContext } from "../ChatInterface";
2025-10-22 16:35:15 +02:00
import { ConfigModal } from "./ConfigModal";
2025-10-22 15:14:38 +02:00
2025-10-22 16:35:15 +02:00
interface ChatPanelViewProps {
2025-10-23 01:28:07 +02:00
chat_id: string;
2025-10-22 16:35:15 +02:00
}
2025-10-23 01:28:07 +02:00
export function ChatPanelView({ chat_id: chatId }: ChatPanelViewProps) {
2025-10-22 15:35:44 +02:00
const context = useContext(chatInterfaceContext);
if (!context) {
throw new Error("chatInterfaceContext must be used within a ChatProvider");
}
const { isChatPannelOpen, setIsChatPannelOpen } = context;
2025-10-22 15:14:38 +02:00
return (
<div className="w-full">
2025-10-22 15:35:44 +02:00
<div
className={cn(
"w-full h-full p-4 border-b",
!isChatPannelOpen && "flex items-center justify-center"
)}
>
{isChatPannelOpen ? (
2025-10-22 16:35:15 +02:00
<div className=" space-y-3 rounded-xl p-3 bg-gradient-to-r from-slate-400/50 to-slate-200/50 dark:from-slate-400/30 dark:to-slate-800/60">
2025-10-22 15:35:44 +02:00
<div className="w-full flex items-center justify-between">
<Podcast strokeWidth={1} />
2025-10-22 16:35:15 +02:00
<ConfigModal />
2025-10-22 15:35:44 +02:00
</div>
<p>Generate Podcast</p>
2025-10-22 15:14:38 +02:00
</div>
2025-10-22 15:35:44 +02:00
) : (
<button
title="Generate Podcast"
type="button"
onClick={() => setIsChatPannelOpen(!isChatPannelOpen)}
>
<Podcast strokeWidth={1} />
</button>
)}
2025-10-22 15:14:38 +02:00
</div>
</div>
);
2025-10-22 14:52:17 +02:00
}