{"version":3,"file":"Avatar.CPC4UjPg.mjs","names":["useState","imageUrl"],"sources":["https:/framerusercontent.com/modules/P5blcXdSFO2YbWevETOD/38PmkBna0kJBQHx6n5rK/Avatar.js"],"sourcesContent":["// @ts-nocheck\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";// Hook pour fetch l'image du médecin\nconst usePhysicianImage=physicianId=>{const[imageUrl,setImageUrl]=useState(null);const[imageLoading,setImageLoading]=useState(true);const[imageError,setImageError]=useState(false);useEffect(()=>{const fetchImage=async()=>{try{setImageLoading(true);setImageError(false);const response=await fetch(`https://tono-marketing-api-production.up.railway.app/providers/${physicianId}/profile-picture`);if(response.ok){const imageUrl=await response.text();setImageUrl(imageUrl.trim().slice(1,-1));}else{setImageError(true);}}catch(error){setImageError(true);}finally{setImageLoading(false);}};if(physicianId){fetchImage();}},[physicianId]);return{imageUrl,imageLoading,imageError};};/**\n * @framerDisableUnlink\n */export default function PhysicianAvatar(props){const{physicianId=1,firstName=\"John\",lastName=\"Doe\",size=80,backgroundColor=\"#d1d5db\",textColor=\"#374151\"}=props;const{imageUrl,imageLoading,imageError}=usePhysicianImage(physicianId);// Générer les initiales à partir du prénom et nom\nconst getInitials=(first,last)=>{const firstInitial=first?first.charAt(0).toUpperCase():\"\";const lastInitial=last?last.charAt(0).toUpperCase():\"\";return firstInitial+lastInitial;};const initials=getInitials(firstName,lastName);const fullName=`${firstName} ${lastName}`.trim();return /*#__PURE__*/_jsx(\"div\",{style:{width:`${size}px`,height:`${size}px`,borderRadius:\"50%\",backgroundColor:backgroundColor,overflow:\"hidden\",position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:imageLoading?// Affichage des initiales pendant le chargement\n/*#__PURE__*/_jsx(\"div\",{style:{fontSize:`${size*.3}px`,fontWeight:\"600\",color:textColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:initials}):imageUrl&&!imageError?// Affichage de l'image si disponible\n/*#__PURE__*/_jsx(\"img\",{src:imageUrl,alt:`Photo de ${fullName}`,style:{width:\"100%\",height:\"100%\",objectFit:\"cover\",borderRadius:\"50%\"},onError:()=>{// En cas d'erreur de chargement de l'image, on garde les initiales\n}}):// Affichage des initiales si l'image n'est pas disponible\n/*#__PURE__*/_jsx(\"div\",{style:{fontSize:`${size*.3}px`,fontWeight:\"600\",color:textColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:initials})});}// Property controls pour Framer\naddPropertyControls(PhysicianAvatar,{physicianId:{type:ControlType.Number,title:\"Physician ID\",defaultValue:1,min:1,step:1},firstName:{type:ControlType.String,title:\"First Name\",defaultValue:\"John\",placeholder:\"Enter first name\"},lastName:{type:ControlType.String,title:\"Last Name\",defaultValue:\"Doe\",placeholder:\"Enter last name\"},size:{type:ControlType.Number,title:\"Avatar Size\",defaultValue:80,min:20,max:200,step:1,unit:\" px\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#d1d5db\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#374151\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PhysicianAvatar\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Avatar.map"],"mappings":"0QAIG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,cAAY,EAAE,YAAU,OAAO,WAAS,MAAM,OAAK,GAAG,kBAAgB,UAAU,YAAU,WAAW,EAAW,CAAC,WAAS,eAAa,cAAY,EAAkB,EAAY,CAC/C,IAAvK,EAAM,IAAO,CAAC,IAAM,EAAa,EAAM,EAAM,OAAO,EAAE,CAAC,aAAa,CAAC,GAAS,EAAY,EAAK,EAAK,OAAO,EAAE,CAAC,aAAa,CAAC,GAAG,OAAO,EAAa,IAAyC,EAAU,EAAS,CAAO,EAAS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