source: Klonkt/src/views/pages/authorize-interaction.ejs@ b6cdc3d

main
Last change on this file since b6cdc3d was b6cdc3d, checked in by Robin Genis <roboburr@…>, 3 months ago

feat(fedi): like/boost/reply on the interaction page + display-only stats

  • Post 'From the fediverse' stats (like/boost/reply) are now display-only counters (the star is no longer a button). One CTA, renamed 'Interact via the fediverse'.
  • The /authorize_interaction page now offers Like AND Boost (next to reply), via a new POST /authorize_interaction/boost (Undo-able later; markBoosted so it shows in the Cirkel if it's in your timeline).
  • The 'view the full post + replies on the source' link is now a prominent button.
  • i18n nl/en/de: fedi.boost_btn, fedi.boosted_title/_done, fedi.remote_interact.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 9.9 KB
Line 
1<div class="auth-interact">
2 <% if (typeof manage !== 'undefined' && manage) { %>
3 <h1 class="auth-interact-title"><%= t('fedi.manage_title') %></h1>
4 <% if (!manage.length) { %>
5 <p class="auth-interact-note"><%= t('fedi.manage_empty') %></p>
6 <% } else { %>
7 <ul class="fedi-manage">
8 <% manage.forEach(function(m){ %>
9 <li class="fedi-manage-item">
10 <div class="fedi-manage-content"><%- m.content %></div>
11 <div class="fedi-manage-foot">
12 <span class="fedi-manage-meta"><% if (m.to_handle) { %>→ <%= m.to_handle %><% } %><% if (m.created_at && typeof formatDateTime === 'function') { %> · <%= formatDateTime(m.created_at) %><% } %></span>
13 <form method="post" action="/fediverse/<%= m.id %>/delete" onsubmit="return confirm('<%= t('fedi.delete_confirm') %>')">
14 <button type="submit" class="fedi-del-btn"><%= t('comments.delete') %></button>
15 </form>
16 </div>
17 </li>
18 <% }); %>
19 </ul>
20 <% } %>
21 <p class="auth-interact-note"><a href="/"><%= t('fedi.remote_back') %></a></p>
22 <% } else if (typeof liked !== 'undefined' && liked) { %>
23 <h1 class="auth-interact-title">★ <%= t('fedi.liked_title') %></h1>
24 <p class="auth-interact-note"><%= t('fedi.liked_done') %></p>
25 <p class="auth-interact-actions">
26 <% if (uri) { %><a class="btn" href="<%= uri %>" rel="nofollow noopener"><%= t('fedi.remote_view_original') %></a><% } %>
27 <a class="btn btn-primary" href="/"><%= t('fedi.remote_back') %></a>
28 </p>
29 <% } else if (typeof boosted !== 'undefined' && boosted) { %>
30 <h1 class="auth-interact-title">🔁 <%= t('fedi.boosted_title') %></h1>
31 <p class="auth-interact-note"><%= t('fedi.boosted_done') %></p>
32 <p class="auth-interact-actions">
33 <% if (uri) { %><a class="btn" href="<%= uri %>" rel="nofollow noopener"><%= t('fedi.remote_view_original') %></a><% } %>
34 <a class="btn btn-primary" href="/"><%= t('fedi.remote_back') %></a>
35 </p>
36 <% } else if (typeof followed !== 'undefined' && followed) { %>
37 <h1 class="auth-interact-title"><%= t('fedi.followed_title') %></h1>
38 <p class="auth-interact-note"><%= t('fedi.followed_done') %></p>
39 <p class="auth-interact-actions">
40 <% if (uri) { %><a class="btn" href="<%= uri %>" rel="nofollow noopener"><%= t('fedi.view_profile') %></a><% } %>
41 <a class="btn btn-primary" href="/"><%= t('fedi.remote_back') %></a>
42 </p>
43 <% } else if (typeof sent !== 'undefined' && sent) { %>
44 <h1 class="auth-interact-title"><%= t('fedi.remote_sent_title') %></h1>
45 <p class="auth-interact-note"><%= t('fedi.remote_sent') %></p>
46 <p class="auth-interact-actions">
47 <% if (uri) { %><a class="btn btn-primary" href="<%= uri %>" rel="nofollow noopener"><%= t('fedi.remote_view_original') %></a><% } %>
48 <a class="btn" href="/"><%= t('fedi.remote_back') %></a>
49 </p>
50 <% } else if (typeof followTarget !== 'undefined' && followTarget) { %>
51 <h1 class="auth-interact-title"><%= t('fedi.follow_heading') %></h1>
52 <p class="auth-interact-meta">
53 <%= t('fedi.follow_intro') %>
54 <a href="<%= followTarget.actor_url %>" rel="nofollow noopener" target="_blank"><strong><%= followTarget.actor_name %></strong></a>
55 <span class="fedi-handle"><%= followTarget.actor_handle %></span>
56 </p>
57 <form method="post" action="/authorize_interaction/follow" class="auth-interact-form">
58 <input type="hidden" name="uri" value="<%= followTarget.actor_uri %>">
59 <div class="auth-interact-actions">
60 <button type="submit" class="btn btn-primary"><%= t('fedi.follow_btn') %></button>
61 <a href="/" class="btn"><%= t('comments.cancel') %></a>
62 </div>
63 </form>
64 <p class="auth-interact-note"><%= t('fedi.remote_as', { site: siteTitle }) %></p>
65 <% } else { %>
66 <h1 class="auth-interact-title"><%= t('fedi.remote_title') %></h1>
67
68 <% if (!target) { %>
69 <p class="auth-interact-note"><%= t('fedi.remote_notfound') %></p>
70 <form method="get" action="/authorize_interaction" class="auth-interact-form">
71 <input type="url" name="uri" placeholder="https://…/een-post" value="<%= uri || '' %>" required>
72 <button type="submit" class="btn btn-primary"><%= t('fedi.remote_load') %></button>
73 </form>
74 <% } else { %>
75 <p class="auth-interact-meta">
76 <%= t('fedi.remote_replying_to') %>
77 <a href="<%= target.actor_url %>" rel="nofollow noopener" target="_blank"><strong><%= target.actor_name %></strong></a>
78 <span class="fedi-handle"><%= target.actor_handle %></span>
79 </p>
80 <blockquote class="auth-interact-preview">
81 <% if (target.content) { %><div class="auth-interact-content"><%- target.content %></div>
82 <% } else if (target.preview) { %><%= target.preview %><% } %>
83 <% (target.images || []).forEach(function(im){ %>
84 <img class="auth-interact-img" src="<%= im %>" alt="" loading="lazy">
85 <% }); %>
86 </blockquote>
87 <% if (target.url || uri) { %>
88 <a class="auth-view-src" href="<%= target.url || uri %>" target="_blank" rel="nofollow noopener">
89 <svg viewBox="0 0 24 24" width="17" height="17" 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>
90 <span><%= t('fedi.remote_view_original') %></span>
91 </a>
92 <% } %>
93 <div class="auth-interact-react">
94 <form method="post" action="/authorize_interaction/like">
95 <input type="hidden" name="uri" value="<%= uri %>">
96 <button type="submit" class="btn btn-primary auth-like-btn">★ <%= t('fedi.like_btn') %></button>
97 </form>
98 <form method="post" action="/authorize_interaction/boost">
99 <input type="hidden" name="uri" value="<%= uri %>">
100 <button type="submit" class="btn auth-boost-btn">🔁 <%= t('fedi.boost_btn') %></button>
101 </form>
102 </div>
103 <p class="auth-interact-or"><%= t('fedi.or_reply') %></p>
104 <p class="auth-interact-where">💬 <%= t('fedi.reply_where') %></p>
105 <form method="post" action="/authorize_interaction" class="auth-interact-form">
106 <input type="hidden" name="uri" value="<%= uri %>">
107 <textarea name="text" rows="4" required placeholder="<%= t('fedi.reply_ph') %>"></textarea>
108 <div class="auth-interact-actions">
109 <button type="submit" class="btn"><%= t('fedi.send') %></button>
110 <a href="<%= uri %>" class="btn"><%= t('comments.cancel') %></a>
111 </div>
112 </form>
113 <p class="auth-interact-note"><%= t('fedi.remote_as', { site: siteTitle }) %></p>
114 <% } %>
115 <% } %>
116</div>
117
118<style>
119 .auth-interact { max-width: 580px; margin: 2rem auto; padding: 0 1rem; }
120 .auth-interact-title { margin: 0 0 1rem; }
121 .auth-interact-meta { color: var(--ink-soft, #888); margin: 0 0 .75rem; }
122 .auth-interact-preview {
123 margin: 0 0 1rem; padding: .75rem 1rem; border-left: 3px solid var(--accent, #888);
124 background: color-mix(in srgb, var(--ink, #000) 4%, transparent); border-radius: 0 12px 12px 0;
125 color: var(--ink, inherit);
126 }
127 .auth-interact-form { display: flex; flex-direction: column; gap: .75rem; }
128 .auth-interact-form textarea, .auth-interact-form input[type=url] {
129 width: 100%; box-sizing: border-box; padding: .6rem .8rem; font: inherit; resize: vertical;
130 border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent);
131 background: var(--paper, #fff); color: var(--ink, #000);
132 }
133 .auth-interact-actions { display: flex; gap: .5rem; align-items: center; }
134 .auth-interact-note { color: var(--ink-soft, #999); font-size: .85rem; margin-top: 1rem; }
135 .auth-interact-where { margin: .25rem 0 .85rem; padding: .6rem .8rem; font-size: .85rem; line-height: 1.5; border-radius: 10px; background: color-mix(in srgb, var(--accent, #888) 12%, transparent); color: var(--ink, inherit); }
136 .auth-interact-content { line-height: 1.55; }
137 .auth-interact-content p { margin: .35rem 0; }
138 .auth-interact-content p:first-child { margin-top: 0; }
139 .auth-interact-img { max-width: 100%; height: auto; border-radius: 10px; margin: .5rem 0 0; display: block; }
140 .auth-interact-orig { margin: .75rem 0 0; font-size: .85rem; }
141 .auth-interact-orig a { color: var(--accent, #06c); }
142 .auth-view-src { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1.1rem; padding: .6rem 1rem;
143 border: 1px solid color-mix(in srgb, var(--accent, #888) 45%, transparent); border-radius: 12px;
144 background: color-mix(in srgb, var(--accent, #888) 10%, transparent); color: var(--accent, #06c);
145 text-decoration: none; font-weight: 600; font-size: .92rem; transition: background .15s, border-color .15s; }
146 .auth-view-src:hover { background: color-mix(in srgb, var(--accent, #888) 18%, transparent); border-color: var(--accent, #888); }
147 .auth-interact-react { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 .25rem; }
148 .auth-interact-react form { margin: 0; }
149 .auth-boost-btn { white-space: nowrap; }
150 .fedi-manage { list-style: none; padding: 0; margin: 1.25rem 0 1rem; display: flex; flex-direction: column; gap: .7rem; }
151 .fedi-manage-item { padding: .85rem 1rem; border-radius: 14px; background: color-mix(in srgb, var(--ink, #000) 4%, transparent); border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent); }
152 .fedi-manage-content { line-height: 1.5; overflow-wrap: anywhere; }
153 .fedi-manage-content p { margin: .15rem 0; }
154 .fedi-manage-content p:first-child { margin-top: 0; }
155 .fedi-manage-content p:last-child { margin-bottom: 0; }
156 .fedi-manage-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .6rem; flex-wrap: wrap; }
157 .fedi-manage-meta { color: var(--ink-soft, #999); font-size: .8rem; }
158 .fedi-del-btn { border: 1px solid color-mix(in srgb, #d9534f 50%, transparent); background: color-mix(in srgb, #d9534f 12%, transparent); color: #e06b66; border-radius: 8px; padding: .3rem .75rem; font-size: .82rem; cursor: pointer; transition: background .15s ease; }
159 .fedi-del-btn:hover { background: color-mix(in srgb, #d9534f 24%, transparent); }
160</style>
Note: See TracBrowser for help on using the repository browser.