diff --git a/ui/modelUtils.go b/ui/modelUtils.go index 037598b3..4bf7e3a6 100644 --- a/ui/modelUtils.go +++ b/ui/modelUtils.go @@ -11,6 +11,7 @@ import ( tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" + "github.com/dlvhdr/gh-dash/config" "github.com/dlvhdr/gh-dash/data" "github.com/dlvhdr/gh-dash/ui/common" @@ -190,17 +191,19 @@ func (m *Model) executeCustomCommand(cmd string) tea.Cmd { func (m *Model) notify(text string) tea.Cmd { id := fmt.Sprint(time.Now().Unix()) - m.tasks[id] = context.Task{ - Id: id, - FinishedText: text, - State: context.TaskFinished, - } - return func() tea.Msg { + startCmd := m.ctx.StartTask( + context.Task{ + Id: id, + StartText: text, + FinishedText: text, + State: context.TaskStart, + }) + + finishCmd := func() tea.Msg { return constants.TaskFinishedMsg{ - SectionId: m.getCurrSection().GetId(), - SectionType: m.getCurrSection().GetType(), - TaskId: id, - Err: nil, + TaskId: id, } } + + return tea.Sequence(startCmd, finishCmd) } diff --git a/ui/ui.go b/ui/ui.go index 65293a12..b2e69a67 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -707,7 +707,7 @@ func (m *Model) renderRunningTask() string { return lipgloss.NewStyle(). Padding(0, 1). Background(m.ctx.Theme.SelectedBackground). - Render(lipgloss.JoinHorizontal(lipgloss.Left, stats, currTaskStatus)) + Render(lipgloss.JoinHorizontal(lipgloss.Top, stats, currTaskStatus)) } type userFetchedMsg struct {