Changeset 9d34855 in Klonkt for src/views/pages


Ignore:
Timestamp:
06/26/2026 11:50:14 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
0a75356
Parents:
c7ecaf9
Message:

fix(news): feed like is a toggle too (like/unlike), like boost

The feed star was fire-and-forget with no state. Now ap_timeline.liked remembers it,
the star shows an 'on' state, and a second click retracts via /news/unlike (Undo Like)
— mirroring the existing boost/unboost toggle. markLiked/unmarkLiked added.

File:
1 edited

Legend:

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

    rc7ecaf9 r9d34855  
    4747
    4848          <div class="tl-actions">
     49            <% if (p.liked) { %>
     50            <form method="post" action="/news/unlike" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act tl-act-like is-on" title="<%= t('fedi.unlike_short') %>" aria-label="<%= t('fedi.unlike_short') %>"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><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></button></form>
     51            <% } else { %>
    4952            <form method="post" action="/news/like" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act tl-act-like" title="<%= t('fedi.likes') %>" aria-label="<%= t('fedi.likes') %>"><svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><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></button></form>
     53            <% } %>
    5054            <% if (p.boosted) { %>
    5155            <form method="post" action="/news/unboost" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act tl-act-boost is-on" title="<%= t('tl.unboost') %>" aria-label="<%= t('tl.unboost') %>"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><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></button></form>
     
    126130  .tl-act-like svg { color: #e8b04b; }
    127131  .tl-act-like:hover { background: color-mix(in srgb, #e8b04b 15%, transparent); border-color: color-mix(in srgb, #e8b04b 50%, transparent); }
     132  .tl-act-like.is-on { background: color-mix(in srgb, #e8b04b 18%, transparent); border-color: color-mix(in srgb, #e8b04b 60%, transparent); }
    128133  .tl-act-boost svg { color: #2fa85a; }
    129134  .tl-act-boost:hover { background: color-mix(in srgb, #2fa85a 15%, transparent); border-color: color-mix(in srgb, #2fa85a 50%, transparent); }
Note: See TracChangeset for help on using the changeset viewer.