Add footer

This commit is contained in:
Dominic Ferrando
2025-04-23 22:07:16 -04:00
parent 71466e8f53
commit f04db77087
5 changed files with 27 additions and 7 deletions
+7
View File
@@ -389,3 +389,10 @@ hr {
height: 0; height: 0;
clear: left; clear: left;
} }
footer {
margin-top: 50px;
margin-bottom: 10px;
font-size: 10px;
text-align: center;
}
+4
View File
@@ -13,6 +13,10 @@ function isOffScreen(el) {
); );
} }
function scrollToBottom() {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
}
function isHttpWarningStatus(code) { function isHttpWarningStatus(code) {
const warningStatuses = [429, 400, 413]; const warningStatuses = [429, 400, 413];
return warningStatuses.includes(code); return warningStatuses.includes(code);
+1
View File
@@ -118,4 +118,5 @@ templ ThreadsCatalog(previews []CatalogThreadPreview, catalogContext CatalogCont
</div> </div>
} }
</div> </div>
<hr/>
} }
+3
View File
@@ -28,5 +28,8 @@ templ Layout() {
</div> </div>
{ children... } { children... }
</body> </body>
<footer>
<p>All trademarks, copyrights, comments, and images on this page are owned by and are the responsibility of their respective parties.</p>
</footer>
</html> </html>
} }
+12 -7
View File
@@ -185,6 +185,15 @@ type ThreadContext struct {
IsAdmin bool IsAdmin bool
} }
templ ThreadActionBar(thread database.Thread) {
<hr/>
<div style="margin-left: 25px;">
<a href={ templ.URL("/" + thread.BoardSlug) } style="margin-right: 5px;" class="link-button">[Catalog]</a>
<a _="on click trigger refreshPosts on body" class="link-button">[Refresh]</a>
</div>
<hr/>
}
templ Thread(board database.Board, thread database.Thread, posts []database.Post, threadContext ThreadContext) { templ Thread(board database.Board, thread database.Thread, posts []database.Post, threadContext ThreadContext) {
@shared.Layout() { @shared.Layout() {
<script src="/static/thread.js" defer></script> <script src="/static/thread.js" defer></script>
@@ -192,19 +201,15 @@ templ Thread(board database.Board, thread database.Thread, posts []database.Post
<div class="new-post-container"> <div class="new-post-container">
@shared.NewPostForm(board, fmt.Sprintf("/%s/threads/%d", board.Slug, thread.Id), false) @shared.NewPostForm(board, fmt.Sprintf("/%s/threads/%d", board.Slug, thread.Id), false)
</div> </div>
<hr/> @ThreadActionBar(thread)
<div style="margin-left: 25px;">
<a href={ templ.URL("/" + thread.BoardSlug) } style="margin-right: 5px;" class="link-button">[Catalog]</a>
<a _="on click trigger refreshPosts on body" class="link-button">[Refresh]</a>
</div>
<hr/>
<div <div
class="thread" class="thread"
hx-get={ fmt.Sprintf("/hx/%s/threads/%d/posts", thread.BoardSlug, thread.Id) } hx-get={ fmt.Sprintf("/hx/%s/threads/%d/posts", thread.BoardSlug, thread.Id) }
hx-trigger="refreshPosts from:body" hx-trigger="refreshPosts from:body"
_="on htmx:afterSwap call insertHeaderReplies()" _="on htmx:afterSwap call insertHeaderReplies() then scrollToBottom()"
> >
@Posts(posts, thread, threadContext) @Posts(posts, thread, threadContext)
</div> </div>
@ThreadActionBar(thread)
} }
} }