1
0
Fork 0
forked from Mirrors/gomuks

Render topic view in modern style

This commit is contained in:
FIGBERT 2023-03-07 23:06:02 -08:00
parent 80638d4a5b
commit 3f01535cdf
No known key found for this signature in database
GPG key ID: 67F1598D607A844B

View file

@ -131,9 +131,15 @@ func NewRoomView(parent *MainView, room *rooms.Room) *RoomView {
view.input.SetPlaceholder("Send an encrypted message...") view.input.SetPlaceholder("Send an encrypted message...")
} }
if view.config.Preferences.DisplayMode != config.DisplayModeModern {
view.topic. view.topic.
SetTextColor(tcell.ColorWhite). SetTextColor(tcell.ColorWhite).
SetBackgroundColor(tcell.ColorDarkGreen) SetBackgroundColor(tcell.ColorDarkGreen)
} else {
view.topic.
SetTextColor(tcell.ColorDefault).
SetTextAlign(mauview.AlignCenter)
}
view.status.SetBackgroundColor(tcell.ColorDimGray) view.status.SetBackgroundColor(tcell.ColorDimGray)
@ -333,6 +339,9 @@ func (view *RoomView) Draw(screen mauview.Screen) {
view.ulBorder.Draw(view.ulBorderScreen) view.ulBorder.Draw(view.ulBorderScreen)
view.userList.Draw(view.ulScreen) view.userList.Draw(view.ulScreen)
} }
if view.config.Preferences.DisplayMode == config.DisplayModeModern {
widget.NewBorder().Draw(mauview.NewProxyScreen(view.topicScreen, 2, 1, view.topicScreen.Width-5, 1))
}
} }
func (view *RoomView) ClearAllContext() { func (view *RoomView) ClearAllContext() {
@ -864,7 +873,9 @@ func (view *RoomView) MxRoom() *rooms.Room {
func (view *RoomView) Update() { func (view *RoomView) Update() {
topicStr := strings.TrimSpace(strings.ReplaceAll(view.Room.GetTopic(), "\n", " ")) topicStr := strings.TrimSpace(strings.ReplaceAll(view.Room.GetTopic(), "\n", " "))
if view.config.Preferences.HideRoomList || view.config.Preferences.DisplayMode == config.DisplayModeModern { if view.config.Preferences.DisplayMode == config.DisplayModeModern {
topicStr = view.Room.GetTitle()
} else if view.config.Preferences.HideRoomList {
if len(topicStr) > 0 { if len(topicStr) > 0 {
topicStr = fmt.Sprintf("%s - %s", view.Room.GetTitle(), topicStr) topicStr = fmt.Sprintf("%s - %s", view.Room.GetTitle(), topicStr)
} else { } else {