Skip to content

Commit c0fa6bb

Browse files
authored
Merge pull request #32 from HambugDev/feature/homeRoute
[Feat] Home 인기게시글에서 게시글 상세 라우팅 로직 추가
2 parents 20aa48f + e55516e commit c0fa6bb

6 files changed

Lines changed: 30 additions & 45 deletions

File tree

Hambug/ContentView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import HomeDI
1212
import CommunityPresentation
1313
import CommunityDI
1414
import SharedUI
15-
//import MyPagePresentation
16-
//import MyPageDI
15+
import MyPagePresentation
16+
import MyPageDI
1717

1818
struct ContentView: View {
1919
@Environment(AppDIContainer.self) var appContainer
@@ -26,9 +26,9 @@ struct ContentView: View {
2626
CommunityDIContainer(appContainer: appContainer)
2727
}
2828

29-
// private var mypageDIContainer: MyPageDIContainer {
30-
// MyPageDIContainer(appContainer: appContainer)
31-
// }
29+
private var mypageDIContainer: MyPageDIContainer {
30+
MyPageDIContainer(appContainer: appContainer)
31+
}
3232

3333
@State private var selectedTab: Int = 0
3434

Home/Package.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ let package = Package(
3333
.package(name: "Common", path: "../Common"),
3434
.package(name: "DI", path: "../DI"),
3535
.package(name: "Infrastructure", path: "../Infrastructure"),
36+
.package(name: "Community", path: "../Community"),
3637
],
3738
targets: [
3839
.target(
@@ -48,7 +49,12 @@ let package = Package(
4849
],
4950
),
5051
// Domain: 의존하지않음
51-
.target(config: .domain),
52+
.target(
53+
config: .domain,
54+
dependencies: [
55+
.product(name: "CommunityDomain", package: "Community")
56+
]
57+
),
5258

5359
// Data: Domain에 의존
5460
.target(
@@ -57,6 +63,8 @@ let package = Package(
5763
.target(config: .domain),
5864
.product(name: "NetworkInterface", package: "Infrastructure"),
5965
.product(name: "Util", package: "Common"),
66+
.product(name: "SharedDomain", package: "Common"),
67+
.product(name: "CommunityDomain", package: "Community"),
6068
],
6169
),
6270

@@ -67,6 +75,7 @@ let package = Package(
6775
.target(config: .domain),
6876
.product(name: "DesignSystem", package: "Common"),
6977
.product(name: "SharedUI", package: "Common"),
78+
.product(name: "Community", package: "Community"),
7079
],
7180
),
7281
]

Home/Sources/Presentation/HomeView.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import SwiftUI
99
import HomeDomain
1010
import DesignSystem
1111
import SharedUI
12+
import CommunityDI
13+
import CommunityPresentation
1214

1315
public struct HomeView: View {
1416

@@ -49,9 +51,11 @@ public struct HomeView: View {
4951

5052
struct PopularPostsView: View {
5153
private let postItems: [TrendingPost]
52-
54+
private let communityDIContainer: CommunityDIContainer
55+
5356
init(postItems: [TrendingPost]) {
5457
self.postItems = postItems
58+
self.communityDIContainer = .init(appContainer: .shared)
5559
}
5660

5761
var body: some View {
@@ -60,7 +64,15 @@ struct PopularPostsView: View {
6064

6165
VStack(spacing: 0) {
6266
ForEach(postItems) { post in
63-
PostView(post: post)
67+
NavigationLink(
68+
destination: CommunityDetailView(
69+
viewModel: communityDIContainer.makeDetailViewModel(),
70+
boardId: post.id,
71+
updateFactory: communityDIContainer,
72+
reportFactory: communityDIContainer
73+
)) {
74+
PostView(post: post)
75+
}
6476
}
6577
}
6678
.background(.white)

MyPage/Package.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ let package = Package(
7575
.product(name: "LocalizedString", package: "Common"),
7676
.product(name: "SharedUI", package: "Common"),
7777
.product(name: "DesignSystem", package: "Common"),
78+
.product(name: "Community", package: "Community"),
7879
.product(name: "CommunityDomain", package: "Community"),
79-
.product(name: "CommunityPresentation", package: "Community"),
80-
.product(name: "CommunityDI", package: "Community")
8180
],
8281
path: Config.presentation.path
8382
),

MyPage/Sources/Presentation/MyActivitiesView.swift

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -124,41 +124,6 @@ struct TabButton: View {
124124
}
125125
}
126126

127-
// MARK: - 게시글 리스트 뷰
128-
struct MyBoardsListView: View {
129-
let boards: [Board]
130-
let isLoadingMore: Bool
131-
let onLoadMore: (Int) -> Void
132-
133-
var body: some View {
134-
ScrollView {
135-
LazyVStack(spacing: 0) {
136-
ForEach(Array(boards.enumerated()), id: \.element.id) { index, board in
137-
NavigationLink(destination: Text("Board Detail \(board.id)")) {
138-
MyBoardListCard(board: board)
139-
}
140-
.buttonStyle(PlainButtonStyle())
141-
.onAppear { onLoadMore(index) }
142-
}
143-
144-
if isLoadingMore {
145-
HStack {
146-
Spacer()
147-
ProgressView()
148-
Spacer()
149-
}
150-
.padding(.vertical, 16)
151-
}
152-
}
153-
}
154-
.background(
155-
RoundedRectangle(cornerRadius: 8)
156-
.fill(Color.white)
157-
.shadow(color: Color.black.opacity(0.1), radius: 4.5, x: 0, y: 0)
158-
)
159-
}
160-
}
161-
162127
// MARK: - 게시글 카드
163128
fileprivate struct MyBoardListCard: View {
164129
let board: Board

hambug_logo.png

-9.62 KB
Binary file not shown.

0 commit comments

Comments
 (0)