source: Klonkt/src/views/pages/account.ejs@ 6150acb

main
Last change on this file since 6150acb was 6150acb, checked in by roboburr <roboburr@…>, 3 months ago

account: cleaner profile card — clickable avatar with camera badge

Replaced the clunky "Choose file / No file chosen / Upload" row with
a clickable avatar (camera badge, upload immediately on file selection)
+ a small "Remove photo" link. Larger avatar, tighter buttons (emojis
removed).

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 10.6 KB
Line 
1<div class="container ax-page">
2
3 <header class="ax-header">
4 <a href="/" class="ax-back" aria-label="Terug naar home">←</a>
5 <div>
6 <h1>Account</h1>
7 <p class="ax-tagline">Profiel en avatar.</p>
8 </div>
9 </header>
10
11 <% if (success) { %><div class="ax-flash ax-flash-ok"><%= success %></div><% } %>
12 <% if (error) { %><div class="ax-flash ax-flash-err"><%= error %></div><% } %>
13
14 <%# ── PROFILE ────────────────────────────────────────────── %>
15 <section class="ax-card">
16 <div class="ax-card-title">Profiel</div>
17
18 <div class="ax-profile-id">
19 <form action="/account/avatar" method="post" enctype="multipart/form-data" class="ax-avatar-form">
20 <label class="ax-avatar-wrap" title="Klik om je foto te wijzigen">
21 <span class="ax-profile-avatar">
22 <% if (account.avatar_url) { %>
23 <img src="<%= account.avatar_url %>" alt="">
24 <% } else { %>
25 <span><%= account.username.charAt(0).toUpperCase() %></span>
26 <% } %>
27 </span>
28 <span class="ax-avatar-edit" aria-hidden="true">
29 <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
30 </span>
31 <input type="file" name="avatar" accept="image/jpeg,image/png,image/webp,image/gif" onchange="this.form.submit()" hidden>
32 </label>
33 </form>
34 <div class="ax-profile-meta">
35 <div class="ax-profile-name"><%= account.username %></div>
36 <div class="ax-profile-role"><%= account.role %> · <%= account.email %></div>
37 <% if (account.created_at) { %>
38 <div class="ax-profile-joined">Lid sinds <%= formatDate(account.created_at) %></div>
39 <% } %>
40 <% if (account.avatar_url) { %>
41 <form action="/account/avatar/remove" method="post" class="ax-avatar-remove">
42 <button type="submit" class="ax-linkbtn">Foto verwijderen</button>
43 </form>
44 <% } %>
45 </div>
46 </div>
47
48 <form action="/account/profile" method="post" class="ax-form ax-form-bio">
49 <label class="ax-field">
50 <span>Bio</span>
51 <textarea name="bio" rows="3" maxlength="500" placeholder="Een korte regel over jezelf"><%= account.bio || '' %></textarea>
52 </label>
53 <div class="ax-form-actions">
54 <button type="submit" class="ax-btn ax-btn-primary">Bio opslaan</button>
55 </div>
56 </form>
57 </section>
58
59 <%# ── WACHTWOORD ────────────────────────────────────────── %>
60 <% if (hasPassword) { %>
61 <section class="ax-card">
62 <div class="ax-card-title">Wachtwoord wijzigen</div>
63 <form action="/account/password" method="post" class="ax-form">
64 <label class="ax-field">
65 <span>Huidig wachtwoord</span>
66 <input type="password" name="current" required autocomplete="current-password">
67 </label>
68 <div class="ax-row ax-row-2">
69 <label class="ax-field">
70 <span>Nieuw wachtwoord <small>(min 8 tekens)</small></span>
71 <input type="password" name="new_password" required minlength="8" autocomplete="new-password">
72 </label>
73 <label class="ax-field">
74 <span>Bevestig nieuw wachtwoord</span>
75 <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
76 </label>
77 </div>
78 <div class="ax-form-actions">
79 <button type="submit" class="ax-btn ax-btn-primary">Wachtwoord wijzigen</button>
80 </div>
81 </form>
82 </section>
83 <% } else { %>
84 <section class="ax-card">
85 <div class="ax-card-title">Inloggen</div>
86 <p class="ax-tagline" style="margin:0">Je bent ingelogd via Google (<%= account.email %>). Er is geen apart wachtwoord.</p>
87 </section>
88 <% } %>
89
90</div>
91
92<style>
93.ax-page { max-width: 720px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
94.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
95.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
96.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
97.ax-back {
98 display: inline-flex; align-items: center; justify-content: center;
99 width: 40px; height: 40px;
100 border: 1px solid var(--rule); border-radius: 8px;
101 background: var(--paper); color: var(--ink); text-decoration: none;
102 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
103}
104.ax-back:hover { border-color: var(--accent); }
105
106.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
107.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
108.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
109
110/* ─── Cards ────────────────────────────────────────────────────── */
111.ax-card {
112 background: var(--paper);
113 border: 1px solid var(--rule);
114 border-radius: 12px;
115 padding: 1.25rem;
116 margin-bottom: 1rem;
117}
118.ax-card-title {
119 font-family: var(--font-display, serif);
120 font-size: 1.15rem;
121 font-weight: 600;
122 margin-bottom: 1rem;
123}
124
125/* ─── Form fields ──────────────────────────────────────────────── */
126.ax-form { display: flex; flex-direction: column; gap: 0.85rem; }
127.ax-form-bio { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
128.ax-row { display: grid; gap: 0.85rem; }
129.ax-row-2 { grid-template-columns: 1fr 1fr; }
130@media (max-width: 600px) { .ax-row-2 { grid-template-columns: 1fr; } }
131
132.ax-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
133.ax-field > span {
134 font-size: 0.8rem; font-weight: 600;
135 color: var(--ink-soft);
136 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
137}
138.ax-field > span small { font-weight: 400; color: var(--ink-muted); font-size: 0.95em; }
139.ax-field input[type="text"],
140.ax-field input[type="email"],
141.ax-field input[type="password"],
142.ax-field input[type="url"],
143.ax-field select,
144.ax-field textarea {
145 width: 100%;
146 box-sizing: border-box;
147 padding: 0.6rem 0.75rem;
148 border: 1px solid var(--rule);
149 border-radius: 6px;
150 background: var(--paper-2);
151 color: var(--ink);
152 font-family: var(--font-ui, system-ui), sans-serif;
153 font-size: 0.95rem;
154 -webkit-appearance: none; appearance: none;
155 transition: border-color 120ms;
156}
157.ax-field textarea { resize: vertical; min-height: 70px; font-family: inherit; }
158.ax-field input:focus, .ax-field select:focus, .ax-field textarea:focus {
159 outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
160}
161
162/* ─── File upload ─────────────────────────────────────────────── */
163.ax-file-control {
164 display: flex; align-items: center; gap: 0.5rem;
165 flex-wrap: wrap;
166 position: relative;
167 min-height: 40px;
168}
169.ax-file-control input[type="file"] {
170 position: absolute; inset: 0;
171 opacity: 0; cursor: pointer;
172 z-index: 2;
173}
174.ax-file-btn { pointer-events: none; }
175.ax-file-name {
176 font-size: 0.85rem;
177 color: var(--ink);
178 word-break: break-all;
179 flex: 1; min-width: 0;
180}
181.ax-file-name[data-empty] { color: var(--ink-muted, var(--ink-soft)); }
182
183.ax-form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
184
185/* ─── Buttons ──────────────────────────────────────────────────── */
186.ax-btn {
187 display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
188 padding: 0.55rem 1rem;
189 border: 1px solid var(--rule); background: var(--paper-2);
190 color: var(--ink);
191 font-family: var(--font-ui, system-ui), sans-serif;
192 font-size: 0.9rem; font-weight: 500;
193 text-decoration: none; border-radius: 6px;
194 cursor: pointer; min-height: 40px;
195 transition: background 120ms, border-color 120ms;
196 -webkit-tap-highlight-color: transparent;
197}
198.ax-btn:hover { border-color: var(--accent); }
199.ax-btn-secondary { background: var(--paper-2); }
200.ax-btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
201.ax-btn-primary:hover { opacity: 0.92; border-color: var(--accent); }
202
203/* ─── Profile ID row ──────────────────────────────────────────── */
204.ax-profile-id {
205 display: flex; align-items: center; gap: 1rem;
206 padding-bottom: 1rem;
207 border-bottom: 1px solid var(--rule);
208 margin-bottom: 1rem;
209}
210.ax-avatar-form { margin: 0; flex-shrink: 0; }
211.ax-avatar-wrap {
212 position: relative; display: block;
213 width: 84px; height: 84px; cursor: pointer;
214}
215.ax-profile-avatar {
216 width: 84px; height: 84px;
217 border-radius: 50%;
218 overflow: hidden;
219 background: var(--paper-2); /* neutral so transparent avatars blend */
220 color: var(--accent); /* accent only for the fallback initial */
221 display: inline-flex; align-items: center; justify-content: center;
222 font-family: var(--font-display, serif);
223 font-size: 1.7rem; font-weight: 600;
224 border: 1px solid var(--rule);
225 transition: border-color 120ms;
226}
227.ax-avatar-wrap:hover .ax-profile-avatar { border-color: var(--accent); }
228.ax-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
229.ax-avatar-edit {
230 position: absolute; right: -2px; bottom: -2px;
231 width: 28px; height: 28px; border-radius: 50%;
232 background: var(--accent); color: #fff;
233 display: flex; align-items: center; justify-content: center;
234 border: 3px solid var(--paper);
235 transition: transform 120ms;
236}
237.ax-avatar-wrap:hover .ax-avatar-edit { transform: scale(1.08); }
238.ax-avatar-remove { margin-top: 0.45rem; }
239.ax-linkbtn {
240 background: none; border: 0; padding: 0; cursor: pointer;
241 color: var(--ink-muted, var(--ink-soft)); font-size: 0.8rem; text-decoration: underline;
242 font-family: var(--font-ui, system-ui), sans-serif;
243}
244.ax-linkbtn:hover { color: #c33; }
245.ax-profile-meta { min-width: 0; }
246.ax-profile-name { font-weight: 600; font-size: 1.1rem; }
247.ax-profile-role,
248.ax-profile-joined {
249 color: var(--ink-muted, var(--ink-soft));
250 font-size: 0.85rem;
251}
252
253@media (max-width: 480px) {
254 .ax-profile-id { flex-direction: column; align-items: flex-start; gap: 0.75rem; text-align: left; }
255}
256</style>
Note: See TracBrowser for help on using the repository browser.