source: Klonkt/src/views/pages/account.ejs@ 99989f9

main
Last change on this file since 99989f9 was 99989f9, checked in by Robin Genis <roboburr@โ€ฆ>, 2 months ago

feat(images): route all remaining avatars through avatar() (downscaled)

Wrap every avatar/profile-photo <img> src in avatar(): feed/comment/follow + nav, profile
header/sheet/bottom-tab, account, EPK hero, admin user list, site-edit preview. Local avatars
go through the thumb route, remote ones through the signed proxy. Covers (thumb()) untouched.

  • Property mode set to 100644
File size: 13.9 KB
Lineย 
1<div class="container ax-page">
2
3 <header class="ax-header">
4 <a href="/" class="ax-back" aria-label="<%= t('acct.back_home') %>">โ†</a>
5 <div>
6 <h1><%= t('acct.title') %></h1>
7 <p class="ax-tagline"><%= t('acct.subtitle') %></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 <% if (isViewer) { %>
15 <div class="ax-viewer-note" role="note">
16 <span class="ax-viewer-ico" aria-hidden="true">๐Ÿ‘๏ธ</span>
17 <div>
18 <strong><%= t('acct.viewer_mode') %></strong>
19 <span><%= t('acct.viewer_note') %></span>
20 </div>
21 </div>
22 <% } %>
23
24 <%# โ”€โ”€ PROFILE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ %>
25 <section class="ax-card">
26 <div class="ax-card-title"><%= t('acct.profile') %></div>
27
28 <div class="ax-profile-id">
29 <span class="ax-profile-avatar ax-profile-avatar-static">
30 <% var _av = (typeof siteAvatar !== 'undefined' ? siteAvatar : null); %>
31 <% if (_av) { %>
32 <img src="<%= avatar(_av, 128) %>" alt="">
33 <% } else { %>
34 <span><%= account.username.charAt(0).toUpperCase() %></span>
35 <% } %>
36 </span>
37 <div class="ax-profile-meta">
38 <div class="ax-profile-name"><%= account.username %></div>
39 <div class="ax-profile-role"><%= account.role %> ยท <%= account.email %></div>
40 <% if (account.created_at) { %>
41 <div class="ax-profile-joined"><%= t('acct.member_since') %> <%= formatDate(account.created_at) %></div>
42 <% } %>
43 <% if (canMutate) { %>
44 <div class="ax-profile-joined"><%- t('acct.photo_site_hint') %></div>
45 <% } %>
46 </div>
47 </div>
48
49 <% if (canMutate) { %>
50 <form action="/account/profile" method="post" class="ax-form ax-form-bio">
51 <label class="ax-field">
52 <span><%= t('acct.username') %></span>
53 <input type="text" name="username" value="<%= account.username %>" minlength="2" maxlength="30" pattern="[A-Za-z0-9_\-]{2,30}" autocomplete="username">
54 </label>
55 <label class="ax-field">
56 <span><%= t('acct.email') %></span>
57 <input type="email" name="email" value="<%= account.email || '' %>" maxlength="254" autocomplete="email" placeholder="<%= t('acct.email_ph') %>">
58 </label>
59 <label class="ax-field">
60 <span><%= t('acct.bio') %></span>
61 <textarea name="bio" rows="3" maxlength="500" placeholder="<%= t('acct.bio_ph') %>"><%= account.bio || '' %></textarea>
62 </label>
63 <div class="ax-form-actions">
64 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.save') %></button>
65 </div>
66 </form>
67 <% } else { %>
68 <div class="ax-form ax-form-bio">
69 <label class="ax-field">
70 <span><%= t('acct.bio') %></span>
71 <textarea rows="3" disabled placeholder="<%= t('acct.bio_empty') %>"><%= account.bio || '' %></textarea>
72 </label>
73 </div>
74 <% } %>
75 </section>
76
77 <%# โ”€โ”€ PERSONAL LANGUAGE โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ %>
78 <% if (canMutate) { %>
79 <section class="ax-card">
80 <div class="ax-card-title"><%= t('acct.lang_label') %></div>
81 <form action="/account/lang" method="post" class="ax-form">
82 <label class="ax-field">
83 <span><%= t('acct.lang_label') %> <small><%= t('acct.lang_hint') %></small></span>
84 <select name="lang">
85 <% langs.forEach(function(l){ var sel = (account && account.lang) ? (account.lang === l.code) : l.active; %>
86 <option value="<%= l.code %>"<%= sel ? ' selected' : '' %>><%= l.name %></option>
87 <% }); %>
88 </select>
89 </label>
90 <div class="ax-form-actions">
91 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.save') %></button>
92 </div>
93 </form>
94 </section>
95 <% } %>
96
97 <%# โ”€โ”€ SITE (owner may update their site name) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ %>
98 <% if (typeof editableSite !== 'undefined' && editableSite && canMutate) { %>
99 <section class="ax-card">
100 <div class="ax-card-title"><%= t('acct.site') %></div>
101 <form action="/account/site" method="post" class="ax-form">
102 <label class="ax-field">
103 <span><%= t('acct.site_name') %> <small><%= t('acct.site_name_hint') %></small></span>
104 <input type="text" name="site_title" value="<%= editableSite.title || '' %>" maxlength="200" required>
105 </label>
106 <label class="ax-field">
107 <span><%= t('acct.tagline') %> <small><%= t('acct.tagline_hint') %></small></span>
108 <input type="text" name="site_tagline" value="<%= editableSite.tagline || '' %>" maxlength="200">
109 </label>
110 <div class="ax-form-actions">
111 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.site_save') %></button>
112 </div>
113 </form>
114 </section>
115 <% } %>
116
117 <%# โ”€โ”€ PASSWORD โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ %>
118 <%# In viewer mode there is no password section (nothing to change). %>
119 <% if (canMutate) { %>
120 <% if (hasPassword) { %>
121 <section class="ax-card">
122 <div class="ax-card-title"><%= t('acct.password_change') %></div>
123 <form action="/account/password" method="post" class="ax-form">
124 <label class="ax-field">
125 <span><%= t('acct.password_current') %></span>
126 <input type="password" name="current" required autocomplete="current-password">
127 </label>
128 <div class="ax-row ax-row-2">
129 <label class="ax-field">
130 <span><%= t('acct.password_new') %> <small><%= t('acct.password_min') %></small></span>
131 <input type="password" name="new_password" required minlength="8" autocomplete="new-password">
132 </label>
133 <label class="ax-field">
134 <span><%= t('acct.password_confirm') %></span>
135 <input type="password" name="confirm" required minlength="8" autocomplete="new-password">
136 </label>
137 </div>
138 <div class="ax-form-actions">
139 <button type="submit" class="ax-btn ax-btn-primary"><%= t('acct.password_change') %></button>
140 </div>
141 </form>
142 </section>
143
144 <% } else { %>
145 <section class="ax-card">
146 <div class="ax-card-title"><%= t('acct.login') %></div>
147 <p class="ax-tagline" style="margin:0"><%= t('acct.login_google_only', { email: account.email }) %></p>
148 </section>
149 <% } %>
150 <% } %>
151
152</div>
153
154<style>
155.ax-page { max-width: 720px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
156.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
157.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
158.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
159.ax-back {
160 display: inline-flex; align-items: center; justify-content: center;
161 width: 40px; height: 40px;
162 border: 1px solid var(--rule); border-radius: 8px;
163 background: var(--paper); color: var(--ink); text-decoration: none;
164 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
165}
166.ax-back:hover { border-color: var(--accent); }
167
168.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
169.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
170.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
171
172/* โ”€โ”€โ”€ Kijker-modus notice โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
173.ax-viewer-note {
174 display: flex; align-items: flex-start; gap: 0.75rem;
175 padding: 0.85rem 1rem; margin-bottom: 1rem;
176 border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
177 border-left: 3px solid var(--accent);
178 border-radius: 10px;
179 background: color-mix(in srgb, var(--accent) 8%, var(--paper));
180}
181.ax-viewer-ico { font-size: 1.1rem; line-height: 1.4; }
182.ax-viewer-note strong { display: block; font-size: 0.92rem; }
183.ax-viewer-note span { color: var(--ink-muted, var(--ink-soft)); font-size: 0.85rem; }
184.ax-profile-avatar-static { flex-shrink: 0; }
185.ax-form-bio textarea:disabled { opacity: 0.7; cursor: default; }
186
187/* โ”€โ”€โ”€ Cards โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
188.ax-card {
189 background: var(--paper);
190 border: 1px solid var(--rule);
191 border-radius: 12px;
192 padding: 1.25rem;
193 margin-bottom: 1rem;
194}
195.ax-card-title {
196 font-family: var(--font-display, serif);
197 font-size: 1.15rem;
198 font-weight: 600;
199 margin-bottom: 1rem;
200}
201
202/* โ”€โ”€โ”€ Form fields โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
203.ax-form { display: flex; flex-direction: column; gap: 0.85rem; }
204.ax-form-bio { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
205.ax-row { display: grid; gap: 0.85rem; }
206.ax-row-2 { grid-template-columns: 1fr 1fr; }
207@media (max-width: 600px) { .ax-row-2 { grid-template-columns: 1fr; } }
208
209.ax-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
210.ax-field > span {
211 font-size: 0.8rem; font-weight: 600;
212 color: var(--ink-soft);
213 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
214}
215.ax-field > span small { font-weight: 400; color: var(--ink-muted); font-size: 0.95em; }
216.ax-field input[type="text"],
217.ax-field input[type="email"],
218.ax-field input[type="password"],
219.ax-field input[type="url"],
220.ax-field select,
221.ax-field textarea {
222 width: 100%;
223 box-sizing: border-box;
224 padding: 0.6rem 0.75rem;
225 border: 1px solid var(--rule);
226 border-radius: 6px;
227 background: var(--paper-2);
228 color: var(--ink);
229 font-family: var(--font-ui, system-ui), sans-serif;
230 font-size: 0.95rem;
231 -webkit-appearance: none; appearance: none;
232 transition: border-color 120ms;
233}
234.ax-field textarea { resize: vertical; min-height: 70px; font-family: inherit; }
235.ax-field input:focus, .ax-field select:focus, .ax-field textarea:focus {
236 outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
237}
238
239/* โ”€โ”€โ”€ File upload โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
240.ax-file-control {
241 display: flex; align-items: center; gap: 0.5rem;
242 flex-wrap: wrap;
243 position: relative;
244 min-height: 40px;
245}
246.ax-file-control input[type="file"] {
247 position: absolute; inset: 0;
248 opacity: 0; cursor: pointer;
249 z-index: 2;
250}
251.ax-file-btn { pointer-events: none; }
252.ax-file-name {
253 font-size: 0.85rem;
254 color: var(--ink);
255 word-break: break-all;
256 flex: 1; min-width: 0;
257}
258.ax-file-name[data-empty] { color: var(--ink-muted, var(--ink-soft)); }
259
260.ax-form-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
261
262/* โ”€โ”€โ”€ Buttons โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
263.ax-btn {
264 display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
265 padding: 0.55rem 1rem;
266 border: 1px solid var(--rule); background: var(--paper-2);
267 color: var(--ink);
268 font-family: var(--font-ui, system-ui), sans-serif;
269 font-size: 0.9rem; font-weight: 500;
270 text-decoration: none; border-radius: 6px;
271 cursor: pointer; min-height: 40px;
272 transition: background 120ms, border-color 120ms;
273 -webkit-tap-highlight-color: transparent;
274}
275.ax-btn:hover { border-color: var(--accent); }
276.ax-btn-secondary { background: var(--paper-2); }
277.ax-btn-primary, a.ax-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
278.ax-btn-primary:hover, a.ax-btn-primary:hover { opacity: 0.92; border-color: var(--accent); color: #fff; }
279
280/* โ”€โ”€โ”€ Profile ID row โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ */
281.ax-profile-id {
282 display: flex; align-items: center; gap: 1rem;
283 padding-bottom: 1rem;
284 border-bottom: 1px solid var(--rule);
285 margin-bottom: 1rem;
286}
287.ax-avatar-form { margin: 0; flex-shrink: 0; }
288.ax-avatar-wrap {
289 position: relative; display: block;
290 width: 84px; height: 84px; cursor: pointer;
291}
292.ax-profile-avatar {
293 width: 84px; height: 84px;
294 border-radius: 50%;
295 overflow: hidden;
296 background: var(--paper-2); /* neutral so transparent avatars blend */
297 color: var(--accent); /* accent only for the fallback initial */
298 display: inline-flex; align-items: center; justify-content: center;
299 font-family: var(--font-display, serif);
300 font-size: 1.7rem; font-weight: 600;
301 border: 1px solid var(--rule);
302 transition: border-color 120ms;
303}
304.ax-avatar-wrap:hover .ax-profile-avatar { border-color: var(--accent); }
305.ax-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
306.ax-avatar-edit {
307 position: absolute; right: -2px; bottom: -2px;
308 width: 28px; height: 28px; border-radius: 50%;
309 background: var(--accent); color: #fff;
310 display: flex; align-items: center; justify-content: center;
311 border: 3px solid var(--paper);
312 transition: transform 120ms;
313}
314.ax-avatar-wrap:hover .ax-avatar-edit { transform: scale(1.08); }
315.ax-avatar-remove { margin-top: 0.45rem; }
316.ax-linkbtn {
317 background: none; border: 0; padding: 0; cursor: pointer;
318 color: var(--ink-muted, var(--ink-soft)); font-size: 0.8rem; text-decoration: underline;
319 font-family: var(--font-ui, system-ui), sans-serif;
320}
321.ax-linkbtn:hover { color: #c33; }
322.ax-profile-meta { min-width: 0; }
323.ax-profile-name { font-weight: 600; font-size: 1.1rem; }
324.ax-profile-role,
325.ax-profile-joined {
326 color: var(--ink-muted, var(--ink-soft));
327 font-size: 0.85rem;
328}
329
330@media (max-width: 480px) {
331 .ax-profile-id { flex-direction: column; align-items: flex-start; gap: 0.75rem; text-align: left; }
332}
333</style>
Note: See TracBrowser for help on using the repository browser.