You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.8 KiB
97 lines
3.8 KiB
//
|
|
// PodcastDetailView.swift
|
|
// PodcastsClone
|
|
//
|
|
// Created by etudiant on 2023-05-12.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PodcastDetailView: View {
|
|
|
|
let podcast: Podcast
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
ZStack() {
|
|
// TODO make this background the same as the dominant color of the podcast logo
|
|
Color.theme.background.ignoresSafeArea(.all, edges: .all)
|
|
VStack(alignment: .center) {
|
|
// TODO make content of the VStack below switch to dark mode if the ZStack's background is dark, and vice versa
|
|
VStack(alignment: .center) {
|
|
|
|
Image(uiImage: podcast.image)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.cornerRadius(12)
|
|
.shadow(color: Color.theme.shadow, radius: 10, x: 0, y: 10)
|
|
.padding(.horizontal, 48)
|
|
.padding(.vertical, 16)
|
|
|
|
Text(podcast.title)
|
|
.font(.title)
|
|
.foregroundColor(Color.theme.primary)
|
|
.multilineTextAlignment(.center)
|
|
|
|
Text(podcast.by)
|
|
.font(.headline)
|
|
.foregroundColor(Color.theme.secondary)
|
|
.multilineTextAlignment(.center)
|
|
|
|
Button(action: {}) {
|
|
HStack {
|
|
Image(systemName: "play.fill")
|
|
Text(Strings.latestEpisode)
|
|
}}
|
|
.foregroundColor(Color.theme.primary)
|
|
.padding(.vertical)
|
|
.padding(.horizontal, 64)
|
|
.background(Color.theme.backgroundSecondary)
|
|
.foregroundColor(Color.theme.primary)
|
|
.clipShape(RoundedRectangle(cornerSize: CGSize(width: 12.0, height: 12.0)))
|
|
|
|
// TODO replace '...' with Strings.readFurtherPrompt
|
|
Text(podcast.latestEpisodeDescription)
|
|
.lineLimit(3)
|
|
.truncationMode(.tail)
|
|
.padding()
|
|
|
|
HStack() {
|
|
Text("\(Image(systemName: "star.fill")) \(podcast.rating, specifier: "%.1f") (\(podcast.reviews)) \(Strings.classySeparator) \(podcast.genre)")
|
|
.padding(.horizontal)
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
|
|
Divider()
|
|
.foregroundColor(Color.theme.backgroundSecondary)
|
|
|
|
ZStack() {
|
|
Color.theme.background.ignoresSafeArea(.all, edges: .all)
|
|
|
|
VStack(alignment: .leading) {
|
|
Text("Episodes")
|
|
.font(.title2)
|
|
.fontWeight(.bold)
|
|
.foregroundColor(Color.theme.primary)
|
|
.padding()
|
|
|
|
ForEach(podcast.episodes, id: \.id) { episode in
|
|
EpisodeViewCell(episode: episode)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
struct PodcastDetailView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
PodcastDetailView(podcast: Stub.podcasts[0])
|
|
}
|
|
}
|