feat(creator-profile): 커뮤니티 섹션 UI 변경
This commit is contained in:
@@ -210,60 +210,71 @@ struct UserProfileView: View {
|
|||||||
.padding(.horizontal, 24)
|
.padding(.horizontal, 24)
|
||||||
}
|
}
|
||||||
|
|
||||||
if viewModel.communityPostList.count > 0 {
|
VStack(alignment: .leading, spacing: 14) {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
HStack(spacing: 0) {
|
||||||
LazyHStack(spacing: 13.3) {
|
Text("커뮤니티")
|
||||||
if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId {
|
.font(.custom(Font.preBold.rawValue, size: 26))
|
||||||
CreatorCommunityWriteItemView()
|
.foregroundColor(Color.white)
|
||||||
.onTapGesture {
|
.padding(.horizontal, 24)
|
||||||
AppState.shared.setAppStep(
|
|
||||||
step: .creatorCommunityWrite(
|
|
||||||
onSuccess: creatorCommunityWriteSuccess
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ForEach(0..<viewModel.communityPostList.count, id: \.self) { index in
|
Spacer()
|
||||||
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, 13.3)
|
|
||||||
.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()
|
||||||
|
.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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user