Skip to content

Commit

Permalink
Merge pull request #354 from OMZigak/fix/#353-meeting-info-qa
Browse files Browse the repository at this point in the history
[fix] 모임 상세 화면 QA 반영하기
  • Loading branch information
JinUng41 committed Sep 2, 2024
2 parents e960117 + 138a8e8 commit 168a340
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 23 deletions.
7 changes: 7 additions & 0 deletions KkuMulKum/Source/MeetingInfo/Cell/MeetingMemberCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ final class MeetingMemberCell: BaseCollectionViewCell {
super.prepareForReuse()

profileImageButton.do {
var config = UIButton.Configuration.plain()
config.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)

$0.imageView?.image = nil
$0.backgroundColor = .clear
$0.isEnabled = false
Expand Down Expand Up @@ -89,6 +92,10 @@ private extension MeetingMemberCell {
self.delegate = delegate

profileImageButton.do {
var config = UIButton.Configuration.plain()
config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)

$0.configuration = config
$0.backgroundColor = .gray1
$0.setImage(.iconPlus.withTintColor(.gray4), for: .normal)
$0.isEnabled = true
Expand Down
25 changes: 16 additions & 9 deletions KkuMulKum/Source/MeetingInfo/View/MeetingInfoBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ final class MeetingInfoBannerView: BaseView {
$0.setText("모임 생성일", style: .label01, color: .gray4)
}

private let divider = UIView(backgroundColor: .gray4)
private let divider = UILabel().then {
$0.setText("l", style: .label01, color: .gray4)
}

private let createdAtLabel = UILabel().then {
$0.setText("2024.06.01", style: .label01, color: .gray4)
Expand All @@ -40,24 +42,29 @@ final class MeetingInfoBannerView: BaseView {
backgroundColor = .lightGreen
layer.cornerRadius = 8

horizontalStackView.addArrangedSubviews(explanationLabel, divider, createdAtLabel)
backgroundImageView.addSubviews(horizontalStackView, metCountLabel)
backgroundImageView.addSubviews(explanationLabel, divider, createdAtLabel, metCountLabel)
addSubviews(backgroundImageView)
}

override func setupAutoLayout() {
explanationLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(20)
$0.leading.equalToSuperview().offset(16)
}

divider.snp.makeConstraints {
$0.width.equalTo(1)
$0.leading.equalTo(explanationLabel.snp.trailing).offset(12)
$0.centerY.equalTo(explanationLabel)
}

horizontalStackView.snp.makeConstraints {
$0.top.equalToSuperview().offset(20)
$0.leading.equalToSuperview().offset(16)
createdAtLabel.snp.makeConstraints {
$0.leading.equalTo(divider.snp.trailing).offset(12)
$0.centerY.equalTo(explanationLabel)
}

metCountLabel.snp.makeConstraints {
$0.top.equalTo(horizontalStackView.snp.bottom).offset(2)
$0.leading.equalTo(horizontalStackView)
$0.top.equalTo(explanationLabel.snp.bottom).offset(2)
$0.leading.equalTo(explanationLabel)
$0.bottom.equalToSuperview().offset(-20)
}

Expand Down
13 changes: 1 addition & 12 deletions KkuMulKum/Source/MeetingInfo/View/MeetingInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ final class MeetingInfoView: BaseView {
$0.setText("모임 참여 인원 0명", style: .body01, color: .gray8)
}

private let arrowButton = UIButton().then {
let image = UIImage(resource: .iconRight).withTintColor(.gray4)
$0.setImage(image, for: .normal)
$0.contentMode = .scaleAspectFill
}

private let createPromiseButton = UIButton(backgroundColor: .maincolor).then {
$0.setTitle("+ 약속추가", style: .body01, color: .white)
$0.layer.cornerRadius = Screen.height(52) / 2
Expand Down Expand Up @@ -102,7 +96,7 @@ final class MeetingInfoView: BaseView {
)
emptyDescriptionView.addSubviews(emptyDescriptionLabel)
addSubviews(
infoBanner, memberCountLabel, arrowButton, memberListView, createPromiseButton,
infoBanner, memberCountLabel, memberListView, createPromiseButton,
grayBackgroundView
)
bringSubviewToFront(createPromiseButton)
Expand All @@ -121,11 +115,6 @@ final class MeetingInfoView: BaseView {
$0.leading.equalTo(infoBanner)
}

arrowButton.snp.makeConstraints {
$0.trailing.equalToSuperview().offset(-20)
$0.centerY.equalTo(memberCountLabel)
}

memberListView.snp.makeConstraints {
$0.top.equalTo(memberCountLabel.snp.bottom).offset(20)
$0.horizontalEdges.equalToSuperview()
Expand Down
30 changes: 28 additions & 2 deletions KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,33 @@ extension MeetingInfoViewModel: ViewModelType {
}
.disposed(by: disposeBag)

let info = infoRelay.asDriver(onErrorJustReturn: nil)
let info = infoRelay
.map { info -> MeetingInfoModel? in
guard let info else {
print("MeetingInfoModel이 존재하지 않습니다.")
return nil
}

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"

guard let date = dateFormatter.date(from: info.createdAt) else {
print("서버의 date가 형식에 맞지 않습니다.")
return nil
}

dateFormatter.dateFormat = "yyyy.MM.dd"
let dateString = dateFormatter.string(from: date)

return MeetingInfoModel(
meetingID: info.meetingID,
name: info.name,
createdAt: dateString,
metCount: info.metCount,
invitationCode: info.invitationCode
)
}
.asDriver(onErrorJustReturn: nil)

let memberCount = meetingMemberModelRelay
.compactMap { $0?.memberCount }
Expand Down Expand Up @@ -218,7 +244,7 @@ private extension MeetingInfoViewModel {
if 0 < dDay {
return ("+\(dDay)", .past)
} else if 0 == dDay {
return ("-Day", .today)
return ("-DAY", .today)
} else {
return ("\(dDay)", .future)
}
Expand Down

0 comments on commit 168a340

Please sign in to comment.