feat: use bubbletea framework

- implement TUI in bubbletea
  - split components into separate files
- remove now unused functions
- restructure files
This commit is contained in:
Sebastian Mark 2024-10-31 07:37:50 +01:00
parent 9656db5335
commit 8a0ef32c91
14 changed files with 269 additions and 187 deletions

24
cmd/client/view.go Normal file
View file

@ -0,0 +1,24 @@
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
}