Sebastian Mark
e6c1ca9deb
- add progress package for visual feedback
- implement calc_percentage function for duration calculation
- update TerminalOutput to include progress percentage and view
🤖
31 lines
827 B
Go
31 lines
827 B
Go
package client
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/alecthomas/colour"
|
|
|
|
"git.smsvc.net/pomodoro/ChronoTomato/cmd/client/helper"
|
|
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
)
|
|
|
|
func (a app) View() string {
|
|
var body string
|
|
var serverStatus string
|
|
|
|
body = "Waiting for server message..."
|
|
if a.pomodoro != (GoTomato.ServerMessage{}) {
|
|
body = helper.TerminalOutput(a.pomodoro)
|
|
helper.DesktopNotifications(a.pomodoro)
|
|
}
|
|
|
|
serverStatus = colour.Sprintf("^D^1disconnected: %v^R\n", client.LastErr)
|
|
if client.Connected() {
|
|
serverStatus = colour.Sprintf("^D^2connected to %s^R\n", client.Server)
|
|
}
|
|
|
|
helpView := a.help.View(a.keys)
|
|
height := 10 - strings.Count(body, "\n") - strings.Count(serverStatus, "\n") - strings.Count(helpView, "\n")
|
|
|
|
return body + strings.Repeat("\n", height) + serverStatus + helpView
|
|
}
|