Linting update
This commit is contained in:
parent
cddd3d69c4
commit
5451e54082
7
main.go
7
main.go
@ -49,7 +49,8 @@ type model struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initialModel(fullscreen bool, colorLeft string, colorRight string) model {
|
func initialModel(fullscreen bool, colorLeft string, colorRight string) model {
|
||||||
inputs := make([]textinput.Model, 3)
|
numInputs := 3
|
||||||
|
inputs := make([]textinput.Model, numInputs)
|
||||||
|
|
||||||
// Set up text input models for interval length, break length, and total intervals
|
// Set up text input models for interval length, break length, and total intervals
|
||||||
for i := range inputs {
|
for i := range inputs {
|
||||||
@ -120,12 +121,14 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
// Move to the next input field
|
// Move to the next input field
|
||||||
m.focusIndex = (m.focusIndex + 1) % len(m.inputs)
|
m.focusIndex = (m.focusIndex + 1) % len(m.inputs)
|
||||||
m.updateFocus()
|
m.updateFocus()
|
||||||
|
|
||||||
return m, nil
|
return m, nil
|
||||||
|
|
||||||
case "shift+tab":
|
case "shift+tab":
|
||||||
// Move to the previous input field
|
// Move to the previous input field
|
||||||
m.focusIndex = (m.focusIndex - 1 + len(m.inputs)) % len(m.inputs)
|
m.focusIndex = (m.focusIndex - 1 + len(m.inputs)) % len(m.inputs)
|
||||||
m.updateFocus()
|
m.updateFocus()
|
||||||
|
|
||||||
return m, nil
|
return m, nil
|
||||||
|
|
||||||
case "enter":
|
case "enter":
|
||||||
@ -188,10 +191,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
m.isFocus = true
|
m.isFocus = true
|
||||||
m.intervalNum++
|
m.intervalNum++
|
||||||
m.runCommands(m.onIntervalEnd)
|
m.runCommands(m.onIntervalEnd)
|
||||||
|
|
||||||
if m.intervalNum > m.intervals {
|
if m.intervalNum > m.intervals {
|
||||||
// All intervals completed
|
// All intervals completed
|
||||||
return m, tea.Quit
|
return m, tea.Quit
|
||||||
}
|
}
|
||||||
|
|
||||||
m.remaining = m.remaining + m.focusTime
|
m.remaining = m.remaining + m.focusTime
|
||||||
m.totalTime = m.focusTime
|
m.totalTime = m.focusTime
|
||||||
m.state = "Focus"
|
m.state = "Focus"
|
||||||
|
Loading…
Reference in New Issue
Block a user