import React from "react"; import { Box, Typography, TextField, Tooltip, Button, CircularProgress, alpha, Stack, Chip } from "@mui/material"; import { AutoAwesome as AutoAwesomeIcon, AttachMoney as AttachMoneyIcon } from "@mui/icons-material"; import { Knobs } from "../types"; export const TOPIC_PLACEHOLDERS = [ "Industry insights: Latest trends in AI for Content Marketing", "Product deep-dive: How our new feature solves common pain points", "Educational: 5 ways to improve your workflow with automation", "Thought leadership: The future of decentralized finance (DeFi)", "Interview prep: Key questions for your next tech hiring round", "Podcast prep: Analyzing the impact of remote work on mental health", ]; interface TopicUrlInputProps { value: string; onChange: (value: string) => void; isUrl: boolean; showAIDetailsButton: boolean; onAIDetailsClick?: () => void; placeholderIndex: number; loading?: boolean; loadingMessage?: string; estimatedCost?: { ttsCost: number; avatarCost: number; videoCost: number; researchCost: number; total: number; } | null; duration?: number; speakers?: number; knobs?: Knobs; } export const TopicUrlInput: React.FC = ({ value, onChange, isUrl, showAIDetailsButton, onAIDetailsClick, placeholderIndex, loading = false, loadingMessage, estimatedCost, duration = 1, speakers = 1, knobs, }) => { return ( 1 Enter Podcast Topic or Blog URL Estimated Cost Breakdown: • Audio Generation: ${estimatedCost.ttsCost}
• Avatar Creation: ${estimatedCost.avatarCost}
• Video Rendering: ${estimatedCost.videoCost}
• Research: ${estimatedCost.researchCost}
Total: ${estimatedCost.total} Based on {duration} min, {speakers} speaker{speakers > 1 ? "s" : ""}, {knobs?.bitrate === "hd" ? "HD" : "standard"} quality
) : ( "Estimate unavailable until returned by the server." ) } arrow placement="top" componentsProps={{ tooltip: { sx: { bgcolor: "#0f172a", color: "#ffffff", maxWidth: 280, fontSize: "0.875rem", p: 1.5, boxShadow: "0 4px 12px rgba(0,0,0,0.15)", }, }, arrow: { sx: { color: "#0f172a", }, }, }} > } label={estimatedCost ? `Est. $${estimatedCost.total}` : "Est. Unavailable"} size="small" sx={{ background: estimatedCost ? "linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.12) 100%)" : "rgba(100, 116, 139, 0.12)", color: estimatedCost ? "#059669" : "#475569", fontWeight: 600, border: estimatedCost ? "1px solid rgba(16, 185, 129, 0.2)" : "1px solid rgba(100, 116, 139, 0.25)", fontSize: "0.75rem", height: 26, cursor: "help", }} /> onChange(e.target.value)} size="small" helperText={ isUrl ? "URL detected. We'll analyze this page content." : "Enter a clear, concise topic. We'll expand it into a full script after you click Analyze." } sx={{ "& .MuiOutlinedInput-root": { backgroundColor: "#f8fafc", border: "2px solid rgba(102, 126, 234, 0.2)", borderRadius: 2, fontSize: "1rem", transition: "all 0.2s ease", "&:hover": { backgroundColor: "#ffffff", borderColor: "rgba(102, 126, 234, 0.4)", boxShadow: "0 2px 8px rgba(102, 126, 234, 0.1)", }, "&.Mui-focused": { backgroundColor: "#ffffff", borderColor: isUrl ? "#10b981" : "#667eea", borderWidth: 2, boxShadow: isUrl ? "0 0 0 4px rgba(16, 185, 129, 0.1)" : "0 0 0 4px rgba(102, 126, 234, 0.1)", }, }, "& .MuiOutlinedInput-input": { fontSize: "1rem", lineHeight: 1.7, color: "#1e293b", fontWeight: 500, "&::placeholder": { color: "#64748b", opacity: 1, fontWeight: 400, }, }, "& .MuiFormHelperText-root": { color: isUrl ? "#059669" : "#64748b", fontSize: "0.8125rem", fontWeight: 500, mt: 1, }, }} /> {/* Enhance topic with AI button - appears when user types (and not a URL) */} {showAIDetailsButton && !isUrl && ( {loading && ( {loadingMessage || "Analyzing your topic and improving clarity..."} )} )}
); };