PageSourceSearch

https://shalev396.com/assets/EditProfilePage-155yDEdU.js

js shalev396.com collected 2026-10-02 01:43:48 UTC 3,971 bytes, 1 lines download raw bytes

1import{O as T,P as z,r as n,j as e,Z as b}from"./vendor-tF6AKaQH.js";import{u as B,$ as H,a4 as J,B as p,p as P,R as C,C as y,v as w,w as F,J as W,x as R,A as X,a as Z,b as $,W as q}from"./index-B_Twxck6.js";import{I}from"./input-Bnz7nTyK.js";import{L}from"./label-D4LIZUV7.js";import{S as G}from"./separator-kQOenAbD.js";import{F as K}from"./FadeContent-BrKlzKNh.js";import{P as Q,b as V}from"./PageMetadata-DfELedTP.js";import{t as Y,O as _,X as ee}from"./icons-B3V7Hv4S.js";import"./three-DQ3O7-sJ.js";import"./redux-nPTL3_Y6.js";import"./query-rSCQzsi3.js";import"./ui-lib-SIfkAfLg.js";function te(t,r){return t?t.split(" ").map(o=>o[0]).join("").toUpperCase().slice(0,2):r?.[0]?.toUpperCase()??"U"}function he(){const{t}=T(),r=z(),{language:o}=B(),{data:l}=H(),u=J(),[A,S]=n.useState(void 0),c=A??l?.name??"",[s,x]=n.useState(null),[U,g]=n.useState(null),[d,j]=n.useState(!1),m=n.useRef(null),h=l?.photoUrl??null,v=d?null:U??h,D=te(c||l?.name,l?.email),N=c!==(l?.name??""),k=N||s!==null||d;function E(i){const a=i.target.files?.[0];if(!a)return;x(a),j(!1);const f=new FileReader;f.onload=()=>{g(f.result)},f.readAsDataURL(a)}function M(){x(null),g(null),j(!0),m.current&&(m.current.value="")}async function O(i){if(i.preventDefault(),!k){b.info(t("profile.edit.noChanges"));return}const a={};N&&(a.name=c);try{s?a.photo=await q(s):d&&(a.removePhoto=!0),await u.mutateAsync(a),b.success(t("profile.edit.success")),r(P(C.ADMIN.PROFILE,o))}catch{}}return e.jsxs(e.Fragment,{children:[e.jsx(Q,{title:V(t("profile.edit.title")),description:t("profile.edit.subtitle"),noIndex:!0}),e.jsxs(K,{className:"mx-auto max-w-xl space-y-6 p-4 md:p-8",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(p,{type:"button",variant:"ghost",size:"icon",onClick:()=>{r(P(C.ADMIN.PROFILE,o))},"aria-label":t("profile.title"),children:e.jsx(Y,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:t("profile.edit.title")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t("profile.edit.subtitle")})]})]}),e.jsxs("form",{onSubmit:i=>{O(i)},className:"space-y-6",children:[e.jsxs(y,{children:[e.jsxs(w,{children:[e.jsx(F,{children:t("profile.edit.photoLabel")}),e.jsx(W,{children:t("profile.edit.photoHint")})]}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(X,{className:"h-20 w-20",children:[v?e.jsx(Z,{src:v,alt:""}):null,e.jsx($,{children:D})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:m,type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",className:"hidden",onChange:E}),e.jsxs(p,{type:"button",variant:"outline",size:"sm",onClick:()=>m.current?.click(),children:[e.jsx(_,{className:"me-2 h-4 w-4"}),t(s||h?"profile.edit.changeFile":"profile.edit.chooseFile")]}),s??(h&&!d)?e.jsxs(p,{type:"button",variant:"ghost",size:"sm",onClick:M,children:[e.jsx(ee,{className:"me-2 h-4 w-4"}),t("profile.edit.removeFile")]}):null]})]}),s?e.jsx("p",{className:"text-muted-foreground text-xs",children:s.name}):null]})]}),e.jsxs(y,{children:[e.jsx(w,{children:e.jsx(F,{children:t("profile.info.title")})}),e.jsxs(R,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"edit-name",children:t("profile.edit.nameLabel")}),e.jsx(I,{id:"edit-name",value:c,onChange:i=>{S(i.target.value)},placeholder:t("profile.edit.namePlaceholder")})]}),e.jsx(G,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"edit-email",children:t("profile.edit.emailLabel")}),e.jsx(I,{id:"edit-email",value:l?.email??"",disabled:!0,readOnly:!0,className:"bg-muted/50"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:t("profile.edit.emailReadonly")})]})]})]}),e.jsx(p,{type:"submit",className:"w-full sm:w-auto",disabled:u.isPending,children:u.isPending?t("profile.edit.submitting"):t("profile.edit.submit")})]})]})]})}export{he 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.