commit d3c1f2b80e753f96ce5c9bc0ae549c191a05d56b
parent b50b4d62bec967932299e11a7bdbbef29f5efe32
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 2 Feb 2023 21:07:38 -0800
add current time in messages template
Diffstat:
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/api/v1/data.go b/pkg/web/handlers/api/v1/data.go
@@ -4,6 +4,7 @@ import (
"dkforest/pkg/database"
"dkforest/pkg/managers"
"encoding/json"
+ "time"
)
type chatTopBarData struct {
@@ -35,6 +36,7 @@ type chatMessagesData struct {
OfficialRooms []database.ChatRoomAug
SubscribedRooms []database.ChatRoomAug
ForceManualRefresh bool
+ Now time.Time
Error string
ErrorTs int64
}
diff --git a/pkg/web/handlers/api/v1/handlers.go b/pkg/web/handlers/api/v1/handlers.go
@@ -126,6 +126,7 @@ func ChatMessagesHandler(c echo.Context) error {
database.UpdateChatReadRecord(authUser.ID, room.ID)
var data chatMessagesData
+ data.Now = time.Now().UTC()
data.Error = c.QueryParam("error")
if data.Error != "" {
diff --git a/pkg/web/public/views/pages/chat-messages.gohtml b/pkg/web/public/views/pages/chat-messages.gohtml
@@ -166,6 +166,7 @@
.mt-10px { margin-top: 10px; }
.notif, .notif:hover { color: #e74c3c; }
#msg-err { background-color: #8f2d2d; color: #ffffff; padding: 1px 5px 2px 5px; display: block; text-decoration: none; }
+ .curr-time { position: absolute; bottom: 0; right: 15px; color: #999; font-family: 'Courier New', Courier, monospace; font-size: 14px; }
</style>
</head>
<body>
@@ -386,6 +387,7 @@
{{- end -}}
</div>
{{- end -}}
+ <div class="curr-time">{{ .Data.Now.Format "15:04:05" }}</div>
</div>
{{- end -}}