Conditionally render admin basic

This commit is contained in:
Dominic Ferrando
2025-04-23 14:39:28 -04:00
parent a0f268b0d3
commit 098c65be70
3 changed files with 39 additions and 24 deletions
+5 -2
View File
@@ -18,7 +18,7 @@ templ BoardHeader(board database.Board) {
</header>
}
templ Board(board database.Board) {
templ Board(board database.Board, isAdmin bool) {
@shared.Layout() {
@BoardHeader(board)
<div class="new-post-container">
@@ -58,7 +58,7 @@ type CatalogThreadPreview struct {
IpCount int
}
templ ThreadsCatalog(previews []CatalogThreadPreview) {
templ ThreadsCatalog(previews []CatalogThreadPreview, isAdmin bool) {
<div id="catalog">
for _, preview := range previews {
{{ replyCount := strconv.FormatInt(int64(preview.ReplyCount), 10) }}
@@ -79,6 +79,9 @@ templ ThreadsCatalog(previews []CatalogThreadPreview) {
<p>
@templ.Raw(util.EnrichPost(preview.Body))
</p>
if isAdmin {
<button>X</button>
}
</div>
}
</div>