Skip to content

Commit

Permalink
✨ :: [#36] EmptyView 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
shwaaaa committed Dec 30, 2024
1 parent 26a8ac0 commit 015b1a5
Show file tree
Hide file tree
Showing 2 changed files with 149 additions and 133 deletions.
272 changes: 146 additions & 126 deletions Projects/App/Sources/Feature/MainFeature/Sources/LocationPostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,142 +32,162 @@ struct LocationPostView: View {
ScrollView {
switch locationType {
case "GYM":
ForEach(viewModel.gymPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
if viewModel.gymPostList.isEmpty {
PostEmptyView()
} else {
ForEach(viewModel.gymPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
}
}
case "HOME":
ForEach(viewModel.homePostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
if viewModel.homePostList.isEmpty {
PostEmptyView()
} else {
ForEach(viewModel.homePostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
}
}
case "PLAYGROUND":
ForEach(viewModel.playgroundPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
if viewModel.playgroundPostList.isEmpty {
PostEmptyView()
} else {
ForEach(viewModel.playgroundPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
}
}
case "DOMITORY":
ForEach(viewModel.domitoryPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
if viewModel.domitoryPostList.isEmpty {
PostEmptyView()
} else {
ForEach(viewModel.domitoryPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
}
}
case "WALKING_TRAIL":
ForEach(viewModel.walkingTrailPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
if viewModel.walkingTrailPostList.isEmpty {
PostEmptyView()
} else {
ForEach(viewModel.walkingTrailPostList) { post in
DetailView(
postViewModel: PostViewModel(),
postId: post.id,
title: post.title,
name: post.author.name,
grade: post.author.grade,
imageUrl: post.imageUrl,
tagList: post.tagList.map{ ($0.name, $0.id) },
emojiList: [
post.emojiList.chinaCount,
post.emojiList.congCount,
post.emojiList.heartCount,
post.emojiList.poopCount,
post.emojiList.thinkCount,
post.emojiList.thumbsCount
],
checkEmojiList: post.checkEmoji,
createTime: post.createdTime
)

Rectangle()
.foregroundStyle(GPleAsset.Color.gray900.swiftUIColor)
.frame(height: 3)
.padding(.vertical, 10)
}
}
default:
EmptyView()
PostEmptyView()
}
}
.padding(.top, 8)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import SwiftUI

struct EmptyView: View {
struct PostEmptyView: View {
var body: some View {
NavigationView {
NavigationStack {
ZStack {
GPleAsset.Color.back.swiftUIColor
.ignoresSafeArea()
GPleAsset.Color.back.swiftUIColor
.ignoresSafeArea()

VStack(spacing: 0) {
Text("아무것도 없어요...")
Expand Down Expand Up @@ -42,7 +42,3 @@ struct EmptyView: View {
.cornerRadius(8)
}
}

#Preview {
EmptyView()
}

0 comments on commit 015b1a5

Please sign in to comment.