Small fixes and adjustments to thread list.
This commit is contained in:
parent
8910e55ad1
commit
ca0de4d2ae
2 changed files with 14 additions and 10 deletions
|
|
@ -1050,9 +1050,10 @@ routes:
|
||||||
where thread = ?
|
where thread = ?
|
||||||
order by creation asc limit 1;"""
|
order by creation asc limit 1;"""
|
||||||
const usersListQuery =
|
const usersListQuery =
|
||||||
sql"""select distinct name, email, strftime('%s',lastOnline)
|
sql"""select distinct name, email, strftime('%s', lastOnline)
|
||||||
from person where id in
|
from person where id in
|
||||||
(select author from post where thread = ?);"""
|
(select author from post where thread = ?)
|
||||||
|
limit 5;""" # TODO: Order by most posts.
|
||||||
|
|
||||||
let thrCount = getValue(db, sql"select count(*) from thread;").parseInt()
|
let thrCount = getValue(db, sql"select count(*) from thread;").parseInt()
|
||||||
let moreCount = max(0, thrCount - (start + count))
|
let moreCount = max(0, thrCount - (start + count))
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ when defined(js):
|
||||||
img(src=user.avatarUrl, title=user.name)
|
img(src=user.avatarUrl, title=user.name)
|
||||||
if user.isOnline:
|
if user.isOnline:
|
||||||
italic(class="avatar-presense online")
|
italic(class="avatar-presense online")
|
||||||
|
text " "
|
||||||
|
|
||||||
proc renderActivity(activity: int64): string =
|
proc renderActivity(activity: int64): string =
|
||||||
let currentTime = getTime()
|
let currentTime = getTime()
|
||||||
|
|
@ -66,6 +67,7 @@ when defined(js):
|
||||||
italic(class="fas fa-lock fa-xs")
|
italic(class="fas fa-lock fa-xs")
|
||||||
text thread.topic
|
text thread.topic
|
||||||
td():
|
td():
|
||||||
|
if thread.category.id.len > 0:
|
||||||
tdiv(class="triangle",
|
tdiv(class="triangle",
|
||||||
style=style(
|
style=style(
|
||||||
(StyleAttr.borderBottom, kstring"0.6rem solid " & thread.category.color)
|
(StyleAttr.borderBottom, kstring"0.6rem solid " & thread.category.color)
|
||||||
|
|
@ -79,7 +81,7 @@ when defined(js):
|
||||||
"super-popular-text": thread.views > 5000
|
"super-popular-text": thread.views > 5000
|
||||||
})):
|
})):
|
||||||
if thread.views > 999:
|
if thread.views > 999:
|
||||||
text fmt"{thread.views/1000:.1f}"
|
text fmt"{thread.views/1000:.1f}k"
|
||||||
else:
|
else:
|
||||||
text $thread.views
|
text $thread.views
|
||||||
td(class=class({"text-success": isNew, "text-gray": not isNew})): # TODO: Colors.
|
td(class=class({"text-success": isNew, "text-gray": not isNew})): # TODO: Colors.
|
||||||
|
|
@ -93,7 +95,7 @@ when defined(js):
|
||||||
tr:
|
tr:
|
||||||
th(text "Topic")
|
th(text "Topic")
|
||||||
th(text "Category")
|
th(text "Category")
|
||||||
th(text "Users")
|
th(style=style((StyleAttr.width, kstring"8rem"))): text "Users"
|
||||||
th(text "Replies")
|
th(text "Replies")
|
||||||
th(text "Views")
|
th(text "Views")
|
||||||
th(text "Activity")
|
th(text "Activity")
|
||||||
|
|
@ -103,7 +105,8 @@ when defined(js):
|
||||||
let isLastVisit =
|
let isLastVisit =
|
||||||
i+1 < list.threads.len and list.threads[i].activity < list.lastVisit
|
i+1 < list.threads.len and list.threads[i].activity < list.lastVisit
|
||||||
let isNew = thread.creation < list.lastVisit
|
let isNew = thread.creation < list.lastVisit
|
||||||
genThread(thread, isNew, noBorder=isLastVisit)
|
genThread(thread, isNew,
|
||||||
|
noBorder=isLastVisit or i+1 == list.threads.len)
|
||||||
if isLastVisit:
|
if isLastVisit:
|
||||||
tr(class="last-visit-separator"):
|
tr(class="last-visit-separator"):
|
||||||
td(colspan="6"):
|
td(colspan="6"):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue