2024-10-22 11:13:41 +00:00
|
|
|
package notifications
|
|
|
|
|
|
|
|
import (
|
2024-10-23 11:16:30 +00:00
|
|
|
"ChronoTomato/internal/shared"
|
2024-10-23 11:58:17 +00:00
|
|
|
"atomicgo.dev/cursor"
|
2024-10-22 11:13:41 +00:00
|
|
|
"fmt"
|
2024-10-23 11:57:24 +00:00
|
|
|
"github.com/fatih/color"
|
2024-10-23 11:51:19 +00:00
|
|
|
"strings"
|
2024-10-22 11:13:41 +00:00
|
|
|
)
|
|
|
|
|
2024-10-23 11:16:30 +00:00
|
|
|
func TerminalOutput() {
|
2024-10-22 11:13:41 +00:00
|
|
|
var timerOutput string
|
|
|
|
|
2024-10-23 11:48:16 +00:00
|
|
|
pomodoro := &shared.ServerMessage
|
2024-10-23 11:16:30 +00:00
|
|
|
|
2024-10-23 11:58:17 +00:00
|
|
|
cursor.Hide()
|
2024-10-22 11:13:41 +00:00
|
|
|
fmt.Print("\033[H\033[2J") // Clears the screen
|
|
|
|
|
2024-10-23 13:49:50 +00:00
|
|
|
color.Blue("Work: %d ◊ Break: %d ◊ Longbreak: %d\n\n",
|
2024-10-23 11:48:16 +00:00
|
|
|
pomodoro.PomodoroSettings.Work/60,
|
|
|
|
pomodoro.PomodoroSettings.ShortBreak/60,
|
|
|
|
pomodoro.PomodoroSettings.LongBreak/60,
|
2024-10-22 11:13:41 +00:00
|
|
|
)
|
|
|
|
fmt.Printf("Session: %d/%d\n",
|
2024-10-23 11:48:16 +00:00
|
|
|
pomodoro.Session,
|
|
|
|
pomodoro.PomodoroSettings.Sessions,
|
2024-10-22 11:13:41 +00:00
|
|
|
)
|
2024-10-23 11:48:16 +00:00
|
|
|
fmt.Printf("▶ %s\n",
|
|
|
|
pomodoro.Mode,
|
2024-10-22 11:13:41 +00:00
|
|
|
)
|
|
|
|
|
2024-10-23 11:48:16 +00:00
|
|
|
switch pomodoro.Mode {
|
2024-10-22 11:13:41 +00:00
|
|
|
case "Idle":
|
|
|
|
timerOutput = ""
|
|
|
|
default:
|
2024-10-23 11:48:16 +00:00
|
|
|
minutes := pomodoro.TimeLeft / 60
|
|
|
|
seconds := pomodoro.TimeLeft % 60
|
2024-10-22 11:13:41 +00:00
|
|
|
|
|
|
|
timerOutput = fmt.Sprintf("⏳ %02d:%02d", minutes, seconds)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf(timerOutput)
|
2024-10-23 11:51:19 +00:00
|
|
|
|
|
|
|
//footer
|
|
|
|
fmt.Printf(strings.Repeat("\n", 3))
|
2024-10-23 15:42:33 +00:00
|
|
|
color.White("space: start/pause/resume • s: stop • r: reset pomodoro • q: quit")
|
2024-10-22 11:13:41 +00:00
|
|
|
}
|