feat: remplacer les étoiles par les réactions dans le hero article

This commit is contained in:
Cedric Abonnel
2026-05-13 01:48:28 +02:00
parent f603c02c81
commit 86baf0bfbb
12 changed files with 410 additions and 92 deletions
-26
View File
@@ -18,32 +18,6 @@ $_csrfToken = bin2hex(random_bytes(16));
$_SESSION['comment_csrf'] = $_csrfToken;
?>
<!-- ── Réactions ──────────────────────────────────────────────────── -->
<div class="card mb-4" id="reactions">
<div class="card-body">
<h6 class="card-title mb-3 text-muted text-uppercase" style="font-size:.75rem;letter-spacing:.06em">Réactions</h6>
<div class="d-flex gap-2 flex-wrap" id="reaction-buttons">
<?php foreach ($_reactionDefs as $type => [$icon, $label]): ?>
<?php $active = in_array($type, $visitorReactions, true); ?>
<form method="post" action="/react" class="reaction-form d-inline">
<input type="hidden" name="uuid" value="<?= htmlspecialchars($article['uuid']) ?>">
<input type="hidden" name="type" value="<?= htmlspecialchars($type) ?>">
<input type="hidden" name="_back" value="/post/<?= rawurlencode($article['slug'] ?? '') ?>#reactions">
<button type="submit"
class="btn btn-sm <?= $active ? 'btn-primary' : 'btn-outline-secondary' ?> reaction-btn"
data-type="<?= htmlspecialchars($type) ?>"
data-uuid="<?= htmlspecialchars($article['uuid']) ?>">
<span class="reaction-icon"><?= $icon ?></span>
<span class="reaction-label"><?= htmlspecialchars($label) ?></span>
<span class="badge <?= $active ? 'bg-light text-primary' : 'bg-secondary' ?> ms-1 reaction-count"
data-type="<?= htmlspecialchars($type) ?>"><?= (int)($reactionStats[$type] ?? 0) ?></span>
</button>
</form>
<?php endforeach; ?>
</div>
</div>
</div>
<?php if (!empty($alsoReadArticles ?? [])): ?>
<!-- ── À lire aussi ──────────────────────────────────────────────── -->
<div class="also-read mb-4" id="also-read">