summaryrefslogtreecommitdiff
path: root/internal/client/ui/core/core.go
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-07-15 16:03:25 +0300
committerKyren223 <Kyren223@proton.me>2025-07-19 18:32:12 +0300
commit6e2ae280251991bf838ae73544d7ad5b714a5646 (patch)
tree3eb9bf3ffdc8100276f623e6573dc3db3cc635fe /internal/client/ui/core/core.go
parent95abbe573e6347797d2eadf3902a7af747d75a82 (diff)
Added toggleable borders (not fully fleshed)
Diffstat (limited to 'internal/client/ui/core/core.go')
-rw-r--r--internal/client/ui/core/core.go43
1 files changed, 37 insertions, 6 deletions
diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go
index 8b45cde..4c64c75 100644
--- a/internal/client/ui/core/core.go
+++ b/internal/client/ui/core/core.go
@@ -8,6 +8,7 @@ import (
"os"
"runtime"
"slices"
+ "strings"
"time"
"github.com/atotto/clipboard"
@@ -76,6 +77,14 @@ const (
Authenticated
)
+const (
+ VerticalBorder = "┃"
+ TopLeftCorner = "┏"
+ BottomLeftCorner = "┗"
+ TopRightCorner = "┓"
+ BottomRightCorner = "┛"
+)
+
type Model struct {
name string
privKey ed25519.PrivateKey
@@ -178,13 +187,32 @@ func (m Model) View() string {
}
chat := m.chat.View()
rightSidebar := m.memberList.View()
- result := lipgloss.JoinHorizontal(lipgloss.Top, networkList, leftSidebar, chat, rightSidebar)
- result = lipgloss.Place(
- ui.Width, ui.Height,
- lipgloss.Left, lipgloss.Top,
- result,
- )
+ leftBorder := ""
+ rightBorder := ""
+ if config.ReadConfig().ScreenBorders {
+ leftBorder = TopLeftCorner + strings.Repeat("\n"+VerticalBorder, ui.Height-2) + "\n" + BottomLeftCorner
+ if m.focus == FocusNetworkList {
+ leftBorder = lipgloss.NewStyle().Background(colors.BackgroundDimmer).Foreground(colors.Focus).Render(leftBorder)
+ } else {
+ leftBorder = lipgloss.NewStyle().Background(colors.BackgroundDimmer).Foreground(colors.White).Render(leftBorder)
+ }
+
+ rightBorder = TopRightCorner + strings.Repeat("\n"+VerticalBorder, ui.Height-2) + "\n" + BottomRightCorner
+ if m.focus == FocusRightSidebar {
+ rightBorder = lipgloss.NewStyle().Background(colors.BackgroundDimmer).Foreground(colors.Focus).Render(rightBorder)
+ } else {
+ rightBorder = lipgloss.NewStyle().Background(colors.BackgroundDimmer).Foreground(colors.White).Render(rightBorder)
+ }
+ }
+
+ result := lipgloss.JoinHorizontal(lipgloss.Top, leftBorder, networkList, leftSidebar, chat, rightSidebar, rightBorder)
+
+ // result = lipgloss.Place(
+ // ui.Width, ui.Height,
+ // lipgloss.Left, lipgloss.Top,
+ // result,
+ // )
if m.HasPopup() {
colors.Restore()
@@ -390,6 +418,9 @@ func (m *Model) updateConnected(message tea.Msg) tea.Cmd {
func (m *Model) updateAuthenticated(message tea.Msg) tea.Cmd {
totalWidth := max(ui.Width, ui.MinWidth)
totalWidth -= NetworkWidth
+ if config.ReadConfig().ScreenBorders {
+ totalWidth -= 2 // Left/right borders
+ }
sidebarWidth := int(math.Round(float64(totalWidth) * SidebarPercentage))
sidebarWidth = max(sidebarWidth, MinSidebarWidth)
chatWidth := totalWidth - (2 * (sidebarWidth + 1))