feat(home): 팔로잉 탭 화면을 조립한다

This commit is contained in:
Yu Sung
2026-07-01 17:36:07 +09:00
parent 5b679389a6
commit f93e65372b
7 changed files with 175 additions and 35 deletions

View File

@@ -0,0 +1,47 @@
import SwiftUI
struct MainHomeFollowingEmptyStateView: View {
let message: String
let loginAction: (() -> Void)?
init(message: String, loginAction: (() -> Void)? = nil) {
self.message = message
self.loginAction = loginAction
}
var body: some View {
VStack(spacing: SodaSpacing.s16) {
Spacer()
Text(message)
.appFont(.body5)
.foregroundColor(Color.gray500)
.multilineTextAlignment(.center)
if let loginAction {
Button(action: loginAction) {
Text(I18n.HomeFollowing.loginButtonTitle)
.appFont(size: 14, weight: .bold)
.foregroundColor(.black)
.padding(.horizontal, SodaSpacing.s16)
.frame(height: 40)
.background(Color.soda400)
.clipShape(RoundedRectangle(cornerRadius: SodaRadius.r14, style: .continuous))
}
.buttonStyle(.plain)
}
Spacer()
}
.frame(maxWidth: .infinity)
.background(Color.black)
}
}
struct MainHomeFollowingEmptyStateView_Previews: PreviewProvider {
static var previews: some View {
MainHomeFollowingEmptyStateView(message: I18n.HomeFollowing.emptyStateMessage)
.frame(width: 390, height: 320)
.previewLayout(.sizeThatFits)
}
}

View File

@@ -16,12 +16,12 @@ struct MainHomeFollowingNewsSection: View {
}
var body: some View {
if !recentNews.isEmpty {
if !renderableNews.isEmpty {
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
SectionTitle(title: I18n.HomeFollowing.recentNewsTitle)
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
ForEach(recentNews) { news in
ForEach(renderableNews) { news in
newsItemView(news)
}
}
@@ -30,6 +30,25 @@ struct MainHomeFollowingNewsSection: View {
}
}
private var renderableNews: [FollowingNewsResponse] {
recentNews.filter { news in
switch news.type {
case .creatorRanking:
return news.creatorRanking != nil
case .contentRanking:
return news.contentRanking != nil
case .communityPost:
return news.communityPost != nil
case .audioContent:
return news.audioContent != nil
case .photoContent:
return news.photoContent != nil
case .unknown:
return false
}
}
}
@ViewBuilder
private func newsItemView(_ news: FollowingNewsResponse) -> some View {
switch news.type {