summaryrefslogtreecommitdiff
path: root/internal/tui/projects_box.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/projects_box.go')
-rw-r--r--internal/tui/projects_box.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/tui/projects_box.go b/internal/tui/projects_box.go
index f40cbd0..9c62d4d 100644
--- a/internal/tui/projects_box.go
+++ b/internal/tui/projects_box.go
@@ -26,7 +26,7 @@ func (m ClientsProjectsModel) View(width, height int, isSelected bool) string {
var content string
if len(m.clients) == 0 {
- content = "No clients found\n\nUse 'punch add client' to\nadd your first client."
+ content = inactiveTimerStyle.Render("No clients found\n\nUse 'punch add client' to\nadd your first client.")
} else {
content = m.renderClientsAndProjects()
}
@@ -105,6 +105,10 @@ func (m *ClientsProjectsModel) changeSelection(forward bool) {
}
func (m *ClientsProjectsModel) changeSelectionForward() {
+ if len(m.clients) == 0 {
+ return
+ }
+
selectedClient := m.clients[m.selectedClient]
projects := m.projects[selectedClient.ID]
@@ -146,6 +150,10 @@ func (m *ClientsProjectsModel) changeSelectionForward() {
}
func (m *ClientsProjectsModel) changeSelectionBackward() {
+ if len(m.clients) == 0 {
+ return
+ }
+
selectedClient := m.clients[m.selectedClient]
if m.selectedProject == nil {
@@ -180,6 +188,10 @@ func (m *ClientsProjectsModel) changeSelectionBackward() {
}
func (m ClientsProjectsModel) selection() (string, string, string, *float64) {
+ if len(m.clients) == 0 {
+ return "", "", "", nil
+ }
+
client := m.clients[m.selectedClient]
clientID := strconv.FormatInt(client.ID, 10)