fix(main): 추천 커뮤니티 상세로 이동한다
This commit is contained in:
@@ -14,6 +14,7 @@ struct CommunityPostCard: View {
|
||||
let isLike: Bool
|
||||
let likeCount: Int
|
||||
let commentCount: Int
|
||||
let onTapPost: () -> Void
|
||||
let onTapLike: () -> Void
|
||||
let onTapComment: () -> Void
|
||||
let onTapPurchase: () -> Void
|
||||
@@ -36,6 +37,7 @@ struct CommunityPostCard: View {
|
||||
isLike: Bool,
|
||||
likeCount: Int,
|
||||
commentCount: Int,
|
||||
onTapPost: @escaping () -> Void = {},
|
||||
onTapLike: @escaping () -> Void = {},
|
||||
onTapComment: @escaping () -> Void = {},
|
||||
onTapPurchase: @escaping () -> Void = {}
|
||||
@@ -52,6 +54,7 @@ struct CommunityPostCard: View {
|
||||
self.isLike = isLike
|
||||
self.likeCount = likeCount
|
||||
self.commentCount = commentCount
|
||||
self.onTapPost = onTapPost
|
||||
self.onTapLike = onTapLike
|
||||
self.onTapComment = onTapComment
|
||||
self.onTapPurchase = onTapPurchase
|
||||
@@ -76,6 +79,8 @@ struct CommunityPostCard: View {
|
||||
.padding(SodaSpacing.s14)
|
||||
.background(Color.gray900)
|
||||
.clipShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
||||
.contentShape(RoundedRectangle(cornerRadius: SodaSpacing.s14, style: .continuous))
|
||||
.onTapGesture(perform: onTapPost)
|
||||
.onChange(of: isLike) { newValue in
|
||||
localIsLike = newValue
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ struct MainHomeView: View {
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunity: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapBanner: (RecommendationBannerResponse) -> Void
|
||||
let onTapFollowAll: (@escaping () -> Void) -> Void
|
||||
let onSelectFollowingTab: () -> Bool
|
||||
@@ -69,7 +69,7 @@ struct MainHomeView: View {
|
||||
onTapCreator: onTapCreator,
|
||||
onTapContent: onTapContent,
|
||||
onTapCharacter: onTapCharacter,
|
||||
onTapCommunity: onTapCommunity,
|
||||
onTapCommunityPost: onTapCommunityPost,
|
||||
onTapBanner: onTapBanner,
|
||||
onTapFollowAll: onTapFollowAll
|
||||
)
|
||||
@@ -117,7 +117,7 @@ struct MainHomeView_Previews: PreviewProvider {
|
||||
onTapCreator: { _ in },
|
||||
onTapContent: { _ in },
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunity: { _ in },
|
||||
onTapCommunityPost: { _ in },
|
||||
onTapBanner: { _ in },
|
||||
onTapFollowAll: { action in action() },
|
||||
onSelectFollowingTab: { true },
|
||||
|
||||
@@ -4,18 +4,18 @@ struct MainHomeActiveCreatorSection: View {
|
||||
let items: [HomeActiveCreatorItem]
|
||||
let onTapLive: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
let onTapCommunity: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
|
||||
init(
|
||||
items: [HomeActiveCreatorItem],
|
||||
onTapLive: @escaping (Int) -> Void = { _ in },
|
||||
onTapContent: @escaping (Int) -> Void = { _ in },
|
||||
onTapCommunity: @escaping (Int) -> Void = { _ in }
|
||||
onTapCommunityPost: @escaping (Int) -> Void = { _ in }
|
||||
) {
|
||||
self.items = items
|
||||
self.onTapLive = onTapLive
|
||||
self.onTapContent = onTapContent
|
||||
self.onTapCommunity = onTapCommunity
|
||||
self.onTapCommunityPost = onTapCommunityPost
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@@ -46,7 +46,7 @@ struct MainHomeActiveCreatorSection: View {
|
||||
case .audio:
|
||||
onTapContent(targetId)
|
||||
case .community:
|
||||
onTapCommunity(targetId)
|
||||
onTapCommunityPost(targetId)
|
||||
case .unknown:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@ import SwiftUI
|
||||
|
||||
struct MainHomePopularCommunitySection: View {
|
||||
let items: [HomePopularCommunityPostItem]
|
||||
let onTapCommunity: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapLike: (Int) -> Void
|
||||
let onTapPurchase: (HomePopularCommunityPostItem) -> Void
|
||||
|
||||
init(
|
||||
items: [HomePopularCommunityPostItem],
|
||||
onTapCommunity: @escaping (Int) -> Void = { _ in },
|
||||
onTapCommunityPost: @escaping (Int) -> Void = { _ in },
|
||||
onTapLike: @escaping (Int) -> Void = { _ in },
|
||||
onTapPurchase: @escaping (HomePopularCommunityPostItem) -> Void = { _ in }
|
||||
) {
|
||||
self.items = items
|
||||
self.onTapCommunity = onTapCommunity
|
||||
self.onTapCommunityPost = onTapCommunityPost
|
||||
self.onTapLike = onTapLike
|
||||
self.onTapPurchase = onTapPurchase
|
||||
}
|
||||
@@ -38,11 +38,14 @@ struct MainHomePopularCommunitySection: View {
|
||||
isLike: item.isLiked,
|
||||
likeCount: item.likeCount,
|
||||
commentCount: item.commentCount,
|
||||
onTapPost: {
|
||||
onTapCommunityPost(item.postId)
|
||||
},
|
||||
onTapLike: {
|
||||
onTapLike(item.postId)
|
||||
},
|
||||
onTapComment: {
|
||||
onTapCommunity(item.creatorId)
|
||||
onTapCommunityPost(item.postId)
|
||||
},
|
||||
onTapPurchase: {
|
||||
onTapPurchase(item)
|
||||
|
||||
@@ -5,7 +5,7 @@ struct MainHomeRecommendationView: View {
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunity: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapBanner: (RecommendationBannerResponse) -> Void
|
||||
let onTapFollowAll: (@escaping () -> Void) -> Void
|
||||
|
||||
@@ -37,7 +37,7 @@ struct MainHomeRecommendationView: View {
|
||||
items: viewModel.recommendations?.recentlyActiveCreators ?? [],
|
||||
onTapLive: onTapLive,
|
||||
onTapContent: onTapContent,
|
||||
onTapCommunity: onTapCommunity
|
||||
onTapCommunityPost: onTapCommunityPost
|
||||
)
|
||||
|
||||
MainHomeRecentDebutCreatorSection(
|
||||
@@ -79,7 +79,7 @@ struct MainHomeRecommendationView: View {
|
||||
|
||||
MainHomePopularCommunitySection(
|
||||
items: viewModel.recommendations?.popularCommunityPosts ?? [],
|
||||
onTapCommunity: onTapCommunity,
|
||||
onTapCommunityPost: onTapCommunityPost,
|
||||
onTapLike: { postId in
|
||||
viewModel.likeCommunityPost(postId: postId)
|
||||
},
|
||||
@@ -132,7 +132,7 @@ struct MainHomeRecommendationView_Previews: PreviewProvider {
|
||||
onTapCreator: { _ in },
|
||||
onTapContent: { _ in },
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunity: { _ in },
|
||||
onTapCommunityPost: { _ in },
|
||||
onTapBanner: { _ in },
|
||||
onTapFollowAll: { action in action() }
|
||||
)
|
||||
|
||||
@@ -161,7 +161,7 @@ struct MainView: View {
|
||||
onTapCreator: handleRecommendationCreatorTap,
|
||||
onTapContent: handleRecommendationContentTap,
|
||||
onTapCharacter: handleRecommendationCreatorTap,
|
||||
onTapCommunity: handleRecommendationCommunityTap,
|
||||
onTapCommunityPost: handleRecommendationCommunityPostTap,
|
||||
onTapBanner: handleRecommendationBannerTap,
|
||||
onTapFollowAll: handleRecommendationFollowAllTap,
|
||||
onSelectFollowingTab: handleFollowingTabSelection,
|
||||
@@ -494,10 +494,10 @@ struct MainView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationCommunityTap(creatorId: Int) {
|
||||
guard creatorId > 0 else { return }
|
||||
private func handleRecommendationCommunityPostTap(postId: Int) {
|
||||
guard postId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .creatorCommunityAll(creatorId: creatorId))
|
||||
appState.setAppStep(step: .creatorChannelCommunityPostDetail(postId: postId))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -527,7 +527,9 @@ struct MainView: View {
|
||||
case .audio:
|
||||
handleRecommendationContentTap(contentId: targetId)
|
||||
case .community:
|
||||
handleRecommendationCommunityTap(creatorId: targetId)
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .creatorCommunityAll(creatorId: targetId))
|
||||
}
|
||||
case .unknown:
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user