1import{c as b,d as j,u as y,r as m,j as e,e as N}from"./index-3d88130a.js";const v=()=>{const{user:l}=b(),{profile:r,updateProfile:u,loading:p,subscription:i}=j(),{t:a}=y(),[x,f]=m.useState(!1),[c,o]=m.useState(""),[s,g]=m.useState({full_name:"",email:"",bio:"",website:"",location:""});m.useEffect(()=>{var t;r&&l&&g({full_name:r.full_name||l.fullName||"",email:((t=l.primaryEmailAddress)==null?void 0:t.emailAddress)||"",bio:r.bio||"",website:r.website||"",location:r.location||""})},[r,l]);const h=async t=>{t.preventDefault(),f(!0),o("");try{const{error:d}=await u({full_name:s.full_name,bio:s.bio,website:s.website,location:s.location,updated_at:new Date().toISOString()});o(d?a("profile.updateError","æ´æ°å¤±è´¥: ")+d.message:a("profile.updateSuccess","æ¡£æ¡æ´æ°æåï¼"))}catch(d){o(a("profile.updateError","æ´æ°å¤±è´¥: ")+d.message)}finally{f(!1)}},n=t=>{g({...s,[t.target.name]:t.target.value})};return p?e.jsx(N,{}):e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"bg-gradient-to-r from-indigo-500 to-purple-600 px-6 py-8",children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"w-20 h-20 rounded-full overflow-hidden bg-white/20 flex items-center justify-center",children:l!=null&&l.imageUrl?e.jsx("img",{src:l.imageUrl,alt:"Avatar",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full bg-gray-300 flex items-center justify-center text-gray-600 text-2xl font-bold",children:s.full_name.charAt(0).toUpperCase()||"U"})}),e.jsxs("div",{className:"text-white",children:[e.jsx("h1",{className:"text-2xl font-bold",children:s.full_name||(l==null?void 0:l.fullName)||a("profile.defaultName","ç¨æ·")}),e.jsx("p",{className:"text-indigo-100",children:s.email}),e.jsxs("p",{className:"text-sm text-indigo-200 mt-1",children:[a("profile.memberSince","å å
¥æ¶é´: "),l!=null&&l.createdAt?new Date(l.createdAt).toLocaleDateString():""]}),e.jsx("div",{className:"mt-2",children:e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${(i==null?void 0:i.plan_name)==="premium"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800"}`,children:(i==null?void 0:i.plan_name)==="premium"?"é«çº§ç¨æ·":"å
è´¹ç¨æ·"})})]})]})}),e.jsxs("div",{className:"p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:a("profile.editProfile","ç¼è¾æ¡£æ¡")}),c&&e.jsx("div",{className:`mb-4 p-4 rounded-md ${c.includes("æå")?"bg-green-50 border border-green-200 text-green-800":"bg-red-50 border border-red-200 text-red-800"}`,children:c}),e.jsxs("form",{onSubmit:h,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"full_name",className:"block text-sm font-medium text-gray-700 mb-2",children:a("profile.fullName","å§å")}),e.jsx("input",{type:"text",id:"full_name",name:"full_name",value:s.full_name,onChange:n,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500",placeholder:a("profile.fullNamePlaceholder","è¾å
¥æ¨çå§å")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:a("profile.email","é®ç®±")}),e.jsx("input",{type:"email",id:"email",name:"email",value:s.email,disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm bg-gray-50 text-gray-500 cursor-not-allowed"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:a("profile.emailNote","é®ç®±å°åç± Clerk 管çï¼æ æ³å¨æ¤ä¿®æ¹")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"website",className:"block text-sm font-medium text-gray-700 mb-2",children:a("profile.website","ç½ç«")}),e.jsx("input",{type:"url",id:"website",name:"website",value:s.website,onChange:n,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500",placeholder:"https://example.com"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"location",className:"block text-sm font-medium text-gray-700 mb-2",children:a("profile.location","ä½ç½®")}),e.jsx("input",{type:"text",id:"location",name:"location",value:s.location,onChange:n,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500",placeholder:a("profile.locationPlaceholder","æ¨çæå¨å°")})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block text-sm font-medium text-gray-700 mb-2",children:a("profile.bio","个人ç®ä»")}),e.jsx("textarea",{id:"bio",name:"bio",rows:4,value:s.bio,onChange:n,className:"w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500",placeholder:a("profile.bioPlaceholder","ä»ç»ä¸ä¸æ¨èªå·±...")})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",disabled:x,className:"px-6 py-2 bg-indigo-600 text-white font-medium rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",children:x?a("profile.updating","æ´æ°ä¸..."):a("profile.updateProfile","æ´æ°æ¡£æ¡")})})]})]}),e.jsxs("div",{className:"bg-gray-50 px-6 py-4 border-t border-gray-200",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-3",children:a("profile.accountInfo","è´¦æ·ä¿¡æ¯")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:a("profile.userId","ç¨æ·ID: ")}),e.jsx("span",{className:"text-gray-600 font-mono",children:l==null?void 0:l.id})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:a("profile.loginMethod","è®¤è¯æä¾å: ")}),e.jsx("span",{className:"text-gray-600",children:"Clerk"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:a("profile.lastLogin","æåç»å½: ")}),e.jsx("span",{className:"text-gray-600",children:l!=null&&l.lastSignInAt?new Date(l.lastSignInAt).toLocaleStr
1ing():"--"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-gray-700",children:a("profile.accountType","è´¦æ·ç±»å: ")}),e.jsx("span",{className:"text-gray-600",children:(i==null?void 0:i.plan_name)==="premium"?"é«çº§è´¦æ·":"å
费账æ·"})]})]}),(i==null?void 0:i.plan_name)==="free"&&e.jsxs("div",{className:"mt-4 p-4 bg-gradient-to-r from-indigo-50 to-purple-50 rounded-lg border border-indigo-200",children:[e.jsx("h4",{className:"text-sm font-medium text-indigo-900 mb-2",children:"å级å°é«çº§ç"}),e.jsx("p",{className:"text-sm text-indigo-700 mb-3",children:"è§£éæ´å¤åè½ï¼æ éå¶ä½¿ç¨ææå·¥å
·ï¼ä¼å
ææ¯æ¯æã"}),e.jsx("button",{onClick:()=>alert("ä»è´¹åè½å³å°æ¨åºï¼"),className:"px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700 transition-colors duration-200",children:"äºè§£é«çº§ç"})]})]})]})})};export{v as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.