source: Klonkt/src/views/pages/admin-circle.ejs@ 3bb8719

main
Last change on this file since 3bb8719 was 814ad8b, checked in by roboburr <roboburr@…>, 3 months ago

feat(circles): site name automatically from the remote actor (no manual input)

syncOne sets circle_links.label = actor.name (every sync, COALESCE fallback).
The manual name field in Admin -> Circles is gone; only the URL is needed.

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

  • Property mode set to 100644
File size: 7.7 KB
Line 
1<div class="container admin-page">
2 <h1><%= t('acir.title') %></h1>
3 <p><a href="/admin/settings" class="btn">&larr; <%= t('acir.back_settings') %></a></p>
4
5 <% if (success) { %><div class="alert alert-success"><%= success %></div><% } %>
6 <% if (error) { %><div class="alert alert-error"><%= error %></div><% } %>
7
8 <% if (tenancy !== 'circle') { %>
9 <section class="set-card">
10 <p class="set-help"><%= t('acir.mode_off_1') %> <strong><%= t('acir.circles') %></strong>. <%= t('acir.mode_off_2') %>
11 <a href="/admin/settings"><%= t('acir.settings') %></a> <%= t('acir.mode_off_3') %> <code>/cirkel</code>.
12 <%= t('acir.mode_off_4') %></p>
13 </section>
14 <% } %>
15
16 <section class="set-card" style="margin-top:1rem">
17 <h2><%= t('acir.visibility_title') %></h2>
18 <p class="set-help"><%= t('acir.visibility_help_1') %> <strong><%= t('acir.all_public') %></strong> <%= t('acir.visibility_help_2') %>
19 (<code>/.klonkt/outbox.json</code>). <%= t('acir.visibility_help_3') %></p>
20 <form method="post" action="/admin/circle/allow" class="set-form">
21 <label class="set-opt" style="align-items:center">
22 <input type="checkbox" name="allow_circle" value="on" <%= allowCircle ? 'checked' : '' %>>
23 <span><strong><%= t('acir.show_in_circles') %></strong></span>
24 </label>
25 <button type="submit" class="btn btn-primary"><%= t('acir.save') %></button>
26 </form>
27 </section>
28
29 <section class="set-card" style="margin-top:1rem">
30 <h2><%= t('acir.add_title') %></h2>
31 <p class="set-help"><%= t('acir.add_help') %></p>
32 <form method="post" action="/admin/circle/add" class="set-form">
33 <label class="set-field">
34 <span><%= t('acir.url') %></span>
35 <input type="text" name="remote_url" inputmode="url" autocapitalize="off" autocorrect="off" spellcheck="false" placeholder="artiest.klonkt.com" required>
36 </label>
37 <p class="set-help" style="margin:.2rem 0 .6rem"><%= t('acir.name_auto') %></p>
38 <button type="submit" class="btn btn-primary"><%= t('acir.add') %></button>
39 </form>
40 </section>
41
42 <section class="set-card" style="margin-top:1rem">
43 <h2><%= t('acir.in_circle', { n: links.length }) %></h2>
44 <% if (!links.length) { %>
45 <p class="set-help"><%= t('acir.no_sources') %></p>
46 <% } else { %>
47 <form method="post" action="/admin/circle/sync-all" style="margin:0 0 .9rem">
48 <button type="submit" class="btn">&#8635; <%= t('acir.sync_all') %></button>
49 </form>
50 <%
51 var _cActive = t('acir.st_active');
52 var _cPosts = t('acir.posts');
53 var _cLast = t('acir.last');
54 var _cMismatch = t('acir.st_mismatch');
55 var _cMismatchReason = t('acir.mismatch_reason');
56 var _cError = t('acir.st_error');
57 var _cPaused = t('acir.st_paused');
58 var _cRefresh = t('acir.refresh');
59 var _cRemove = t('acir.remove');
60 var _cRemoveConfirm = t('acir.remove_confirm');
61 %>
62 <ul class="circ-list">
63 <% links.forEach(function(l){ %>
64 <li class="circ-item">
65 <div class="circ-main">
66 <strong><%= l.label || l.remote_url %></strong>
67 <small><%= l.remote_url %></small>
68 <div class="circ-status">
69 <% if (l.status === 'active') { %>
70 <span class="circ-badge ok">&#10003; <%= _cActive %></span>
71 <span class="circ-meta"><%= counts[l.id] || 0 %> <%= _cPosts %><% if (l.last_synced) { %> &middot; <%= _cLast %>: <%= l.last_synced %><% } %></span>
72 <% } else if (l.status === 'outdated') { %>
73 <span class="circ-badge err">&#8635; <%= _cMismatch %></span>
74 <div class="circ-reason"><%= l.last_error || _cMismatchReason %></div>
75 <% } else if (l.status === 'error') { %>
76 <span class="circ-badge err">&#9888; <%= _cError %></span>
77 <% if (l.last_error) { %><div class="circ-reason"><%= l.last_error %></div><% } %>
78 <% } else if (l.status === 'paused') { %>
79 <span class="circ-badge">&#9208; <%= _cPaused %></span>
80 <% } else { %>
81 <%# Onbekende status: toon 'm rauw + eventuele reden i.p.v. stil "gepauzeerd". %>
82 <span class="circ-badge"><%= l.status %></span>
83 <% if (l.last_error) { %><div class="circ-reason"><%= l.last_error %></div><% } %>
84 <% } %>
85 </div>
86 </div>
87 <div class="circ-actions">
88 <form method="post" action="/admin/circle/<%= l.id %>/sync" style="display:inline">
89 <button type="submit" class="btn"><%= _cRefresh %></button>
90 </form>
91 <form method="post" action="/admin/circle/<%= l.id %>/remove" style="display:inline"
92 onsubmit="return confirm('<%= _cRemoveConfirm %>')">
93 <button type="submit" class="btn btn-danger"><%= _cRemove %></button>
94 </form>
95 </div>
96 </li>
97 <% }); %>
98 </ul>
99 <% } %>
100 </section>
101</div>
102
103<style>
104.admin-page { max-width: 760px; margin: 3rem auto; padding: 0 1rem; }
105.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 .25rem; }
106.set-card { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 12px; padding: 1.25rem; }
107.set-card h2 { font-family: var(--font-display, serif); font-size: 1.25rem; margin: 0 0 .5rem; }
108.set-help { color: var(--ink-muted); font-size: .9rem; margin: 0 0 1rem; }
109.set-form { display: flex; flex-direction: column; gap: 1rem; }
110.set-opt { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); }
111.set-field { display: flex; flex-direction: column; gap: .3rem; }
112.set-field > span { font-size: .8rem; font-weight: 600; color: var(--ink-soft, var(--ink-muted)); }
113.set-field input { width: 100%; box-sizing: border-box; padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; }
114.set-form .btn, .circ-actions .btn { align-self: flex-start; }
115.circ-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
116.circ-item { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem 1rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); flex-wrap: wrap; }
117.circ-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
118.circ-main small { color: var(--ink-muted); font-size: .78rem; word-break: break-all; }
119.circ-actions { display: flex; gap: .4rem; flex-shrink: 0; }
120.circ-badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 20px; background: var(--rule); white-space: nowrap; }
121.circ-badge.ok { background: #d1fae5; color: #065f46; }
122.circ-badge.err { background: #fee2e2; color: #991b1b; }
123.circ-status { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin-top: .25rem; font-size: .78rem; color: var(--ink-muted); }
124.circ-meta { color: var(--ink-muted); }
125/* Reden op een eigen regel onder de badge; normale woordafbreking (geen break-all
126 die hele zinnen midden in woorden knipt — dat zit op de URL-small, niet hier). */
127.circ-reason { flex-basis: 100%; line-height: 1.4; color: var(--ink-muted); word-break: normal; overflow-wrap: anywhere; }
128.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
129.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
130.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
131.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
132.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
133</style>
Note: See TracBrowser for help on using the repository browser.