크리에이터 채널

- 후원랭킹이 없어도 내 채널에서는 후원랭킹 영역이 보이도록 수정
- 채널 주인이 아닌 다른 유저는 커뮤니티 게시물이 없으면 커뮤니티 영역이 보이지 않도록 수정
This commit is contained in:
Yu Sung
2026-02-04 11:26:04 +09:00
parent 13f8d924c0
commit c0288b5eb8

View File

@@ -256,70 +256,72 @@ struct UserProfileView: View {
.padding(.horizontal, 24) .padding(.horizontal, 24)
} }
VStack(alignment: .leading, spacing: 14) { if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || viewModel.communityPostList.count > 0 {
HStack(spacing: 0) { VStack(alignment: .leading, spacing: 14) {
Text(I18n.MemberChannel.communityHeader) HStack(spacing: 0) {
.appFont(size: 26, weight: .bold) Text(I18n.MemberChannel.communityHeader)
.foregroundColor(Color.white) .appFont(size: 26, weight: .bold)
.padding(.horizontal, 24) .foregroundColor(Color.white)
.padding(.horizontal, 24)
Spacer() Spacer()
}
if viewModel.communityPostList.count > 0 {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 14) {
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)
.onTapGesture {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
.background(
GeometryReader { geo in
Color.clear
.preference(key: HeightPreferenceKey.self, value: geo.size.height)
}
)
}
CreatorCommunityMoreItemView {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 24)
.frame(height: maxCommunityPostHeight)
.onPreferenceChange(HeightPreferenceKey.self) { value in
if let current = maxCommunityPostHeight {
maxCommunityPostHeight = max(current, value)
} else {
maxCommunityPostHeight = value
}
}
} }
} else { if viewModel.communityPostList.count > 0 {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { ScrollView(.horizontal, showsIndicators: false) {
CreatorCommunityNoPostsItemView( LazyHStack(spacing: 14) {
onSuccess: creatorCommunityWriteSuccess if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
) CreatorCommunityWriteItemView()
.padding(.horizontal, 24) .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)
.onTapGesture {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
.background(
GeometryReader { geo in
Color.clear
.preference(key: HeightPreferenceKey.self, value: geo.size.height)
}
)
}
CreatorCommunityMoreItemView {
AppState.shared
.setAppStep(
step: .creatorCommunityAll(creatorId: userId)
)
}
}
.padding(.horizontal, 24)
.frame(height: maxCommunityPostHeight)
.onPreferenceChange(HeightPreferenceKey.self) { value in
if let current = maxCommunityPostHeight {
maxCommunityPostHeight = max(current, value)
} else {
maxCommunityPostHeight = value
}
}
}
} else {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
CreatorCommunityNoPostsItemView(
onSuccess: creatorCommunityWriteSuccess
)
.padding(.horizontal, 24)
}
} }
} }
} }
@@ -332,7 +334,7 @@ struct UserProfileView: View {
) )
} }
if creatorProfile.userDonationRanking.count > 0 { if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || creatorProfile.userDonationRanking.count > 0 {
UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking) UserProfileDonationView(userId: userId, donationRankingResponse: creatorProfile.userDonationRanking)
} }