iOS 1.0.9: Add to Playlist sheet

Replaces the chain of dialogs (each waited ~450 ms for the last to close)
with one sheet: Plex | Stem tabs, inline new-playlist name field, playlist
rows with art, and mix chips for stem playlists. One "Add to Playlist…"
menu entry now covers both kinds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-10-20 10:28:25 -07:00
1 parent 790f8a35a2
commit eb541b9a16
4 files changed
+218 -43

No files matched your search

+10
View File
@@ -22,11 +22,13 @@ final class Overlays {
struct Confirm { var title: String; var message: String?; var button: String; var destructive: Bool; var run: () -> Void }
struct Prompt { var title: String; var message: String?; var initial: String; var button: String; var placeholder: String; var run: (String) -> Void }
struct Hud: Equatable { let id = UUID(); var text: String; var icon: String }
struct AddToPlaylist: Identifiable { let id = UUID(); var tracks: [Track]; var title: String; var skip: String? }
var actions: Actions?
var confirm: Confirm?
var prompt: Prompt?
var hud: Hud?
var addToPlaylist: AddToPlaylist?
/// 1 while the Now Playing sheet is up, so its host shows overlays instead of the root's.
var level = 0
@@ -59,6 +61,10 @@ final class Overlays {
present { self.prompt = Prompt(title: title, message: message, initial: initial, button: button, placeholder: placeholder, run: run) }
}
func addToPlaylist(_ tracks: [Track], title: String, skip: String?) {
present { self.addToPlaylist = AddToPlaylist(tracks: tracks, title: title, skip: skip) }
}
func hud(_ text: String, _ icon: String = "checkmark") {
hudTask?.cancel()
withAnimation(.easeOut(duration: 0.15)) { hud = Hud(text: text, icon: icon) }
@@ -75,6 +81,7 @@ struct OverlayHost: ViewModifier {
let overlays: Overlays
let level: Int
@State private var text = ""
@Environment(\.palette) private var p
private var mine: Bool { overlays.level == level }
@@ -109,6 +116,9 @@ struct OverlayHost: ViewModifier {
if let m = p.message { Text(m) }
}
.onChange(of: overlays.prompt?.title) { _, _ in text = overlays.prompt?.initial ?? "" }
.sheet(item: Binding(get: { mine ? overlays.addToPlaylist : nil }, set: { overlays.addToPlaylist = $0 })) { r in
AddToPlaylistSheet(req: r, overlays: overlays).environment(\.palette, p).tint(p.accent)
}
}
private func binding<T>(_ kp: ReferenceWritableKeyPath<Overlays, T?>) -> Binding<Bool> {