Make threads openable from catalog

This commit is contained in:
Dominic Ferrando
2025-04-18 11:21:47 -04:00
parent e53a65d437
commit a809b3c403
8 changed files with 134 additions and 68 deletions
-7
View File
@@ -1,7 +0,0 @@
package views
import "github.com/dominicf2001/comfychan/internal/database"
templ Post(board database.Board) {
BoardHeader(board)
}
-19
View File
@@ -1,19 +0,0 @@
package views
import "github.com/dominicf2001/comfychan/internal/database"
type ThreadGridBoxViewModel struct {
Thread database.Thread
Posts []database.Post
}
templ PostsCatalog(vms []ThreadGridBoxViewModel) {
<div id="catalog">
for _, vm := range vms {
<div class="catalog-post">
<h1><a class="catalog-post-link">{ vm.Thread.Subject }</a></h1>
<p>{ vm.Posts[0].Body }</p>
</div>
}
</div>
}
+12
View File
@@ -0,0 +1,12 @@
package views
import (
"github.com/dominicf2001/comfychan/internal/database"
"github.com/dominicf2001/comfychan/web/views/shared"
)
templ Thread(board database.Board, thread database.Thread, posts []database.Post) {
@shared.Layout() {
@BoardHeader(board)
}
}
+18
View File
@@ -0,0 +1,18 @@
package views
type CatalogThreadPreview struct {
Subject string
Body string
ThreadURL string
}
templ ThreadsCatalog(previews []CatalogThreadPreview) {
<div id="catalog">
for _, preview := range previews {
<div class="catalog-post">
<h1><a href={ templ.SafeURL(preview.ThreadURL) } class="catalog-post-link">{ preview.Subject }</a></h1>
<p>{ preview.Body }</p>
</div>
}
</div>
}