Changeset 04c70fc in Klonkt


Ignore:
Timestamp:
06/27/2026 12:22:38 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
204bd74
Parents:
dd7daef
Message:

style(fedi): neater Edit button — pill in the foot row (left), like the other buttons

  • views/pages/authorize-interaction.ejs — the reply Edit toggle is now a pill button styled like Go-to-post / Delete, placed first (left) in the manage-card foot; Delete is pushed right. The edit textarea expands below via a small JS toggle (no more <details>). + CSS.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/authorize-interaction.ejs

    rdd7daef r04c70fc  
    3333            <div class="fedi-manage-content"><%- m.content %></div>
    3434            <div class="fedi-manage-foot">
     35              <button type="button" class="fedi-edit-btn" aria-expanded="false"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg> <%= t('fedi.edit') %></button>
    3536              <% if (m.in_reply_to) { %>
    3637              <a class="fedi-goto-btn" href="<%= m.in_reply_to %>" target="_blank" rel="nofollow noopener"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 17 17 7"/><path d="M7 7h10v10"/></svg> <%= t('fedi.goto_post') %></a>
    37               <% } else { %><span></span><% } %>
    38               <form method="post" action="/fediverse/<%= m.id %>/delete" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
     38              <% } %>
     39              <form method="post" action="/fediverse/<%= m.id %>/delete" class="fedi-del-form" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
    3940                <button type="submit" class="fedi-del-btn"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg> <%= t('comments.delete') %></button>
    4041              </form>
    4142            </div>
    42             <details class="fedi-edit">
    43               <summary class="fedi-edit-toggle"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg> <%= t('fedi.edit') %></summary>
    44               <form method="post" action="/fediverse/<%= m.id %>/edit" class="fedi-edit-form">
    45                 <textarea name="text" rows="3" maxlength="2000" class="fedi-edit-ta"><%= m.editable %></textarea>
    46                 <div class="fedi-edit-actions"><button type="submit" class="fedi-edit-save"><%= t('fedi.save_edit') %></button></div>
    47               </form>
    48             </details>
     43            <form method="post" action="/fediverse/<%= m.id %>/edit" class="fedi-edit-form">
     44              <textarea name="text" rows="3" maxlength="2000" class="fedi-edit-ta"><%= m.editable %></textarea>
     45              <div class="fedi-edit-actions"><button type="submit" class="fedi-edit-save"><%= t('fedi.save_edit') %></button></div>
     46            </form>
    4947          </li>
    5048        <% }); %>
    5149      </ul>
     50      <script>
     51      (function () {
     52        if (window.__fediEditWired) return; window.__fediEditWired = true;
     53        document.addEventListener('click', function (e) {
     54          var b = e.target.closest && e.target.closest('.fedi-edit-btn');
     55          if (!b) return;
     56          var li = b.closest('.fedi-manage-item'); if (!li) return;
     57          var form = li.querySelector('.fedi-edit-form'); if (!form) return;
     58          var open = form.classList.toggle('is-open');
     59          b.classList.toggle('is-open', open);
     60          b.setAttribute('aria-expanded', open ? 'true' : 'false');
     61          if (open) { var ta = form.querySelector('textarea'); if (ta) ta.focus(); }
     62        });
     63      })();
     64      </script>
    5265    <% } %>
    5366    <p class="auth-interact-note"><a href="/"><%= t('fedi.remote_back') %></a></p>
     
    209222  .fedi-manage-content p:first-child { margin-top: 0; }
    210223  .fedi-manage-content p:last-child { margin-bottom: 0; }
    211   .fedi-manage-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .65rem; }
     224  .fedi-manage-foot { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
    212225  .fedi-goto-btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid color-mix(in srgb, var(--accent, #888) 45%, transparent); background: color-mix(in srgb, var(--accent, #888) 12%, transparent); color: var(--accent, #06c); border-radius: 999px; padding: .3rem .8rem; font-size: .82rem; text-decoration: none; transition: background .15s ease; }
    213226  .fedi-goto-btn:hover { background: color-mix(in srgb, var(--accent, #888) 22%, transparent); }
     
    224237  @keyframes fedi-bm-nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
    225238  .fedi-bm-help { color: var(--ink-soft, #888); font-size: .82rem; line-height: 1.5; margin: .6rem 0 0; }
    226   .fedi-edit { margin: .4rem 0 0; }
    227   .fedi-edit > summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; list-style: none;
    228     font-size: .78rem; font-weight: 600; color: var(--ink-soft, #888); padding: .2rem 0; }
    229   .fedi-edit > summary::-webkit-details-marker { display: none; }
    230   .fedi-edit[open] > summary { color: var(--accent); }
    231   .fedi-edit-form { margin: .5rem 0 0; }
     239  .fedi-edit-btn { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid color-mix(in srgb, var(--ink, #888) 28%, transparent);
     240    background: color-mix(in srgb, var(--ink, #888) 8%, transparent); color: var(--ink-soft, #aaa); border-radius: 999px; padding: .3rem .8rem;
     241    font: inherit; font-size: .82rem; cursor: pointer; transition: background .15s ease, color .15s ease; }
     242  .fedi-edit-btn:hover { background: color-mix(in srgb, var(--ink, #888) 16%, transparent); }
     243  .fedi-edit-btn.is-open { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
     244  .fedi-del-form { margin-left: auto; }
     245  .fedi-edit-form { display: none; margin: .55rem 0 0; }
     246  .fedi-edit-form.is-open { display: block; }
    232247  .fedi-edit-ta { width: 100%; box-sizing: border-box; min-height: 70px; resize: vertical; padding: .55rem .7rem;
    233248    border: 1.5px solid var(--rule, #333); border-radius: 10px; background: var(--paper-2, #14141a); color: var(--ink, #eee); font: inherit; font-size: .9rem; }
Note: See TracChangeset for help on using the changeset viewer.