Ignore:
Timestamp:
06/26/2026 11:41:24 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
c7ecaf9
Parents:
3d37c67
Message:

style(fedi): nicer card layout for Notifications + My-replies

Notifications: emoji type-icons -> coloured SVG icons in tinted circles (gold like /
green boost / accent follow+reply), two-line hierarchy (who+time, then action+post),
reply preview in a tinted block, hover lift. My-replies: reply-arrow head with
'to @handle' + time, content indented, pill delete button with trash icon, hover lift.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/fedi-notifications.ejs

    r3d37c67 r2f42b60  
    66  <% } else { %>
    77    <ul class="nt-list">
    8       <% items.forEach(function(n){ %>
    9         <li class="nt-item">
    10           <span class="nt-icon"><%= n.type === 'follow' ? '👤' : (n.type === 'like' ? '⭐' : (n.type === 'announce' ? '🔁' : '💬')) %></span>
     8      <% items.forEach(function(n){
     9           var _ic = n.type === 'follow' ? 'follow' : (n.type === 'like' ? 'like' : (n.type === 'announce' ? 'boost' : 'reply'));
     10      %>
     11        <li class="nt-item nt-<%= _ic %>">
     12          <span class="nt-icon" aria-hidden="true">
     13            <% if (_ic === 'like') { %><svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.6l2.9 5.88 6.49.95-4.7 4.58 1.11 6.46L12 17.96l-5.8 3.06 1.1-6.46-4.69-4.58 6.49-.95z"/></svg>
     14            <% } else if (_ic === 'boost') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
     15            <% } else if (_ic === 'follow') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><line x1="19" y1="8" x2="19" y2="14"/><line x1="22" y1="11" x2="16" y2="11"/></svg>
     16            <% } else { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg><% } %>
     17          </span>
    1118          <div class="nt-body">
    1219            <div class="nt-line">
    1320              <a class="nt-who" href="<%= n.url %>" target="_blank" rel="nofollow noopener"><%= n.name || n.handle %></a>
    1421              <% if (n.handle && n.name) { %><span class="nt-handle"><%= n.handle %></span><% } %>
    15               <span class="nt-what">
    16                 <% if (n.type === 'follow') { %><%= t('notif.followed') %>
    17                 <% } else if (n.type === 'like') { %><%= t('notif.liked') %>
    18                 <% } else if (n.type === 'announce') { %><%= t('notif.boosted') %>
    19                 <% } else { %><%= t('notif.replied') %><% } %>
    20                 <% if (n.post_slug) { %><a href="/<%= n.post_slug %>"><%= n.post_title || n.post_slug %></a><% } %>
    21               </span>
    2222              <% if (n.created_at) { %><span class="nt-time"><%= formatDateTime(n.created_at) %></span><% } %>
     23            </div>
     24            <div class="nt-what">
     25              <% if (n.type === 'follow') { %><%= t('notif.followed') %>
     26              <% } else if (n.type === 'like') { %><%= t('notif.liked') %>
     27              <% } else if (n.type === 'announce') { %><%= t('notif.boosted') %>
     28              <% } else { %><%= t('notif.replied') %><% } %>
     29              <% if (n.post_slug) { %><a class="nt-post" href="/<%= n.post_slug %>"><%= n.post_title || n.post_slug %></a><% } %>
    2330            </div>
    2431            <% if (n.type === 'reply' && n.content) { %><div class="nt-content"><%- n.content %></div><% } %>
     
    3542  .nt-title { margin: 0 0 1.25rem; }
    3643  .nt-empty { color: var(--ink-soft, #888); }
    37   .nt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
    38   .nt-item { display: flex; gap: .7rem; padding: .7rem .9rem; border-radius: 12px; background: color-mix(in srgb, var(--ink, #000) 4%, transparent); border: 1px solid color-mix(in srgb, var(--ink, #000) 8%, transparent); }
    39   .nt-icon { font-size: 1.1rem; flex: 0 0 1.4rem; text-align: center; }
     44  .nt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
     45  .nt-item { display: flex; gap: .85rem; padding: .9rem 1rem; border-radius: 14px; align-items: flex-start;
     46    background: color-mix(in srgb, var(--ink, #000) 3.5%, transparent);
     47    border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent);
     48    transition: border-color .15s ease, box-shadow .15s ease; }
     49  .nt-item:hover { border-color: color-mix(in srgb, var(--accent, #888) 30%, transparent);
     50    box-shadow: 0 2px 12px color-mix(in srgb, var(--ink, #000) 6%, transparent); }
     51  .nt-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
     52    display: inline-flex; align-items: center; justify-content: center; }
     53  .nt-icon svg { width: 18px; height: 18px; }
     54  .nt-like .nt-icon { background: color-mix(in srgb, #e8b04b 16%, transparent); color: #e8b04b; }
     55  .nt-boost .nt-icon { background: color-mix(in srgb, #2fa85a 16%, transparent); color: #2fa85a; }
     56  .nt-follow .nt-icon, .nt-reply .nt-icon { background: color-mix(in srgb, var(--accent, #888) 16%, transparent); color: var(--accent, #06c); }
    4057  .nt-body { flex: 1; min-width: 0; }
    41   .nt-line { display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; }
    42   .nt-who { font-weight: 600; color: var(--ink, inherit); text-decoration: none; }
     58  .nt-line { display: flex; align-items: baseline; gap: .4rem; }
     59  .nt-who { font-weight: 700; color: var(--ink, inherit); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    4360  .nt-who:hover { text-decoration: underline; }
    44   .nt-handle { color: var(--ink-soft, #888); font-size: .82rem; }
    45   .nt-what { color: var(--ink-soft, #aaa); }
    46   .nt-what a { color: var(--accent, #06c); }
    47   .nt-time { color: var(--ink-soft, #999); font-size: .78rem; margin-left: auto; }
    48   .nt-content { margin: .3rem 0 0; line-height: 1.45; color: var(--ink, inherit); overflow-wrap: anywhere; }
    49   .nt-content p { margin: .2rem 0; } .nt-content p:first-child { margin-top: 0; }
     61  .nt-handle { color: var(--ink-soft, #888); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
     62  .nt-time { color: var(--ink-soft, #999); font-size: .76rem; margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
     63  .nt-what { color: var(--ink-soft, #aaa); margin-top: .12rem; line-height: 1.4; }
     64  .nt-post { color: var(--accent, #06c); font-weight: 600; }
     65  .nt-content { margin: .45rem 0 0; padding: .55rem .75rem; border-radius: 10px; line-height: 1.5;
     66    background: color-mix(in srgb, var(--ink, #000) 4%, transparent); color: var(--ink, inherit); overflow-wrap: anywhere; }
     67  .nt-content p { margin: .2rem 0; } .nt-content p:first-child { margin-top: 0; } .nt-content p:last-child { margin-bottom: 0; }
    5068</style>
Note: See TracChangeset for help on using the changeset viewer.