diff --git a/internal/webserver/static/styles.css b/internal/webserver/static/styles.css index c5b70cb..0ca62b6 100644 --- a/internal/webserver/static/styles.css +++ b/internal/webserver/static/styles.css @@ -248,14 +248,17 @@ main { flex-basis: 0; flex-grow: 7; border-left: 1px solid var(--color-outline-gray); - padding: 0.5em; box-sizing: border-box; display: flex; flex-direction: column; + /* To position the participants list page */ + position: relative; + .chat-messages { flex-grow: 1; overflow-y: auto; + padding: 0 0.5em; } } } @@ -1248,12 +1251,26 @@ main { } .chat-header { - border-bottom: 1px solid var(--color-outline-gray); - padding: 0.5em; - display: flex; - justify-content: space-around; - background-color: var(--color-twitter-off-white); - margin: -0.5em -0.5em 0 -0.5em; + border-bottom: 1px solid var(--color-outline-gray); + padding: 0.5em; + display: flex; + justify-content: space-around; + background-color: var(--color-twitter-off-white); +} + +.groupchat-participants-list { + position: absolute; + background-color: white; + top: 4.2em; /* TODO: wtf is this number */ + left: 0; + right: 0; + bottom: 0; + overflow-y: scroll; + display: none; + + &.unhidden { + display: revert; + } } /** diff --git a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl index e5ebfff..42af58a 100644 --- a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl +++ b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl @@ -102,7 +102,7 @@
{{if (ne $room.Type "ONE_TO_ONE")}} - + {{end}} @@ -121,7 +121,7 @@ {{if .ActiveRoomID}}
+ + {{ $room := (index $.Rooms $.ActiveRoomID) }} + {{if (ne $room.Type "ONE_TO_ONE")}} +
+
+ + + +

People

+
+ {{template "list" (dict "UserIDs" $room.GetParticipantIDs)}} +
+ {{end}} {{end}}
@@ -200,6 +213,18 @@ replied_to_message.classList.remove("highlighted"); }, 1000); } + + /** + * Show or hide the Participants view + */ + function toggle_participants_view() { + const panel = document.querySelector(".groupchat-participants-list"); + if (panel.classList.contains("unhidden")) { + panel.classList.remove("unhidden"); + } else { + panel.classList.add("unhidden"); + } + } {{end}} diff --git a/pkg/scraper/dm_chat_room.go b/pkg/scraper/dm_chat_room.go index 5f26faa..fc18dd6 100644 --- a/pkg/scraper/dm_chat_room.go +++ b/pkg/scraper/dm_chat_room.go @@ -45,6 +45,14 @@ type DMChatRoom struct { Participants map[UserID]DMChatParticipant } +func (r DMChatRoom) GetParticipantIDs() []UserID { + ret := []UserID{} + for user_id := range r.Participants { + ret = append(ret, user_id) + } + return ret +} + func ParseAPIDMChatRoom(api_room APIDMConversation) DMChatRoom { ret := DMChatRoom{} ret.ID = DMChatRoomID(api_room.ConversationID)