import React from "react"; import { Stack, Box, Typography, Chip, TextField, Divider } from "@mui/material"; import { Groups as GroupsIcon, Search as SearchIcon } from "@mui/icons-material"; import { useAnalysisPanel } from "../AnalysisPanelContext"; const inputStyles = { '& .MuiInputBase-input': { color: '#111827 !important', fontWeight: 500 }, '& .MuiInputLabel-root': { color: '#4b5563 !important' }, '& .MuiOutlinedInput-root': { bgcolor: '#ffffff !important', '& fieldset': { borderColor: '#d1d5db !important' }, '&:hover fieldset': { borderColor: '#4f46e5 !important' }, '&.Mui-focused fieldset': { borderColor: '#4f46e5 !important' }, }, }; const AnalysisTabContent: React.FC<{ title: string; icon?: React.ReactNode; children: React.ReactNode }> = ({ title, icon, children }) => ( {icon && {icon}} {title} {children} ); export const AnalysisPanelAudienceTab: React.FC = () => { const { currentAnalysis, isEditing, setEditedAnalysis, editedAnalysis, handleRemoveKeyword, handleAddKeyword, handleRemoveTitle, handleAddTitle } = useAnalysisPanel(); if (!currentAnalysis) { return ( No analysis data available. Please generate analysis first. ); } const analysis = currentAnalysis; const handleAudienceChange = (value: string) => { if (editedAnalysis) { setEditedAnalysis({ ...editedAnalysis, audience: value }); } }; const handleContentTypeChange = (value: string) => { if (editedAnalysis) { setEditedAnalysis({ ...editedAnalysis, contentType: value }); } }; return ( }> Audience Description {isEditing ? ( handleAudienceChange(e.target.value)} placeholder="Describe your target audience..." sx={inputStyles} /> ) : ( {analysis.audience} )} Content Type {isEditing ? ( handleContentTypeChange(e.target.value)} placeholder="e.g. Interview, Narrative, Solo..." sx={inputStyles} /> ) : ( )} Top Keywords {analysis.topKeywords?.map((k: string) => ( handleRemoveKeyword?.(k) : undefined} sx={{ borderColor: isEditing ? "#ef4444" : "rgba(0,0,0,0.15)", color: isEditing ? "#dc2626" : "#0f172a", background: isEditing ? "#fef2f2" : "#f8fafc", fontWeight: 500, "& .MuiChip-deleteIcon": { color: "#ef4444", "&:hover": { color: "#dc2626", backgroundColor: "#fee2e2", }, }, }} /> ))} {isEditing && ( { if (e.key === 'Enter') { e.preventDefault(); const input = e.target as HTMLInputElement; handleAddKeyword?.(input.value); input.value = ''; } }} /> )} {analysis.exaSuggestedConfig && ( Exa Research Config {analysis.exaSuggestedConfig.exa_search_type && ( )} {analysis.exaSuggestedConfig.exa_category && ( )} {analysis.exaSuggestedConfig.date_range && ( )} {analysis.exaSuggestedConfig.max_sources && ( )} )} Title Suggestions {analysis.titleSuggestions?.map((t: string) => ( handleRemoveTitle?.(t) : undefined} sx={{ color: isEditing ? "#dc2626" : "#0f172a", background: isEditing ? "#fef2f2" : "#f8fafc", border: isEditing ? "1px solid #ef4444" : "1px solid #e2e8f0", maxWidth: "100%", whiteSpace: "normal", fontWeight: 500, "& .MuiChip-deleteIcon": { color: "#ef4444", "&:hover": { color: "#dc2626", backgroundColor: "#fee2e2", }, }, height: "auto", }} /> ))} {isEditing && ( { if (e.key === 'Enter') { e.preventDefault(); const input = e.target as HTMLInputElement; handleAddTitle?.(input.value); input.value = ''; } }} /> )} ); };