From 9feaa9a3639e410eb34b707da1790d0b0520becc Mon Sep 17 00:00:00 2001
From: Sebastian Mark
-
-
+
+
@@ -98,7 +98,7 @@
document.getElementById("saveButton").addEventListener("click", function () {
// Get the values from the input fields
var password = document.getElementById("password").value;
- var work = parseInt(document.getElementById("workDuration").value);
+ var focus = parseInt(document.getElementById("focusDuration").value);
var shortBreak = parseInt(document.getElementById("shortBreakDuration").value);
var longBreak = parseInt(document.getElementById("longBreakDuration").value);
var sessions = parseInt(document.getElementById("sessions").value);
@@ -108,7 +108,7 @@
command: "updateSettings",
password: password,
settings: {
- work: work,
+ focus: focus,
shortBreak: shortBreak,
longBreak: longBreak,
sessions: sessions
diff --git a/internal/pomodoro/pomodoro.go b/internal/pomodoro/pomodoro.go
index a7bcc00..fdd61ea 100644
--- a/internal/pomodoro/pomodoro.go
+++ b/internal/pomodoro/pomodoro.go
@@ -40,9 +40,9 @@ func RunPomodoro() {
shared.State.Session = session
- // Work
- shared.State.Mode = "Work"
- timer.StartAsync(pomodoroConfig.Work)
+ // Focus
+ shared.State.Mode = "Focus"
+ timer.StartAsync(pomodoroConfig.Focus)
if !waitForTimer(timer) {
break
}
@@ -74,7 +74,7 @@ func RunPomodoro() {
shared.State.Mode = "Idle"
shared.State.Session = 0
- shared.State.TimeLeft = shared.State.Settings.Work
+ shared.State.TimeLeft = shared.State.Settings.Focus
}
func ResetPomodoro() {
@@ -111,6 +111,6 @@ func IsPomodoroPaused() bool {
func UpdateSettings(settings models.PomodoroConfig) {
if settings != (models.PomodoroConfig{}) {
shared.State.Settings = settings
- shared.State.TimeLeft = settings.Work
+ shared.State.TimeLeft = settings.Focus
}
}
diff --git a/internal/shared/configDefaults.go b/internal/shared/configDefaults.go
index e125da8..5b668cc 100644
--- a/internal/shared/configDefaults.go
+++ b/internal/shared/configDefaults.go
@@ -10,7 +10,7 @@ var DefaultServerConfig = models.ServerConfig{
// The default pomodoro config if nothing else is set
var DefaultPomodoroConfig = models.PomodoroConfig{
- Work: 25 * 60,
+ Focus: 25 * 60,
ShortBreak: 5 * 60,
LongBreak: 15 * 60,
Sessions: 4,
diff --git a/internal/shared/state.go b/internal/shared/state.go
index e21d4d3..00934f5 100644
--- a/internal/shared/state.go
+++ b/internal/shared/state.go
@@ -10,7 +10,7 @@ var State = models.ServerMessage{
Mode: "Idle",
Settings: DefaultPomodoroConfig,
Session: 0,
- TimeLeft: DefaultPomodoroConfig.Work,
+ TimeLeft: DefaultPomodoroConfig.Focus,
Ongoing: false,
Paused: false,
ProtocolVersion: metadata.ProtocolVersion,
diff --git a/internal/websocket/client_commands.go b/internal/websocket/client_commands.go
index bdb6e7a..7149faa 100644
--- a/internal/websocket/client_commands.go
+++ b/internal/websocket/client_commands.go
@@ -10,7 +10,7 @@ import (
)
func checkSettings(settings models.PomodoroConfig) bool {
- return settings.Work > 0 && settings.ShortBreak > 0 && settings.LongBreak > 0 && settings.Sessions > 0
+ return settings.Focus > 0 && settings.ShortBreak > 0 && settings.LongBreak > 0 && settings.Sessions > 0
}
// Listens for commands from a client and handles them
diff --git a/pkg/models/config.go b/pkg/models/config.go
index 1852165..d2590f0 100644
--- a/pkg/models/config.go
+++ b/pkg/models/config.go
@@ -4,7 +4,7 @@ import "fmt"
// Represents the configuration of a pomodoro
type PomodoroConfig struct {
- Work int `json:"work"` // Length of work sessions in seconds
+ Focus int `json:"Focus"` // Length of work sessions in seconds
ShortBreak int `json:"shortBreak"` // Length of short break in seconds
LongBreak int `json:"longBreak"` // Length of long break in seconds
Sessions int `json:"sessions"` // Number of total sessions
@@ -12,7 +12,7 @@ type PomodoroConfig struct {
// Stringer interface for the PomodocoConfig model
func (c PomodoroConfig) String() string {
- return fmt.Sprintf("{work: %d, short: %d, long: %d, sessions: %d}", c.Work, c.ShortBreak, c.LongBreak, c.Sessions)
+ return fmt.Sprintf("{work: %d, short: %d, long: %d, sessions: %d}", c.Focus, c.ShortBreak, c.LongBreak, c.Sessions)
}
// Represents the server configuration
diff --git a/pkg/models/server.go b/pkg/models/server.go
index 6aa914a..f495505 100644
--- a/pkg/models/server.go
+++ b/pkg/models/server.go
@@ -2,7 +2,7 @@ package models
// Represents the data sent to the client via WebSocket
type ServerMessage struct {
- Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End"
+ Mode string `json:"mode"` // "Idle", "Focus", "ShortBreak", "LongBreak" or "End"
Settings PomodoroConfig `json:"settings"` // The currrent pomodoro settings
Session int `json:"session"` // Current session number
TimeLeft int `json:"time_left"` // Remaining time in seconds