PageSourceSearch

https://fishersama.com/assets/UserProfile-dec34404.js

js fishersama.com collected 2026-10-02 01:29:35 UTC 7,409 bytes, 1 lines download raw bytes

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.