{"version":3,"file":"Avatar.DIRlw2Ut.mjs","names":["useState"],"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":"kLAIG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,cAAY,EAAE,YAAU,OAAO,WAAS,MAAM,OAAK,GAAG,kBAAgB,UAAU,YAAU,WAAW,EAAW,CAAC,WAAS,eAAa,cAAY,EAAkB,CAAW,EAC9C,IAAvK,EAAM,KAA2B,EAAM,EAAM,OAAO,CAAC,CAAC,CAAC,YAAY,EAAE,KAAqB,EAAK,EAAK,OAAO,CAAC,CAAC,CAAC,YAAY,EAAE,IAAoD,CAAY,EAAU,CAAQ,EAAQ,EAAS,GAAG,EAAU,GAAG,IAAW,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