feat(home): 팔로잉 탭 API 상태를 추가한다

This commit is contained in:
Yu Sung
2026-06-30 22:04:40 +09:00
parent e2d46614bd
commit ae09776c9b
9 changed files with 423 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ struct MainHomeView: View {
let onTapCommunity: (Int) -> Void
let onTapBanner: (RecommendationBannerResponse) -> Void
let onTapFollowAll: (@escaping () -> Void) -> Void
let onSelectFollowingTab: () -> Bool
@State private var selectedTab: MainHomeTab = .recommendation
@@ -31,7 +32,7 @@ struct MainHomeView: View {
TextTabBar(
items: MainHomeTab.allCases,
selectedItem: $selectedTab,
selectedItem: selectedTabBinding,
title: { $0.title }
)
@@ -41,6 +42,19 @@ struct MainHomeView: View {
.background(Color.black.ignoresSafeArea())
}
private var selectedTabBinding: Binding<MainHomeTab> {
Binding(
get: { selectedTab },
set: { newValue in
if newValue == .following, onSelectFollowingTab() == false {
return
}
selectedTab = newValue
}
)
}
@ViewBuilder
private var tabContent: some View {
switch selectedTab {
@@ -91,7 +105,8 @@ struct MainHomeView_Previews: PreviewProvider {
onTapCharacter: { _ in },
onTapCommunity: { _ in },
onTapBanner: { _ in },
onTapFollowAll: { action in action() }
onTapFollowAll: { action in action() },
onSelectFollowingTab: { true }
)
}
}