| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import SwiftUI
- /// Compact track row for track lists.
- struct TrackRow: View {
- let track: Track
- var body: some View {
- HStack(spacing: 8) {
- // Album art placeholder / format badge
- ZStack {
- RoundedRectangle(cornerRadius: 4)
- .fill(trackColor.opacity(0.15))
- .frame(width: 32, height: 32)
- Image(systemName: "music.note")
- .font(.caption)
- .foregroundStyle(trackColor)
- }
- VStack(alignment: .leading, spacing: 1) {
- HStack(spacing: 4) {
- Text(track.title)
- .lineLimit(1)
- .font(.body)
- if track.isCloud {
- Image(systemName: "cloud.fill")
- .font(.system(size: 8))
- .foregroundStyle(.secondary)
- }
- }
- if !track.artist.isEmpty {
- Text(track.artist)
- .lineLimit(1)
- .font(.caption)
- .foregroundStyle(.secondary)
- }
- }
- }
- }
- private var trackColor: Color {
- if let hex = track.color {
- return Color(hex: hex) ?? .accentColor
- }
- return .accentColor
- }
- }
|