mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 23:54:32 +00:00
Working - need to fix ui issues
This commit is contained in:
parent
97566b754b
commit
fed1a43f88
12 changed files with 510 additions and 65 deletions
83
DynamicIsland/components/MinimalisticMusicView.swift
Normal file
83
DynamicIsland/components/MinimalisticMusicView.swift
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// MinimalisticMusicView.swift
|
||||
// DynamicIsland
|
||||
//
|
||||
// Created for minimalistic UI mode
|
||||
// A clean, focused music player for closed notch state
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Defaults
|
||||
|
||||
struct MinimalisticMusicView: View {
|
||||
@EnvironmentObject var vm: DynamicIslandViewModel
|
||||
@ObservedObject var musicManager = MusicManager.shared
|
||||
@State private var isHovering: Bool = false
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 0) {
|
||||
// Left: Album Art
|
||||
albumArtView
|
||||
|
||||
// Middle: Song Title (scrolling if needed)
|
||||
Rectangle()
|
||||
.fill(.black)
|
||||
.overlay(
|
||||
HStack(alignment: .center) {
|
||||
if !musicManager.songTitle.isEmpty {
|
||||
MarqueeText(
|
||||
.constant(musicManager.songTitle),
|
||||
textColor: Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor) : Color.gray,
|
||||
minDuration: 0.4,
|
||||
frameWidth: 100
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
.frame(width: vm.closedNotchSize.width)
|
||||
|
||||
// Right: Music Visualizer
|
||||
visualizerView
|
||||
}
|
||||
.frame(height: vm.effectiveClosedNotchHeight + (isHovering ? 8 : 0), alignment: .center)
|
||||
.onHover { hovering in
|
||||
isHovering = hovering
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Album Art
|
||||
|
||||
private var albumArtView: some View {
|
||||
HStack {
|
||||
Color.clear
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.background(
|
||||
Image(nsImage: musicManager.albumArt)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fill)
|
||||
)
|
||||
.clipped()
|
||||
.clipShape(RoundedRectangle(cornerRadius: 18)) // Dramatically increased corner radius for minimalistic mode
|
||||
.frame(width: max(0, vm.effectiveClosedNotchHeight - 12), height: max(0, vm.effectiveClosedNotchHeight - 12))
|
||||
}
|
||||
.frame(width: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)), height: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)))
|
||||
}
|
||||
|
||||
// MARK: - Visualizer
|
||||
|
||||
private var visualizerView: some View {
|
||||
HStack {
|
||||
Rectangle()
|
||||
.fill(Defaults[.coloredSpectrogram] ? Color(nsColor: musicManager.avgColor).gradient : Color.gray.gradient)
|
||||
.frame(width: 50, alignment: .center)
|
||||
.mask {
|
||||
AudioSpectrumView(isPlaying: $musicManager.isPlaying)
|
||||
.frame(width: 16, height: 12)
|
||||
}
|
||||
.frame(width: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)),
|
||||
height: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)), alignment: .center)
|
||||
}
|
||||
.frame(width: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)),
|
||||
height: max(0, vm.effectiveClosedNotchHeight - (isHovering ? 0 : 12)), alignment: .center)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue