// // SeriesDetailIntroductionView.swift // SodaLive // // Created by klaus on 4/29/24. // import SwiftUI import SwiftUIFlowLayout struct SeriesDetailIntroductionView: View { let width: CGFloat let seriesDetail: GetSeriesDetailResponse var body: some View { VStack(alignment: .leading, spacing: 16) { Text(I18n.SeriesDetail.keywords) .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color.grayee) .padding(.top, 16) .padding(.horizontal, 13.3) FlowLayout(mode: .scrollable, items: seriesDetail.displayKeywords, itemSpacing: 5.3) { SeriesKeywordChipView(keyword: $0) } .padding(.horizontal, 13.3) Rectangle() .frame(height: 6.7) .foregroundColor(Color.gray22) VStack(alignment: .leading, spacing: 13.3) { Text(I18n.SeriesDetail.workIntro) .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color.grayee) Text(seriesDetail.displayIntroduction) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) .lineSpacing(4) } .padding(.horizontal, 13.3) Rectangle() .frame(height: 6.7) .foregroundColor(Color.gray22) VStack(alignment: .leading, spacing: 16) { Text(I18n.SeriesDetail.details) .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color.grayee) HStack(spacing: 30) { VStack(alignment: .leading, spacing: 13.3) { Text(I18n.SeriesDetail.genre) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) Text(I18n.SeriesDetail.ageLimit) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) if let _ = seriesDetail.writer { Text(I18n.SeriesDetail.writer) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) } if let _ = seriesDetail.studio { Text(I18n.SeriesDetail.studio) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) } Text(I18n.SeriesDetail.schedule) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) Text(I18n.SeriesDetail.releaseDate) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) } VStack(alignment: .leading, spacing: 13.3) { Text(seriesDetail.displayGenre) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) Text(seriesDetail.isAdult ? I18n.SeriesDetail.age19Plus : I18n.SeriesDetail.ageAll) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) if let writer = seriesDetail.writer { Text(writer) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) } if let studio = seriesDetail.studio { Text(studio) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) } Text(seriesDetail.publishedDaysOfWeek == "랜덤" ? I18n.SeriesDetail.random : "\(seriesDetail.publishedDaysOfWeek)") .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) Text(seriesDetail.displayPublishedDate) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.white) } } } .padding(.horizontal, 13.3) VStack(alignment: .leading, spacing: 13.3) { Text(I18n.SeriesDetail.price) .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(Color.grayee) HStack(spacing: 30) { VStack(alignment: .leading, spacing: 13.3) { Text(I18n.SeriesDetail.rentLabel) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) Text(I18n.SeriesDetail.buyLabel) .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.gray77) } VStack(alignment: .leading, spacing: 13.3) { Text("\(calculatePriceInfo(seriesDetail.rentalMinPrice, seriesDetail.rentalMaxPrice)) \(I18n.SeriesDetail.daysSuffix(5))") .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.button) Text("\(calculatePriceInfo(seriesDetail.minPrice, seriesDetail.maxPrice))") .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(Color.button) } } } .padding(.horizontal, 13.3) } } func calculatePriceInfo(_ minPrice: Int, _ maxPrice: Int) -> String { I18n.SeriesDetail.priceInfo(min: minPrice, max: maxPrice) } }