Initial Commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// PlaylistDetailView.swift
|
||||
// Mobile Music Assistant
|
||||
//
|
||||
// Created by Sven Hanold on 26.03.26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PlaylistDetailView: View {
|
||||
@Environment(MAService.self) private var service
|
||||
let playlist: MAPlaylist
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(spacing: 24) {
|
||||
// Playlist Header
|
||||
VStack(spacing: 16) {
|
||||
// Playlist Cover
|
||||
if let imageUrl = playlist.imageUrl {
|
||||
let coverURL = service.imageProxyURL(path: imageUrl, size: 512)
|
||||
|
||||
CachedAsyncImage(url: coverURL) { image in
|
||||
image
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
} placeholder: {
|
||||
Rectangle()
|
||||
.fill(Color.gray.opacity(0.2))
|
||||
}
|
||||
.frame(width: 250, height: 250)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||
.shadow(radius: 10)
|
||||
} else {
|
||||
RoundedRectangle(cornerRadius: 12)
|
||||
.fill(Color.gray.opacity(0.2))
|
||||
.frame(width: 250, height: 250)
|
||||
.overlay {
|
||||
Image(systemName: "music.note.list")
|
||||
.font(.system(size: 60))
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
// Playlist Info
|
||||
VStack(spacing: 8) {
|
||||
if let owner = playlist.owner {
|
||||
Text("By \(owner)")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
if playlist.isEditable {
|
||||
Label("Editable", systemImage: "pencil")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.blue)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.top)
|
||||
|
||||
// TODO: Load playlist tracks
|
||||
Text("Playlist details coming soon")
|
||||
.foregroundStyle(.secondary)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
.navigationTitle(playlist.name)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationStack {
|
||||
PlaylistDetailView(
|
||||
playlist: MAPlaylist(
|
||||
uri: "library://playlist/1",
|
||||
name: "Test Playlist",
|
||||
owner: "Test User",
|
||||
imageUrl: nil,
|
||||
isEditable: true
|
||||
)
|
||||
)
|
||||
.environment(MAService())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user