Favorites, Queue, Now Playing improved

This commit is contained in:
2026-04-06 11:45:32 +02:00
parent 3ebf1763ed
commit e7e9a59e70
6 changed files with 893 additions and 217 deletions
@@ -0,0 +1,37 @@
//
// FavoriteButton.swift
// Mobile Music Assistant
//
// Created by Sven Hanold on 05.04.26.
//
import SwiftUI
/// Reusable heart button for toggling favorites on artists, albums, and tracks.
struct FavoriteButton: View {
@Environment(MAService.self) private var service
let uri: String
var size: CGFloat = 22
var showInLight: Bool = false
private var isFavorite: Bool {
service.libraryManager.isFavorite(uri: uri)
}
var body: some View {
Button {
Task {
await service.libraryManager.toggleFavorite(
uri: uri,
currentlyFavorite: isFavorite
)
}
} label: {
Image(systemName: isFavorite ? "heart.fill" : "heart")
.font(.system(size: size))
.foregroundStyle(isFavorite ? .red : (showInLight ? .white.opacity(0.7) : .secondary))
.contentTransition(.symbolEffect(.replace))
}
.buttonStyle(.plain)
}
}