diff --git a/web/css/app.css b/web/css/app.css index 4898eab..9e4f485 100644 --- a/web/css/app.css +++ b/web/css/app.css @@ -244,8 +244,9 @@ img.avatar-lg { width: 72px; height: 72px; } /* Nur die Vorfahren bilden einen Thread -> Linie. Antworten nur eingerückt. */ #ancestors .threadline { border-right: var(--line-w) solid gray; } -/* Interaktionsleiste: Vote-Buttons zentriert (das Antworten-Label sitzt jetzt - oben in der Byline). */ +/* Interaktionsleiste: Antworten-Button links, Vote-Buttons mittig, Repost + rechts. Antwort- und Repost-Zahl stehen in den Buttons; der Repost-Cooldown + wandert in die Byline (siehe setupBump). */ .interactions { display: flex; align-items: center; diff --git a/web/js/feed.js b/web/js/feed.js index 8e8ec1d..e1a52e7 100644 --- a/web/js/feed.js +++ b/web/js/feed.js @@ -73,10 +73,12 @@ function renderEntry(e) { media = ``; } + // Antwort- und Repost-Zahl wandern in die Buttons unten; in der Byline bleibt + // nur Name, Zeit und (im Cooldown) der Hinweis bis zum nächsten Repost. el.innerHTML = `
- ${escapeHtml(e.username)} · ${when} · ${replyLabel} · ${repostLabel} + ${escapeHtml(e.username)} · ${when}
@@ -84,12 +86,13 @@ function renderEntry(e) {
${linkify(e.content)}
${media}
+ Antworten (${e.reply_count})
– / –
- +
@@ -137,16 +140,17 @@ function setupVoting(el, pid) { function setupBump(el, e) { const btn = el.querySelector(".bump"); if (!btn) return; + const cooldown = el.querySelector(".cooldown"); // sekunden bis zum nächsten erlaubten Bump aus den geladenen Daten. const nowSec = () => Math.floor(Date.now() / 1000); - // lock sperrt den Button und zeigt die grobe Restzeit (auf Tage aufgerundet, - // mindestens 1 -> nie "0 Tage", solange noch Restzeit übrig ist). + // lock sperrt den Button; die Restzeit steht jetzt oben in der Byline, auf + // Stunden aufgerundet (mindestens 1 -> nie "0h", solange Restzeit übrig ist). function lock(retryAfter) { btn.disabled = true; - const days = Math.max(1, Math.ceil(retryAfter / 86400)); - btn.textContent = `Repost (${days} ${days === 1 ? "Tag" : "Tage"})`; + const hours = Math.max(1, Math.ceil(retryAfter / 3600)); + if (cooldown) cooldown.textContent = ` · Repost in ${hours}h`; } const remaining = e.last_bump + e.bump_count * 86400 - nowSec(); @@ -155,8 +159,8 @@ function setupBump(el, e) { btn.addEventListener("click", async () => { const res = await api.post(`/entry/${e.pid}/bump`, new FormData()); if (res.ok) { - btn.disabled = true; - btn.textContent = "repostet"; + btn.textContent = `Repost (${res.data.bump_count})`; + lock(res.data.retry_after || 86400); } else if (res.status === 429) { lock(res.data.retry_after || 86400); } else {