커뮤니티 게시물 등록 API 적용,

채널 프로필 API - 커뮤니티 게시물 추가
This commit is contained in:
Yu Sung
2023-12-20 00:10:16 +09:00
parent d393bb8f8b
commit d829399b05
15 changed files with 412 additions and 56 deletions

View File

@@ -59,34 +59,45 @@ struct UserProfileView: View {
.padding(.top, 13.3)
.padding(.horizontal, 13.3)
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 13.3) {
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
CreatorCommunityWriteItemView()
.onTapGesture {
AppState.shared.setAppStep(step: .creatorCommunityWrite)
}
}
CreatorCommunityItemView()
.frame(width: 320)
CreatorCommunityItemView()
.frame(width: 320)
CreatorCommunityItemView()
.frame(width: 320)
CreatorCommunityMoreItemView {
AppState.shared.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
if viewModel.communityPostList.count > 0 {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 13.3) {
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
CreatorCommunityWriteItemView()
.onTapGesture {
AppState.shared.setAppStep(
step: .creatorCommunityWrite(
onSuccess: creatorCommunityWriteSuccess
)
)
}
}
ForEach(0..<viewModel.communityPostList.count, id: \.self) { index in
let item = viewModel.communityPostList[index]
CreatorCommunityItemView(item: item)
.frame(width: 320)
}
CreatorCommunityMoreItemView {
AppState.shared.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 13.3)
}
.frame(minHeight: 146)
.padding(.top, 26.7)
} else {
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
CreatorCommunityNoPostsItemView(
onSuccess: creatorCommunityWriteSuccess
)
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
}
.padding(.horizontal, 15)
}
.frame(minHeight: 146)
.padding(.top, 26.7)
}
if creatorProfile.contentList.count > 0 ||
@@ -296,6 +307,10 @@ struct UserProfileView: View {
}
}
}
private func creatorCommunityWriteSuccess() {
viewModel.getCreatorProfile(userId: userId)
}
}
struct UserProfileView_Previews: PreviewProvider {