From 62500d69dd9f301697a6414388d52a31890798a6 Mon Sep 17 00:00:00 2001 From: Alessio Date: Fri, 3 May 2024 15:10:14 -0700 Subject: [PATCH] Add header section to DM chat views --- internal/webserver/static/icons/info.svg | 1 + internal/webserver/static/styles.css | 32 +++++++++++++------ .../tweet_page_includes/chat_list_entry.tpl | 18 +---------- .../tpl/tweet_page_includes/chat_view.tpl | 12 +++++++ .../tpl/tweet_page_includes/single_tweet.tpl | 2 +- 5 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 internal/webserver/static/icons/info.svg diff --git a/internal/webserver/static/icons/info.svg b/internal/webserver/static/icons/info.svg new file mode 100644 index 0000000..a7338fb --- /dev/null +++ b/internal/webserver/static/icons/info.svg @@ -0,0 +1 @@ + diff --git a/internal/webserver/static/styles.css b/internal/webserver/static/styles.css index 12fc017..839868a 100644 --- a/internal/webserver/static/styles.css +++ b/internal/webserver/static/styles.css @@ -1202,16 +1202,6 @@ main { align-items: center; justify-content: space-between; } - .chat-list-entry__groupchat-profile-image { - display: flex; - } - .chat-list-entry__groupchat-profile-image .display-name { - padding: 0.6em; - font-style: italic; - font-weight: bold; /* TODO: redundancy check `.author-info__display-name` */ - white-space: nowrap; - cursor: default; /* TODO: redundancy check `.author-info` */ - } .chat-list-entry__preview-and-unread-container { justify-content: space-between; } @@ -1246,6 +1236,28 @@ main { } } +/** + * Groupchat info module (like Author Info but for group chats) + */ +.groupchat-info { + .groupchat-info__display-name { + padding: 0.6em; + font-style: italic; + font-weight: bold; /* TODO: redundancy check `.author-info__display-name` */ + white-space: nowrap; + cursor: default; /* TODO: redundancy check `.author-info` */ + } +} + +.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; +} + /** * DM message module */ diff --git a/internal/webserver/tpl/tweet_page_includes/chat_list_entry.tpl b/internal/webserver/tpl/tweet_page_includes/chat_list_entry.tpl index 12b6c36..5a7be53 100644 --- a/internal/webserver/tpl/tweet_page_includes/chat_list_entry.tpl +++ b/internal/webserver/tpl/tweet_page_includes/chat_list_entry.tpl @@ -7,23 +7,7 @@ hx-target="body" >
- {{if (eq $room.Type "ONE_TO_ONE")}} - {{range $room.Participants}} - {{if (ne .UserID (active_user).ID)}} - -
- {{template "author-info" (user .UserID)}} -
- {{end}} - {{end}} - {{else}} -
- {{template "circle-profile-img-no-link" (dict "IsContentDownloaded" false "ProfileImageUrl" $room.AvatarImageRemoteURL)}} -
-
{{$room.Name}}
-
-
- {{end}} + {{template "chat-profile-image" $room}}

{{$room.LastMessagedAt.Time.Format "Jan 2, 2006"}} diff --git a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl index 133fd60..aba7d2c 100644 --- a/internal/webserver/tpl/tweet_page_includes/chat_view.tpl +++ b/internal/webserver/tpl/tweet_page_includes/chat_view.tpl @@ -92,6 +92,18 @@ {{define "chat-view"}}

+ {{if $.ActiveRoomID}} +
+ {{ $room := (index $.Rooms $.ActiveRoomID) }} + {{template "chat-profile-image" $room}} + {{if (ne $room.Type "ONE_TO_ONE")}} + + + + + {{end}} +
+ {{end}}
{{if $.ActiveRoomID}} {{template "messages-with-poller" .}} diff --git a/internal/webserver/tpl/tweet_page_includes/single_tweet.tpl b/internal/webserver/tpl/tweet_page_includes/single_tweet.tpl index 6627ac6..69231a7 100644 --- a/internal/webserver/tpl/tweet_page_includes/single_tweet.tpl +++ b/internal/webserver/tpl/tweet_page_includes/single_tweet.tpl @@ -156,7 +156,7 @@