Duo deck: Now Playing tab, full-pane Stems / Lyrics / Playing Next / EQ pages
Unfolded with something playing, the tab bar leads with a Now Playing item that shows the deck beside docked Now Playing. Each deck page gets the whole pane; the queue moved to its own page and a vertical graphic EQ page was added. Dev build 27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
190b793043
commit
4ddcfd7ff5
5 files changed
+166
-49
No files matched your search
@@ -11,8 +11,16 @@ struct RootView: View {
|
||||
var body: some View {
|
||||
let s = g.settings
|
||||
let p = Palette.of(s.theme, s.accent)
|
||||
TabView(selection: Binding(get: { ui.tab }, set: { ui.selectTab($0) })) {
|
||||
ForEach(Tab.layout(s.tabLayout), id: \.self) { t in
|
||||
TabView(selection: Binding(get: { ui.showsDeck ? BarItem.deck : .tab(ui.tab) },
|
||||
set: { if case .tab(let t) = $0 { ui.selectTab(t) } else { ui.showDeck() } })) {
|
||||
// Unfolded with something playing, Now Playing leads the bar: the deck (stems, lyrics,
|
||||
// queue, EQ) on this side of the hinge, the player docked on the other.
|
||||
if ui.hasDeckTab {
|
||||
DuoPane { NowPlayingDeck() }
|
||||
.tabItem { Label("Now Playing", systemImage: "waveform") }
|
||||
.tag(BarItem.deck)
|
||||
}
|
||||
ForEach(ui.tabs, id: \.self) { t in
|
||||
DuoPane {
|
||||
NavigationStack(path: ui.path(t)) {
|
||||
root(t).miniPlayerRoom()
|
||||
@@ -21,12 +29,12 @@ struct RootView: View {
|
||||
.modifier(FloatingMiniPlayer())
|
||||
}
|
||||
.tabItem { Label(t.rawValue, systemImage: t.icon) }
|
||||
.tag(t)
|
||||
.tag(BarItem.tab(t))
|
||||
}
|
||||
}
|
||||
.modifier(GlassMiniPlayerHost())
|
||||
.background(p.bg.ignoresSafeArea())
|
||||
.onChange(of: s.tabLayout) { _, _ in ui.ensureValidTab() }
|
||||
.onChange(of: ui.tabs) { _, _ in ui.ensureValidTab() }
|
||||
.fullScreenCover(isPresented: Binding(get: { ui.nowPlayingOpen }, set: { ui.nowPlayingOpen = $0 })) {
|
||||
NowPlayingScreen()
|
||||
.overlayHost(ui.overlays, level: 1)
|
||||
@@ -45,6 +53,8 @@ struct RootView: View {
|
||||
.tint(p.accent)
|
||||
}
|
||||
|
||||
private enum BarItem: Hashable { case deck, tab(Tab) }
|
||||
|
||||
@ViewBuilder private func root(_ t: Tab) -> some View {
|
||||
switch t {
|
||||
case .Library: LibraryHome()
|
||||
@@ -156,7 +166,7 @@ private extension View {
|
||||
}
|
||||
|
||||
/// One tab's content, split at the iPhone Duo's hinge (the system's division region): the tab
|
||||
/// (with the deck over it while it's showing) on one side, docked Now Playing on the other, left
|
||||
/// (or, for the Now Playing item, the deck) on one side, docked Now Playing on the other, left
|
||||
/// and right trading places with the deck's swap button. It measures inside the tab's safe area,
|
||||
/// so the system's tab bar is never covered. Anywhere without a hinge it's just the tab, and the
|
||||
/// tab stays put in the view tree so its scroll state survives folding, unfolding and swapping.
|
||||
@@ -170,13 +180,9 @@ private struct DuoPane<Content: View>: View {
|
||||
GeometryReader { geo in
|
||||
let cut = Self.cut(geo)
|
||||
let flip = swap && cut?.vertical == true
|
||||
let deck = cut != nil && ui.deck && g.playback.current != nil
|
||||
let layout = cut?.vertical == false ? AnyLayout(VStackLayout(spacing: cut?.gap ?? 0)) : AnyLayout(HStackLayout(spacing: cut?.gap ?? 0))
|
||||
layout {
|
||||
ZStack {
|
||||
content
|
||||
if deck { NowPlayingDeck().transition(.opacity) }
|
||||
}
|
||||
content
|
||||
.environment(\.layoutDirection, .leftToRight)
|
||||
.frame(width: cut.map { $0.vertical ? (flip ? $0.second : $0.first) : geo.size.width } ?? geo.size.width,
|
||||
height: cut.map { $0.vertical ? geo.size.height : $0.first } ?? geo.size.height)
|
||||
@@ -191,7 +197,6 @@ private struct DuoPane<Content: View>: View {
|
||||
.environment(\.layoutDirection, flip ? .rightToLeft : .leftToRight)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
||||
.animation(.spring(duration: 0.4, bounce: 0.1), value: flip)
|
||||
.animation(.easeInOut(duration: 0.2), value: deck)
|
||||
.onChange(of: cut != nil, initial: true) { _, on in ui.setSplit(on) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user