ChronoTomato/cmd/client/view.go

25 lines
556 B
Go
Raw Normal View History

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
}