ChronoTomato/cmd/client/view.go
Sebastian Mark 8a0ef32c91 feat: use bubbletea framework
- implement TUI in bubbletea
  - split components into separate files
- remove now unused functions
- restructure files
2024-11-02 10:55:15 +01:00

24 lines
556 B
Go

package client
import (
"strings"
"git.smsvc.net/pomodoro/ChronoTomato/cmd/client/helper"
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
)
func (a app) View() string {
var body string
if a.pomodoro != (GoTomato.ServerMessage{}) {
body = helper.TerminalOutput(a.pomodoro)
helper.DesktopNotifications(a.pomodoro)
} else {
body = "Waiting for first server message..."
}
helpView := a.help.View(a.keys)
height := 8 - strings.Count(body, "\n") - strings.Count(helpView, "\n")
return body + strings.Repeat("\n", height) + helpView
}