Skip to content

Commit

Permalink
Merge pull request #239 from Nexters/feat/#238-empty-route
Browse files Browse the repository at this point in the history
[Feat/#238] �여행 루트 페이지에서 Empty Guide 뷰 추가
  • Loading branch information
mooyoung2309 authored May 12, 2023
2 parents 7974e85 + c9b3960 commit 67b5f2e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class PlannerRouteViewController: NavigationBarViewController, View {
let emptyLabel: UILabel = .init()
let routeCollectionView: UICollectionView = .init(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
let pikmiRouteCollectionView: UICollectionView = .init(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
let emptyPikmiRouteView: UIView = .init()
let emptyPikmiRouteImageView: UIImageView = .init()
let emptyPikmiRouteLabel: UILabel = .init()
let doneButton: JYPButton = .init(type: .done)

// MARK: - Initializer
Expand Down Expand Up @@ -94,14 +97,23 @@ class PlannerRouteViewController: NavigationBarViewController, View {
pikmiRouteCollectionView.register(RouteCollectionViewCell.self, forCellWithReuseIdentifier: String(describing: RouteCollectionViewCell.self))
pikmiRouteCollectionView.register(PikmiRouteCollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: String(describing: PikmiRouteCollectionReusableView.self))

emptyPikmiRouteImageView.image = JYPIOSAsset.searchPlaceIllust.image

emptyPikmiRouteLabel.text = "토론장에서 후보 장소를 추가하고\n루트를 계획해주세요!"
emptyPikmiRouteLabel.font = JYPIOSFontFamily.Pretendard.regular.font(size: 16)
emptyPikmiRouteLabel.textColor = JYPIOSAsset.textB75.color
emptyPikmiRouteLabel.textAlignment = .center
emptyPikmiRouteLabel.numberOfLines = 0

doneButton.isEnabled = true
}

override func setupHierarchy() {
super.setupHierarchy()

contentView.addSubviews([routeCollectionView, pikmiRouteCollectionView, doneButton])
contentView.addSubviews([routeCollectionView, pikmiRouteCollectionView, emptyPikmiRouteView, doneButton])
routeCollectionView.addSubviews([emptyLabel])
emptyPikmiRouteView.addSubviews([emptyPikmiRouteImageView, emptyPikmiRouteLabel])
}

override func setupLayout() {
Expand All @@ -121,6 +133,22 @@ class PlannerRouteViewController: NavigationBarViewController, View {
$0.leading.trailing.bottom.equalToSuperview()
}

emptyPikmiRouteView.snp.makeConstraints {
$0.centerX.equalTo(pikmiRouteCollectionView)
$0.bottom.equalTo(doneButton.snp.top).offset(-160)
}

emptyPikmiRouteImageView.snp.makeConstraints {
$0.top.equalToSuperview()
$0.centerX.equalToSuperview()
$0.height.equalTo(99)
}

emptyPikmiRouteLabel.snp.makeConstraints {
$0.top.equalTo(emptyPikmiRouteImageView.snp.bottom).offset(8)
$0.leading.trailing.bottom.equalToSuperview()
}

doneButton.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(24)
$0.bottom.equalToSuperview().inset(34)
Expand Down Expand Up @@ -197,6 +225,7 @@ class PlannerRouteViewController: NavigationBarViewController, View {
.bind { this, sections in
let layout = this.makePikmiRouteLayout(sections: sections)
this.pikmiRouteCollectionView.collectionViewLayout = layout
this.emptyPikmiRouteView.isHidden = !sections.isEmpty
}
.disposed(by: disposeBag)

Expand Down Expand Up @@ -259,6 +288,7 @@ extension PlannerRouteViewController {

func makePikmiRouteSectionLayout(from sectionItems: [PikmiRouteItem]) -> NSCollectionLayoutSection? {
if sectionItems.isEmpty {
self.emptyPikmiRouteView.isHidden = false
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BaseProjectFactory: ProjectFactory {
let infoPlist: [String: InfoPlist.Value] = [
"ITSAppUsesNonExemptEncryption": false,
"CFBundleName": "저니피키",
"CFBundleShortVersionString": "1.2.0",
"CFBundleShortVersionString": "1.2.1",
"CFBundleVersion": "1",
"UILaunchStoryboardName": "LaunchScreen",
"KAKAO_REST_KEY": "$(KAKAO_REST_KEY)",
Expand Down

0 comments on commit 67b5f2e

Please # to comment.