dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 47788945137533439b5687e8656f84e2e24db660
parent aa1339fc6df3bb6c6946489df0a183ac49975c3c
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 19 Dec 2023 22:21:40 -0500

Add chat to poker page

Diffstat:
Mpkg/web/handlers/api/v1/chat.go | 6++++++
Mpkg/web/handlers/api/v1/data.go | 1+
Mpkg/web/handlers/api/v1/messages.qtpl | 2+-
Mpkg/web/handlers/api/v1/messages.qtpl.go | 2+-
Mpkg/web/handlers/poker/poker.go | 7+++++++
5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go @@ -117,6 +117,12 @@ func ChatStreamMessagesHandler(c echo.Context) error { data.TopBarQueryParams = "&ml=1" } + if authUser.HideRightColumn { + data.HideRightColumn = true + } else if _, found := c.QueryParams()["hrm"]; found { + data.HideRightColumn = true + } + // Register modals and send the css for them modalsManager := streamModals.NewModalsManager() modalsManager.Register(streamModals.NewCodeModal(authUser.ID, room)) diff --git a/pkg/web/handlers/api/v1/data.go b/pkg/web/handlers/api/v1/data.go @@ -36,6 +36,7 @@ type ChatMenuData struct { RoomName string TopBarQueryParams string PreventRefresh bool + HideRightColumn bool } type ChatMessagesData struct { diff --git a/pkg/web/handlers/api/v1/messages.qtpl b/pkg/web/handlers/api/v1/messages.qtpl @@ -175,7 +175,7 @@ .hb-row { background-color: rgba(0, 0, 0, 0.7); opacity: {%f AuthUser.GetHellbanOpacityF64() %}; } .own-highlight { background-color: rgba(255,241,176,0.05); } .read-marker { border-style: outset; border-top: {%dl AuthUser.ChatReadMarkerSize %}px solid {%s AuthUser.ChatReadMarkerColor %}; } - #msgs { {% if !AuthUser.HideRightColumn %}width: calc(100% - 185px); float: left; {% endif %}line-height: 1.2; } + #msgs { {% if !Data.HideRightColumn %}width: calc(100% - 185px); float: left; {% endif %}line-height: 1.2; } #no-msg { padding-left: 10px; color: #ddd; } #rgt-pane-w { width: 150px; height: 100%; position: fixed; right: 15px; overflow-y: auto; } #rgt-pane { line-height: 1.15; } diff --git a/pkg/web/handlers/api/v1/messages.qtpl.go b/pkg/web/handlers/api/v1/messages.qtpl.go @@ -231,7 +231,7 @@ func StreamGenerateStyle(qw422016 *qt422016.Writer, AuthUser *database.User, Dat qw422016.N().S(`; } #msgs { `) //line messages.qtpl:178 - if !AuthUser.HideRightColumn { + if !Data.HideRightColumn { //line messages.qtpl:178 qw422016.N().S(`width: calc(100% - 185px); float: left; `) //line messages.qtpl:178 diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1603,6 +1603,10 @@ func BuildBaseHtml(g *PokerGame, authUser *database.User) (html string) { html += buildGameDiv(g, authUser) html += buildSoundsHtml(authUser) html += buildHelpHtml() + html += `<div id="chat-div">` + html += ` <iframe id="chat-top-bar" name="iframe1" src="/api/v1/chat/top-bar/general" sandbox="allow-forms allow-scripts allow-same-origin allow-top-navigation-by-user-activation"></iframe>` + html += ` <iframe id="chat-content" name="iframe2" src="/api/v1/chat/messages/general/stream?hrm=1&hactions=1"></iframe>` + html += `</div>` html += `<iframe src="/poker/` + roomID.String() + `/logs" id="eventLogs"></iframe>` if ongoing != nil { @@ -2185,6 +2189,9 @@ body { padding: 2px 3px; border-radius: 3px; } +#chat-div { position: absolute; bottom: 0px; right: 320px; width: 600px; height: 250px; } +#chat-top-bar { height: 57px; width: 100%; } +#chat-content { height: 193px; width: 100%; background-color: #222; } #eventLogs { position: absolute; bottom: 5px; right: 5px; width: 300px; height: 200px; border: 1px solid black; background-color: #ccc; padding: 3px; border-radius: 3px; } #dealerToken { top: 125px; left: 714px; width: 20px; height: 20px; background-color: #ccc; border: 1px solid #333; border-radius: 11px; position: absolute; } #dealerToken .inner { padding: 2px 4px; }