import React, { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; // --- Helper Component for Tag Inputs --- const TagInput = ({ name, value, onChange, placeholder, isEditing }) => { const [inputValue, setInputValue] = useState(""); // Convert string "A, B, C" to array ["A", "B", "C"] const tags = value ? value.split(',').map(s => s.trim()).filter(Boolean) : []; const handleAddParam = (val) => { const trimmed = val.trim(); if (trimmed && !tags.includes(trimmed)) { const newTags = [...tags, trimmed]; onChange({ target: { name, value: newTags.join(', ') } }); } setInputValue(""); }; const handleKeyDown = (e) => { if (e.key === 'Enter' || e.key === ',') { e.preventDefault(); handleAddParam(inputValue); } else if (e.key === 'Backspace' && !inputValue && tags.length > 0) { handleRemoveTag(tags.length - 1); } }; const handleRemoveTag = (index) => { const newTags = tags.filter((_, i) => i !== index); onChange({ target: { name, value: newTags.join(', ') } }); }; return (
{tags.map((tag, index) => ( {tag} {isEditing && ( )} ))} {isEditing && ( setInputValue(e.target.value)} onKeyDown={handleKeyDown} onBlur={() => handleAddParam(inputValue)} // Add on blur too placeholder={tags.length === 0 ? placeholder : ""} style={{ background: 'transparent', border: 'none', color: 'white', outline: 'none', flex: 1, minWidth: '100px' }} /> )} {!isEditing && tags.length === 0 && Not set}
); }; const ProfileTab = ({ profileData, isEditing, handleProfileChange, handleExperienceChange, handleAddExperience, handleAddEducation, handleEducationChange, showFullProfile, }) => { if (!profileData) return null; const inputStyles = { width: '100%', padding: '0.75rem', borderRadius: '0.5rem', border: '1px solid rgba(251, 191, 36, 0.3)', backgroundColor: 'rgba(255,255,255,0.1)', color: 'white' }; const labelStyles = { display: 'block', marginBottom: '0.5rem', color: '#d1d5db' }; const checkboxLabelStyles = { display: 'flex', alignItems: 'center', gap: '0.5rem', color: '#d1d5db' }; const checkboxStyles = { width: '1.15em', height: '1.15em', accentColor: '#FBBF24' }; return (
{/* Basic Info */}
{isEditing ? () : (

{profileData?.full_name || 'Not set'}

)}
{isEditing ? () : (

{profileData?.headline || 'Not set'}

)}
{/* Summary */}
{isEditing ? (