PageSourceSearch

https://arcanes.be/assets/Settings-Ce2Tzg7Y.js

js arcanes.be collected 2026-09-25 12:38:47 UTC 14,426 bytes, 6 lines download raw bytes

1import{p as ie,b as oe,a as ce,u as de,j as e,c as xe,aG as me,d as M,aH as q,r as a,Y as ue,a0 as he,M as ge,ab as fe,D as pe,an as be,E as y,k as S,ac as je,s as c,J as n}from"./index-DrUUimuw.js";import{A as Ne}from"./arrow-left-V7CrFsJW.js";import{S as we}from"./save-CcVQfrkw.js";import{T as B}from"./trash-2-DUXS_Jyg.js";import{K as ve}from"./key-DP5dv30E.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ye=ie("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);function _e(){const[G,O]=oe(),u=ce(),{t:s,language:R}=de(),J=e.jsx(xe,{title:s("seo.login.title").replace("Connexion","Paramètres"),description:"Gérez vos paramètres Arcanes",noIndex:!0}),K=[{id:"profile",label:s("settings.tabs.profile"),icon:me},{id:"security",label:s("settings.tabs.security"),icon:M},{id:"notifications",label:s("settings.tabs.notifications"),icon:q}],d=s("settings.dangerZone.confirmWord"),W=R==="nl"?"nl-BE":"fr-FR",[z,Y]=a.useState(!1),[Q,V]=a.useState(0),[X,$]=a.useState(!0),[E,C]=a.useState(!1),[r,P]=a.useState(null),[x,k]=a.useState(""),[g,_]=a.useState("fr"),[D,A]=a.useState(""),[m,F]=a.useState(""),[f,L]=a.useState(""),[p,ee]=a.useState(!1),[b,se]=a.useState(!1),[j,te]=a.useState(!1),[T,U]=a.useState(!1),[H,N]=a.useState(!1),[w,v]=a.useState(""),[I,Z]=a.useState(!1),h=G.get("tab")||"profile";a.useEffect(()=>{(async()=>{try{const{data:{user:i}}=await c.auth.getUser();if(!i){u("/login");return}Y(!0);const{data:l}=await c.from("profiles").select("*").eq("id",i.id).single();l&&(P({id:l.id,username:l.username||"",email:i.email||"",preferred_language:l.preferred_language||"fr",created_at:l.created_at}),k(l.username||""),_(l.preferred_language||"fr"));const{data:o}=await c.from("user_credits").select("credits_remaining, purchased_credits").eq("user_id",i.id).maybeSingle();V(((o==null?void 0:o.credits_remaining)||0)+((o==null?void 0:o.purchased_credits)||0))}catch(i){console.error("Error loading user data:",i)}finally{$(!1)}})()},[u]);const ae=t=>{O({tab:t}),N(!1),v("")},re=async()=>{if(r){C(!0);try{const{error:t}=await c.from("profiles").update({username:x,preferred_language:g}).eq("id",r.id);if(t)throw t;n.success(s("settings.toasts.profileSaved")),P({...r,username:x,preferred_language:g})}catch(t){console.error("Error saving profile:",t),n.error(s("settings.toasts.profileError"))}finally{C(!1)}}},le=async()=>{if(m!==f){n.error(s("settings.toasts.passwordMismatch"));return}if(m.length<8){n.error(s("settings.toasts.passwordTooShort"));return}U(!0);try{const{error:t}=await c.auth.updateUser({password:m});if(t)throw t;n.success(s("settings.toasts.passwordChanged")),A(""),F(""),L("")}catch(t){console.error("Error changing password:",t),n.error(s("settings.toasts.passwordError"))}finally{U(!1)}},ne=async()=>{if(w!==d){n.error(s("settings.toasts.confirmRequired").replace("{{word}}",d));return}Z(!0);try{const{error:t}=await c.auth.signOut();if(t)throw t;n.success(s("settings.toasts.accountDeleted")),u("/")}catch(t){console.error("Error deleting account:",t),n.error(s("settings.toasts.accountDeleteError"))}finally{Z(!1)}};return X?e.jsx("div",{className:"min-h-screen bg-[#FAFAFA] flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#0E3639]"})}):e.jsxs("div",{className:"min-h-screen bg-[#FAFAFA]",children:[J,e.jsx(ue,{isLoggedIn:z,totalCredits:Q}),e.jsx("main",{className:"pt-28 pb-16",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("button",{onClick:()=>u(-1),className:"flex items-center gap-2 text-slate-500 hover:text-[#0E3639] transition-colors mb-4",children:[e.jsx(Ne,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:s("settings.nav.back")})]}),e.jsx("p",{className:"text-slate-600",children:s("settings.nav.subtitle")})]}),e.jsx("div",{className:"flex gap-2 mb-6",children:K.map(t=>{const i=t.icon,l=h===t.id;return e.jsxs("button",{onClick:()=>ae(t.id),className:he("flex items-center gap-2 px-4 py-2.5 rounded-xl font-medium transition-all duration-200",l?"bg-[#0E3639] text-white shadow-lg shadow-[#0E3639]/20":"bg-white text-slate-600 hover:bg-slate-50 border border-slate-200"),children:[e.jsx(i,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:t.label})]},t.id)})}),e.jsxs("div",{className:"space-y-6",children:[h==="profile"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-[#0E3639] mb-4",children:s("settings.profile.photo")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-16 h-16 rounded-xl bg-[#0E3639] flex items-center justify-center text-white text-xl font-bold",children:x?x.substring(0,2).toUpperCase():"U"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-600",children:s("settings.profile.photoDesc")}),e.jsx("p",{className:"text-xs text-[#D4AF37] mt-1",children:s("settings.profile.photoFormat")})]})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-[#0E3639] mb-6",children:s("settings.profile.info")}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.profile.username")}),e.jsx("input",{type:"text",value:x,onChange:t=>k(t.target.value),className:"w-full px-4 py-3 rounded-xl border border-slate-200 focus:border-[#0E3639] focus:ring-2 focus:ring-[#0E3639]/10 transition-all outline-none",placeholder:s("settings.profile.usernamePlaceholder")}),e.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:s("settings.profile.usernameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.profile.email")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"email",value:(r==null?void 0:r.email)||"",disabled:!0,className:"w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-slate-500 cursor-not-allowed"}),e.jsx(ge,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"})]}),e.jsx("p",{className:"text-xs text-[#D4AF37] mt-1.5",children:s("settings.profile.emailHint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.profile.language")}),e.jsxs("div",{className:"relative",children:[e.jsxs("select",{value:g,onChange:t=>_(t.target.value),className:"w-full px-4 py-3 rounded-xl border border-slate-200 focus:border-[#0E3639] focus:ring-2 focus:ring-[#0E3639]/10 transition-all outline-none appearance-none cursor-pointer",children:[e.jsx("option",{value:"fr",children:"🇫🇷 Français"}),e.jsx("option",{value:"nl",children:"🇳🇱 Nederlands"})]}),e.jsx(fe,{className:"absolute right-4 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-slate-100",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-slate-100 flex items-center justify-center",children:e.jsx(pe,{className:"w-4 h-4 text-slate-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-slate-500",children:s("settings.profile.memberSince")}),e.jsx("p",{className:"text-sm font-medium text-[#0E3639]",children:r!=null&&r.created_at?new Date(r.created_at).toLocaleDateString(W,{day:"numeric",month:"long",year:"numeric"}):"-"})]})]})]}),e.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-slate-100",children:e.jsxs("button",{onClick:re,disabled:E,className:"flex items-center gap-2 px-6 py-2.5 bg-[#0E3639] text-white rounded-xl font-medium hover:bg-[#0b2a2d] transition-all disabled:opacity-50",children:[e.jsx(we,{className:"w-4 h-4"}),e.jsx("span",{children:s(E?"settings.profile.saving":"settings.profile.save")})]})})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-red-50 flex items-center justify-center flex-shrink-0",children:e.jsx(be,{className:"w-4 h-4 text-red-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-slate-700",children:s("settings.dangerZone.deleteAccount")}
6),e.jsx("p",{className:"text-xs text-slate-400",children:s("settings.dangerZone.irreversible")})]})]}),H?e.jsx("button",{onClick:()=>{N(!1),v("")},className:"text-xs text-slate-400 hover:text-slate-600",children:s("settings.dangerZone.cancel")}):e.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1.5 px-3 py-1.5 text-red-500 hover:bg-red-50 rounded-lg text-sm transition-all",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:s("settings.dangerZone.delete")})]})]}),H&&e.jsxs("div",{className:"px-4 pb-4 pt-2 border-t border-slate-100 bg-slate-50/50",children:[e.jsx("p",{className:"text-xs text-slate-500 mb-3",dangerouslySetInnerHTML:{__html:s("settings.dangerZone.confirmText").replace("{{word}}",d)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:w,onChange:t=>v(t.target.value),placeholder:d,className:"flex-1 px-3 py-2 rounded-lg border border-slate-200 focus:border-red-300 focus:ring-2 focus:ring-red-100 transition-all outline-none text-sm"}),e.jsxs("button",{onClick:ne,disabled:I||w!==d,className:"flex items-center gap-1.5 px-4 py-2 bg-red-500 text-white rounded-lg text-sm hover:bg-red-600 transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:I?"...":s("settings.dangerZone.confirm")})]})]})]})]})]}),h==="security"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-[#0E3639]/10 flex items-center justify-center",children:e.jsx(ve,{className:"w-5 h-5 text-[#0E3639]"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-[#0E3639]",children:s("settings.security.changePassword")}),e.jsx("p",{className:"text-sm text-slate-500",children:s("settings.security.changePasswordDesc")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.security.currentPassword")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:p?"text":"password",value:D,onChange:t=>A(t.target.value),className:"w-full px-4 py-3 rounded-xl border border-slate-200 focus:border-[#0E3639] focus:ring-2 focus:ring-[#0E3639]/10 transition-all outline-none pr-12"}),e.jsx("button",{type:"button",onClick:()=>ee(!p),className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:p?e.jsx(y,{className:"w-4 h-4"}):e.jsx(S,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.security.newPassword")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:b?"text":"password",value:m,onChange:t=>F(t.target.value),className:"w-full px-4 py-3 rounded-xl border border-slate-200 focus:border-[#0E3639] focus:ring-2 focus:ring-[#0E3639]/10 transition-all outline-none pr-12"}),e.jsx("button",{type:"button",onClick:()=>se(!b),className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:b?e.jsx(y,{className:"w-4 h-4"}):e.jsx(S,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1.5",children:s("settings.security.minChars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:s("settings.security.confirmPassword")}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:j?"text":"password",value:f,onChange:t=>L(t.target.value),className:"w-full px-4 py-3 rounded-xl border border-slate-200 focus:border-[#0E3639] focus:ring-2 focus:ring-[#0E3639]/10 transition-all outline-none pr-12"}),e.jsx("button",{type:"button",onClick:()=>te(!j),className:"absolute right-4 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:j?e.jsx(y,{className:"w-4 h-4"}):e.jsx(S,{className:"w-4 h-4"})})]})]})]}),e.jsx("div",{className:"flex justify-end mt-6 pt-6 border-t border-slate-100",children:e.jsxs("button",{onClick:le,disabled:T||!D||!m||!f,className:"flex items-center gap-2 px-6 py-2.5 bg-[#0E3639] text-white rounded-xl font-medium hover:bg-[#0b2a2d] transition-all disabled:opacity-50",children:[e.jsx(M,{className:"w-4 h-4"}),e.jsx("span",{children:s(T?"settings.security.changing":"settings.security.changeBtn")})]})})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-6 opacity-60",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-slate-100 flex items-center justify-center",children:e.jsx(ye,{className:"w-5 h-5 text-slate-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-400",children:s("settings.security.activeSessions")}),e.jsx("p",{className:"text-sm text-slate-400",children:s("settings.security.comingSoon")})]})]}),e.jsx("p",{className:"text-sm text-slate-400",children:s("settings.security.sessionsDesc")})]})]}),h==="notifications"&&e.jsx("div",{className:"bg-white rounded-2xl border border-slate-200 p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center mb-4",children:e.jsx(q,{className:"w-8 h-8 text-slate-300"})}),e.jsx("h3",{className:"text-lg font-semibold text-[#0E3639] mb-2",children:s("settings.notifications.noNotifications")}),e.jsx("p",{className:"text-sm text-slate-500 text-center",children:s("settings.notifications.noNotificationsDesc")})]})})]})]})}),e.jsx(je,{})]})}
6export{_e 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.