feat(author): Add Cancel Job button to Author module

Added a "Cancel Job" button to the Author module top bar that:
- Appears only when an Author job is currently running
- Uses DangerImportance styling for clear visual indication
- Cancels the running author job when clicked
- Hides automatically when no author job is running

This addresses the user's request for cancel buttons in every module
where it's relevant. The button provides immediate job cancellation
without needing to navigate to the queue view.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-30 22:02:21 -05:00
parent 52dce047b7
commit f8a9844b53
2 changed files with 29 additions and 1 deletions

View File

@ -161,7 +161,18 @@ func buildAuthorView(state *appState) fyne.CanvasObject {
})
clearCompletedBtn.Importance = widget.LowImportance
topBar := ui.TintedBar(authorColor, container.NewHBox(backBtn, layout.NewSpacer(), clearCompletedBtn, queueBtn))
cancelBtn := widget.NewButton("Cancel Job", func() {
if state.jobQueue != nil {
if job := state.jobQueue.CurrentRunning(); job != nil && job.Type == queue.JobTypeAuthor {
state.jobQueue.Cancel(job.ID)
}
}
})
cancelBtn.Importance = widget.DangerImportance
state.authorCancelBtn = cancelBtn
state.updateAuthorCancelButton()
topBar := ui.TintedBar(authorColor, container.NewHBox(backBtn, layout.NewSpacer(), cancelBtn, clearCompletedBtn, queueBtn))
bottomBar := moduleFooter(authorColor, layout.NewSpacer(), state.statsBar)
tabs := container.NewAppTabs(
@ -1397,6 +1408,22 @@ func (s *appState) setAuthorProgress(percent float64) {
}
}
func (s *appState) updateAuthorCancelButton() {
if s.authorCancelBtn == nil {
return
}
if s.jobQueue == nil {
s.authorCancelBtn.Hide()
return
}
job := s.jobQueue.CurrentRunning()
if job != nil && job.Type == queue.JobTypeAuthor {
s.authorCancelBtn.Show()
} else {
s.authorCancelBtn.Hide()
}
}
func (s *appState) startAuthorGeneration(startNow bool) {
if s.authorVideoTSPath != "" {
title := authorOutputTitle(s)

View File

@ -974,6 +974,7 @@ type appState struct {
authorProgress float64
authorProgressBar *widget.ProgressBar
authorStatusLabel *widget.Label
authorCancelBtn *widget.Button
authorVideoTSPath string
// Rip module state