Changeset 6150acb in Klonkt


Ignore:
Timestamp:
06/14/2026 04:55:06 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
42081fb
Parents:
ab544fd
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/account.ejs

    rab544fd r6150acb  
    1717
    1818    <div class="ax-profile-id">
    19       <div class="ax-profile-avatar">
    20         <% if (account.avatar_url) { %>
    21           <img src="<%= account.avatar_url %>" alt="">
    22         <% } else { %>
    23           <span><%= account.username.charAt(0).toUpperCase() %></span>
    24         <% } %>
    25       </div>
     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>
    2634      <div class="ax-profile-meta">
    2735        <div class="ax-profile-name"><%= account.username %></div>
     
    3038          <div class="ax-profile-joined">Lid sinds <%= formatDate(account.created_at) %></div>
    3139        <% } %>
     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        <% } %>
    3245      </div>
    3346    </div>
    34 
    35     <form action="/account/avatar" method="post" enctype="multipart/form-data" class="ax-form">
    36       <label class="ax-field ax-file">
    37         <span>Avatar uploaden <small>(jpg/png/webp/gif, max 5 MB)</small></span>
    38         <span class="ax-file-control">
    39           <span class="ax-btn ax-btn-secondary ax-file-btn">📷 Kies bestand</span>
    40           <span class="ax-file-name" data-empty>Geen bestand gekozen</span>
    41           <input type="file" name="avatar" accept="image/jpeg,image/png,image/webp,image/gif" required>
    42         </span>
    43       </label>
    44       <div class="ax-form-actions">
    45         <button type="submit" class="ax-btn ax-btn-primary">⬆ Uploaden</button>
    46         <% if (account.avatar_url) { %>
    47           <%# Separate <form> block kept inline since it submits to a different endpoint. %>
    48           <button type="button" class="ax-btn" onclick="document.getElementById('avatar-remove-form').submit()">Avatar verwijderen</button>
    49         <% } %>
    50       </div>
    51     </form>
    52     <% if (account.avatar_url) { %>
    53       <form action="/account/avatar/remove" method="post" id="avatar-remove-form" hidden></form>
    54     <% } %>
    5547
    5648    <form action="/account/profile" method="post" class="ax-form ax-form-bio">
     
    6052      </label>
    6153      <div class="ax-form-actions">
    62         <button type="submit" class="ax-btn ax-btn-primary">💾 Bio opslaan</button>
     54        <button type="submit" class="ax-btn ax-btn-primary">Bio opslaan</button>
    6355      </div>
    6456    </form>
     
    8577      </div>
    8678      <div class="ax-form-actions">
    87         <button type="submit" class="ax-btn ax-btn-primary">🔒 Wachtwoord wijzigen</button>
     79        <button type="submit" class="ax-btn ax-btn-primary">Wachtwoord wijzigen</button>
    8880      </div>
    8981    </form>
     
    216208  margin-bottom: 1rem;
    217209}
     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}
    218215.ax-profile-avatar {
    219   width: 64px; height: 64px;
     216  width: 84px; height: 84px;
    220217  border-radius: 50%;
    221218  overflow: hidden;
     
    224221  display: inline-flex; align-items: center; justify-content: center;
    225222  font-family: var(--font-display, serif);
    226   font-size: 1.6rem; font-weight: 600;
    227   flex-shrink: 0;
    228 }
     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); }
    229228.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; }
    230245.ax-profile-meta { min-width: 0; }
    231246.ax-profile-name { font-weight: 600; font-size: 1.1rem; }
Note: See TracChangeset for help on using the changeset viewer.