크리에이터 채널

- 후원랭킹이 없어도 내 채널에서는 후원랭킹 영역이 보이도록 수정
- 채널 주인이 아닌 다른 유저는 커뮤니티 게시물이 없으면 커뮤니티 영역이 보이지 않도록 수정
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)
}
VStack(alignment: .leading, spacing: 14) {
HStack(spacing: 0) {
Text(I18n.MemberChannel.communityHeader)
.appFont(size: 26, weight: .bold)
.foregroundColor(Color.white)
.padding(.horizontal, 24)
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) || viewModel.communityPostList.count > 0 {
VStack(alignment: .leading, spacing: 14) {
HStack(spacing: 0) {
Text(I18n.MemberChannel.communityHeader)
.appFont(size: 26, weight: .bold)
.foregroundColor(Color.white)
.padding(.horizontal, 24)
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
}
}
Spacer()
}
} else {
if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) {
CreatorCommunityNoPostsItemView(
onSuccess: creatorCommunityWriteSuccess
)
.padding(.horizontal, 24)
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 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)
}