fixed user comments UI

This commit is contained in:
orangix 2023-08-15 20:57:04 +02:00
parent 1c5479511b
commit 52dbf0195d
No known key found for this signature in database
GPG Key ID: C31D4A86601C8416
4 changed files with 38 additions and 40 deletions

View File

@ -1,7 +1,6 @@
package pages package pages
import ( import (
"fmt"
"strconv" "strconv"
"codeberg.org/rimgo/rimgo/utils" "codeberg.org/rimgo/rimgo/utils"
@ -97,8 +96,6 @@ func HandleUserComments(c *fiber.Ctx) error {
return err return err
} }
fmt.Println(comments[0].Post.Cover.Url) //FIXME:debug
return c.Render("userComments", fiber.Map{ return c.Render("userComments", fiber.Map{
"user": user, "user": user,
"comments": comments, "comments": comments,

View File

@ -1,15 +1,11 @@
<div class="flex flex-col gap-2"> <a href="{{Post.Link}}">
<img src="{{this.Post.Cover.Url}}" alt=""> <div class="flex flex-row gap-2 w-full bg-slate-600 p-2 rounded-lg">
<!-- https://codeberg.org/orangix/rimgo/src/branch/main/pages/user.go#L100 <img class="object-cover hidden sm:block w-[80px] h-[100px] rounded-lg" src="{{this.Post.Cover.Url}}" alt="">
The URL prints properly here, why doesn't it appear? <div class="flex flex-col gap-2">
Also TODO, covers can be videos, ???? -->
<div class="flex gap-2 items-center"> <div class="flex gap-2 items-center">
{{#noteq this.User.Username "[deleted]"}} {{#noteq this.User.Username "[deleted]"}}
<img src="{{this.User.Avatar}}" class="rounded-full" width="24" height="24" loading="lazy"> <img src="{{this.User.Avatar}}" class="rounded-full" width="24" height="24" loading="lazy">
<a href="/user/{{this.User.Username}}">
<p class="whitespace-nowrap text-ellipsis overflow-hidden"><b>{{this.User.Username}}</b></p> <p class="whitespace-nowrap text-ellipsis overflow-hidden"><b>{{this.User.Username}}</b></p>
</a>
{{/noteq}} {{/noteq}}
{{#equal this.User.Username "[deleted]"}} {{#equal this.User.Username "[deleted]"}}
<p class="whitespace-nowrap text-ellipsis overflow-hidden"><b>[deleted]</b></p> <p class="whitespace-nowrap text-ellipsis overflow-hidden"><b>[deleted]</b></p>
@ -29,11 +25,6 @@
{{this.Downvotes}} {{this.Downvotes}}
</div> </div>
</div> </div>
{{#if this.Comments}}
<div class="ml-4 p-2 border-solid border-l-2 border-slate-400">
{{#each this.Comments}}
{{> partials/comment }}
{{/each}}
</div> </div>
{{/if}} </div>
</div> </a>

View File

@ -21,6 +21,11 @@
<h2 class="font-bold text-2xl">{{user.Username}}</h2> <h2 class="font-bold text-2xl">{{user.Username}}</h2>
<p>{{user.Points}} pts · {{user.CreatedAt}}</p> <p>{{user.Points}} pts · {{user.CreatedAt}}</p>
</div> </div>
<hr class="sm:border-0 flex-grow">
<div class="flex flex-col sm:items-end">
<a href="/user/{{user.Username}}"><b>Submissions</b></a>
<a href="/user/{{user.Username}}/comments">Comments</a>
</div>
</div> </div>
<p class="mt-2">{{user.Bio}}</p> <p class="mt-2">{{user.Bio}}</p>
</header> </header>

View File

@ -21,6 +21,11 @@
<h2 class="font-bold text-2xl">{{user.Username}}</h2> <h2 class="font-bold text-2xl">{{user.Username}}</h2>
<p>{{user.Points}} pts · {{user.CreatedAt}}</p> <p>{{user.Points}} pts · {{user.CreatedAt}}</p>
</div> </div>
<hr class="sm:border-0 flex-grow">
<div class="flex flex-col sm:items-end">
<a href="/user/{{user.Username}}">Submissions</a>
<a href="/user/{{user.Username}}/comments"><b>Comments</b></a>
</div>
</div> </div>
<p class="mt-2">{{user.Bio}}</p> <p class="mt-2">{{user.Bio}}</p>
</header> </header>