Files
sodalive-ios/SodaLive/Sources/UI/Component/SeriesListBigItemView.swift
Yu Sung 280e424385 커스텀 폰트 pretendard-medium, gmarket-medium를 사용하고 있던 것을 appFont 모디
파이어를 사용하여 한국어는 pretendard, 그 외에는 시스템 폰트를 사용하도록 수정
2026-01-23 03:09:20 +09:00

128 lines
4.6 KiB
Swift

//
// SeriesListBigItemView.swift
// SodaLive
//
// Created by klaus on 4/29/24.
//
import SwiftUI
import Kingfisher
struct SeriesListBigItemView: View {
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
let item: SeriesListItem
let isVisibleCreator: Bool
var body: some View {
VStack(alignment: .leading, spacing: 8) {
ZStack {
KFImage(URL(string: item.coverImage))
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: 116.7, height: 165))
.resizable()
.scaledToFill()
.frame(width: 116.7, height: 165, alignment: .center)
.cornerRadius(5)
.clipped()
.onTapGesture {
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
AppState.shared
.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
} else {
AppState.shared
.setAppStep(step: .login)
}
}
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 3.3) {
if !item.isComplete && item.isNew {
SeriesItemBadgeView(title: I18n.Series.new, backgroundColor: .button)
}
if item.isComplete {
SeriesItemBadgeView(title: I18n.Series.complete, backgroundColor: Color(hex: "002abd"))
}
if item.isPopular {
SeriesItemBadgeView(title: I18n.Series.popular, backgroundColor: Color(hex: "ec6033"))
}
Spacer()
}
Spacer()
HStack {
Spacer()
SeriesItemBadgeView(title: I18n.Series.totalEpisodes(item.numberOfContent), backgroundColor: Color.gray33.opacity(0.7))
}
}
.padding(3.3)
}
.frame(width: 116.7, height: 165, alignment: .center)
Text(item.title)
.appFont(size: 18, weight: .medium)
.foregroundColor(Color.grayee)
.lineLimit(1)
if isVisibleCreator {
HStack(spacing: 3) {
KFImage(URL(string: item.creator.profileImage))
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: 16, height: 16))
.resizable()
.scaledToFill()
.frame(width: 16, height: 16, alignment: .center)
.clipShape(Circle())
Text(item.creator.nickname)
.appFont(size: 12, weight: .medium)
.foregroundColor(Color.gray77)
.lineLimit(1)
}
.onTapGesture {
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
AppState.shared
.setAppStep(step: .creatorDetail(userId: item.creator.creatorId))
} else {
AppState.shared
.setAppStep(step: .login)
}
}
}
Text(item.publishedDaysOfWeek)
.appFont(size: 14, weight: .medium)
.foregroundColor(Color.gray77)
}
.frame(width: 116.7)
}
}
#Preview {
SeriesListBigItemView(
item: SeriesListItem(
seriesId: 1,
title: "제목, 관심사,프로필+방장, 참여인원(어딘가..)",
coverImage: "https://test-cf.sodalive.net/profile/default-profile.png",
publishedDaysOfWeek: "매주 수, 토요일",
isComplete: true,
creator: SeriesListItemCreator(
creatorId: 1,
nickname: "creator",
profileImage: "https://test-cf.sodalive.net/profile/default-profile.png"
),
numberOfContent: 10,
isNew: true,
isPopular: true
),
isVisibleCreator: true
)
}