Release list: close after a successful grab
Back to where the search started (library, drill-down or search), unless something was opened on top of the list meanwhile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- **After a grab** the release list closes and you are back where the search started.
|
||||||
- **Season posters** in the series drill-down: a season and its episodes show the season's poster
|
- **Season posters** in the series drill-down: a season and its episodes show the season's poster
|
||||||
(from TheTVDB, via Sonarr), the series poster where a season has none or it cannot be loaded.
|
(from TheTVDB, via Sonarr), the series poster where a season has none or it cannot be loaded.
|
||||||
- **Cast in the details pane:** with a Trakt client ID, the details of a movie or series list its
|
- **Cast in the details pane:** with a Trakt client ID, the details of a movie or series list its
|
||||||
|
|||||||
+10
-1
@@ -101,6 +101,7 @@ var serviceNames = []string{"Radarr", "Sonarr", "SABnzbd"}
|
|||||||
// hints replaces the view's key hints in the status bar while it is open.
|
// hints replaces the view's key hints in the status bar while it is open.
|
||||||
type overlay struct {
|
type overlay struct {
|
||||||
page string
|
page string
|
||||||
|
root tview.Primitive // what was pushed
|
||||||
focus tview.Primitive
|
focus tview.Primitive
|
||||||
hints string
|
hints string
|
||||||
full bool // full-screen view (can be left with F1-F7), as opposed to a dialog
|
full bool // full-screen view (can be left with F1-F7), as opposed to a dialog
|
||||||
@@ -527,7 +528,7 @@ func (a *App) renderStatus() {
|
|||||||
// pushOverlay stacks p above everything and focuses focus.
|
// pushOverlay stacks p above everything and focuses focus.
|
||||||
func (a *App) pushOverlay(p, focus tview.Primitive, hints string, full bool, onClose func()) {
|
func (a *App) pushOverlay(p, focus tview.Primitive, hints string, full bool, onClose func()) {
|
||||||
name := fmt.Sprintf("overlay-%d", len(a.overlays))
|
name := fmt.Sprintf("overlay-%d", len(a.overlays))
|
||||||
a.overlays = append(a.overlays, overlay{page: name, focus: a.app.GetFocus(), hints: hints, full: full, close: onClose})
|
a.overlays = append(a.overlays, overlay{page: name, root: p, focus: a.app.GetFocus(), hints: hints, full: full, close: onClose})
|
||||||
a.pages.AddPage(name, p, true, true)
|
a.pages.AddPage(name, p, true, true)
|
||||||
a.app.SetFocus(focus)
|
a.app.SetFocus(focus)
|
||||||
a.renderStatus()
|
a.renderStatus()
|
||||||
@@ -566,6 +567,14 @@ func (a *App) openFull(p tview.Primitive, hints string, onClose func()) {
|
|||||||
a.pushOverlay(p, p, hints, true, onClose)
|
a.pushOverlay(p, p, hints, true, onClose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// closeIfTop closes the topmost overlay if it is p (and not something opened
|
||||||
|
// on top of it since).
|
||||||
|
func (a *App) closeIfTop(p tview.Primitive) {
|
||||||
|
if n := len(a.overlays); n > 0 && a.overlays[n-1].root == p {
|
||||||
|
a.closeModal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// closeModal removes the topmost overlay and restores the previous focus.
|
// closeModal removes the topmost overlay and restores the previous focus.
|
||||||
func (a *App) closeModal() {
|
func (a *App) closeModal() {
|
||||||
if len(a.overlays) == 0 {
|
if len(a.overlays) == 0 {
|
||||||
|
|||||||
@@ -269,6 +269,7 @@ func (v *releasesView) doGrab(r arr.Release) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
v.app.SetMessage("[green]Sent to the download client: " + tview.Escape(truncate(r.Title, 60)))
|
v.app.SetMessage("[green]Sent to the download client: " + tview.Escape(truncate(r.Title, 60)))
|
||||||
|
v.app.closeIfTop(v.root) // done here: back to where the search started
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user