Files
sodalive-ios/SodaLive/Sources/Content/Series/Detail/SeriesDetailIntroductionView.swift
Yu Sung 27b024f187 시리즈 상세 화면 현지화 문자열 제공
시리즈 상세 화면의 탭과 섹션 제목을 다국어로 제공한다.
가격 표시와 요일 표기를 로케일에 맞게 보여준다.
2025-12-19 18:30:52 +09:00

153 lines
6.7 KiB
Swift

//
// 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)
}
}