Tweaks to now playing view
This commit is contained in:
@@ -14,7 +14,6 @@ struct QueueCubeApp: App {
|
|||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
ContentView()
|
ContentView()
|
||||||
.frame(minWidth: 400.0, minHeight: 600.0)
|
|
||||||
.onAppear {
|
.onAppear {
|
||||||
#if targetEnvironment(macCatalyst)
|
#if targetEnvironment(macCatalyst)
|
||||||
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return }
|
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return }
|
||||||
|
|||||||
@@ -118,43 +118,21 @@ struct MainView: View
|
|||||||
struct NowPlayingMiniPlayerModifier: ViewModifier
|
struct NowPlayingMiniPlayerModifier: ViewModifier
|
||||||
{
|
{
|
||||||
@Binding var model: NowPlayingViewModel
|
@Binding var model: NowPlayingViewModel
|
||||||
private let height = 64.0
|
@State var nowPlayingHeight: CGFloat = 0.0
|
||||||
|
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
let playPauseImageName = model.isPlaying ? "pause.fill" : "play.fill"
|
|
||||||
|
|
||||||
ZStack {
|
ZStack {
|
||||||
content
|
content
|
||||||
.safeAreaPadding(.bottom, height)
|
.safeAreaPadding(.bottom, nowPlayingHeight)
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
HStack {
|
NowPlayingMiniView(model: $model)
|
||||||
VStack(alignment: .leading) {
|
.padding()
|
||||||
Text(model.title)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.bold()
|
.onGeometryChange(for: CGSize.self) { $0.size }
|
||||||
|
action: { nowPlayingHeight = $0.height }
|
||||||
Text(model.subtitle)
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Button(action: { model.onPlayPause(model) }) { Image(systemName: playPauseImageName) }
|
|
||||||
.imageScale(.large)
|
|
||||||
.padding(12.0)
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
.frame(height: height)
|
|
||||||
.background(
|
|
||||||
RoundedRectangle(cornerRadius: 12)
|
|
||||||
.fill(.regularMaterial)
|
|
||||||
.stroke(.ultraThinMaterial, lineWidth: 1.0)
|
|
||||||
)
|
|
||||||
.shadow(color: .black.opacity(0.15), radius: 14.0, y: 2.0)
|
|
||||||
|
|
||||||
.padding()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
QueueCube/Views/NowPlayingMiniView.swift
Normal file
42
QueueCube/Views/NowPlayingMiniView.swift
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// NowPlayingMiniView.swift
|
||||||
|
// QueueCube
|
||||||
|
//
|
||||||
|
// Created by James Magahern on 6/11/25.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct NowPlayingMiniView: View {
|
||||||
|
@Binding var model: NowPlayingViewModel
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
let playPauseImageName = model.isPlaying ? "pause.fill" : "play.fill"
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text(model.title)
|
||||||
|
.font(.caption)
|
||||||
|
.lineLimit(1)
|
||||||
|
.bold()
|
||||||
|
|
||||||
|
Text(model.subtitle)
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Button(action: { model.onPlayPause(model) }) { Image(systemName: playPauseImageName) }
|
||||||
|
.imageScale(.large)
|
||||||
|
.padding(12.0)
|
||||||
|
}
|
||||||
|
.padding(EdgeInsets(top: 4.0, leading: 10.0, bottom: 4.0, trailing: 10.0))
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 12)
|
||||||
|
.fill(.regularMaterial)
|
||||||
|
.stroke(.ultraThinMaterial, lineWidth: 1.0)
|
||||||
|
)
|
||||||
|
.shadow(color: .black.opacity(0.15), radius: 14.0, y: 2.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user