Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
merge :: (#190) winter intern page
Browse files Browse the repository at this point in the history
merge :: (#190) winter intern page
  • Loading branch information
HongSJae authored Nov 22, 2023
2 parents bee13c2 + ddb0b99 commit d728830
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import Foundation
public protocol RemoteRecruitmentsDataSource {
func fetchRecruitmentDetail(id: String) -> AnyPublisher<RecruitmentDetailEntity, Error>
func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import Foundation
public protocol RecruitmentsRepository {
func fetchRecruitmentDetail(id: String) -> AnyPublisher<RecruitmentDetailEntity, Error>
func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Combine

public protocol FetchRecruitmentListUseCase {
func execute(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error>
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import BaseDomain

public enum RecruitmentsAPI {
case fetchRecruitmentDetail(id: String)
case fetchRecruitmentList(page: Int, jobCode: String?, techCode: [String]?, name: String?)
case fetchRecruitmentList(
page: Int,
jobCode: String?,
techCode: [String]?,
name: String?,
winterIntern: Bool
)
}

extension RecruitmentsAPI: JobisAPI {
Expand Down Expand Up @@ -34,13 +40,20 @@ extension RecruitmentsAPI: JobisAPI {

public var task: Moya.Task {
switch self {
case let .fetchRecruitmentList(page, jobCode, techCode, name):
return .requestParameters(parameters: [
"page": page,
"job_code": jobCode ?? "",
"tech_code": techCode?.joined(separator: ",") ?? "",
"name": name ?? ""
], encoding: URLEncoding.queryString)
case let .fetchRecruitmentList(page, jobCode, techCode, name, winterIntern):
var dic: [String: Any] = ["page": page]
if let jobCode, !jobCode.isEmpty {
dic.updateValue(jobCode, forKey: "job_code")
}
if let techCode, !techCode.isEmpty {
dic.updateValue(techCode.joined(separator: ","), forKey: "tech_code")
}
if let name, !name.isEmpty {
dic.updateValue(name, forKey: "name")
}
dic.updateValue(winterIntern, forKey: "winter_intern")

return .requestParameters(parameters: dic, encoding: URLEncoding.queryString)

default:
return .requestPlain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ public final class RemoteRecruitmentsDataSourceImpl:
}

public func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error> {
request(
.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name),
.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
),
dto: RecruitmentListResponseDTO.self
)
.map { $0.toDomain() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ public struct RecruitmentsRepositoryImpl: RecruitmentsRepository {
}

public func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error> {
remoteRecruitmentsDataSource.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name)
remoteRecruitmentsDataSource.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ public struct FetchRecruitmentListUseCaseImpl: FetchRecruitmentListUseCase {
}

public func execute(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool
) -> AnyPublisher<RecruitmentListEntity, Error> {
recruitmentsRepository.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name)
recruitmentsRepository.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
)
}
}
36 changes: 26 additions & 10 deletions Projects/Feature/BookmarkListFeature/Sources/BookmarkListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,27 @@ struct BookmarkListView: View {
} else {
Spacer()

Text("아직 북마크한 모집의뢰서가 없어요.")
.JOBISFont(.body(.body4), color: .Sub.gray90)
VStack(spacing: 16) {
Text("아직 북마크한 모집의뢰서가 없어요.")
.JOBISFont(.body(.body4), color: .Sub.gray90)

Button {
viewModel.isNavigateRecruitmentView.toggle()
} label: {
Text("모집의뢰서 보러가기 >")
.JOBISFont(.etc(.caption), color: .Sub.gray60)
.underlineText(color: .Sub.gray60)
VStack(spacing: 8) {
Button {
viewModel.isNavigateRecruitmentView.toggle()
} label: {
Text("모집의뢰서 보러가기 >")
.JOBISFont(.etc(.caption), color: .Sub.gray60)
.underlineText(color: .Sub.gray60)
}

Button {
viewModel.isNavigateWinterIntern.toggle()
} label: {
Text("겨울인턴 보러가기 >")
.JOBISFont(.etc(.caption), color: .Sub.gray60)
.underlineText(color: .Sub.gray60)
}
}
}
}
} else {
Expand All @@ -69,7 +81,7 @@ struct BookmarkListView: View {
tabbarHidden.wrappedValue = newValue
}
}
.onChange(of: viewModel.isNavigateRecruitmentView) { newValue in
.onChange(of: viewModel.isNavigateRecruitmentView || viewModel.isNavigateWinterIntern) { newValue in
withAnimation {
tabbarHidden.wrappedValue = newValue
}
Expand All @@ -81,9 +93,13 @@ struct BookmarkListView: View {
when: $viewModel.isNavigateRecruitmentDetail
)
.navigate(
to: recruitmentFactory.makeView().eraseToAnyView(),
to: recruitmentFactory.makeView(winterIntern: false).eraseToAnyView(),
when: $viewModel.isNavigateRecruitmentView
)
.navigate(
to: recruitmentFactory.makeView(winterIntern: true).eraseToAnyView(),
when: $viewModel.isNavigateWinterIntern
)
.navigationTitle("북마크한 모집의뢰서")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ final class BookmarkListViewModel: BaseViewModel {
@Published var bookmarkList: [BookmarkEntity] = []
@Published var recruitmentID: Int = 0
@Published var isNavigateRecruitmentView: Bool = false
@Published var isNavigateWinterIntern: Bool = false
@Published var isNavigateRecruitmentDetail: Bool = false
@Published var isFetchingBookmarkList: Bool = true

Expand Down
1 change: 1 addition & 0 deletions Projects/Feature/HomeFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let project = Project.makeModule(
.Feature.BaseFeature,
.Feature.FindCompanyFeatureInterface,
.Feature.RecruitmentFeatureInterface,
.Feature.WinterInternFeatureInterface,
.Domain.ApplicationsDomainInterface,
.Domain.StudentsDomainInterface,
.Domain.RecruitmentsDomainInterface,
Expand Down
60 changes: 42 additions & 18 deletions Projects/Feature/HomeFeature/Sources/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,32 @@ struct HomeView: View {
Divider()
.foregroundColor(.Sub.gray40)

HStack(spacing: 12) {
navigateButton(
text: "모집의뢰서\n조회하기",
image: .recruitmentImage
) {
viewModel.isNavigateRecruitment.toggle()
}
.frame(width: proxy.size.width / 2)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 12) {
navigateButton(
text: "모집의뢰서\n조회하기",
image: .recruitmentImage
) {
viewModel.isNavigateRecruitment.toggle()
}
.frame(width: proxy.size.width / 2)

navigateButton(
text: "기업찾기\n ",
image: .findCompanyImage
) {
viewModel.isNavigateFindCompany.toggle()
}

navigateButton(
text: "기업찾기\n ",
image: .findCompanyImage
) {
viewModel.isNavigateFindCompany.toggle()
navigateButton(
text: "겨울인턴\n ",
image: .winterInternImage
) {
viewModel.isNavigateWinterIntern.toggle()
}
}
.padding(22)
}
.padding(22)
.padding(.bottom, 100)
.background(Color.Sub.gray20)
}
Expand All @@ -65,16 +74,23 @@ struct HomeView: View {
.onAppear {
viewModel.onAppear()
}
.onChange(of: viewModel.isNavigateRecruitment || viewModel.isNavigateFindCompany) { newValue in
.onChange(
of: viewModel.isNavigateRecruitment || viewModel.isNavigateFindCompany || viewModel.isNavigateWinterIntern
) { newValue in
withAnimation {
tabbarHidden.wrappedValue = newValue
}
}
.navigate(
to: recruitmentFactory.makeView()
to: recruitmentFactory.makeView(winterIntern: false)
.eraseToAnyView(),
when: $viewModel.isNavigateRecruitment
)
.navigate(
to: recruitmentFactory.makeView(winterIntern: true)
.eraseToAnyView(),
when: $viewModel.isNavigateWinterIntern
)
.navigate(
to: findCompanyFactory.makeView()
.eraseToAnyView(),
Expand Down Expand Up @@ -109,12 +125,20 @@ struct HomeView: View {
HStack {
Spacer()

JOBISImage(image)
.frame(width: 96, height: 96)
if image == .winterInternImage {
JOBISImage(image)
.frame(width: 63, height: 68)
.padding(.vertical, (96 - 68)/2)
.padding(.trailing, (96 - 68)/2)
} else {
JOBISImage(image)
.frame(width: 96, height: 96)
}
}
.padding(.bottom, 8)
.padding(.trailing, 7)
}
.frame(minWidth: 122)
.background(Color.Sub.gray10)
.cornerRadius(10)
.shadow(opacity: 0.1, y: 1, blur: 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class HomeViewModel: BaseViewModel {
@Published var totalPassStudent: TotalPassStudentEntity?
@Published var studentInfo: StudentInfoEntity?
@Published var isNavigateRecruitment: Bool = false
@Published var isNavigateWinterIntern: Bool = false
@Published var isNavigateFindCompany: Bool = false

private let fetchApplicationUseCase: FetchApplicationUseCase
Expand Down
11 changes: 10 additions & 1 deletion Projects/Feature/MenuFeature/Sources/MenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct MenuView: View {

menuListCell(image: .fetchRecruitment, title: "모집의뢰서 조회하기")

menuListCell(image: .winterInternImage, title: "겨울인턴 조회하기")

menuListCell(image: .findCompany, title: "기업 찾기")

menuListCell(image: .bookmarkList, title: "북마크한 기업 보기")
Expand All @@ -59,9 +61,13 @@ struct MenuView: View {
when: $viewModel.isNavigateMyPage
)
.navigate(
to: recruitmentFactory.makeView().eraseToAnyView(),
to: recruitmentFactory.makeView(winterIntern: false).eraseToAnyView(),
when: $viewModel.isNavigateRecruitmentView
)
.navigate(
to: recruitmentFactory.makeView(winterIntern: true).eraseToAnyView(),
when: $viewModel.isNavigateWinterInternView
)
.navigate(
to: findCompanyFactory.makeView().eraseToAnyView(),
when: $viewModel.isNavigateCompanyView
Expand Down Expand Up @@ -101,6 +107,9 @@ struct MenuView: View {
case .profile:
viewModel.isNavigateMyPage.toggle()

case .winterInternImage:
viewModel.isNavigateWinterInternView.toggle()

default: break
}
} label: {
Expand Down
3 changes: 2 additions & 1 deletion Projects/Feature/MenuFeature/Sources/MenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import Combine
final class MenuViewModel: BaseViewModel {
@Published var isNavigateMyPage = false
@Published var isNavigateRecruitmentView = false
@Published var isNavigateWinterInternView = false
@Published var isNavigateCompanyView = false
@Published var isNavigateBookmarkListView = false
var isTabbarHidden: Bool {
isNavigateMyPage || isNavigateRecruitmentView || isNavigateCompanyView || isNavigateBookmarkListView
isNavigateMyPage || isNavigateRecruitmentView || isNavigateCompanyView || isNavigateBookmarkListView || isNavigateWinterInternView
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import SwiftUI

public protocol RecruitmentFactory {
associatedtype SomeView: View
func makeView() -> SomeView
func makeView(winterIntern: Bool) -> SomeView
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ public protocol RecruitmentDependency: Dependency {
}

public final class RecruitmentComponent: Component<RecruitmentDependency>, RecruitmentFactory {
public func makeView() -> some View {
public func makeView(winterIntern: Bool) -> some View {
RecruitmentView(
viewModel: .init(
fetchCodeUseCase: dependency.fetchCodesUseCase,
fetchRecruitmentListUseCase: dependency.fetchRecruitmentListUseCase,
bookmarkUseCase: dependency.bookmarkUseCase
bookmarkUseCase: dependency.bookmarkUseCase,
winterIntern: winterIntern
),
recruitmentDetailFactory: dependency.recruitmentDetailFactory
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RecruitmentView: View {
viewModel.onAppear()
}
.hideKeyboardWhenTap()
.navigationTitle("모집의뢰서 조회하기")
.navigationTitle((viewModel.winterIntern ? "겨울인턴": "모집의뢰서") + " 조회하기")
.sheet(isPresented: $viewModel.isShowFilterSheet) {
viewModel.fetchRecruitment()
} content: {
Expand Down
Loading

0 comments on commit d728830

Please sign in to comment.