Polish artist page layout

This commit is contained in:
lucast committed 2026-10-07 04:31:22 +02:00
1 parent 437f56f730
commit 3bee3fdaed
1 file changed
+20 -77
+20 -77
View File
@@ -132,10 +132,10 @@ struct ArtistDetailView: View {
private func content(_ artist: Artist) -> some View { private func content(_ artist: Artist) -> some View {
ZStack { ZStack {
artistPageBackdrop(artist) Color.black.ignoresSafeArea()
ScrollView { ScrollView {
VStack(alignment: .leading, spacing: 14) { VStack(alignment: .leading, spacing: 20) {
artistHero(artist) artistHero(artist)
HStack { HStack {
@@ -170,7 +170,7 @@ struct ArtistDetailView: View {
} }
if !viewModel.albums.isEmpty { if !viewModel.albums.isEmpty {
VStack(alignment: .leading, spacing: 12) { VStack(alignment: .leading, spacing: 16) {
Text("Albums").font(.title2.weight(.bold)) Text("Albums").font(.title2.weight(.bold))
.padding(.horizontal, 20) .padding(.horizontal, 20)
ScrollView(.horizontal) { ScrollView(.horizontal) {
@@ -205,34 +205,6 @@ struct ArtistDetailView: View {
} }
} }
private func artistPageBackdrop(_ artist: Artist) -> some View {
GeometryReader { geometry in
ZStack {
Color.black
if let url = viewModel.artworkURL(for: artist) {
AsyncImage(url: url) { phase in
if let image = phase.image {
image.resizable().scaledToFill()
} else {
Color.black
}
}
.frame(width: geometry.size.width, height: geometry.size.height)
.blur(radius: 48)
.opacity(0.90)
.clipped()
}
LinearGradient(
colors: [.black.opacity(0.04), .black.opacity(0.18)],
startPoint: .top,
endPoint: .bottom
)
}
.frame(width: geometry.size.width, height: geometry.size.height)
}
.ignoresSafeArea()
}
private func artistHero(_ artist: Artist) -> some View { private func artistHero(_ artist: Artist) -> some View {
ZStack(alignment: .bottom) { ZStack(alignment: .bottom) {
AsyncImage(url: viewModel.artworkURL(for: artist)) { phase in AsyncImage(url: viewModel.artworkURL(for: artist)) { phase in
@@ -244,19 +216,20 @@ struct ArtistDetailView: View {
} }
} }
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.containerRelativeFrame(.vertical) { length, _ in min(length * 0.43, 440) } .containerRelativeFrame(.vertical) { length, _ in min(length * 0.48, 480) }
.clipped() .clipped()
.overlay { .overlay {
LinearGradient(stops: [ LinearGradient(stops: [
.init(color: .black.opacity(0.22), location: 0), .init(color: .black.opacity(0.22), location: 0),
.init(color: .clear, location: 0.34), .init(color: .clear, location: 0.30),
.init(color: .black.opacity(0.04), location: 0.62), .init(color: .black.opacity(0.18), location: 0.50),
.init(color: .black.opacity(0.14), location: 1), .init(color: .black.opacity(0.62), location: 0.78),
.init(color: .black.opacity(0.96), location: 1),
], startPoint: .top, endPoint: .bottom) ], startPoint: .top, endPoint: .bottom)
} }
.accessibilityLabel("\(artist.name) artist artwork") .accessibilityLabel("\(artist.name) artist artwork")
VStack(spacing: 18) { VStack(spacing: 20) {
Text(artist.name) Text(artist.name)
.font(.system(size: 32, weight: .bold)) .font(.system(size: 32, weight: .bold))
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
@@ -299,49 +272,19 @@ struct ArtistDetailView: View {
} }
} }
.padding(.horizontal, 20) .padding(.horizontal, 20)
.padding(.bottom, 18) .padding(.bottom, 22)
HStack(spacing: 0) { Button { dismiss() } label: {
Button { dismiss() } label: { Image(systemName: "chevron.left")
Image(systemName: "chevron.left") .font(.title3.weight(.semibold))
.font(.title3.weight(.semibold)) .foregroundStyle(.white)
.foregroundStyle(.white) .frame(width: 52, height: 52)
.frame(width: 52, height: 52) .background(.ultraThinMaterial.opacity(0.8), in: Circle())
.background(.ultraThinMaterial.opacity(0.8), in: Circle())
}
.buttonStyle(.plain)
.accessibilityLabel("Back")
Spacer()
HStack(spacing: 20) {
ShareLink(item: URL(string: "https://music.lucasskt.dk/artist/\(artist.id)")!) {
Image(systemName: "square.and.arrow.up")
.font(.title3.weight(.medium))
.foregroundStyle(.white)
}
.accessibilityLabel("Share \(artist.name)")
Menu {
Button("Play", systemImage: "play.fill") {
player.play(viewModel.tracks)
}
Button("Shuffle", systemImage: "shuffle") {
player.play(viewModel.tracks, shuffled: true)
}
} label: {
Image(systemName: "ellipsis")
.font(.title3.weight(.semibold))
.foregroundStyle(.white)
}
.accessibilityLabel("More options for \(artist.name)")
}
.padding(.horizontal, 22)
.frame(height: 52)
.background(.ultraThinMaterial.opacity(0.8), in: Capsule())
} }
.buttonStyle(.plain)
.accessibilityLabel("Back")
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
.padding(.horizontal, 18) .padding(.horizontal, 18)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
.padding(.top, 58) .padding(.top, 58)
} }
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
@@ -360,7 +303,7 @@ struct ArtistDetailView: View {
Spacer(minLength: 8) Spacer(minLength: 8)
Image(systemName: "ellipsis").font(.body.weight(.semibold)).foregroundStyle(.secondary) Image(systemName: "ellipsis").font(.body.weight(.semibold)).foregroundStyle(.secondary)
} }
.padding(.vertical, 6) .padding(.vertical, 8)
.contentShape(Rectangle()) .contentShape(Rectangle())
} }
.buttonStyle(.plain) .buttonStyle(.plain)