diff --git a/web/main.go b/web/main.go index a8210a7..496f7ea 100644 --- a/web/main.go +++ b/web/main.go @@ -277,7 +277,7 @@ func main() { } // dont pass the op post. only replies - views.ThreadPosts(posts[1:]).Render(r.Context(), w) + views.PostReplies(posts[1:]).Render(r.Context(), w) }) // ----------------- diff --git a/web/static/index.css b/web/static/index.css index e4ded78..1ad5ae7 100644 --- a/web/static/index.css +++ b/web/static/index.css @@ -175,6 +175,7 @@ body { } .post-header { + clear: none; margin-bottom: 10px; } @@ -186,19 +187,20 @@ body { color: #13A82A; } -.post-img-container { +.post-img { + display: block; float: left; margin: 4px 12px 4px 0; -} - -.post-img { cursor: pointer; height: auto; max-width: 100%; } .post-body { - overflow-wrap: break-word; + margin-top: 10px; + margin-left: 5px; + clear: none; + word-wrap: break-word; line-height: 1.3; } @@ -211,6 +213,12 @@ body { color: #789922 } +.post-filename { + color: rgb(52, 52, 92); + text-decoration: underline; + cursor: pointer; +} + .reply-link { color: #D00; text-decoration: underline; diff --git a/web/views/thread.templ b/web/views/thread.templ index b5bae01..769a341 100644 --- a/web/views/thread.templ +++ b/web/views/thread.templ @@ -8,31 +8,22 @@ import ( "strconv" ) -func getPostClass(isOp bool) string { - if isOp { - return "post-op" - } - return "post" -} - -templ ThreadPost(post database.Post, thread *database.Thread) { - {{ isOp := thread != nil }} -
- if post.MediaPath != "" { -
- -
- } +templ PostOriginal(post database.Post, thread *database.Thread) { +
+
+ File: + + { post.MediaPath } + +
+
- if isOp && thread.Subject != "" { -

{ thread.Subject } -

- } +

{ thread.Subject } -

{ post.CreatedAt.Format("15:04") } @@ -42,17 +33,54 @@ templ ThreadPost(post database.Post, thread *database.Thread) { > No.{ strconv.Itoa(post.Id) } -
+
-

+

@templ.Raw(util.EnrichPost(post.Body))

} -templ ThreadPosts(posts []database.Post) { +templ PostReply(post database.Post) { +
+
+ + + { post.CreatedAt.Format("15:04") } + >%d\n'", post.Id) } + class=" post-num" + > + No.{ strconv.Itoa(post.Id) } + + +
+ if post.MediaPath != "" { +
+
+ File: + + { post.MediaPath } + +
+ +
+ } +

+ @templ.Raw(util.EnrichPost(post.Body)) +

+
+} + +templ PostReplies(posts []database.Post) { for _, post := range (posts) { - @ThreadPost(post, nil) + @PostReply(post)
} } @@ -97,13 +125,13 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
- @ThreadPost(posts[0], &thread) + @PostOriginal(posts[0], &thread)
- @ThreadPosts(posts[1:]) + @PostReplies(posts[1:])
}