Files
Atomcms-edit/frontend/.next/static/chunks/0jkqt3tq_uikt.js
T
2026-05-09 17:32:17 +02:00

1 line
8.2 KiB
JavaScript
Executable File

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,13399,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(57688),a=e.i(22016),n=e.i(88589),l=e.i(13642),i=e.i(9165);e.s(["default",0,function(){let[e,o]=(0,s.useState)(null),[d,c]=(0,s.useState)(!0),[m,x]=(0,s.useState)(!1),[u,g]=(0,s.useState)(null),[p,b]=(0,s.useState)(null),[h,f]=(0,s.useState)("profile"),[j,w]=(0,s.useState)({motto:"",mail:"",currentPassword:"",newPassword:"",newPasswordConfirm:""});(0,s.useEffect)(()=>{!async function(){try{let{data:e,error:t}=await i.api.get("/auth/user");t?g("Kon profiel niet laden"):e&&(o(e),w(t=>({...t,motto:e.motto||"",mail:e.mail||""})))}catch{g("Er is een fout opgetreden bij het laden van je profiel")}c(!1)}()},[]);let v=async()=>{x(!0),g(null),b(null);try{let{error:e}=await i.api.put("/user/profile",{motto:j.motto,mail:j.mail});e?g(e):b("Profiel succesvol bijgewerkt")}catch{g("Er is een fout opgetreden")}x(!1)},N=async()=>{if(j.newPassword!==j.newPasswordConfirm)return void g("Wachtwoorden komen niet overeen");x(!0),g(null),b(null);try{let{error:e}=await i.api.put("/user/password",{current_password:j.currentPassword,new_password:j.newPassword});e?g(e):(b("Wachtwoord succesvol gewijzigd"),w(e=>({...e,currentPassword:"",newPassword:"",newPasswordConfirm:""})))}catch{g("Er is een fout opgetreden")}x(!1)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.default,{}),(0,t.jsx)("main",{className:"bg-background min-h-screen",children:(0,t.jsxs)("div",{className:"max-w-3xl mx-auto p-4 lg:p-6",children:[(0,t.jsx)("div",{className:"bg-surface rounded-lg shadow-card p-4 md:p-6 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-primary flex items-center justify-center",children:(0,t.jsxs)("svg",{className:"w-6 h-6 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl md:text-3xl font-bold text-text-main",children:"Instellingen"}),(0,t.jsx)("p",{className:"text-text-muted",children:"Beheer je profiel en account instellingen"})]})]})}),d?(0,t.jsx)("div",{className:"bg-surface rounded-lg shadow-card p-8 text-center",children:(0,t.jsx)("p",{className:"text-text-muted",children:"Instellingen laden..."})}):e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex gap-2 mb-6",children:[{id:"profile",label:"Profiel"},{id:"security",label:"Beveiliging"}].map(e=>(0,t.jsx)("button",{onClick:()=>f(e.id),className:`px-4 py-2 rounded-lg font-semibold transition-colors ${h===e.id?"bg-primary text-text-main":"bg-surface text-text-muted hover:bg-gray-100"}`,children:e.label},e.id))}),u&&(0,t.jsx)("div",{className:"bg-danger/10 border border-danger rounded-lg p-4 mb-6",children:(0,t.jsx)("p",{className:"text-danger text-sm",children:u})}),p&&(0,t.jsx)("div",{className:"bg-accent/10 border border-accent rounded-lg p-4 mb-6",children:(0,t.jsx)("p",{className:"text-accent text-sm",children:p})}),"profile"===h&&(0,t.jsxs)("div",{className:"bg-surface rounded-lg shadow-card p-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,t.jsx)("div",{className:"w-20 h-20 rounded-lg overflow-hidden bg-background relative",children:(0,t.jsx)(r.default,{src:`https://epicnabbo.nl/imaging/?figure=${e.look}&direction=2`,alt:e.username,fill:!0,className:"object-contain"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-bold text-text-main",children:e.username}),(0,t.jsxs)("p",{className:"text-sm text-text-muted",children:["Lid sinds"," ",new Date(e.created_at).toLocaleDateString("nl-NL")]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-4 mb-6",children:[(0,t.jsxs)("div",{className:"bg-background rounded-lg p-3 text-center",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-primary",children:e.credits?.toLocaleString()}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:"Credits"})]}),void 0!==e.diamonds&&(0,t.jsxs)("div",{className:"bg-background rounded-lg p-3 text-center",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-blue-400",children:e.diamonds?.toLocaleString()}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:"Diamanten"})]}),(0,t.jsxs)("div",{className:"bg-background rounded-lg p-3 text-center",children:[(0,t.jsx)("p",{className:"text-lg font-bold text-accent",children:e.online_time?.toLocaleString()||0}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:"Uren online"})]})]}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-text-main mb-1",children:"Motto"}),(0,t.jsx)("input",{type:"text",value:j.motto,onChange:e=>w({...j,motto:e.target.value}),className:"w-full px-3 py-2 rounded-lg border border-input-border bg-background text-text-main text-sm focus:outline-none focus:ring-2 focus:ring-primary",placeholder:"Je motto..."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-text-main mb-1",children:"E-mailadres"}),(0,t.jsx)("input",{type:"email",value:j.mail,onChange:e=>w({...j,mail:e.target.value}),className:"w-full px-3 py-2 rounded-lg border border-input-border bg-background text-text-main text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),(0,t.jsx)("button",{onClick:v,disabled:m,className:"px-6 py-2 rounded-lg bg-primary text-text-main font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:m?"Opslaan...":"Opslaan"})]})]}),"security"===h&&(0,t.jsxs)("div",{className:"bg-surface rounded-lg shadow-card p-6",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-text-main mb-4",children:"Wachtwoord wijzigen"}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-text-main mb-1",children:"Huidig wachtwoord"}),(0,t.jsx)("input",{type:"password",value:j.currentPassword,onChange:e=>w({...j,currentPassword:e.target.value}),className:"w-full px-3 py-2 rounded-lg border border-input-border bg-background text-text-main text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-text-main mb-1",children:"Nieuw wachtwoord"}),(0,t.jsx)("input",{type:"password",value:j.newPassword,onChange:e=>w({...j,newPassword:e.target.value}),className:"w-full px-3 py-2 rounded-lg border border-input-border bg-background text-text-main text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-text-main mb-1",children:"Bevestig nieuw wachtwoord"}),(0,t.jsx)("input",{type:"password",value:j.newPasswordConfirm,onChange:e=>w({...j,newPasswordConfirm:e.target.value}),className:"w-full px-3 py-2 rounded-lg border border-input-border bg-background text-text-main text-sm focus:outline-none focus:ring-2 focus:ring-primary"})]}),(0,t.jsx)("button",{onClick:N,disabled:m,className:"px-6 py-2 rounded-lg bg-primary text-text-main font-semibold hover:bg-primary-hover transition-colors disabled:opacity-50",children:m?"Opslaan...":"Wachtwoord wijzigen"})]})]})]}):(0,t.jsxs)("div",{className:"bg-surface rounded-lg shadow-card p-8 text-center",children:[(0,t.jsx)("p",{className:"text-text-muted mb-4",children:"Je moet ingelogd zijn om je instellingen te bekijken"}),(0,t.jsx)(a.default,{href:"/login",className:"inline-block px-6 py-2 rounded-lg bg-primary text-text-main font-semibold hover:bg-primary-hover transition-colors",children:"Inloggen"})]})]})}),(0,t.jsx)(l.default,{})]})}])}]);