subredditsview: added button to add subreddit

This commit is contained in:
Tigor Hutasuhut 2024-05-02 21:26:28 +07:00
parent 08d81a2f94
commit 530723503e
2 changed files with 7 additions and 3 deletions

View file

@ -40,7 +40,7 @@ templ DetailsContent(c *views.Context, data Data) {
<button <button
hx-post="/htmx/subreddits/start" hx-post="/htmx/subreddits/start"
hx-include="this" hx-include="this"
class="btn btn-info" class="btn btn-primary text-base-100"
hx-target={ components.NotificationContainerID } hx-target={ components.NotificationContainerID }
hx-target-error={ components.NotificationContainerID } hx-target-error={ components.NotificationContainerID }
hx-swap="afterbegin" hx-swap="afterbegin"

View file

@ -19,12 +19,16 @@ templ SubredditContent(c *views.Context, data Data) {
<main class="prose min-w-full"> <main class="prose min-w-full">
@components.Container() { @components.Container() {
<h1>Subreddits</h1> <h1>Subreddits</h1>
<div class="divider"></div>
if data.Subreddits.Total == 0 { if data.Subreddits.Total == 0 {
<div class="divider"></div>
<h3>No Subreddits Found</h3> <h3>No Subreddits Found</h3>
<p>Click <a class="text-primary" href="/subreddits/add">here</a> to add a new subreddit.</p> <p>Click <a class="text-primary" href="/subreddits/add">here</a> to add a new subreddit.</p>
} else { } else {
<h2>{ strconv.FormatInt(data.Subreddits.Total, 10) } Subreddits Registered</h2> <div class="flex justify-between flex-wrap">
<h2 class="my-auto">{ strconv.FormatInt(data.Subreddits.Total, 10) } Subreddits Registered</h2>
<a class="btn btn-primary text-base-100 no-underline" href="/subreddits/add">Add Subreddit</a>
</div>
<div class="divider"></div>
} }
<div class="flex flex-wrap gap-1" hx-boost="true"> <div class="flex flex-wrap gap-1" hx-boost="true">
for _, subreddit := range data.Subreddits.Data { for _, subreddit := range data.Subreddits.Data {