Files
Trey t 66c2bbec8b feat: complete marketing command center with pipeline, UI, and asset generation
- Dashboard with campaign management, asset gallery, and publishing queue
- 7-agent pipeline: trend scout, research, scripts, ad creative, video, copy, distribution
- Campaign form with screenshot upload, goal picker, platform selection
- Campaign detail view with Details/Pipeline/Assets/Chat tabs
- Two-set image generation: Gemini AI (NanoBanana MCP) + Canvas Design posters
- Remotion video rendering with phone.png frame and real screenshot alignment
- honeyDue branding: blue #0079FF, orange #FF9400, Inter font, warm off-white
- Asset cards with source badges (Gemini/Canvas/Remotion/Playwright)
- Markdown/JSON render endpoint for viewing pipeline outputs as HTML
- Settings page with Tavily, Gemini, Postiz, Nextdoor integration management
- Claude Chat for campaign feedback loop with streaming SSE
- Postiz publishing modal with scheduling
- Auth with NextAuth credentials + JWT sessions
- SQLite via Prisma with better-sqlite3 adapter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:05:26 -05:00

83 lines
2.6 KiB
TypeScript

"use client";
import { useRef, useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { useClaudeChat } from "@/hooks/use-claude-chat";
import { Send, Loader2 } from "lucide-react";
export function ClaudeChat({ campaignId }: { campaignId: string }) {
const { messages, sendMessage, isStreaming } = useClaudeChat(campaignId);
const [input, setInput] = useState("");
const messagesEndRef = useRef<HTMLDivElement>(null);
useEffect(() => {
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
}, [messages]);
function handleSubmit(e: React.FormEvent) {
e.preventDefault();
if (!input.trim() || isStreaming) return;
sendMessage(input.trim());
setInput("");
}
function handleKeyDown(e: React.KeyboardEvent) {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
handleSubmit(e);
}
}
return (
<div className="flex flex-col h-[calc(100vh-16rem)]">
{/* Messages */}
<div className="flex-1 overflow-y-auto space-y-4 p-4">
{messages.length === 0 && (
<p className="text-center text-muted-foreground py-12">
Chat with Claude about this campaign. Ask for edits, new variations,
or feedback on generated content.
</p>
)}
{messages.map((msg, i) => (
<div
key={i}
className={`flex ${
msg.role === "user" ? "justify-end" : "justify-start"
}`}
>
<div
className={`max-w-[80%] rounded-lg px-4 py-2 text-sm whitespace-pre-wrap ${
msg.role === "user"
? "bg-primary text-primary-foreground"
: "bg-muted"
}`}
>
{msg.content}
{isStreaming && i === messages.length - 1 && msg.role === "assistant" && (
<Loader2 className="inline-block ml-1 h-3 w-3 animate-spin" />
)}
</div>
</div>
))}
<div ref={messagesEndRef} />
</div>
{/* Input */}
<form onSubmit={handleSubmit} className="border-t p-4 flex gap-2">
<Textarea
value={input}
onChange={(e) => setInput(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Ask Claude to modify content, regenerate hooks, give feedback..."
className="min-h-[2.5rem] max-h-32 resize-none"
rows={1}
/>
<Button type="submit" size="icon" disabled={!input.trim() || isStreaming}>
<Send className="h-4 w-4" />
</Button>
</form>
</div>
);
}