From 6092a4d452619b706fb0cb69e550d805297e8407 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Thu, 9 Jan 2025 15:36:17 +0900 Subject: [PATCH 01/11] =?UTF-8?q?chore:=20=ED=8F=B4=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=EB=B0=8F=20=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MatchingStatusApplicantDetailViewController.swift | 8 ++++++++ .../Views/MatchingStatusApplicantDetailView.swift | 8 ++++++++ .../MatchingStatusApplicantListViewController.swift | 8 ++++++++ .../Views/MatchingStatusApplicantListView.swift | 8 ++++++++ .../MatchingStatusMyApplicationViewController.swift | 8 ++++++++ .../Views/MatchingStatusMyApplicationView.swift | 8 ++++++++ .../MatchingStatusWalkInfoForOwnerViewController.swift | 8 ++++++++ .../Views/MatchingStatusWalkInfoForOwnerView.swift | 8 ++++++++ .../MatchingStatusWalkInfoForWalkerViewController.swift | 8 ++++++++ .../Views/MatchingStatusWalkInfoForWalkerView.swift | 8 ++++++++ 10 files changed, 80 insertions(+) create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift new file mode 100644 index 00000000..0726cbf6 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusApplicantDetailViewController.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift new file mode 100644 index 00000000..5f184545 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusApplicantDetailView.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift new file mode 100644 index 00000000..32f8d6f8 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusApplicantListViewController.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift new file mode 100644 index 00000000..93a116a1 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusApplicantListView.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift new file mode 100644 index 00000000..dcb619d4 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusMyApplicationViewController.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift new file mode 100644 index 00000000..f86731e7 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusMyApplicationView.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift new file mode 100644 index 00000000..993940cc --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusWalkInfoForOwnerViewController.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift new file mode 100644 index 00000000..df3d4403 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusWalkInfoForOwnerView.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift new file mode 100644 index 00000000..27ea6c9c --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusWalkInfoForWalkerViewController.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift new file mode 100644 index 00000000..b56995f6 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift @@ -0,0 +1,8 @@ +// +// MatchingStatusWalkInfoForWalkerView.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation From 5e1f11b5e98b82fbeac17eef097bd3c90bfc79b7 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Thu, 9 Jan 2025 16:55:54 +0900 Subject: [PATCH 02/11] =?UTF-8?q?feat:=20dogProfileView=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Matching/Views/MatchingCell.swift | 7 ++ ...ingStatusApplicantListViewController.swift | 62 ++++++++++++++++- .../MatchingStatusApplicantListView.swift | 69 ++++++++++++++++++- 3 files changed, 136 insertions(+), 2 deletions(-) diff --git a/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift b/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift index 01f0722d..a3010992 100644 --- a/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift +++ b/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift @@ -234,6 +234,13 @@ class MatchingCell: UIView { genderIcon.image = genderIconImage(for: data.dogGender) } + func setCustomViewAppearance(hideSizeLabel: Bool, hideDistanceLabel: Bool, hideTimeLabel: Bool, backgroundColor: UIColor) { + sizeLabel.isHidden = hideSizeLabel + distanceLabel.isHidden = hideDistanceLabel + timeLabel.isHidden = hideTimeLabel + mainView.backgroundColor = backgroundColor + } + func configureDateLabel(selectedDate: String, startTime: String, endTime: String) { let dateFormatter = DateFormatter() dateFormatter.locale = Locale(identifier: "ko_KR") diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift index 32f8d6f8..38dc3319 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift @@ -5,4 +5,64 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusApplicantListViewController: UIViewController { + + // MARK: - Properties + private let applicantListView = MatchingStatusApplicantListView() + private var matchingData: MatchingData? + + // MARK: - Life Cycle + override func viewDidLoad() { + super.viewDidLoad() + setupView() + setupNavigationBar() + loadData() + } + + // MARK: - Setup View + private func setupView() { + view.backgroundColor = .white + view.addSubview(applicantListView) + applicantListView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(52) + make.leading.trailing.bottom.equalToSuperview() + } + } + + private func setupNavigationBar() { + addCustomNavigationBar( + titleText: "지원한 산책자 보기", + showLeftBackButton: true, + showLeftCloseButton: false, + showRightCloseButton: false, + showRightRefreshButton: false + ) + } + + // MARK: - Data Management + private func loadData() { + matchingData = MatchingData( + boardId: 1, + startTime: "2025-01-03T00:32:40", + endTime: "2025-01-03T14:32:30", + matchingYn: "Y", + dogName: "봄별이", + dogProfile: "https://vetmed.tamu.edu/news/wp-content/uploads/sites/9/2023/05/AdobeStock_472713009-1024x768.jpeg", + dogGender: "FEMALE", + breed: "말티즈", + weight: 4, + dogSize: "SMALL", + content: "Helloworld", + dongAddress: "마포구 공덕동", + distance: 1000, + createdAt: "2025-01-02T00:32:40" + ) + + if let data = matchingData { + applicantListView.configureContent(with: data) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift index 93a116a1..08bba21a 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift @@ -5,4 +5,71 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusApplicantListView: UIView { + + // MARK: - UI Components + private let scrollView = UIScrollView() + private let contentView = UIView() + private let dogProfileView = UIView() + + // MARK: - Initializers + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup UI + private func setupUI() { + backgroundColor = .white + + addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.equalToSuperview() + } + } + + // MARK: - Configure Content + func configureContent(with data: MatchingData) { + contentView.subviews.forEach { $0.removeFromSuperview() } + + dogProfileView.backgroundColor = .gray100 + dogProfileView.layer.cornerRadius = 10 + contentView.addSubview(dogProfileView) + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(32) + make.leading.trailing.equalToSuperview().inset(20) + } + + let dogProfileCell = MatchingCell() + dogProfileCell.configure(with: data) + dogProfileCell.setCustomViewAppearance( + hideSizeLabel: true, + hideDistanceLabel: true, + hideTimeLabel: true, + backgroundColor: .clear + ) + dogProfileView.addSubview(dogProfileCell) + dogProfileCell.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + + dogProfileView.snp.makeConstraints { make in + make.bottom.equalToSuperview().offset(-32) + } + } +} From 6c6c7acce50fab89268dee9015c7436be83c6d43 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Thu, 9 Jan 2025 23:24:24 +0900 Subject: [PATCH 03/11] =?UTF-8?q?feat:=20MatchingStatusApplicantListViewCo?= =?UTF-8?q?ntroller=20=EA=B5=AC=ED=98=84=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/MatchingDogInformationView.swift | 13 +- .../DogInformation/Views/OwnerInfoView.swift | 49 +---- .../Model/MatchingStatusApplicantDetail.swift | 18 ++ ...ingStatusApplicantListViewController.swift | 36 +++- .../MatchingStatusApplicantListCell.swift | 180 ++++++++++++++++++ .../MatchingStatusApplicantListView.swift | 77 +++++++- 6 files changed, 311 insertions(+), 62 deletions(-) create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Model/MatchingStatusApplicantDetail.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift diff --git a/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/MatchingDogInformationView.swift b/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/MatchingDogInformationView.swift index 93e606d3..e9ff0cc9 100644 --- a/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/MatchingDogInformationView.swift +++ b/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/MatchingDogInformationView.swift @@ -6,7 +6,7 @@ protocol MatchingDogInformationViewDelegate: AnyObject { func applyWalkButtonTapped() } -class MatchingDogInformationView: UIView, UIScrollViewDelegate { +final class MatchingDogInformationView: UIView, UIScrollViewDelegate { // MARK: - Delegate weak var delegate: MatchingDogInformationViewDelegate? @@ -23,9 +23,7 @@ class MatchingDogInformationView: UIView, UIScrollViewDelegate { private let ownerInfoFrame = OwnerInfoView() private let buttonFrame = UIView() - private let walkTalkButton: UIView = MatchingDogInformationView.createRoundedButton( - backgroundColor: UIColor.gray100, cornerRadius: 15 - ) + private let walkTalkButton: UIView = UIView.createRoundedView(backgroundColor: UIColor.gray100, cornerRadius: 15) private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "산책 지원하기") // MARK: - Initializer @@ -244,13 +242,6 @@ class MatchingDogInformationView: UIView, UIScrollViewDelegate { } // MARK: - Helper Methods - private static func createRoundedButton(backgroundColor: UIColor, cornerRadius: CGFloat) -> UIView { - let view = UIView() - view.backgroundColor = backgroundColor - view.layer.cornerRadius = cornerRadius - return view - } - func configureImages(with imageUrls: [String?]) { guard let firstImageUrl = imageUrls.first else { imageView.image = UIImage(named: "placeholder") diff --git a/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/OwnerInfoView.swift b/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/OwnerInfoView.swift index 335b2475..36877b3a 100644 --- a/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/OwnerInfoView.swift +++ b/walkmong/walkmong/Presentation/MatchingApply/DogInformation/Views/OwnerInfoView.swift @@ -12,13 +12,7 @@ class OwnerInfoView: UIView { ) private let nameLabel = UpperTitleLabel(text: "", textColor: .gray600) - - private let ageLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) - - private let separatorLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) - - private let genderLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) - + private let infoLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) private let starIcon = UIImage.createImageView(named: "starIcon.png") private let ratingLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .mainBlue) @@ -44,8 +38,7 @@ class OwnerInfoView: UIView { layer.cornerRadius = 20 let subviews = [ - titleLabel, profileImageView, nameLabel, ageLabel, separatorLabel, - genderLabel, starIcon, ratingLabel, locationIcon, locationLabel + titleLabel, profileImageView, nameLabel, infoLabel, starIcon, ratingLabel, locationIcon, locationLabel ] subviews.forEach { addSubview($0) } setupConstraints() @@ -68,23 +61,13 @@ class OwnerInfoView: UIView { make.leading.equalTo(profileImageView.snp.trailing).offset(12) } - ageLabel.snp.makeConstraints { make in - make.leading.equalTo(nameLabel.snp.trailing).offset(8) - make.centerY.equalTo(nameLabel.snp.centerY) - } - - separatorLabel.snp.makeConstraints { make in - make.leading.equalTo(ageLabel.snp.trailing).offset(4) - make.centerY.equalTo(ageLabel.snp.centerY) - } - - genderLabel.snp.makeConstraints { make in - make.leading.equalTo(separatorLabel.snp.trailing).offset(4) - make.centerY.equalTo(separatorLabel.snp.centerY) + infoLabel.snp.makeConstraints { make in + make.centerY.equalTo(nameLabel) + make.leading.equalTo(nameLabel.snp.trailing).offset(24) } starIcon.snp.makeConstraints { make in - make.top.equalTo(ageLabel.snp.bottom).offset(16) + make.top.equalTo(infoLabel.snp.bottom).offset(16) make.leading.equalTo(nameLabel.snp.leading) make.width.height.equalTo(17) } @@ -119,8 +102,8 @@ class OwnerInfoView: UIView { ) { profileImageView.setImage(from: ownerProfile, placeholder: "profileExample") nameLabel.text = ownerName - ageLabel.text = formatAge(ownerAge) - genderLabel.text = ownerGender == "FEMALE" ? "여성" : "남성" + let genderText = ownerGender == "FEMALE" ? "여성" : "남성" + infoLabel.text = "\(ownerAge)살 · \(genderText)" ratingLabel.text = String(format: "%.1f", ownerRate) locationLabel.text = "\(dongAddress) \(formatDistance(distance))" } @@ -134,22 +117,6 @@ class OwnerInfoView: UIView { return label } - private func formatAge(_ age: Int) -> String { - let ageGroup = (age / 10) * 10 - let ageCategory: String - switch age % 10 { - case 0...2: - ageCategory = "초반" - case 3...6: - ageCategory = "중반" - case 7...9: - ageCategory = "후반" - default: - ageCategory = "" - } - return "\(ageGroup)대 \(ageCategory)" - } - private func formatDistance(_ distance: Double) -> String { if distance < 1000 { return "\(Int(distance))m" diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Model/MatchingStatusApplicantDetail.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Model/MatchingStatusApplicantDetail.swift new file mode 100644 index 00000000..14803364 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Model/MatchingStatusApplicantDetail.swift @@ -0,0 +1,18 @@ +// +// MatchingStatusApplicantDetail.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation + +struct MatchingStatusApplicantDetail { + let ownerProfile: String? + let ownerName: String + let ownerAge: Int + let ownerGender: String + let ownerRate: Double? + let dongAddress: String + let distance: Double +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift index 38dc3319..c88bb28e 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/ViewController/MatchingStatusApplicantListViewController.swift @@ -44,7 +44,7 @@ final class MatchingStatusApplicantListViewController: UIViewController { // MARK: - Data Management private func loadData() { - matchingData = MatchingData( + let dogProfileData = MatchingData( boardId: 1, startTime: "2025-01-03T00:32:40", endTime: "2025-01-03T14:32:30", @@ -60,9 +60,37 @@ final class MatchingStatusApplicantListViewController: UIViewController { distance: 1000, createdAt: "2025-01-02T00:32:40" ) + applicantListView.configureDogProfile(with: dogProfileData) - if let data = matchingData { - applicantListView.configureContent(with: data) - } + let applicants: [MatchingStatusApplicantDetail] = [ + MatchingStatusApplicantDetail( + ownerProfile: "https://img.freepik.com/free-photo/expressive-asian-girl-posing-indoor_344912-1234.jpg?semt=ais_hybrid", + ownerName: "홍길동", + ownerAge: 32, + ownerGender: "MALE", + ownerRate: 4.8, + dongAddress: "서울시 강남구", + distance: 500 + ), + MatchingStatusApplicantDetail( + ownerProfile: "https://img.freepik.com/free-photo/expressive-asian-girl-posing-indoor_344912-1234.jpg?semt=ais_hybrid", + ownerName: "김영희", + ownerAge: 28, + ownerGender: "FEMALE", + ownerRate: 4.9, + dongAddress: "서울시 마포구", + distance: 800 + ), + MatchingStatusApplicantDetail( + ownerProfile: "https://img.freepik.com/free-photo/expressive-asian-girl-posing-indoor_344912-1234.jpg?semt=ais_hybrid", + ownerName: "김영희", + ownerAge: 28, + ownerGender: "FEMALE", + ownerRate: 4.9, + dongAddress: "서울시 마포구", + distance: 800 + ) + ] + applicantListView.configureApplicantsList(with: applicants) } } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift new file mode 100644 index 00000000..c2ec9596 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift @@ -0,0 +1,180 @@ +// +// MatchingStatusApplicantListCell.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import UIKit +import SnapKit + +final class MatchingStatusApplicantListCell: UIView { + + // MARK: - UI Components + + private let profileImageView = UIImage.createImageView( + named: "profileExample", + cornerRadius: 41 + ) + + private let nameLabel = UpperTitleLabel(text: "", textColor: .gray600) + private let infoLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) + private let profileButton = UIButton() + private let starIcon = UIImage.createImageView(named: "starIcon.png") + + private let ratingLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .mainBlue) + + private let locationIcon = UIImage.createImageView(named: "locationIcon.png") + + private let locationLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .gray400) + + private let walkTalkButton: UIView = { + let view = UIView.createRoundedView(backgroundColor: UIColor.gray100, cornerRadius: 15) + + let label = UILabel() + label.text = "워크톡" + label.textColor = UIColor.gray400 + label.font = UIFont(name: "Pretendard-SemiBold", size: 16) + + let icon = UIImageView() + icon.image = UIImage(named: "messageIcon") + icon.contentMode = .scaleAspectFit + + let stackView = UIStackView(arrangedSubviews: [label, icon]) + stackView.axis = .horizontal + stackView.alignment = .center + stackView.spacing = 8 + + view.addSubview(stackView) + stackView.snp.makeConstraints { make in + make.center.equalToSuperview() + } + + return view + }() + + private let viewApplicationButton = UIButton.createStyledButton(type: .large, style: .dark, title: "지원서 보기") + + // MARK: - Initializer + override init(frame: CGRect) { + super.init(frame: frame) + setupView() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup + private func setupView() { + backgroundColor = .gray100 + layer.cornerRadius = 20 + + addSubviews(profileImageView, nameLabel, infoLabel, profileButton, starIcon, ratingLabel, locationIcon, locationLabel, walkTalkButton, viewApplicationButton) + setupConstraints() + } + + private func setupConstraints() { + profileImageView.contentMode = .scaleAspectFill + profileImageView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.leading.equalToSuperview() + make.width.height.equalTo(82) + } + + nameLabel.snp.makeConstraints { make in + make.top.equalTo(profileImageView) + make.leading.equalTo(profileImageView.snp.trailing).offset(12) + } + + infoLabel.snp.makeConstraints { make in + make.centerY.equalTo(nameLabel) + make.leading.equalTo(nameLabel.snp.trailing).offset(24) + } + + profileButton.setTitle("프로필", for: .normal) + profileButton.backgroundColor = .mainBlue + profileButton.layer.cornerRadius = 5 + profileButton.titleLabel?.font = UIFont(name: "Pretendard-SemiBold", size: 12) + profileButton.setTitleColor(.white, for: .normal) + profileButton.snp.makeConstraints { make in + make.trailing.equalToSuperview() + make.top.equalTo(profileImageView) + make.width.equalTo(54) + make.height.equalTo(25) + } + + starIcon.snp.makeConstraints { make in + make.centerY.equalTo(ratingLabel) + make.leading.equalTo(nameLabel.snp.leading) + make.width.height.equalTo(17) + } + + ratingLabel.snp.makeConstraints { make in + make.leading.equalTo(starIcon.snp.trailing).offset(4) + make.top.equalTo(nameLabel.snp.bottom).offset(8) + } + + locationIcon.snp.makeConstraints { make in + make.centerX.equalTo(starIcon.snp.centerX) + make.centerY.equalTo(locationLabel) + make.height.equalTo(14) + } + + locationLabel.snp.makeConstraints { make in + make.top.equalTo(ratingLabel.snp.bottom).offset(8) + make.leading.equalTo(ratingLabel.snp.leading) + } + + walkTalkButton.snp.makeConstraints { make in + make.top.equalTo(profileImageView.snp.bottom).offset(24) + make.leading.equalToSuperview() + make.width.equalTo(83) + make.height.equalTo(53) + make.bottom.equalToSuperview() + } + + viewApplicationButton.snp.makeConstraints { make in + make.centerY.equalTo(walkTalkButton) + make.leading.equalTo(walkTalkButton.snp.trailing).offset(8) + make.trailing.equalToSuperview() + make.height.equalTo(walkTalkButton) + } + } + + // MARK: - Public Method + func updateOwnerInfo( + ownerProfile: String?, + ownerName: String, + ownerAge: Int, + ownerGender: String, + ownerRate: Double, + dongAddress: String, + distance: Double + ) { + profileImageView.setImage(from: ownerProfile, placeholder: "profileExample") + nameLabel.text = ownerName + let genderText = ownerGender == "FEMALE" ? "여성" : "남성" + infoLabel.text = "\(ownerAge)살 · \(genderText)" + ratingLabel.text = String(format: "%.1f", ownerRate) + locationLabel.text = "\(dongAddress) \(formatDistance(distance))" + } + + // MARK: - Helper Methods + private static func createLabel(text: String, textColor: UIColor, font: UIFont?) -> UILabel { + let label = UILabel() + label.text = text + label.textColor = textColor + label.font = font + return label + } + + private func formatDistance(_ distance: Double) -> String { + if distance < 1000 { + return "\(Int(distance))m" + } else { + let distanceInKm = distance / 1000 + return distanceInKm == floor(distanceInKm) ? "\(Int(distanceInKm))km" : String(format: "%.1fkm", distanceInKm) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift index 08bba21a..96c0362a 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift @@ -14,6 +14,16 @@ final class MatchingStatusApplicantListView: UIView { private let scrollView = UIScrollView() private let contentView = UIView() private let dogProfileView = UIView() + private let applicantsLabel = SmallTitleLabel(text: "지원한 산책자 (2)") + + private let cellContainerView: UIView = { + let view = UIView() + view.backgroundColor = .gray100 + view.layer.cornerRadius = 10 + view.layer.masksToBounds = true + return view + }() + private let applicantListCell = MatchingStatusApplicantListCell() // MARK: - Initializers override init(frame: CGRect) { @@ -42,12 +52,11 @@ final class MatchingStatusApplicantListView: UIView { } // MARK: - Configure Content - func configureContent(with data: MatchingData) { - contentView.subviews.forEach { $0.removeFromSuperview() } - + func configureDogProfile(with data: MatchingData) { dogProfileView.backgroundColor = .gray100 dogProfileView.layer.cornerRadius = 10 - contentView.addSubview(dogProfileView) + contentView.addSubviews(dogProfileView, applicantsLabel, cellContainerView) + dogProfileView.snp.makeConstraints { make in make.top.equalToSuperview().offset(32) make.leading.trailing.equalToSuperview().inset(20) @@ -68,8 +77,64 @@ final class MatchingStatusApplicantListView: UIView { make.height.equalTo(151) } - dogProfileView.snp.makeConstraints { make in - make.bottom.equalToSuperview().offset(-32) + applicantsLabel.snp.makeConstraints { make in + make.top.equalTo(dogProfileView.snp.bottom).offset(52) + make.leading.equalToSuperview().inset(20) + } + } + + func configureApplicantsList(with applicants: [MatchingStatusApplicantDetail]) { + contentView.subviews.filter { $0 !== dogProfileView && $0 !== applicantsLabel }.forEach { $0.removeFromSuperview() } + + var previousContainer: UIView? + + for applicant in applicants { + let cellContainerView = UIView() + cellContainerView.backgroundColor = .gray100 + cellContainerView.layer.cornerRadius = 10 + cellContainerView.layer.masksToBounds = true + + let containerView = UIView() + containerView.backgroundColor = .clear + + let cell = MatchingStatusApplicantListCell() + cell.updateOwnerInfo( + ownerProfile: applicant.ownerProfile ?? "defaultProfileImage", + ownerName: applicant.ownerName, + ownerAge: applicant.ownerAge, + ownerGender: applicant.ownerGender, + ownerRate: applicant.ownerRate ?? 1.0, + dongAddress: applicant.dongAddress, + distance: applicant.distance + ) + + containerView.addSubview(cell) + cell.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + cellContainerView.addSubview(containerView) + containerView.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(12) + } + + contentView.addSubview(cellContainerView) + cellContainerView.snp.makeConstraints { make in + if let previous = previousContainer { + make.top.equalTo(previous.snp.bottom).offset(12) + } else { + make.top.equalTo(applicantsLabel.snp.bottom).offset(12) + } + make.leading.trailing.equalToSuperview().inset(20) + } + + previousContainer = cellContainerView + } + + if let lastContainer = previousContainer { + lastContainer.snp.makeConstraints { make in + make.bottom.equalToSuperview().offset(-16) + } } } } From 4d9bc012ad73b20002a0f93e943fc83cb44c0b77 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Fri, 10 Jan 2025 16:26:27 +0900 Subject: [PATCH 04/11] =?UTF-8?q?feat:=20=EC=A7=80=EC=9B=90=ED=95=9C=20?= =?UTF-8?q?=EC=82=B0=EC=B1=85=20=EC=A0=95=EB=B3=B4=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/MatchingStatusApplicantInfo.swift | 17 +++ ...gStatusApplicantDetailViewController.swift | 70 ++++++++- .../MatchingStatusApplicantDetailCell.swift | 118 +++++++++++++++ .../MatchingStatusApplicantDetailView.swift | 137 +++++++++++++++++- .../MatchingStatusApplicantListCell.swift | 7 - .../MatchingStatusApplicantListView.swift | 4 +- .../ViewController/MyPageViewController.swift | 5 - .../MyPage/Views/MyPageReviewView.swift | 1 + 8 files changed, 344 insertions(+), 15 deletions(-) create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Model/MatchingStatusApplicantInfo.swift create mode 100644 walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Model/MatchingStatusApplicantInfo.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Model/MatchingStatusApplicantInfo.swift new file mode 100644 index 00000000..2b836117 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Model/MatchingStatusApplicantInfo.swift @@ -0,0 +1,17 @@ +// +// MatchingStatusApplicantInfo.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import Foundation + +struct MatchingStatusApplicantInfo { + let ownerProfile: String? + let ownerName: String + let ownerAge: Int + let ownerGender: String + let dongAddress: String + let distance: Double +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift index 0726cbf6..dc7cd5af 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/ViewController/MatchingStatusApplicantDetailViewController.swift @@ -5,4 +5,72 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusApplicantDetailViewController: UIViewController { + + // MARK: - Properties + private let applicationDetailView = MatchingStatusApplicantDetailView() + private var matchingData: MatchingData? + + // MARK: - Life Cycle + override func viewDidLoad() { + super.viewDidLoad() + setupView() + setupNavigationBar() + loadData() + } + + // MARK: - Setup View + private func setupView() { + view.backgroundColor = .gray100 + view.addSubview(applicationDetailView) + applicationDetailView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(52) + make.leading.trailing.bottom.equalToSuperview() + } + } + + private func setupNavigationBar() { + addCustomNavigationBar( + titleText: "산책 지원서", + showLeftBackButton: true, + showLeftCloseButton: false, + showRightCloseButton: false, + showRightRefreshButton: false, + backgroundColor: .clear + ) + } + + // MARK: - Data Management + private func loadData() { + let dogProfileData = MatchingData( + boardId: 1, + startTime: "2025-01-03T00:32:40", + endTime: "2025-01-03T14:32:30", + matchingYn: "Y", + dogName: "봄별이", + dogProfile: "https://vetmed.tamu.edu/news/wp-content/uploads/sites/9/2023/05/AdobeStock_472713009-1024x768.jpeg", + dogGender: "FEMALE", + breed: "말티즈", + weight: 4, + dogSize: "SMALL", + content: "Helloworld", + dongAddress: "마포구 공덕동", + distance: 1000, + createdAt: "2025-01-02T00:32:40" + ) + applicationDetailView.configureDogProfileSection(with: dogProfileData) + + let applicant = MatchingStatusApplicantInfo( + ownerProfile: "https://img.freepik.com/free-photo/expressive-asian-girl-posing-indoor_344912-1234.jpg?semt=ais_hybrid", + ownerName: "홍길동", + ownerAge: 32, + ownerGender: "MALE", + dongAddress: "서울시 강남구", + distance: 500 + ) + applicationDetailView.configureApplicantsList(with: applicant) + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift new file mode 100644 index 00000000..41eb51b9 --- /dev/null +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift @@ -0,0 +1,118 @@ +// +// MatchingStatusApplicantDetailCell.swift +// walkmong +// +// Created by 신호연 on 1/9/25. +// + +import UIKit +import SnapKit + +final class MatchingStatusApplicantDetailCell: UIView { + + // MARK: - UI Components + + private let profileImageView = UIImage.createImageView( + named: "profileExample", + cornerRadius: 41 + ) + + private let nameLabel = UpperTitleLabel(text: "", textColor: .gray600) + private let infoLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) + private let profileButton: UIButton = { + let button = UIButton() + button.setTitle("프로필", for: .normal) + button.backgroundColor = .mainBlue + button.layer.cornerRadius = 5 + button.titleLabel?.font = UIFont(name: "Pretendard-SemiBold", size: 12) + button.setTitleColor(.white, for: .normal) + return button + }() + + private let locationIcon = UIImage.createImageView(named: "meetingPlace") + + private let locationLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .gray400) + + // MARK: - Initializer + override init(frame: CGRect) { + super.init(frame: frame) + setupView() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup + private func setupView() { + backgroundColor = .gray100 + layer.cornerRadius = 20 + + addSubviews(profileImageView, nameLabel, infoLabel, profileButton, locationIcon, locationLabel) + setupConstraints() + } + + private func setupConstraints() { + profileImageView.contentMode = .scaleAspectFill + profileImageView.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(16) + make.leading.equalToSuperview().inset(12) + make.width.height.equalTo(82) + } + + nameLabel.snp.makeConstraints { make in + make.top.equalTo(profileImageView) + make.leading.equalTo(profileImageView.snp.trailing).offset(12) + } + + infoLabel.snp.makeConstraints { make in + make.centerY.equalTo(nameLabel) + make.leading.equalTo(nameLabel.snp.trailing).offset(24) + } + + profileButton.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(12) + make.top.equalTo(profileImageView) + make.width.equalTo(54) + make.height.equalTo(25) + } + + locationIcon.snp.makeConstraints { make in + make.centerY.equalTo(locationLabel) + make.leading.equalTo(nameLabel.snp.leading) + make.width.height.equalTo(17) + } + + locationLabel.snp.makeConstraints { make in + make.leading.equalTo(locationIcon.snp.trailing).offset(4) + make.top.equalTo(nameLabel.snp.bottom).offset(8) + } + } + + // MARK: - Public Method + func updateOwnerInfo( + ownerProfile: String?, + ownerName: String, + ownerAge: Int, + ownerGender: String, + dongAddress: String, + distance: Double + ) { + profileImageView.setImage(from: ownerProfile, placeholder: "profileExample") + nameLabel.text = ownerName + let genderText = ownerGender == "FEMALE" ? "여성" : "남성" + infoLabel.text = "\(ownerAge)살 · \(genderText)" + locationLabel.text = "\(dongAddress) \(formatDistance(distance))" + } + + // MARK: - Helper Methods + + private func formatDistance(_ distance: Double) -> String { + if distance < 1000 { + return "\(Int(distance))m" + } else { + let distanceInKm = distance / 1000 + return distanceInKm == floor(distanceInKm) ? "\(Int(distanceInKm))km" : String(format: "%.1fkm", distanceInKm) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift index 5f184545..2e533ab7 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift @@ -5,4 +5,139 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit +import Charts + +final class MatchingStatusApplicantDetailView: UIView { + + // MARK: - UI Components + private let scrollView = UIScrollView() + private let contentView = UIView() + private let dogProfileView = UIView() + private let applicantInfoLabel = SmallTitleLabel(text: "지원한 산책 정보", textColor: .gray600) + private let applicantInfoCell = MatchingStatusApplicantDetailCell() + private let walkerReviewTitle = SmallTitleLabel(text: "김철수님의 산책자 후기") + private let walkerReviewCount = MainHighlightParagraphLabel(text: "3개", textColor: .gray600) + private let arrowImageView = UIImageView(image: UIImage(named: "MyPageReviewArrow")) + + // MARK: - Initializers + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup UI + private func setupUI() { + setupScrollView() + setupContentView() + } + + private func setupScrollView() { + addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + } + + private func setupContentView() { + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.equalToSuperview() + } + } + + func configureDogProfileSection(with data: MatchingData) { + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + + contentView.addSubviews(dogProfileView, applicantInfoLabel) + + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(32) + make.leading.trailing.equalToSuperview().inset(20) + } + + let dogProfileCell = MatchingCell() + dogProfileCell.configure(with: data) + dogProfileCell.setCustomViewAppearance( + hideSizeLabel: true, + hideDistanceLabel: true, + hideTimeLabel: true, + backgroundColor: .clear + ) + dogProfileView.addSubview(dogProfileCell) + dogProfileCell.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + + applicantInfoLabel.snp.makeConstraints { make in + make.top.equalTo(dogProfileView.snp.bottom).offset(48) + make.leading.equalToSuperview().inset(20) + } + } + + func configureReviewSection() { + contentView.addSubviews(walkerReviewTitle, walkerReviewCount, arrowImageView) + + walkerReviewTitle.snp.makeConstraints { make in + make.top.equalTo(applicantInfoCell.snp.bottom).offset(48) + make.leading.equalTo(applicantInfoCell) + make.bottom.equalTo(0) + } + + walkerReviewCount.snp.makeConstraints { make in + make.centerY.equalTo(walkerReviewTitle) + make.leading.equalTo(walkerReviewTitle.snp.trailing).offset(4) + } + + arrowImageView.snp.makeConstraints { make in + make.centerY.equalTo(walkerReviewTitle) + make.trailing.equalToSuperview().inset(20) + } + } + + // MARK: - Configure Applicant Info Section + func configureApplicantsList(with applicant: MatchingStatusApplicantInfo) { + clearApplicantRelatedSubviews() + setupApplicantInfoCell(with: applicant) + + contentView.addSubview(applicantInfoCell) + applicantInfoCell.snp.makeConstraints { make in + make.top.equalTo(applicantInfoLabel.snp.bottom).offset(20) + make.leading.trailing.equalToSuperview().inset(20) + } + } + + private func clearApplicantRelatedSubviews() { + contentView.subviews.filter { $0 !== dogProfileView && $0 !== applicantInfoLabel }.forEach { $0.removeFromSuperview() } + } + + private func setupApplicantInfoCell(with applicant: MatchingStatusApplicantInfo) { + applicantInfoCell.backgroundColor = .white + applicantInfoCell.layer.cornerRadius = 10 + applicantInfoCell.layer.masksToBounds = true + + applicantInfoCell.updateOwnerInfo( + ownerProfile: applicant.ownerProfile ?? "defaultProfileImage", + ownerName: applicant.ownerName, + ownerAge: applicant.ownerAge, + ownerGender: applicant.ownerGender, + dongAddress: applicant.dongAddress, + distance: applicant.distance + ) + + contentView.addSubview(applicantInfoCell) + applicantInfoCell.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + make.top.equalTo(applicantInfoLabel.snp.bottom).offset(20) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift index c2ec9596..7fac63a5 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift @@ -161,13 +161,6 @@ final class MatchingStatusApplicantListCell: UIView { } // MARK: - Helper Methods - private static func createLabel(text: String, textColor: UIColor, font: UIFont?) -> UILabel { - let label = UILabel() - label.text = text - label.textColor = textColor - label.font = font - return label - } private func formatDistance(_ distance: Double) -> String { if distance < 1000 { diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift index 96c0362a..44b5b1ad 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift @@ -14,7 +14,7 @@ final class MatchingStatusApplicantListView: UIView { private let scrollView = UIScrollView() private let contentView = UIView() private let dogProfileView = UIView() - private let applicantsLabel = SmallTitleLabel(text: "지원한 산책자 (2)") + private let applicantsLabel = SmallTitleLabel(text: "지원한 산책자 (n)") private let cellContainerView: UIView = { let view = UIView() @@ -84,6 +84,8 @@ final class MatchingStatusApplicantListView: UIView { } func configureApplicantsList(with applicants: [MatchingStatusApplicantDetail]) { + applicantsLabel.text = "지원한 산책자 (\(applicants.count))" + contentView.subviews.filter { $0 !== dogProfileView && $0 !== applicantsLabel }.forEach { $0.removeFromSuperview() } var previousContainer: UIView? diff --git a/walkmong/walkmong/Presentation/MyPage/MyPage/ViewController/MyPageViewController.swift b/walkmong/walkmong/Presentation/MyPage/MyPage/ViewController/MyPageViewController.swift index 94af09a1..de95727f 100644 --- a/walkmong/walkmong/Presentation/MyPage/MyPage/ViewController/MyPageViewController.swift +++ b/walkmong/walkmong/Presentation/MyPage/MyPage/ViewController/MyPageViewController.swift @@ -23,11 +23,6 @@ class MyPageViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - updateReviewData() - } - - private func updateReviewData() { - myPageView.contentViewSection.reviewView.updateChartData(scores: [5.0, 5.0, 5.0, 5.0, 5.0]) } } diff --git a/walkmong/walkmong/Presentation/MyPage/MyPage/Views/MyPageReviewView.swift b/walkmong/walkmong/Presentation/MyPage/MyPage/Views/MyPageReviewView.swift index b986e5e5..374a6e2c 100644 --- a/walkmong/walkmong/Presentation/MyPage/MyPage/Views/MyPageReviewView.swift +++ b/walkmong/walkmong/Presentation/MyPage/MyPage/Views/MyPageReviewView.swift @@ -116,6 +116,7 @@ class MyPageReviewView: UIView { keywordTitleLabel.snp.makeConstraints { make in make.top.leading.equalToSuperview().inset(20) + make.height.equalTo(28) } keywordBubbleContainer.snp.makeConstraints { make in From dd7f2da26eae85fb14c04fb2387c251c9b281a49 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Fri, 10 Jan 2025 19:18:51 +0900 Subject: [PATCH 05/11] =?UTF-8?q?feat:=20=EA=B0=81=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=20MatchingCell=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ingStatusMyApplicationViewController.swift | 61 ++++++++++++++- .../MatchingStatusMyApplicationView.swift | 74 ++++++++++++++++++- ...StatusWalkInfoForOwnerViewController.swift | 61 ++++++++++++++- .../MatchingStatusWalkInfoForOwnerView.swift | 74 ++++++++++++++++++- ...tatusWalkInfoForWalkerViewController.swift | 61 ++++++++++++++- .../MatchingStatusWalkInfoForWalkerView.swift | 74 ++++++++++++++++++- 6 files changed, 399 insertions(+), 6 deletions(-) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift index dcb619d4..d2e1fcc8 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/ViewController/MatchingStatusMyApplicationViewController.swift @@ -5,4 +5,63 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusMyApplicationViewController: UIViewController { + + // MARK: - Properties + private let matchingStatusMyApplicationView = MatchingStatusMyApplicationView() + private var matchingData: MatchingData? + + // MARK: - Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + setupView() + setupNavigationBar() + loadData() + } + + private func setupView() { + view.backgroundColor = .gray100 + view.addSubview(matchingStatusMyApplicationView) + matchingStatusMyApplicationView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(52) + make.leading.trailing.bottom.equalToSuperview() + } + } + + private func setupNavigationBar() { + addCustomNavigationBar( + titleText: "산책 지원서", + showLeftBackButton: true, + showLeftCloseButton: false, + showRightCloseButton: false, + showRightRefreshButton: false, + backgroundColor: .clear + ) + } + + // MARK: - Data Management + private func loadData() { + let dogProfileData = MatchingData( + boardId: 1, + startTime: "2025-01-03T00:32:40", + endTime: "2025-01-03T14:32:30", + matchingYn: "Y", + dogName: "봄별이", + dogProfile: "https://vetmed.tamu.edu/news/wp-content/uploads/sites/9/2023/05/AdobeStock_472713009-1024x768.jpeg", + dogGender: "FEMALE", + breed: "말티즈", + weight: 4, + dogSize: "SMALL", + content: "Helloworld", + dongAddress: "마포구 공덕동", + distance: 1000, + createdAt: "2025-01-02T00:32:40" + ) + matchingStatusMyApplicationView.updateDogProfile(with: dogProfileData) + } + +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift index f86731e7..9c18aff8 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift @@ -5,4 +5,76 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusMyApplicationView: UIView { + + // MARK: - UI Components + private let scrollView = UIScrollView() + private let contentView = UIView() + private let dogProfileView = UIView() + + // MARK: - Initializers + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - UI Setup + private func setupUI() { + addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.equalToSuperview() + } + + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + dogProfileView.layer.masksToBounds = true + + contentView.addSubview(dogProfileView) + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } + + // MARK: - 데이터 설정 + func updateDogProfile(with data: MatchingData) { + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + + contentView.addSubviews(dogProfileView) + + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(32) + make.leading.trailing.equalToSuperview().inset(20) + } + + let dogProfileCell = MatchingCell() + dogProfileCell.configure(with: data) + dogProfileCell.setCustomViewAppearance( + hideSizeLabel: true, + hideDistanceLabel: true, + hideTimeLabel: true, + backgroundColor: .clear + ) + dogProfileView.addSubview(dogProfileCell) + dogProfileCell.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift index 993940cc..3d5e3ff4 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift @@ -5,4 +5,63 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusWalkInfoForOwnerViewController: UIViewController { + + // MARK: - Properties + private let matchingStatusWalkInfoForOwnerView = MatchingStatusWalkInfoForOwnerView() + private var matchingData: MatchingData? + + // MARK: - Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + setupView() + setupNavigationBar() + loadData() + } + + private func setupView() { + view.backgroundColor = .gray100 + view.addSubview(matchingStatusWalkInfoForOwnerView) + matchingStatusWalkInfoForOwnerView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(52) + make.leading.trailing.bottom.equalToSuperview() + } + } + + private func setupNavigationBar() { + addCustomNavigationBar( + titleText: "산책 지원서", + showLeftBackButton: true, + showLeftCloseButton: false, + showRightCloseButton: false, + showRightRefreshButton: false, + backgroundColor: .clear + ) + } + + // MARK: - Data Management + private func loadData() { + let dogProfileData = MatchingData( + boardId: 1, + startTime: "2025-01-03T00:32:40", + endTime: "2025-01-03T14:32:30", + matchingYn: "Y", + dogName: "봄별이", + dogProfile: "https://vetmed.tamu.edu/news/wp-content/uploads/sites/9/2023/05/AdobeStock_472713009-1024x768.jpeg", + dogGender: "FEMALE", + breed: "말티즈", + weight: 4, + dogSize: "SMALL", + content: "Helloworld", + dongAddress: "마포구 공덕동", + distance: 1000, + createdAt: "2025-01-02T00:32:40" + ) + matchingStatusWalkInfoForOwnerView.updateDogProfile(with: dogProfileData) + } + +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift index df3d4403..fbb37453 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -5,4 +5,76 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusWalkInfoForOwnerView: UIView { + + // MARK: - UI Components + private let scrollView = UIScrollView() + private let contentView = UIView() + private let dogProfileView = UIView() + + // MARK: - Initializers + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - UI Setup + private func setupUI() { + addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.equalToSuperview() + } + + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + dogProfileView.layer.masksToBounds = true + + contentView.addSubview(dogProfileView) + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } + + // MARK: - 데이터 설정 + func updateDogProfile(with data: MatchingData) { + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + + contentView.addSubviews(dogProfileView) + + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(32) + make.leading.trailing.equalToSuperview().inset(20) + } + + let dogProfileCell = MatchingCell() + dogProfileCell.configure(with: data) + dogProfileCell.setCustomViewAppearance( + hideSizeLabel: true, + hideDistanceLabel: true, + hideTimeLabel: true, + backgroundColor: .clear + ) + dogProfileView.addSubview(dogProfileCell) + dogProfileCell.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift index 27ea6c9c..4a626f9a 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift @@ -5,4 +5,63 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusWalkInfoForWalkerViewController: UIViewController { + + // MARK: - Properties + private let matchingStatusWalkInfoForWalkerView = MatchingStatusWalkInfoForWalkerView() + private var matchingData: MatchingData? + + // MARK: - Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + setupView() + setupNavigationBar() + loadData() + } + + private func setupView() { + view.backgroundColor = .gray100 + view.addSubview(matchingStatusWalkInfoForWalkerView) + matchingStatusWalkInfoForWalkerView.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(52) + make.leading.trailing.bottom.equalToSuperview() + } + } + + private func setupNavigationBar() { + addCustomNavigationBar( + titleText: "산책 지원서", + showLeftBackButton: true, + showLeftCloseButton: false, + showRightCloseButton: false, + showRightRefreshButton: false, + backgroundColor: .clear + ) + } + + // MARK: - Data Management + private func loadData() { + let dogProfileData = MatchingData( + boardId: 1, + startTime: "2025-01-03T00:32:40", + endTime: "2025-01-03T14:32:30", + matchingYn: "Y", + dogName: "봄별이", + dogProfile: "https://vetmed.tamu.edu/news/wp-content/uploads/sites/9/2023/05/AdobeStock_472713009-1024x768.jpeg", + dogGender: "FEMALE", + breed: "말티즈", + weight: 4, + dogSize: "SMALL", + content: "Helloworld", + dongAddress: "마포구 공덕동", + distance: 1000, + createdAt: "2025-01-02T00:32:40" + ) + matchingStatusWalkInfoForWalkerView.updateDogProfile(with: dogProfileData) + } + +} diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift index b56995f6..e8421959 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift @@ -5,4 +5,76 @@ // Created by 신호연 on 1/9/25. // -import Foundation +import UIKit +import SnapKit + +final class MatchingStatusWalkInfoForWalkerView: UIView { + + // MARK: - UI Components + private let scrollView = UIScrollView() + private let contentView = UIView() + private let dogProfileView = UIView() + + // MARK: - Initializers + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - UI Setup + private func setupUI() { + addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.equalToSuperview() + } + + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + dogProfileView.layer.masksToBounds = true + + contentView.addSubview(dogProfileView) + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } + + // MARK: - 데이터 설정 + func updateDogProfile(with data: MatchingData) { + dogProfileView.backgroundColor = .white + dogProfileView.layer.cornerRadius = 10 + + contentView.addSubviews(dogProfileView) + + dogProfileView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(32) + make.leading.trailing.equalToSuperview().inset(20) + } + + let dogProfileCell = MatchingCell() + dogProfileCell.configure(with: data) + dogProfileCell.setCustomViewAppearance( + hideSizeLabel: true, + hideDistanceLabel: true, + hideTimeLabel: true, + backgroundColor: .clear + ) + dogProfileView.addSubview(dogProfileCell) + dogProfileCell.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(20) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(151) + } + } +} From 007081b9bdd0ec95a84205e266eec07b5fa298ea Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 07:04:28 +0900 Subject: [PATCH 06/11] =?UTF-8?q?feat:=20MatchingStatusMyApplicationViewCo?= =?UTF-8?q?ntroller=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Components/CustomButtonView.swift | 72 ++++++++++ .../Global/Components/CustomView.swift | 129 ++++++++++++++++++ .../Matching/Views/MatchingCell.swift | 22 +-- .../MatchingStatusMyApplicationView.swift | 93 +++++++++++-- 4 files changed, 294 insertions(+), 22 deletions(-) create mode 100644 walkmong/walkmong/Global/Components/CustomButtonView.swift create mode 100644 walkmong/walkmong/Global/Components/CustomView.swift diff --git a/walkmong/walkmong/Global/Components/CustomButtonView.swift b/walkmong/walkmong/Global/Components/CustomButtonView.swift new file mode 100644 index 00000000..b98e4eb8 --- /dev/null +++ b/walkmong/walkmong/Global/Components/CustomButtonView.swift @@ -0,0 +1,72 @@ +// +// CustomButtonView.swift +// walkmong +// +// Created by 신호연 on 1/11/25. +// + +import UIKit +import SnapKit + +final class CustomButtonView: UIView { + + // MARK: - Initializer + init( + backgroundColor: UIColor, + cornerRadius: CGFloat, + text: String, + textColor: UIColor, + iconName: String? = nil, + iconSpacing: CGFloat = 8 + ) { + super.init(frame: .zero) + setupView( + backgroundColor: backgroundColor, + cornerRadius: cornerRadius, + text: text, + textColor: textColor, + iconName: iconName, + iconSpacing: iconSpacing + ) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Private Methods + private func setupView( + backgroundColor: UIColor, + cornerRadius: CGFloat, + text: String, + textColor: UIColor, + iconName: String?, + iconSpacing: CGFloat + ) { + self.backgroundColor = backgroundColor + self.layer.cornerRadius = cornerRadius + self.layer.masksToBounds = true + + let label = UILabel() + label.text = text + label.textColor = textColor + label.font = UIFont(name: "Pretendard-SemiBold", size: 16) + + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.alignment = .center + stackView.spacing = iconSpacing + stackView.addArrangedSubview(label) + + if let iconName = iconName, let iconImage = UIImage(named: iconName) { + let icon = UIImageView(image: iconImage) + icon.contentMode = .scaleAspectFit + stackView.addArrangedSubview(icon) + } + + addSubview(stackView) + stackView.snp.makeConstraints { make in + make.center.equalToSuperview() + } + } +} diff --git a/walkmong/walkmong/Global/Components/CustomView.swift b/walkmong/walkmong/Global/Components/CustomView.swift new file mode 100644 index 00000000..d43efd7f --- /dev/null +++ b/walkmong/walkmong/Global/Components/CustomView.swift @@ -0,0 +1,129 @@ +// +// CustomView.swift +// walkmong +// +// Created by 신호연 on 1/11/25. +// + +import UIKit +import SnapKit + +class CustomView: UIView { + static func createCustomView( + titleText: String?, + warningText: String? = nil, + warningColor: UIColor? = nil, + centerLabelText: String? = nil, + contentText: String? = nil, + contentTextColor: UIColor = .gray600, + layoutOption: LayoutOption = .default + ) -> UIView { + let containerView = UIView() + var lastView: UIView = containerView + + if let titleText = titleText { + let titleLabel = SmallTitleLabel(text: titleText, textColor: .gray600) + containerView.addSubview(titleLabel) + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview() + make.leading.trailing.equalToSuperview() + } + lastView = titleLabel + } + + if let warningText = warningText, let warningColor = warningColor { + let warningIcon = UIImage.createImageView( + named: "WarningIcon", + contentMode: .scaleAspectFit + ) + warningIcon.tintColor = warningColor + containerView.addSubview(warningIcon) + + let warningLabel = SmallMainHighlightParagraphLabel(text: warningText, textColor: warningColor) + containerView.addSubview(warningLabel) + + warningIcon.snp.makeConstraints { make in + make.top.equalTo(lastView.snp.bottom).offset(8) + make.leading.equalToSuperview() + } + + warningLabel.snp.makeConstraints { make in + make.centerY.equalTo(warningIcon.snp.centerY) + make.leading.equalTo(warningIcon.snp.trailing).offset(4) + make.trailing.equalToSuperview() + } + + lastView = warningLabel + } + + let whiteBackgroundView = UIView() + whiteBackgroundView.backgroundColor = .white + whiteBackgroundView.layer.cornerRadius = 5 + whiteBackgroundView.clipsToBounds = true + containerView.addSubview(whiteBackgroundView) + whiteBackgroundView.snp.makeConstraints { make in + make.top.equalTo(lastView.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview() + make.bottom.equalToSuperview() + } + + switch layoutOption { + case .default: + if let centerLabelText = centerLabelText { + let centerLabel = MainHighlightParagraphLabel(text: centerLabelText, textColor: .gray600) + whiteBackgroundView.addSubview(centerLabel) + centerLabel.snp.makeConstraints { make in + make.center.equalToSuperview() + } + } else if let contentText = contentText { + let contentLabel = MainParagraphLabel(text: contentText, textColor: contentTextColor) + contentLabel.numberOfLines = 0 + contentLabel.lineBreakMode = .byWordWrapping + contentLabel.textAlignment = .left + whiteBackgroundView.addSubview(contentLabel) + contentLabel.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(12) + make.leading.trailing.equalToSuperview().inset(16) + } + } + case .leftAlignedContent: + if let contentText = contentText { + let contentLabel = MainParagraphLabel(text: contentText, textColor: contentTextColor) + contentLabel.numberOfLines = 0 + contentLabel.lineBreakMode = .byWordWrapping + contentLabel.textAlignment = .left + whiteBackgroundView.addSubview(contentLabel) + contentLabel.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(12) + } + } + case .centerAndLeftAligned: + if let centerLabelText = centerLabelText { + let centerLabel = MainHighlightParagraphLabel(text: centerLabelText, textColor: .gray600) + whiteBackgroundView.addSubview(centerLabel) + centerLabel.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview().inset(12) + } + + if let contentText = contentText { + let contentLabel = MainParagraphLabel(text: contentText, textColor: contentTextColor) + contentLabel.numberOfLines = 0 + contentLabel.lineBreakMode = .byWordWrapping + whiteBackgroundView.addSubview(contentLabel) + contentLabel.snp.makeConstraints { make in + make.top.equalTo(centerLabel.snp.bottom).offset(10) + make.leading.trailing.bottom.equalToSuperview().inset(12) + } + } + } + } + + return containerView + } + + enum LayoutOption { + case `default` + case leftAlignedContent + case centerAndLeftAligned + } +} diff --git a/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift b/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift index a3010992..ca4b5537 100644 --- a/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift +++ b/walkmong/walkmong/Presentation/MatchingApply/Matching/Views/MatchingCell.swift @@ -119,14 +119,13 @@ class MatchingCell: UIView { mainView.addSubview(bottomFrame) bottomFrame.snp.makeConstraints { make in make.leading.trailing.bottom.equalToSuperview() - make.height.equalTo(109) + make.top.equalTo(topFrame.snp.bottom).offset(16) } bottomFrame.addSubview(puppyImageView) puppyImageView.snp.makeConstraints { make in - make.width.height.equalTo(112) - make.leading.equalToSuperview() - make.bottom.equalToSuperview() + make.width.equalTo(puppyImageView.snp.height) + make.top.leading.bottom.equalToSuperview() } bottomFrame.addSubview(contentFrame) @@ -151,13 +150,15 @@ class MatchingCell: UIView { dogInfoFrame.addSubview(nameLabel) nameLabel.snp.makeConstraints { make in - make.leading.centerY.equalToSuperview() + make.top.equalTo(puppyImageView) + make.leading.equalToSuperview() + make.height.equalTo(25) } dogInfoFrame.addSubview(genderIcon) genderIcon.snp.makeConstraints { make in make.leading.equalTo(nameLabel.snp.trailing).offset(5) - make.centerY.equalToSuperview() + make.centerY.equalTo(nameLabel) make.height.equalTo(16) } @@ -174,7 +175,7 @@ class MatchingCell: UIView { postContentLabel.lineBreakMode = .byTruncatingTail postContentLabel.numberOfLines = 2 postContentLabel.snp.makeConstraints { make in - make.top.equalTo(dogInfoFrame.snp.bottom).offset(8) + make.top.equalTo(nameLabel.snp.bottom).offset(8) make.leading.trailing.equalToSuperview() } } @@ -189,14 +190,15 @@ class MatchingCell: UIView { locationTimeFrame.addSubview(locationIcon) locationIcon.snp.makeConstraints { make in - make.leading.centerY.equalToSuperview() - make.width.height.equalTo(14) + make.leading.equalToSuperview() + make.bottom.equalTo(locationTimeFrame) + make.width.size.equalTo(14) } locationTimeFrame.addSubview(locationLabel) locationLabel.snp.makeConstraints { make in make.leading.equalTo(locationIcon.snp.trailing).offset(4) - make.centerY.equalToSuperview() + make.centerY.equalTo(locationIcon) } locationTimeFrame.addSubview(distanceLabel) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift index 9c18aff8..94d74a62 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift @@ -14,6 +14,39 @@ final class MatchingStatusMyApplicationView: UIView { private let scrollView = UIScrollView() private let contentView = UIView() private let dogProfileView = UIView() + + private let meetingPlace: UIView = CustomView.createCustomView( + titleText: "만남 장소", + centerLabelText: "강남구 학동로 508", + contentText: "스타벅스 로고 앞에서 만나요!", + layoutOption: .centerAndLeftAligned + ) + private let walkSuppliesProvided: UIView = CustomView.createCustomView( + titleText: "산책 용품 제공", + contentText: "배변봉투, 입마개, 리드줄(목줄)이 필요해요." + ) + private let preMeeting: UIView = CustomView.createCustomView( + titleText: "사전 만남", + warningText: "매칭 확정 후 산책자와 상의하여 사전 만남을 진행해 주세요", + warningColor: .mainBlue, + contentText: "산책일 전 사전 만남이 필요해요." + ) + private let sendMessage: UIView = CustomView.createCustomView( + titleText: "반려인에게 전달할 메시지", + contentText: "저 열심히 산책 시킬 수 있습니다!! 강아지를 좋아해서 꼭 산책시키고 싶어요. 책임지고 열심히 임할 수 있습니다 꼭 시켜주세요!!!!!!", + contentTextColor: .gray500, + layoutOption: .leftAlignedContent + ) + + private let buttonFrame = UIView() + private let walkTalkButton = CustomButtonView( + backgroundColor: UIColor.gray100, + cornerRadius: 15, + text: "워크톡", + textColor: UIColor.gray400, + iconName: "messageIcon" + ) + private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "산책 지원하기") // MARK: - Initializers override init(frame: CGRect) { @@ -27,9 +60,31 @@ final class MatchingStatusMyApplicationView: UIView { // MARK: - UI Setup private func setupUI() { - addSubview(scrollView) + addSubviews(scrollView, buttonFrame) scrollView.snp.makeConstraints { make in - make.edges.equalToSuperview() + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: 102, right: 0)) + } + + buttonFrame.backgroundColor = .gray100 + buttonFrame.snp.makeConstraints { make in + make.bottom.equalTo(safeAreaLayoutGuide.snp.bottom) + make.centerX.equalToSuperview() + make.width.equalToSuperview() + make.height.equalTo(78) + } + + buttonFrame.addSubviews(walkTalkButton, applyWalkButton) + walkTalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(buttonFrame.snp.leading).offset(20) + make.width.equalTo(93) + make.height.equalTo(54) + } + applyWalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(walkTalkButton.snp.trailing).offset(12) + make.trailing.equalTo(buttonFrame.snp.trailing).inset(17) + make.height.equalTo(54) } scrollView.addSubview(contentView) @@ -42,11 +97,33 @@ final class MatchingStatusMyApplicationView: UIView { dogProfileView.layer.cornerRadius = 10 dogProfileView.layer.masksToBounds = true - contentView.addSubview(dogProfileView) + contentView.addSubviews(dogProfileView, meetingPlace, walkSuppliesProvided, preMeeting, sendMessage) + dogProfileView.snp.makeConstraints { make in make.top.equalToSuperview().offset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) + make.height.equalTo(187) + } + + meetingPlace.snp.makeConstraints { make in + make.top.equalTo(dogProfileView.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(16) + } + + walkSuppliesProvided.snp.makeConstraints { make in + make.top.equalTo(meetingPlace.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(16) + } + + preMeeting.snp.makeConstraints { make in + make.top.equalTo(walkSuppliesProvided.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(16) + } + + sendMessage.snp.makeConstraints { make in + make.top.equalTo(preMeeting.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(16) + make.bottom.equalToSuperview().inset(87) } } @@ -55,13 +132,6 @@ final class MatchingStatusMyApplicationView: UIView { dogProfileView.backgroundColor = .white dogProfileView.layer.cornerRadius = 10 - contentView.addSubviews(dogProfileView) - - dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(32) - make.leading.trailing.equalToSuperview().inset(20) - } - let dogProfileCell = MatchingCell() dogProfileCell.configure(with: data) dogProfileCell.setCustomViewAppearance( @@ -74,7 +144,6 @@ final class MatchingStatusMyApplicationView: UIView { dogProfileCell.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } } } From f933f3e52214ca2e8ee76260db6eb86981c39784 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 08:17:10 +0900 Subject: [PATCH 07/11] =?UTF-8?q?feat:=20MatchingStatusWalkInfoForWalkerVi?= =?UTF-8?q?ewControlelr=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../walkmong/Global/Extension/UIImage+.swift | 3 +- .../MatchingStatusApplicantDetailView.swift | 2 +- .../MatchingStatusApplicantListView.swift | 2 +- .../MatchingStatusMyApplicationView.swift | 6 +- .../MatchingStatusWalkInfoForOwnerView.swift | 3 +- ...tatusWalkInfoForWalkerViewController.swift | 2 +- .../MatchingStatusWalkInfoForWalkerView.swift | 162 ++++++++++++++++-- 7 files changed, 155 insertions(+), 25 deletions(-) diff --git a/walkmong/walkmong/Global/Extension/UIImage+.swift b/walkmong/walkmong/Global/Extension/UIImage+.swift index 4d6f7b4c..a1c62508 100644 --- a/walkmong/walkmong/Global/Extension/UIImage+.swift +++ b/walkmong/walkmong/Global/Extension/UIImage+.swift @@ -37,7 +37,8 @@ extension UIImage { // 이미지 설정 if let imageName = imageName { - imageView.image = UIImage(named: imageName) + let image = UIImage(named: imageName)?.withRenderingMode(.alwaysTemplate) + imageView.image = image } // 공통 속성 diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift index 2e533ab7..c2a40fe4 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailView.swift @@ -61,6 +61,7 @@ final class MatchingStatusApplicantDetailView: UIView { dogProfileView.snp.makeConstraints { make in make.top.equalToSuperview().offset(32) make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(187) } let dogProfileCell = MatchingCell() @@ -75,7 +76,6 @@ final class MatchingStatusApplicantDetailView: UIView { dogProfileCell.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } applicantInfoLabel.snp.makeConstraints { make in diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift index 44b5b1ad..f6e7d5e1 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListView.swift @@ -60,6 +60,7 @@ final class MatchingStatusApplicantListView: UIView { dogProfileView.snp.makeConstraints { make in make.top.equalToSuperview().offset(32) make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(187) } let dogProfileCell = MatchingCell() @@ -74,7 +75,6 @@ final class MatchingStatusApplicantListView: UIView { dogProfileCell.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } applicantsLabel.snp.makeConstraints { make in diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift index 94d74a62..cf93d5d8 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift @@ -40,13 +40,13 @@ final class MatchingStatusMyApplicationView: UIView { private let buttonFrame = UIView() private let walkTalkButton = CustomButtonView( - backgroundColor: UIColor.gray100, + backgroundColor: UIColor.gray200, cornerRadius: 15, text: "워크톡", textColor: UIColor.gray400, iconName: "messageIcon" ) - private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "산책 지원하기") + private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "지원 취소") // MARK: - Initializers override init(frame: CGRect) { @@ -123,7 +123,7 @@ final class MatchingStatusMyApplicationView: UIView { sendMessage.snp.makeConstraints { make in make.top.equalTo(preMeeting.snp.bottom).offset(48) make.leading.trailing.equalToSuperview().inset(16) - make.bottom.equalToSuperview().inset(87) + make.bottom.equalToSuperview().inset(43) } } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift index fbb37453..7c30d65d 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -46,7 +46,7 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { dogProfileView.snp.makeConstraints { make in make.top.equalToSuperview().offset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) + make.height.equalTo(187) } } @@ -74,7 +74,6 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { dogProfileCell.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } } } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift index 4a626f9a..bab9fbef 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/ViewController/MatchingStatusWalkInfoForWalkerViewController.swift @@ -56,7 +56,7 @@ final class MatchingStatusWalkInfoForWalkerViewController: UIViewController { breed: "말티즈", weight: 4, dogSize: "SMALL", - content: "Helloworld", + content: "HelloworldHelloworldHelloworldHelloworldHelloworldHelloworldHelloworld", dongAddress: "마포구 공덕동", distance: 1000, createdAt: "2025-01-02T00:32:40" diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift index e8421959..108fdd61 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift @@ -14,7 +14,43 @@ final class MatchingStatusWalkInfoForWalkerView: UIView { private let scrollView = UIScrollView() private let contentView = UIView() private let dogProfileView = UIView() + + private let preMeeting: UIView = CustomView.createCustomView( + titleText: "사전 만남", + contentText: "2024.10.23 (수) 16:00" + ) + + private let walkRequestTitle = SmallTitleLabel(text: "산책 요청 사항") + private let walkRequestView = UIView.createRoundedView(backgroundColor: .white, cornerRadius: 20) + private let requestTitleLabel = MainHighlightParagraphLabel(text: "산책 요청 사항", textColor: .gray600) + private let requestDescriptionLabel = MainParagraphLabel(text: "산책 요청 사항 상세", textColor: .gray500) + private let referenceTitleLabel = MainHighlightParagraphLabel(text: "산책 참고 사항", textColor: .gray600) + private let referenceDescriptionLabel = MainParagraphLabel(text: "산책 참고 사항 상세", textColor: .gray500) + private let additionalInfoTitleLabel = MainHighlightParagraphLabel(text: "추가 안내 사항", textColor: .gray600) + private let additionalInfoDescriptionLabel = MainParagraphLabel(text: "추가 안내 사항 상세", textColor: .gray500) + private let meetingPlaceTitle = SmallTitleLabel(text: "만남 장소") + private let meetingPlaceView = UIView.createRoundedView(backgroundColor: .white, cornerRadius: 10) + private let locationIcon = UIImage.createImageView(named: "locationIcon", tintColor: .gray600) + private let locationLabel = MainParagraphLabel(text: "강남구 학동로 508", textColor: .gray600) + private let locationDescriptionLabel: UILabel = { + let label = UILabel() + label.text = "스타벅스 로고 앞에서 만나요!" + label.font = UIFont(name: "Pretendard-Regular", size: 16) + label.textColor = UIColor(hexCode: "#444444") + return label + }() + private let mapView = UIView.createRoundedView(backgroundColor: .red, cornerRadius: 15) + private let buttonFrame = UIView() + private let walkTalkButton = CustomButtonView( + backgroundColor: UIColor.gray200, + cornerRadius: 15, + text: "워크톡", + textColor: UIColor.gray400, + iconName: "messageIcon" + ) + private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "매칭 취소") + // MARK: - Initializers override init(frame: CGRect) { super.init(frame: frame) @@ -27,9 +63,31 @@ final class MatchingStatusWalkInfoForWalkerView: UIView { // MARK: - UI Setup private func setupUI() { - addSubview(scrollView) + addSubviews(scrollView, buttonFrame) scrollView.snp.makeConstraints { make in - make.edges.equalToSuperview() + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: 102, right: 0)) + } + + buttonFrame.backgroundColor = .gray100 + buttonFrame.snp.makeConstraints { make in + make.bottom.equalTo(safeAreaLayoutGuide.snp.bottom) + make.centerX.equalToSuperview() + make.width.equalToSuperview() + make.height.equalTo(78) + } + + buttonFrame.addSubviews(walkTalkButton, applyWalkButton) + walkTalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(buttonFrame.snp.leading).offset(20) + make.width.equalTo(93) + make.height.equalTo(54) + } + applyWalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(walkTalkButton.snp.trailing).offset(12) + make.trailing.equalTo(buttonFrame.snp.trailing).inset(17) + make.height.equalTo(54) } scrollView.addSubview(contentView) @@ -38,29 +96,102 @@ final class MatchingStatusWalkInfoForWalkerView: UIView { make.width.equalToSuperview() } + contentView.addSubview(dogProfileView) dogProfileView.backgroundColor = .white dogProfileView.layer.cornerRadius = 10 dogProfileView.layer.masksToBounds = true - - contentView.addSubview(dogProfileView) dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(20) + make.top.equalToSuperview().offset(36) + make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(187) + } + + contentView.addSubview(preMeeting) + preMeeting.snp.makeConstraints { make in + make.top.equalTo(dogProfileView.snp.bottom).offset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } - } - - // MARK: - 데이터 설정 - func updateDogProfile(with data: MatchingData) { - dogProfileView.backgroundColor = .white - dogProfileView.layer.cornerRadius = 10 - contentView.addSubviews(dogProfileView) + contentView.addSubview(walkRequestTitle) + walkRequestTitle.snp.makeConstraints { make in + make.top.equalTo(preMeeting.snp.bottom).offset(24) + make.leading.trailing.equalToSuperview().inset(20) + } - dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(32) + contentView.addSubview(walkRequestView) + walkRequestView.snp.makeConstraints { make in + make.top.equalTo(walkRequestTitle.snp.bottom).offset(16) + make.leading.trailing.equalToSuperview().inset(20) + } + + walkRequestView.addSubviews(requestTitleLabel, requestDescriptionLabel, referenceTitleLabel, referenceDescriptionLabel, additionalInfoTitleLabel, additionalInfoDescriptionLabel) + + requestTitleLabel.snp.makeConstraints { make in + make.top.leading.trailing.equalToSuperview().inset(12) + } + + requestDescriptionLabel.snp.makeConstraints { make in + make.top.equalTo(requestTitleLabel.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(12) + } + + referenceTitleLabel.snp.makeConstraints { make in + make.top.equalTo(requestDescriptionLabel.snp.bottom).offset(24) + make.leading.trailing.equalToSuperview().inset(12) + } + + referenceDescriptionLabel.snp.makeConstraints { make in + make.top.equalTo(referenceTitleLabel.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(12) + } + + additionalInfoTitleLabel.snp.makeConstraints { make in + make.top.equalTo(referenceDescriptionLabel.snp.bottom).offset(24) + make.leading.trailing.equalToSuperview().inset(12) + } + + additionalInfoDescriptionLabel.snp.makeConstraints { make in + make.top.equalTo(additionalInfoTitleLabel.snp.bottom).offset(8) + make.bottom.leading.trailing.equalToSuperview().inset(12) + } + + contentView.addSubview(meetingPlaceTitle) + meetingPlaceTitle.snp.makeConstraints { make in + make.top.equalTo(walkRequestView.snp.bottom).offset(24) + make.leading.equalTo(20) + } + contentView.addSubview(meetingPlaceView) + meetingPlaceView.snp.makeConstraints { make in + make.top.equalTo(meetingPlaceTitle.snp.bottom).offset(8) make.leading.trailing.equalToSuperview().inset(20) + make.bottom.equalToSuperview().inset(43) + } + + meetingPlaceView.addSubviews(locationIcon, locationLabel, locationDescriptionLabel, mapView) + locationIcon.snp.makeConstraints { make in + make.centerY.equalTo(locationLabel) + make.leading.equalToSuperview().offset(12) + } + + locationLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(16) + make.leading.equalTo(locationIcon.snp.trailing).offset(4) + } + + locationDescriptionLabel.snp.makeConstraints { make in + make.top.equalTo(locationLabel.snp.bottom).offset(10) + make.leading.trailing.equalToSuperview().offset(12) + } + + mapView.snp.makeConstraints { make in + make.top.equalTo(locationDescriptionLabel.snp.bottom).offset(10) + make.leading.trailing.bottom.equalToSuperview().inset(12) + make.height.equalTo(mapView.snp.width) } + } + + // MARK: - 데이터 설정 + func updateDogProfile(with data: MatchingData) { let dogProfileCell = MatchingCell() dogProfileCell.configure(with: data) @@ -74,7 +205,6 @@ final class MatchingStatusWalkInfoForWalkerView: UIView { dogProfileCell.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(20) make.leading.trailing.equalToSuperview().inset(12) - make.height.equalTo(151) } } } From 4b9a9fcd3132e0cc8a17f95eb810f4d386c62a37 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 09:30:02 +0900 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20MatchingStatusWalkInfoForOwnerVie?= =?UTF-8?q?w=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Components/CustomView.swift | 4 +- .../MatchingStatusApplicantDetailCell.swift | 2 +- .../MatchingStatusMyApplicationView.swift | 2 +- ...StatusWalkInfoForOwnerViewController.swift | 10 + .../MatchingStatusWalkInfoForOwnerView.swift | 179 ++++++++++++++++-- .../MatchingStatusWalkInfoForWalkerView.swift | 3 +- 6 files changed, 184 insertions(+), 16 deletions(-) diff --git a/walkmong/walkmong/Global/Components/CustomView.swift b/walkmong/walkmong/Global/Components/CustomView.swift index d43efd7f..be8ff7b6 100644 --- a/walkmong/walkmong/Global/Components/CustomView.swift +++ b/walkmong/walkmong/Global/Components/CustomView.swift @@ -16,6 +16,7 @@ class CustomView: UIView { centerLabelText: String? = nil, contentText: String? = nil, contentTextColor: UIColor = .gray600, + contentTextAlignment: NSTextAlignment = .left, layoutOption: LayoutOption = .default ) -> UIView { let containerView = UIView() @@ -79,7 +80,7 @@ class CustomView: UIView { let contentLabel = MainParagraphLabel(text: contentText, textColor: contentTextColor) contentLabel.numberOfLines = 0 contentLabel.lineBreakMode = .byWordWrapping - contentLabel.textAlignment = .left + contentLabel.textAlignment = contentTextAlignment whiteBackgroundView.addSubview(contentLabel) contentLabel.snp.makeConstraints { make in make.top.bottom.equalToSuperview().inset(12) @@ -109,6 +110,7 @@ class CustomView: UIView { let contentLabel = MainParagraphLabel(text: contentText, textColor: contentTextColor) contentLabel.numberOfLines = 0 contentLabel.lineBreakMode = .byWordWrapping + contentLabel.textAlignment = contentTextAlignment whiteBackgroundView.addSubview(contentLabel) contentLabel.snp.makeConstraints { make in make.top.equalTo(centerLabel.snp.bottom).offset(10) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift index 41eb51b9..306556fa 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantDetail/Views/MatchingStatusApplicantDetailCell.swift @@ -29,7 +29,7 @@ final class MatchingStatusApplicantDetailCell: UIView { return button }() - private let locationIcon = UIImage.createImageView(named: "meetingPlace") + private let locationIcon = UIImage.createImageView(named: "meetingPlace", tintColor: .gray400) private let locationLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .gray400) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift index cf93d5d8..61741e01 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/MyApplication/Views/MatchingStatusMyApplicationView.swift @@ -100,7 +100,7 @@ final class MatchingStatusMyApplicationView: UIView { contentView.addSubviews(dogProfileView, meetingPlace, walkSuppliesProvided, preMeeting, sendMessage) dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(20) + make.top.equalToSuperview().offset(32) make.leading.trailing.equalToSuperview().inset(12) make.height.equalTo(187) } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift index 3d5e3ff4..02cd4d6e 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/ViewController/MatchingStatusWalkInfoForOwnerViewController.swift @@ -62,6 +62,16 @@ final class MatchingStatusWalkInfoForOwnerViewController: UIViewController { createdAt: "2025-01-02T00:32:40" ) matchingStatusWalkInfoForOwnerView.updateDogProfile(with: dogProfileData) + + let applicant = MatchingStatusApplicantInfo( + ownerProfile: "https://img.freepik.com/free-photo/expressive-asian-girl-posing-indoor_344912-1234.jpg?semt=ais_hybrid", + ownerName: "홍길동", + ownerAge: 32, + ownerGender: "MALE", + dongAddress: "서울시 강남구", + distance: 500 + ) + matchingStatusWalkInfoForOwnerView.configureApplicantsList(with: applicant) } } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift index 7c30d65d..62e04f49 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -14,7 +14,49 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { private let scrollView = UIScrollView() private let contentView = UIView() private let dogProfileView = UIView() + + private let applicantInfoLabel = SmallTitleLabel(text: "산책자 정보", textColor: .gray600) + private let applicantInfoCell = MatchingStatusApplicantDetailCell() + + private let preMeeting: UIView = CustomView.createCustomView( + titleText: "사전 만남", + contentText: "2024.10.23 (수) 16:00", + contentTextAlignment: .center + ) + + private let meetingPlaceTitle = SmallTitleLabel(text: "만남 장소") + private let meetingPlaceView = UIView.createRoundedView(backgroundColor: .white, cornerRadius: 10) + private let locationIcon = UIImage.createImageView(named: "locationIcon", tintColor: .gray600) + private let locationLabel = MainParagraphLabel(text: "강남구 학동로 508", textColor: .gray600) + private let sendMessage: UIView = CustomView.createCustomView( + titleText: "산책인이 전달한 메시지", + contentText: "우리 멍멍이 귀여워요", + contentTextColor: .gray500, + contentTextAlignment: .center + ) + private let locationDescriptionLabel: UILabel = { + let label = UILabel() + label.text = "스타벅스 로고 앞에서 만나요!" + label.font = UIFont(name: "Pretendard-Regular", size: 16) + label.textColor = UIColor(hexCode: "#444444") + return label + }() + private let mapView = UIView.createRoundedView(backgroundColor: .red, cornerRadius: 15) + private let walkItemTitle = SmallTitleLabel(text: "산책 준비물") + private let walkItemleadLineButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "리드줄(목줄)") + private let walkItemleadPoopBagButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "배변봉투") + private let walkItemleadMuzzleButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "입마개") + private let buttonFrame = UIView() + private let walkTalkButton = CustomButtonView( + backgroundColor: UIColor.gray200, + cornerRadius: 15, + text: "워크톡", + textColor: UIColor.gray400, + iconName: "messageIcon" + ) + private let applyWalkButton = UIButton.createStyledButton(type: .large, style: .dark, title: "매칭 취소") + // MARK: - Initializers override init(frame: CGRect) { super.init(frame: frame) @@ -27,9 +69,31 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { // MARK: - UI Setup private func setupUI() { - addSubview(scrollView) + addSubviews(scrollView, buttonFrame) scrollView.snp.makeConstraints { make in - make.edges.equalToSuperview() + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 0, bottom: 102, right: 0)) + } + + buttonFrame.backgroundColor = .gray100 + buttonFrame.snp.makeConstraints { make in + make.bottom.equalTo(safeAreaLayoutGuide.snp.bottom) + make.centerX.equalToSuperview() + make.width.equalToSuperview() + make.height.equalTo(78) + } + + buttonFrame.addSubviews(walkTalkButton, applyWalkButton) + walkTalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(buttonFrame.snp.leading).offset(20) + make.width.equalTo(93) + make.height.equalTo(54) + } + applyWalkButton.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.leading.equalTo(walkTalkButton.snp.trailing).offset(12) + make.trailing.equalTo(buttonFrame.snp.trailing).inset(17) + make.height.equalTo(54) } scrollView.addSubview(contentView) @@ -44,24 +108,99 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { contentView.addSubview(dogProfileView) dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(20) + make.top.equalToSuperview().offset(32) make.leading.trailing.equalToSuperview().inset(12) make.height.equalTo(187) } - } - - // MARK: - 데이터 설정 - func updateDogProfile(with data: MatchingData) { - dogProfileView.backgroundColor = .white - dogProfileView.layer.cornerRadius = 10 - contentView.addSubviews(dogProfileView) + contentView.addSubview(applicantInfoLabel) + applicantInfoLabel.snp.makeConstraints { make in + make.top.equalTo(dogProfileView.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(20) + } - dogProfileView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(32) + applicantInfoCell.backgroundColor = .white + applicantInfoCell.layer.cornerRadius = 10 + applicantInfoCell.layer.masksToBounds = true + contentView.addSubview(applicantInfoCell) + applicantInfoCell.snp.makeConstraints { make in + make.top.equalTo(applicantInfoLabel.snp.bottom).offset(20) + make.leading.trailing.equalToSuperview().inset(20) + } + + contentView.addSubview(preMeeting) + preMeeting.snp.makeConstraints { make in + make.top.equalTo(applicantInfoCell.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(12) + } + + contentView.addSubview(meetingPlaceTitle) + meetingPlaceTitle.snp.makeConstraints { make in + make.top.equalTo(preMeeting.snp.bottom).offset(48) + make.leading.equalTo(20) + } + contentView.addSubview(meetingPlaceView) + meetingPlaceView.snp.makeConstraints { make in + make.top.equalTo(meetingPlaceTitle.snp.bottom).offset(8) + make.leading.trailing.equalToSuperview().inset(20) + } + + meetingPlaceView.addSubviews(locationIcon, locationLabel, locationDescriptionLabel, mapView) + locationIcon.snp.makeConstraints { make in + make.centerY.equalTo(locationLabel) + make.leading.equalToSuperview().offset(12) + } + + locationLabel.snp.makeConstraints { make in + make.top.equalToSuperview().offset(16) + make.leading.equalTo(locationIcon.snp.trailing).offset(4) + } + + locationDescriptionLabel.snp.makeConstraints { make in + make.top.equalTo(locationLabel.snp.bottom).offset(10) + make.leading.trailing.equalToSuperview().offset(12) + } + + mapView.snp.makeConstraints { make in + make.top.equalTo(locationDescriptionLabel.snp.bottom).offset(10) + make.leading.trailing.equalToSuperview().inset(12) + make.height.equalTo(mapView.snp.width) + make.bottom.equalToSuperview().inset(12) + } + + contentView.addSubview(sendMessage) + sendMessage.snp.makeConstraints { make in + make.top.equalTo(meetingPlaceView.snp.bottom).offset(48) + make.leading.trailing.equalToSuperview().inset(20) + } + + contentView.addSubviews(walkItemTitle, walkItemleadLineButton, walkItemleadPoopBagButton, walkItemleadMuzzleButton) + walkItemTitle.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + make.top.equalTo(sendMessage.snp.bottom).offset(48) + } + walkItemleadLineButton.snp.makeConstraints { make in make.leading.trailing.equalToSuperview().inset(20) + make.top.equalTo(walkItemTitle.snp.bottom).offset(24) + make.height.equalTo(46) + } + walkItemleadPoopBagButton.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + make.top.equalTo(walkItemleadLineButton.snp.bottom).offset(12) + make.height.equalTo(46) + } + walkItemleadMuzzleButton.snp.makeConstraints { make in + make.leading.trailing.equalToSuperview().inset(20) + make.top.equalTo(walkItemleadPoopBagButton.snp.bottom).offset(12) + make.bottom.equalToSuperview().inset(43) + make.height.equalTo(46) } + } + + // MARK: - 데이터 설정 + func updateDogProfile(with data: MatchingData) { + let dogProfileCell = MatchingCell() dogProfileCell.configure(with: data) dogProfileCell.setCustomViewAppearance( @@ -76,4 +215,20 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { make.leading.trailing.equalToSuperview().inset(12) } } + + func configureApplicantsList(with applicant: MatchingStatusApplicantInfo) { + setupApplicantInfoCell(with: applicant) + } + + private func setupApplicantInfoCell(with applicant: MatchingStatusApplicantInfo) { + + applicantInfoCell.updateOwnerInfo( + ownerProfile: applicant.ownerProfile ?? "defaultProfileImage", + ownerName: applicant.ownerName, + ownerAge: applicant.ownerAge, + ownerGender: applicant.ownerGender, + dongAddress: applicant.dongAddress, + distance: applicant.distance + ) + } } diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift index 108fdd61..ef24d84e 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForWalker/Views/MatchingStatusWalkInfoForWalkerView.swift @@ -17,7 +17,8 @@ final class MatchingStatusWalkInfoForWalkerView: UIView { private let preMeeting: UIView = CustomView.createCustomView( titleText: "사전 만남", - contentText: "2024.10.23 (수) 16:00" + contentText: "2024.10.23 (수) 16:00", + contentTextAlignment: .center ) private let walkRequestTitle = SmallTitleLabel(text: "산책 요청 사항") From ba18e082496464611a2eb82c6b2aad6475492d29 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 09:33:36 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20=EB=B2=84=ED=8A=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/MatchingStatusWalkInfoForOwnerView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift index 62e04f49..08c85b1d 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -43,9 +43,9 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { }() private let mapView = UIView.createRoundedView(backgroundColor: .red, cornerRadius: 15) private let walkItemTitle = SmallTitleLabel(text: "산책 준비물") - private let walkItemleadLineButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "리드줄(목줄)") - private let walkItemleadPoopBagButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "배변봉투") - private let walkItemleadMuzzleButton = UIButton.createStyledButton(type: .largeSelection, style: .light, title: "입마개") + private let walkItemleadLineButton = UIButton.createStyledButton(type: .largeSelectionCheck, style: .light, title: "리드줄(목줄)") + private let walkItemleadPoopBagButton = UIButton.createStyledButton(type: .largeSelectionCheck, style: .light, title: "배변봉투") + private let walkItemleadMuzzleButton = UIButton.createStyledButton(type: .largeSelectionCheck, style: .light, title: "입마개") private let buttonFrame = UIView() private let walkTalkButton = CustomButtonView( From d6dca2c825868ea902334ec187e20f30346f0c2c Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 10:40:17 +0900 Subject: [PATCH 10/11] =?UTF-8?q?fix:=20largeSelectionCheck=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=8A=A4=ED=83=80=EC=9D=BC=EB=A1=9C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../walkmong/Global/Extension/UIButton+.swift | 85 +++++++++++++------ .../MatchingStatusWalkInfoForOwnerView.swift | 53 ++++++++++++ 2 files changed, 113 insertions(+), 25 deletions(-) diff --git a/walkmong/walkmong/Global/Extension/UIButton+.swift b/walkmong/walkmong/Global/Extension/UIButton+.swift index 71005c81..b0d79172 100644 --- a/walkmong/walkmong/Global/Extension/UIButton+.swift +++ b/walkmong/walkmong/Global/Extension/UIButton+.swift @@ -21,6 +21,7 @@ extension UIButton { case smallSelection case homeFilter case customFilter + case largeSelectionCheck case tag } @@ -42,6 +43,8 @@ extension UIButton { } else { configureHomeFilter(button: button, style: style, title: title) } + case .largeSelectionCheck: + configureLargeSelectionCheck(button: button, style: style, title: title) case .tag: configureTagButton(button: button, style: style, title: title) default: @@ -82,7 +85,7 @@ extension UIButton { : (type == .large ? .gray100 : .white) switch type { - case .large, .homeFilter, .customFilter: + case .large, .homeFilter, .customFilter, .largeSelectionCheck: return MainHighlightParagraphLabel(text: text, textColor: textColor) case .largeSelection, .smallSelection: return MainParagraphLabel(text: text, textColor: textColor) @@ -97,10 +100,10 @@ extension UIButton { } private static func setButtonSizeConstraints(button: UIButton, width: CGFloat, height: CGFloat) { - NSLayoutConstraint.activate([ - button.widthAnchor.constraint(equalToConstant: width), - button.heightAnchor.constraint(equalToConstant: height) - ]) + button.snp.makeConstraints { make in + make.width.equalTo(width) + make.height.equalTo(height) + } } private static func configureStyle(for button: UIButton, type: ButtonCategory, style: ButtonStyle) { @@ -119,6 +122,9 @@ extension UIButton { button.backgroundColor = style == .dark ? .gray600 : .gray100 case .customFilter: break + case .largeSelectionCheck: + button.layer.cornerRadius = 5 + button.backgroundColor = style == .light ? .gray100 : .mainBlue case .tag: button.layer.cornerRadius = 15 button.backgroundColor = style == .light ? .gray200 : .mainBlue @@ -147,13 +153,9 @@ extension UIButton { button.addSubview(stackView) - NSLayoutConstraint.activate([ - stackView.leadingAnchor.constraint(equalTo: button.leadingAnchor, constant: 16), - stackView.trailingAnchor.constraint(equalTo: button.trailingAnchor, constant: -16), - stackView.topAnchor.constraint(equalTo: button.topAnchor, constant: 8), - stackView.bottomAnchor.constraint(equalTo: button.bottomAnchor, constant: -8), - icon.centerYAnchor.constraint(equalTo: label.centerYAnchor) - ]) + stackView.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)) + } button.layer.cornerRadius = 18 button.backgroundColor = style == .light ? .gray100 : .gray600 @@ -162,6 +164,8 @@ extension UIButton { func updateStyle(type: ButtonCategory, style: ButtonStyle) { if type == .customFilter { UIButton.configureCustomFilter(button: self, style: style, title: self.title(for: .normal) ?? "") + } else if type == .largeSelectionCheck { + UIButton.configureLargeSelectionCheck(button: self, style: style, title: self.title(for: .normal) ?? "") } else { let label = UIButton.labelForCategory(type: type, text: self.title(for: .normal) ?? "", style: style) self.titleLabel?.font = label.font @@ -184,13 +188,9 @@ extension UIButton { label.translatesAutoresizingMaskIntoConstraints = false button.addSubview(label) - NSLayoutConstraint.activate([ - label.leadingAnchor.constraint(equalTo: button.leadingAnchor, constant: 16), - label.trailingAnchor.constraint(equalTo: button.trailingAnchor, constant: -16), - label.topAnchor.constraint(equalTo: button.topAnchor, constant: 8), - label.bottomAnchor.constraint(equalTo: button.bottomAnchor, constant: -8) - ]) - + label.snp.makeConstraints { make in + make.edges.equalTo(button).inset(UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)) + } button.layer.cornerRadius = 18 button.backgroundColor = style == .light ? .gray200 : .gray600 } @@ -206,12 +206,9 @@ extension UIButton { label.translatesAutoresizingMaskIntoConstraints = false button.addSubview(label) - NSLayoutConstraint.activate([ - label.leadingAnchor.constraint(equalTo: button.leadingAnchor, constant: 16), - label.trailingAnchor.constraint(equalTo: button.trailingAnchor, constant: -16), - label.topAnchor.constraint(equalTo: button.topAnchor, constant: 8), - label.bottomAnchor.constraint(equalTo: button.bottomAnchor, constant: -8) - ]) + label.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)) + } button.layer.cornerRadius = 18 button.backgroundColor = style == .light ? .gray100 : .gray600 @@ -227,6 +224,44 @@ extension UIButton { } } + private static func configureLargeSelectionCheck(button: UIButton, style: ButtonStyle, title: String) { + let textColor: UIColor = style == .light ? .gray500 : .white + let customFont = UIFont(name: "Pretendard-SemiBold", size: 16)! + + button.setTitle(title, for: .normal) + button.setTitleColor(textColor, for: .normal) + button.titleLabel?.font = customFont + button.contentHorizontalAlignment = .leading + button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 0) + + let icon = UIImageView() + icon.translatesAutoresizingMaskIntoConstraints = false + icon.image = UIImage(named: style == .light ? "myPageReportUnchecked" : "checkWhiteIcon") + icon.contentMode = .scaleAspectFit + + button.subviews + .filter { $0 is UIImageView } + .forEach { $0.removeFromSuperview() } + button.addSubview(icon) + + icon.snp.makeConstraints { make in + make.trailing.equalTo(button).offset(-24) + make.centerY.equalTo(button) + make.width.height.equalTo(24) + } + + button.snp.makeConstraints { make in + make.height.equalTo(46) + } + + button.layer.cornerRadius = 5 + button.backgroundColor = style == .light ? .gray100 : .mainBlue + } + + func setStyle(_ style: ButtonStyle, type: ButtonCategory) { + self.updateStyle(type: type, style: style) + } + private static func configureTagButton(button: UIButton, style: ButtonStyle, title: String) { let textColor: UIColor = .mainBlack let backgroundColor: UIColor = style == .light ? .gray200 : .mainBlue diff --git a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift index 08c85b1d..67f90806 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/WalkInfoForOwner/Views/MatchingStatusWalkInfoForOwnerView.swift @@ -47,6 +47,10 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { private let walkItemleadPoopBagButton = UIButton.createStyledButton(type: .largeSelectionCheck, style: .light, title: "배변봉투") private let walkItemleadMuzzleButton = UIButton.createStyledButton(type: .largeSelectionCheck, style: .light, title: "입마개") + private var isLeadLineButtonDark = false + private var isPoopBagButtonDark = false + private var isMuzzleButtonDark = false + private let buttonFrame = UIView() private let walkTalkButton = CustomButtonView( backgroundColor: UIColor.gray200, @@ -196,6 +200,11 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { make.height.equalTo(46) } + setupInitialButtonStyle(walkItemleadLineButton) + setupInitialButtonStyle(walkItemleadPoopBagButton) + setupInitialButtonStyle(walkItemleadMuzzleButton) + setupWalkItemButtons() + } // MARK: - 데이터 설정 @@ -231,4 +240,48 @@ final class MatchingStatusWalkInfoForOwnerView: UIView { distance: applicant.distance ) } + + private func setupWalkItemButtons() { + walkItemleadLineButton.addTarget(self, action: #selector(didTapLeadLineButton), for: .touchUpInside) + walkItemleadPoopBagButton.addTarget(self, action: #selector(didTapPoopBagButton), for: .touchUpInside) + walkItemleadMuzzleButton.addTarget(self, action: #selector(didTapMuzzleButton), for: .touchUpInside) + } + + @objc private func didTapLeadLineButton() { + isLeadLineButtonDark.toggle() + if isLeadLineButtonDark { + walkItemleadLineButton.backgroundColor = .mainBlue + walkItemleadLineButton.setTitleColor(.white, for: .normal) + } else { + walkItemleadLineButton.backgroundColor = .white + walkItemleadLineButton.setTitleColor(.gray500, for: .normal) + } + } + + @objc private func didTapPoopBagButton() { + isPoopBagButtonDark.toggle() + if isPoopBagButtonDark { + walkItemleadPoopBagButton.backgroundColor = .mainBlue + walkItemleadPoopBagButton.setTitleColor(.white, for: .normal) + } else { + walkItemleadPoopBagButton.backgroundColor = .white + walkItemleadPoopBagButton.setTitleColor(.gray500, for: .normal) + } + } + + @objc private func didTapMuzzleButton() { + isMuzzleButtonDark.toggle() + if isMuzzleButtonDark { + walkItemleadMuzzleButton.backgroundColor = .mainBlue + walkItemleadMuzzleButton.setTitleColor(.white, for: .normal) + } else { + walkItemleadMuzzleButton.backgroundColor = .white + walkItemleadMuzzleButton.setTitleColor(.gray500, for: .normal) + } + } + + private func setupInitialButtonStyle(_ button: UIButton) { + button.backgroundColor = .white + button.setTitleColor(.gray500, for: .normal) + } } From 309c216308a092d846d870ea11a8a836124180a9 Mon Sep 17 00:00:00 2001 From: hoyeon Date: Sat, 11 Jan 2025 12:14:45 +0900 Subject: [PATCH 11/11] =?UTF-8?q?fix:=20=EC=95=84=EC=9D=B4=EC=BD=98=20?= =?UTF-8?q?=EC=83=89=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApplicantList/Views/MatchingStatusApplicantListCell.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift index 7fac63a5..dab4df54 100644 --- a/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift +++ b/walkmong/walkmong/Presentation/MatchingStatus/ApplicantList/Views/MatchingStatusApplicantListCell.swift @@ -20,11 +20,11 @@ final class MatchingStatusApplicantListCell: UIView { private let nameLabel = UpperTitleLabel(text: "", textColor: .gray600) private let infoLabel = SmallMainParagraphLabel(text: "", textColor: .gray600) private let profileButton = UIButton() - private let starIcon = UIImage.createImageView(named: "starIcon.png") + private let starIcon = UIImage.createImageView(named: "starIcon.png", tintColor: .mainBlue) private let ratingLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .mainBlue) - private let locationIcon = UIImage.createImageView(named: "locationIcon.png") + private let locationIcon = UIImage.createImageView(named: "locationIcon.png", tintColor: .gray400) private let locationLabel = SmallMainHighlightParagraphLabel(text: "", textColor: .gray400)