Files
RedLintu16andClaude Opus 5.5 64ec524ba0 CrossSound for Apple platforms
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-14 13:28:34 -07:00

36 lines
1.1 KiB
Swift
Executable File

// NowPlayingBorder — the outline on the track the player is on, the same
// edge wherever a track is listed: playlists, Likes, History, search, the
// queue.
//
// 2pt in the primary colour. It reads the palette AROUND the row, so apply it
// outside any lit `.environment(\.rw, …)` (TrackRow does): the row's text
// takes the hover colour while it plays, the edge stays primary.
import RedWhiteUI
import SwiftUI
extension View {
/// Outlines this row while [playing].
func nowPlayingBorder(_ playing: Bool) -> some View {
modifier(NowPlayingBorder(playing: playing))
}
}
private struct NowPlayingBorder: ViewModifier {
let playing: Bool
@Environment(\.rw) private var p
func body(content: Content) -> some View {
// An overlay, not an `if` around the content: swapping the content's
// identity would reset the row's state (TrackRow's like flip, an open
// sheet) every time the track changes.
content.overlay {
if playing {
Rectangle()
.strokeBorder(p.red.color, lineWidth: 2)
.allowsHitTesting(false)
}
}
}
}