Skip to content

Commit

Permalink
๐ŸŽจ :: [#33] MyPageView PostList Code ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
Xixn2 committed Dec 29, 2024
1 parent d8d1115 commit 75c4a4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ struct DetailView: View {
@State private var topNavigationState: Bool = false
@State private var emojiName: [String] = ["heart", "congrats", "ThumbsUp", "thinking", "poop", "china"]
@State private var emojiServerName: [String] = ["HEART", "CONGRATUATION", "THUMBSUP", "THINKING", "POOP", "CHINA"]
@State private var test: [Bool] = [false, false, false, false, false, false]
@State private var graySmileState: Bool = false
@Environment(\.dismiss) private var dismiss
@StateObject var postViewModel: PostViewModel
Expand Down
42 changes: 18 additions & 24 deletions Projects/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,7 @@ struct MyPageView: View {

ScrollView {
LazyVGrid(columns: columns, spacing: 2) {
ForEach(postViewModel.myPostList.indices, id: \.self) { index in
let myPost = postViewModel.myPostList[index]

let myPostEmojiArray = [
myPost.emojiList.heartCount,
myPost.emojiList.congCount,
myPost.emojiList.thumbsCount,
myPost.emojiList.thinkCount,
myPost.emojiList.poopCount,
myPost.emojiList.chinaCount
]
ForEach(postViewModel.myPostList, id: \.id) { myPost in

NavigationLink(destination: DetailView(
viewModel: DetailViewModel(),
Expand All @@ -142,7 +132,14 @@ struct MyPageView: View {
grade: myPost.author.grade,
imageUrl: myPost.imageUrl,
tagList: myPost.tagList.map { ($0.name, $0.id) },
emojiList: myPostEmojiArray,
emojiList: [
myPost.emojiList.heartCount,
myPost.emojiList.congCount,
myPost.emojiList.thumbsCount,
myPost.emojiList.thinkCount,
myPost.emojiList.poopCount,
myPost.emojiList.chinaCount
],
checkEmojiList: myPost.checkEmoji,
createTime: myPost.createdTime
)) {
Expand Down Expand Up @@ -173,17 +170,7 @@ struct MyPageView: View {

ScrollView {
LazyVGrid(columns: columns1, spacing: 2) {
ForEach(postViewModel.myReactionPostList.indices, id: \.self) { index in
let rtPost = postViewModel.myReactionPostList[index]

let emojiArray = [
rtPost.emojiList.heartCount,
rtPost.emojiList.congCount,
rtPost.emojiList.thumbsCount,
rtPost.emojiList.thinkCount,
rtPost.emojiList.poopCount,
rtPost.emojiList.chinaCount
]
ForEach(postViewModel.myReactionPostList, id: \.id) { rtPost in

NavigationLink(destination: DetailView(
viewModel: DetailViewModel(),
Expand All @@ -195,7 +182,14 @@ struct MyPageView: View {
grade: rtPost.author.grade,
imageUrl: rtPost.imageUrl,
tagList: rtPost.tagList.map { ($0.name, $0.id) },
emojiList: emojiArray,
emojiList: [
rtPost.emojiList.heartCount,
rtPost.emojiList.congCount,
rtPost.emojiList.thumbsCount,
rtPost.emojiList.thinkCount,
rtPost.emojiList.poopCount,
rtPost.emojiList.chinaCount
],
checkEmojiList: rtPost.checkEmoji,
createTime: rtPost.createdTime
)) {
Expand Down

0 comments on commit 75c4a4b

Please sign in to comment.