From 68cb0f8aa64164025e14f5efaf613b1c1e545a17 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sat, 1 Feb 2025 23:10:46 +0900 Subject: [PATCH 01/39] =?UTF-8?q?[#198]=20MenuChipHorizontalScrollView=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MenuChipHorizontalScrollView.swift | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift new file mode 100644 index 00000000..f6a2ccf1 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift @@ -0,0 +1,83 @@ +// +// MenuChipHorizontalScrollView.swift +// EATSSU-DEV +// +// Created by 최지우 on 1/30/25. +// + +import UIKit + +import EATSSUDesign + +class MenuChipHorizontalScrollView: BaseUIView { + + // MARK: - Properties + var menuDataSource: [String]? { + didSet { bind() } + } + + lazy var horizontalScrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.showsHorizontalScrollIndicator = false + return scrollView + }() + + private lazy var stackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = 4 + return stackView + }() + + override func configureUI() { + horizontalScrollView.addSubview(stackView) + addSubview(horizontalScrollView) + } + + override func setLayout() { + stackView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + horizontalScrollView.snp.makeConstraints { make in + make.center.width.equalToSuperview() + make.height.equalTo(stackView) + make.trailing.equalToSuperview() + } + } + + private func bind() { + menuDataSource?.forEach { menuData in + let button = createButton(menuData) + stackView.addArrangedSubview(button) + debugPrint(menuData) + } + } + + private func createButton(_ title: String) -> UIButton { + var config = UIButton.Configuration.borderedTinted() + config = configureButton(config, title) + return UIButton(configuration: config) + } + + private func configureButton(_ config: UIButton.Configuration, _ title: String) -> UIButton.Configuration { + var config = config + + let attributedString = AttributedString( + title, + attributes: AttributeContainer([ + .font: EATSSUDesignFontFamily.Pretendard.medium.font(size: 10), + .foregroundColor: EATSSUDesignAsset.Color.Main.primary.color])) + config.attributedTitle = attributedString + config.baseBackgroundColor = EATSSUDesignAsset.Color.Main.secondary.color + config.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color + config.background.strokeWidth = 0.5 + + config.image = EATSSUDesignAsset.Images.thumbUp.image + config.imagePadding = 1 + config.cornerStyle = .capsule + config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 6, bottom: 5, trailing: 6) + + return config + } +} From 6350b070f614718dc826b5f009195e4504f5b551 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 10:58:42 +0900 Subject: [PATCH 02/39] =?UTF-8?q?[#198]=20ReviewList=20=EA=B5=AC=EC=84=B1?= =?UTF-8?q?=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 레이아웃 적용 x --- .../MainReviewView/MainReviewView.swift | 78 ++++++ .../MenuChipCollectionViewCell.swift | 124 ++++++++++ .../MenuChipHorizontalScrollView.swift | 1 + .../ReviewListTableViewCell.swift | 230 ++++++++++++++++++ .../ReviewListTableViewHeader.swift | 66 +++++ .../Review/MainReviewView/UserReview.swift | 8 + .../Review/MainReviewViewController.swift | 65 +++++ 7 files changed, 572 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift new file mode 100644 index 00000000..428f6a2d --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -0,0 +1,78 @@ +// +// MainReviewView.swift +// EATSSU-DEV +// +// Created by 최지우 on 1/30/25. +// + +import UIKit +import SnapKit + +import EATSSUDesign + +final class MainReviewView: BaseUIView { + + // MARK: - Properties + + + + // MARK: - UI Components + + private let menuChipHorizontalScrollView = MenuChipHorizontalScrollView() + + /// 사용자 정보 + private let profileImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.profile.image) + return imageView + }() + + /// 리뷰 리스트 + lazy var tableView: UITableView = { + let tableView = UITableView() + tableView.separatorStyle = .none + tableView.rowHeight = 150 + tableView.backgroundColor = .yellow + return tableView + }() + + + + // MARK: - Functions + + override func configureUI() { + addSubview( + tableView + ) + } + + override func setLayout() { + self.tableView.snp.makeConstraints { + $0.edges.equalTo(self.safeAreaLayoutGuide) + } +// profileImageView.snp.makeConstraints { make in +// make.top.leading.equalToSuperview() +// } +// menuChipHorizontalScrollView.snp.makeConstraints { make in +// make.horizontalEdges.equalToSuperview() +// make.top.equalToSuperview().offset(100) +// +// } + } + + private func insertMenuData() { + menuChipHorizontalScrollView.menuDataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","고구마치즈돈까스", "막국수", "요구르트","김치"] + } + +} + +#if DEBUG +import SwiftUI + +struct Preview: PreviewProvider { + static var previews: some View { + MainReviewViewController().toPreview() + } +} +#endif + + diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift new file mode 100644 index 00000000..90c2b930 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift @@ -0,0 +1,124 @@ +// +// MenuChipCollectionViewCell.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/2/25. +// + +import UIKit +import SnapKit + +import EATSSUDesign + +final class MenuChipCollectionViewCell: UICollectionViewCell { + static let id = "MenuChipCollectionViewCell" + + private let menuChipView: UIView = { + let view = UIView() + view.backgroundColor = EATSSUDesignAsset.Color.Main.secondary.color + view.layer.cornerRadius = 10 + view.layer.borderColor = EATSSUDesignAsset.Color.Main.primary.color.cgColor + view.layer.borderWidth = 0.5 + view.backgroundColor = .purple + return view + }() + + private let thumbsupImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.thumbUp.image) + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private let menuLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 10) + label.textColor = EATSSUDesignAsset.Color.Main.primary.color + label.text = "김치볶음바바바밥" +// label.numberOfLines = 1 +// label.sizeToFit() +// label.frame.size = CGSize(width: CGFloat.greatestFiniteMagnitude, height: 22) + return label + }() + + lazy var menuChipStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [thumbsupImageView, menuLabel]) + stackView.axis = .horizontal + stackView.spacing = 1 +// stackView.backgroundColor = .green + return stackView + }() + + override init(frame: CGRect) { + super.init(frame: frame) + + configureUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func configureUI() { + addSubview(menuChipView) + menuChipView.addSubviews(menuChipStackView) + } + + private func setLayout() { + setupDynamicLayout() + +// menuChipStackView.snp.makeConstraints { make in +// make.edges.equalToSuperview() + +// make.verticalEdges.equalToSuperview().inset(5) +// make.horizontalEdges.equalToSuperview().inset(6) +// } +// menuChipView.snp.makeConstraints { make in +// make.edges.equalToSuperview() +// } + thumbsupImageView.snp.makeConstraints { make in + make.width.height.equalTo(10) + } + + } + + override func prepareForReuse() { + super.prepareForReuse() + self.prepare(name: nil) + } + func prepare(name: String?) { + self.menuLabel.text = name + setupDynamicLayout() + } + private func setupDynamicLayout() { + menuLabel.sizeToFit() + let viewSize = menuLabel.intrinsicContentSize + let width = viewSize.width + 58 + let height = viewSize.height + 48 + + menuChipView.snp.remakeConstraints { make in + make.width.equalTo(width) + make.height.equalTo(height) + } + + menuChipStackView.snp.remakeConstraints { make in + make.width.equalTo(width) + make.height.equalTo(height) + } + + layoutIfNeeded() + } + +// private func setupDynamicLayout() { +// menuLabel.sizeToFit() +// let viewSize = menuLabel.intrinsicContentSize +// let width = viewSize.width + 58 +// let height = viewSize.height + 48 +//// menuChipStackView.frame.size = CGSize(width: width, height: height) +// menuChipStackView.frame.size = CGSize(width: width, height: height) +// menuChipView.frame.size = CGSize(width: width, height: height) +// +//// menuChipStackView.center = CGPoint(x: width / 2, y: height / 2) +// } + +} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift index f6a2ccf1..c9fce2c5 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift @@ -69,6 +69,7 @@ class MenuChipHorizontalScrollView: BaseUIView { .font: EATSSUDesignFontFamily.Pretendard.medium.font(size: 10), .foregroundColor: EATSSUDesignAsset.Color.Main.primary.color])) config.attributedTitle = attributedString + config.baseBackgroundColor = EATSSUDesignAsset.Color.Main.secondary.color config.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color config.background.strokeWidth = 0.5 diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift new file mode 100644 index 00000000..2d964488 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift @@ -0,0 +1,230 @@ +// +// ReviewListTableViewCell.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/1/25. +// + +import UIKit +import SnapKit + +import EATSSUDesign + +final class ReviewListTableViewCell: BaseTableViewCell { + static let id = "ReviewListTableViewCell" + private var menuChipList = [String]() + + + /// user + // MARK: - Properties + + var handler: (() -> Void)? + var reviewId: Int = .init() + var menuName: String = .init() + + // MARK: - UI Components + + lazy var totalRateView = RateNumberView() + + private var dateLabel: UILabel = { + let label = UILabel() + label.text = "2023.03.03" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + return label + }() + + private var userNameLabel: UILabel = { + let label = UILabel() + label.text = "hellosoongsil1234" + label.font = .caption1 + return label + }() + + private var menuNameLabel: UILabel = { + let label = UILabel() + label.text = "깐깐슈" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + return label + }() + + private let userProfileImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.profile.image) + return imageView + }() + + private var sideButton: BaseButton = { + let button = BaseButton() +// button.setImage(EATSSUDesignAsset.Images.icInfo.image, for: .normal) + button.setTitleColor(EATSSUDesignAsset.Color.GrayScale.gray400.color, for: .normal) + button.titleLabel?.font = .caption2 + button.setTitle("신고", for: .normal) + button.configuration?.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 15) + return button + }() + + var reviewTextView: UITextView = { + let textView = UITextView() + textView.textColor = UIColor.black + textView.isEditable = false + textView.isScrollEnabled = false + textView.backgroundColor = .systemBackground + textView.font = .body1 + textView.text = "여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지" + return textView + }() + + var foodImageView: UIImageView = { + let imageView = UIImageView() + imageView.contentMode = .scaleAspectFit + imageView.isHidden = true + return imageView + }() + + /// 이름 + 메뉴 + lazy var nameMenuStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [userNameLabel, menuNameLabel]) + stackView.axis = .horizontal + stackView.spacing = 8.adjusted + stackView.alignment = .center + return stackView + }() + + /// 이름 + 메뉴 + 별점 + lazy var infoStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [nameMenuStackView, totalRateView]) + stackView.axis = .vertical + stackView.spacing = 4.adjusted + stackView.alignment = .leading + return stackView + }() + + /// 프로필 + 이름 + 메뉴 + 별점 + lazy var profileStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [userProfileImageView, infoStackView]) + stackView.axis = .horizontal + stackView.spacing = 8.adjusted + stackView.alignment = .leading + return stackView + }() + + lazy var dateReportStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [sideButton, dateLabel]) + stackView.axis = .vertical + stackView.spacing = 11.adjusted + stackView.alignment = .trailing + return stackView + }() + + lazy var contentStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [reviewTextView, foodImageView]) + stackView.axis = .vertical + stackView.spacing = 8.adjusted + stackView.alignment = .leading + return stackView + }() + + /// other + + private let titleLabel = UILabel().then { + $0.textColor = .black + $0.font = .systemFont(ofSize: 15) + } + + private lazy var collectionView: UICollectionView = { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + layout.minimumLineSpacing = 2.0 + layout.minimumInteritemSpacing = 5.0 + let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) + cv.dataSource = self + cv.backgroundColor = .red + cv.showsHorizontalScrollIndicator = false + return cv + }() + + // MARK: - Functions + + private func setCollectionView() { + collectionView.register(MenuChipCollectionViewCell.self, + forCellWithReuseIdentifier: MenuChipCollectionViewCell.id) + } + + override func configureUI() { + setCollectionView() + contentView.addSubviews(profileStackView, + dateReportStackView, + contentStackView, + collectionView) + } + + override func setLayout() { + profileStackView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(5) + make.leading.equalToSuperview().offset(16) + make.height.equalTo(50) + } + + dateReportStackView.snp.makeConstraints { make in + make.top.equalTo(profileStackView) + make.trailing.equalToSuperview().inset(16) + } + + contentStackView.snp.makeConstraints { make in + make.top.equalTo(collectionView.snp.bottom) + make.leading.equalToSuperview().offset(16) + make.bottom.equalToSuperview().offset(-15) + make.trailing.equalToSuperview().offset(-16) + } + + foodImageView.snp.makeConstraints { make in + make.height.width.equalTo(358) + } + + sideButton.snp.makeConstraints { + $0.height.equalTo(12.adjusted) + } + + collectionView.snp.makeConstraints { + $0.top.equalTo(profileStackView.snp.bottom).offset(8) + $0.left.right.equalToSuperview() + $0.height.equalTo(22) + } + } + + override func prepareForReuse() { + super.prepareForReuse() + self.prepare(review: nil, menuChipList: []) + + sideButton.setTitle("", for: .normal) + sideButton.setImage(UIImage(), for: .normal) + foodImageView.image = UIImage() + foodImageView.isHidden = true + } + + func prepare(review: String?, menuChipList: [String]) { + self.titleLabel.text = review + self.menuChipList = menuChipList + self.collectionView.reloadData() + } + + @objc + func touchedSideButtonEvent() { + handler?() + } + +} + +extension ReviewListTableViewCell: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return menuChipList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MenuChipCollectionViewCell.id, for: indexPath) as! MenuChipCollectionViewCell + let menuName = self.menuChipList[indexPath.item] + cell.prepare(name: menuName) + return cell + } +} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift new file mode 100644 index 00000000..e747a3fc --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift @@ -0,0 +1,66 @@ +// +// ReviewListTableViewHeader.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/2/25. +// + +import UIKit +import SnapKit + +import EATSSUDesign + +final class ReviewListTableViewHeader: UITableViewHeaderFooterView { + static let id = "ReviewListTableViewHeader" + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "리뷰" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 24) + return label + }() + + private let reviewImageThumbnailView: UIView = { + let view = UIView() + view.backgroundColor = .blue + return view + }() + + private let reviewThumbnailImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.reviewPhotoDummy.image) + return imageView + }() + + override init(reuseIdentifier: String?) { + super.init(reuseIdentifier: reuseIdentifier) + + configureUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func configureUI() { + reviewImageThumbnailView.addSubview(reviewThumbnailImageView) + addSubviews(titleLabel, + reviewImageThumbnailView) + + } + + private func setLayout() { + titleLabel.snp.makeConstraints { + $0.left.top.right.equalToSuperview() + } + reviewImageThumbnailView.snp.makeConstraints { + $0.left.right.bottom.equalToSuperview() + $0.top.equalTo(titleLabel.snp.bottom) + $0.height.equalTo(90) + } + reviewThumbnailImageView.snp.makeConstraints { make in + make.height.width.equalTo(82) + make.verticalEdges.equalToSuperview().inset(12) + } + } +} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift new file mode 100644 index 00000000..644ea395 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift @@ -0,0 +1,8 @@ +// +// UserReview.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/1/25. +// + +import Foundation diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift new file mode 100644 index 00000000..9cf5e16b --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -0,0 +1,65 @@ +// +// MainReviewViewController.swift +// EATSSU-DEV +// +// Created by 최지우 on 1/30/25. +// + +import UIKit + +final class MainReviewViewController: BaseViewController { + + // MARK: - Properties + private var dataSource = [String]() + + // View Properties + private let mainReviewView = MainReviewView() + private let scrollView = UIScrollView() + + // MARK: - View Life Cycle + + // MARK: - Functions + + override func viewDidLoad() { + super.viewDidLoad() + + setTableView() + self.dataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","고구마치즈돈까스", "막국수", "요구르트","김치"] + mainReviewView.tableView.reloadData() + } + + override func configureUI() { + view.addSubview(mainReviewView) + mainReviewView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + } + + private func setTableView() { + mainReviewView.tableView.dataSource = self + mainReviewView.tableView.delegate = self + mainReviewView.tableView.register(ReviewListTableViewCell.self, forCellReuseIdentifier: ReviewListTableViewCell.id) + mainReviewView.tableView.register(ReviewListTableViewHeader.self, forHeaderFooterViewReuseIdentifier: ReviewListTableViewHeader.id) + } +} + +extension MainReviewViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + self.dataSource.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: ReviewListTableViewCell.id, + for: indexPath) as! ReviewListTableViewCell +// let row = self.dataSource[indexPath.row] + cell.prepare(review: "name: Jay", menuChipList: dataSource) + return cell + } +} + +extension MainReviewViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + let cell = tableView.dequeueReusableHeaderFooterView(withIdentifier: ReviewListTableViewHeader.id) as! ReviewListTableViewHeader + return cell + } +} From 866bcb4c650d48dde559425b4b15f7d984529bf7 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 12:43:16 +0900 Subject: [PATCH 03/39] =?UTF-8?q?[#198]=20ReviewView=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=B6=94=EA=B0=80=20=EB=B0=8F?= =?UTF-8?q?=20reviewCell=20=EB=8F=99=EC=A0=81=20=ED=81=AC=EA=B8=B0=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainReviewView/MainReviewView.swift | 60 +++++++++++++------ .../Review/MainReviewViewController.swift | 1 - 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift index 428f6a2d..ab62bb28 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -18,7 +18,15 @@ final class MainReviewView: BaseUIView { // MARK: - UI Components - private let menuChipHorizontalScrollView = MenuChipHorizontalScrollView() + private let scrollView = UIScrollView() + private let contentView = UIView() + + /// 리뷰 상단 summary + let summaryView: UIView = { + let view = UIView() + view.backgroundColor = .red + return view + }() /// 사용자 정보 private let profileImageView: UIImageView = { @@ -30,37 +38,53 @@ final class MainReviewView: BaseUIView { lazy var tableView: UITableView = { let tableView = UITableView() tableView.separatorStyle = .none - tableView.rowHeight = 150 tableView.backgroundColor = .yellow + tableView.rowHeight = UITableView.automaticDimension + tableView.isScrollEnabled = false return tableView }() - + /// 리뷰작성 + let writingReviewButton = ESButton(size: .big, title: "리뷰 작성하기") // MARK: - Functions override func configureUI() { - addSubview( + addSubviews( + scrollView, + writingReviewButton + ) + scrollView.addSubview(contentView) + contentView.addSubviews( + summaryView, tableView ) } override func setLayout() { - self.tableView.snp.makeConstraints { - $0.edges.equalTo(self.safeAreaLayoutGuide) + writingReviewButton.snp.makeConstraints { make in + make.horizontalEdges.equalTo(safeAreaLayoutGuide).inset(16) + make.bottom.equalTo(safeAreaLayoutGuide) + } + scrollView.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(safeAreaLayoutGuide) + make.bottom.equalTo(writingReviewButton.snp.top) + } + contentView.snp.makeConstraints { make in + make.edges.equalTo(scrollView.contentLayoutGuide) + make.width.equalTo(scrollView.frameLayoutGuide) + make.height.equalTo(2000) + } + summaryView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.horizontalEdges.equalToSuperview() + make.height.equalTo(200) + } + tableView.snp.makeConstraints { make in + make.top.equalTo(summaryView.snp.bottom) + make.horizontalEdges.equalToSuperview() + make.bottom.equalToSuperview() } -// profileImageView.snp.makeConstraints { make in -// make.top.leading.equalToSuperview() -// } -// menuChipHorizontalScrollView.snp.makeConstraints { make in -// make.horizontalEdges.equalToSuperview() -// make.top.equalToSuperview().offset(100) -// -// } - } - - private func insertMenuData() { - menuChipHorizontalScrollView.menuDataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","고구마치즈돈까스", "막국수", "요구르트","김치"] } } diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift index 9cf5e16b..d35725ba 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -14,7 +14,6 @@ final class MainReviewViewController: BaseViewController { // View Properties private let mainReviewView = MainReviewView() - private let scrollView = UIScrollView() // MARK: - View Life Cycle From 3624101ab71865cd950856c30289addccce9c86a Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 12:43:37 +0900 Subject: [PATCH 04/39] =?UTF-8?q?[#198]=20reviewTextView=20->=20label?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewListTableViewCell.swift | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift index 2d964488..a54c8f2c 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift @@ -64,15 +64,12 @@ final class ReviewListTableViewCell: BaseTableViewCell { return button }() - var reviewTextView: UITextView = { - let textView = UITextView() - textView.textColor = UIColor.black - textView.isEditable = false - textView.isScrollEnabled = false - textView.backgroundColor = .systemBackground - textView.font = .body1 - textView.text = "여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지" - return textView + var reviewTextLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + label.text = "여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd" + label.numberOfLines = 0 + return label }() var foodImageView: UIImageView = { @@ -118,7 +115,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { }() lazy var contentStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [reviewTextView, foodImageView]) + let stackView = UIStackView(arrangedSubviews: [reviewTextLabel, foodImageView]) stackView.axis = .vertical stackView.spacing = 8.adjusted stackView.alignment = .leading @@ -155,8 +152,8 @@ final class ReviewListTableViewCell: BaseTableViewCell { setCollectionView() contentView.addSubviews(profileStackView, dateReportStackView, - contentStackView, - collectionView) + collectionView, + contentStackView) } override func setLayout() { @@ -173,9 +170,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { contentStackView.snp.makeConstraints { make in make.top.equalTo(collectionView.snp.bottom) - make.leading.equalToSuperview().offset(16) - make.bottom.equalToSuperview().offset(-15) - make.trailing.equalToSuperview().offset(-16) + make.horizontalEdges.bottom.equalToSuperview() } foodImageView.snp.makeConstraints { make in From 2635bd6b516d8fe0bf6df8f9ca3360909e50165b Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 12:51:37 +0900 Subject: [PATCH 05/39] =?UTF-8?q?[#198]=20scrollView=EC=99=80=20writingRev?= =?UTF-8?q?iewButton=20=EC=82=AC=EC=9D=B4=20offset=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Review/MainReviewView/MainReviewView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift index ab62bb28..13950865 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -68,11 +68,12 @@ final class MainReviewView: BaseUIView { } scrollView.snp.makeConstraints { make in make.top.leading.trailing.equalTo(safeAreaLayoutGuide) - make.bottom.equalTo(writingReviewButton.snp.top) + make.bottom.equalTo(writingReviewButton.snp.top).offset(-10) } contentView.snp.makeConstraints { make in make.edges.equalTo(scrollView.contentLayoutGuide) make.width.equalTo(scrollView.frameLayoutGuide) + // TODO: 수정 필요 make.height.equalTo(2000) } summaryView.snp.makeConstraints { make in From 0e354137a75186be14cc161f998b7be1915d1b12 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 18:59:29 +0900 Subject: [PATCH 06/39] =?UTF-8?q?[#198]=20photoUpload=20asset=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../photoUpload.imageset/Contents.json | 12 ++++++++++++ .../photoUpload.imageset/photoUpload.svg | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/Contents.json create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/photoUpload.svg diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/Contents.json new file mode 100644 index 00000000..98f4cc67 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "photoUpload.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/photoUpload.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/photoUpload.svg new file mode 100644 index 00000000..1c80a011 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/photoUpload.imageset/photoUpload.svg @@ -0,0 +1,5 @@ + + + + + From 589b1ed75d8e82d7b1ab62e872aaab657256e913 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 19:00:32 +0900 Subject: [PATCH 07/39] =?UTF-8?q?[#198]=20modal=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20.pageSheet=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/MainReviewViewController.swift | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift index d35725ba..ad7c0d5c 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -34,11 +34,24 @@ final class MainReviewViewController: BaseViewController { } } + override func setButtonEvent() { + mainReviewView.writingReviewButton.addTarget(self, action: #selector(writeReviewButtonIsTapped), for: .touchUpInside) + } + private func setTableView() { mainReviewView.tableView.dataSource = self mainReviewView.tableView.delegate = self - mainReviewView.tableView.register(ReviewListTableViewCell.self, forCellReuseIdentifier: ReviewListTableViewCell.id) - mainReviewView.tableView.register(ReviewListTableViewHeader.self, forHeaderFooterViewReuseIdentifier: ReviewListTableViewHeader.id) + mainReviewView.tableView.register(ReviewListTableViewCell.self, + forCellReuseIdentifier: ReviewListTableViewCell.id) + mainReviewView.tableView.register(ReviewListTableViewHeader.self, + forHeaderFooterViewReuseIdentifier: ReviewListTableViewHeader.id) + } + + @objc + private func writeReviewButtonIsTapped() { + let writingReviewModalViewController = WritingReviewModalViewController() + writingReviewModalViewController.modalPresentationStyle = .pageSheet + self.present(writingReviewModalViewController, animated: true) } } From 2631b676025065a3c09721e25a18eb55311eeda0 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Sun, 2 Feb 2025 19:01:13 +0900 Subject: [PATCH 08/39] =?UTF-8?q?[#198]=20=EB=A9=94=EB=89=B4=20thumbup/dow?= =?UTF-8?q?n=20=ED=95=AD=EB=AA=A9=20=EC=A0=9C=EC=99=B8=ED=95=9C=20UI=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WritingReviewModalViewController.swift | 300 ++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift new file mode 100644 index 00000000..654b530e --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift @@ -0,0 +1,300 @@ +// +// WritingReviewModalViewController.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/2/25. +// + +import UIKit + +import EATSSUDesign + +final class WritingReviewModalViewController: BaseViewController { + + // MARK: - Properties + + // View Properties +// private let writingReviewModalView = WritingReviewModalView() + + private var userPickedImage: UIImage? + + + + // MARK: - UI Components + + private var rateView = RateView() + private let imagePickerController = UIImagePickerController() + + private var titleLabel: UILabel = { + let label = UILabel() + label.text = "리뷰 남기기" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + return label + }() + + private var questionLabel: UILabel = { + let label = UILabel() + label.text = "오늘 식사는 어떠셨나요" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + return label + }() + + private let userReviewTextView: UITextView = { + let textView = UITextView() + textView.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + textView.layer.cornerRadius = 12.adjusted + textView.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color + textView.layer.borderWidth = 1.adjusted + textView.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray200.color.cgColor + textView.textContainerInset = UIEdgeInsets(top: 12.0.adjusted, + left: 12.0.adjusted, + bottom: 12.0.adjusted, + right: 12.0.adjusted) + textView.text = "메뉴에 대한 상세한 리뷰를 작성해주세요" + textView.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color + return textView + }() + + private lazy var userReviewImageView: UIImageView = { + let imageView = UIImageView() + imageView.layer.cornerRadius = 10 // 원하는 둥근 모서리의 크기 + imageView.clipsToBounds = true // 이 속성을 true로 설정해야 둥근 모서리가 보입니다. + + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTappedimageView)) + imageView.isUserInteractionEnabled = true // 사용자 상호작용을 가능하게 설정 + imageView.addGestureRecognizer(tapGesture) + return imageView + }() + + private lazy var selectImageButton: UIButton = { + let button = UIButton() + button.setImage(EATSSUDesignAsset.Images.photoUpload.image, for: .normal) + button.addTarget(self, action: #selector(didSelectedImage), for: .touchUpInside) + return button + }() + + private let deleteMethodLabel: UILabel = { + let label = UILabel() + label.text = "이미지 클릭 시, 삭제됩니다" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color + return label + }() + + private let maximumWordLabel: UILabel = { + let label = UILabel() + label.text = "0 / 300" + label.font = .caption2 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + return label + }() + + private var nextButton: UIButton = { + let button = UIButton() + button.setTitle("완료하기", for: .normal) +// button.colo + return button + }() + + override func viewDidLoad() { + super.viewDidLoad() + setDelegate() + } + + override func viewWillAppear(_: Bool) { + addKeyboardNotifications() + } + + override func viewWillDisappear(_: Bool) { + removeKeyboardNotifications() + } + + // MARK: - Functions + + override func configureUI() { + dismissKeyboard() + view.addSubviews( + titleLabel, + questionLabel, + rateView, + maximumWordLabel, + selectImageButton, + userReviewImageView, + userReviewTextView, + deleteMethodLabel, + nextButton) + } + + override func setLayout() { + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().inset(20) + make.centerX.equalToSuperview() + } + + questionLabel.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(30) + make.centerX.equalToSuperview() + } + + rateView.snp.makeConstraints { make in + make.top.equalTo(questionLabel.snp.bottom).offset(35) + make.centerX.equalToSuperview() + make.height.equalTo(24) + } + + nextButton.snp.makeConstraints { make in + make.top.equalTo(titleLabel) + make.trailing.equalToSuperview().inset(30) + } + + + + userReviewTextView.snp.makeConstraints { make in + make.top.equalTo(rateView.snp.bottom).offset(40) + make.leading.equalToSuperview().offset(16) + make.trailing.equalToSuperview().offset(-16) + make.height.equalTo(181) + } + + maximumWordLabel.snp.makeConstraints { make in + make.top.equalTo(userReviewTextView.snp.bottom).offset(7) + make.trailing.equalTo(userReviewTextView) + } + + selectImageButton.snp.makeConstraints { + $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) + $0.leading.equalToSuperview().offset(15) + $0.width.equalTo(60) + $0.height.equalTo(60) + } + + userReviewImageView.snp.makeConstraints { + $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) + $0.leading.equalTo(selectImageButton.snp.trailing).offset(13) + $0.width.equalTo(60) + $0.height.equalTo(60) + } + + deleteMethodLabel.snp.makeConstraints { + $0.top.equalTo(selectImageButton.snp.bottom).offset(7) + $0.leading.equalTo(selectImageButton) + } + } + + override func setButtonEvent() { + nextButton.addTarget(self, action: #selector(tappedNextButton), for: .touchUpInside) + } + + @objc + func didSelectedImage() { + present(imagePickerController, animated: true, completion: nil) + } + + @objc + func didTappedimageView() { + userReviewImageView.image = nil // 이미지 삭제 + userPickedImage = nil + } + + @objc + func tappedNextButton() { + + } + + func setDelegate() { + imagePickerController.delegate = self + imagePickerController.sourceType = .photoLibrary + imagePickerController.allowsEditing = false + } + +// private func prepareForNextReview() { +// let setRateVC = SetRateViewController() +// setRateVC.dataBind(list: selectedList, +// idList: selectedIDList, +// reviewList: reviewList, +// currentPage: currentPage + 1) +// navigationController?.pushViewController(setRateVC, animated: true) +// } + +} + +// MARK: - UIImagePickerControllerDelegate + +extension WritingReviewModalViewController: UIImagePickerControllerDelegate { + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { + if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { + userReviewImageView.image = image + userPickedImage = image + } + picker.dismiss(animated: true, completion: nil) + } +} + +// MARK: - UINavigationControllerDelegate + +extension WritingReviewModalViewController: UINavigationControllerDelegate { +// func navigationController(_: UINavigationController, willShow viewController: UIViewController, animated _: Bool) { +// if viewController == self { +// // Pop 되기 직전의 로직을 여기서 실행 +// print("Back button pressed, will pop the current view controller") +// } +// } + + // 키보드가 나타났다는 알림을 받으면 실행할 메서드 + @objc + func keyboardWillShow(_ noti: NSNotification) { + // 키보드의 높이만큼 화면을 올려준다. + if let keyboardFrame: NSValue = noti.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { + let keyboardRectangle = keyboardFrame.cgRectValue + UIView.animate( + withDuration: 0.3, + animations: { + self.view.transform = CGAffineTransform(translationX: 0, y: -keyboardRectangle.height) + self.navigationController?.isNavigationBarHidden = true + } + ) + } + } + + // 키보드가 사라졌다는 알림을 받으면 실행할 메서드 + @objc + func keyboardWillHide(_: NSNotification) { + view.transform = .identity + navigationController?.isNavigationBarHidden = false + } + + // 노티피케이션을 추가하는 메서드 + func addKeyboardNotifications() { + // 키보드가 나타날 때 앱에게 알리는 메서드 추가 + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillShow(_:)), + name: UIResponder.keyboardWillShowNotification, + object: nil) + // 키보드가 사라질 때 앱에게 알리는 메서드 추가 + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), + name: UIResponder.keyboardWillHideNotification, + object: nil) + } + + // 노티피케이션을 제거하는 메서드 + func removeKeyboardNotifications() { + // 키보드가 나타날 때 앱에게 알리는 메서드 제거 + NotificationCenter.default.removeObserver(self, + name: UIResponder.keyboardWillShowNotification, + object: nil) + // 키보드가 사라질 때 앱에게 알리는 메서드 제거 + NotificationCenter.default.removeObserver(self, + name: UIResponder.keyboardWillHideNotification, + object: nil) + } +} + +#if DEBUG +import SwiftUI + +struct aPreview: PreviewProvider { + static var previews: some View { + WritingReviewModalViewController().toPreview() + } +} +#endif From c005daff059c3cee7a36e13d68e6b66cbba9cc55 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:49:48 +0900 Subject: [PATCH 09/39] =?UTF-8?q?[#198]=20=EB=A6=AC=EB=B7=B0v2=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ReactionView.swift | 8 + .../MenuChipHorizontalScrollView.swift | 84 ----- .../ReviewListTableViewCell.swift | 225 ------------- .../WritingReviewModalView.swift | 15 + .../WritingReviewModalView.swift | 15 + .../WritingReviewModalViewController.swift | 300 ------------------ .../like.imageset/Contents.json | 12 + .../Images.xcassets/like.imageset/like.svg | 3 + .../unlike.imageset/Contents.json | 12 + .../unlike.imageset/unlike.svg | 3 + 10 files changed, 68 insertions(+), 609 deletions(-) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift delete mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift delete mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift delete mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/Contents.json create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/like.svg create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/Contents.json create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/unlike.svg diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift new file mode 100644 index 00000000..5f983469 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift @@ -0,0 +1,8 @@ +// +// ReactionView.swift +// EATSSU +// +// Created by 최지우 on 2/11/25. +// + +import Foundation diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift deleted file mode 100644 index c9fce2c5..00000000 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipHorizontalScrollView.swift +++ /dev/null @@ -1,84 +0,0 @@ -// -// MenuChipHorizontalScrollView.swift -// EATSSU-DEV -// -// Created by 최지우 on 1/30/25. -// - -import UIKit - -import EATSSUDesign - -class MenuChipHorizontalScrollView: BaseUIView { - - // MARK: - Properties - var menuDataSource: [String]? { - didSet { bind() } - } - - lazy var horizontalScrollView: UIScrollView = { - let scrollView = UIScrollView() - scrollView.showsHorizontalScrollIndicator = false - return scrollView - }() - - private lazy var stackView: UIStackView = { - let stackView = UIStackView() - stackView.axis = .horizontal - stackView.spacing = 4 - return stackView - }() - - override func configureUI() { - horizontalScrollView.addSubview(stackView) - addSubview(horizontalScrollView) - } - - override func setLayout() { - stackView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - - horizontalScrollView.snp.makeConstraints { make in - make.center.width.equalToSuperview() - make.height.equalTo(stackView) - make.trailing.equalToSuperview() - } - } - - private func bind() { - menuDataSource?.forEach { menuData in - let button = createButton(menuData) - stackView.addArrangedSubview(button) - debugPrint(menuData) - } - } - - private func createButton(_ title: String) -> UIButton { - var config = UIButton.Configuration.borderedTinted() - config = configureButton(config, title) - return UIButton(configuration: config) - } - - private func configureButton(_ config: UIButton.Configuration, _ title: String) -> UIButton.Configuration { - var config = config - - let attributedString = AttributedString( - title, - attributes: AttributeContainer([ - .font: EATSSUDesignFontFamily.Pretendard.medium.font(size: 10), - .foregroundColor: EATSSUDesignAsset.Color.Main.primary.color])) - config.attributedTitle = attributedString - - config.baseBackgroundColor = EATSSUDesignAsset.Color.Main.secondary.color - config.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color - config.background.strokeWidth = 0.5 - - config.image = EATSSUDesignAsset.Images.thumbUp.image - config.imagePadding = 1 - config.cornerStyle = .capsule - config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 6, bottom: 5, trailing: 6) - - return config - } -} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift deleted file mode 100644 index a54c8f2c..00000000 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewCell.swift +++ /dev/null @@ -1,225 +0,0 @@ -// -// ReviewListTableViewCell.swift -// EATSSU-DEV -// -// Created by 최지우 on 2/1/25. -// - -import UIKit -import SnapKit - -import EATSSUDesign - -final class ReviewListTableViewCell: BaseTableViewCell { - static let id = "ReviewListTableViewCell" - private var menuChipList = [String]() - - - /// user - // MARK: - Properties - - var handler: (() -> Void)? - var reviewId: Int = .init() - var menuName: String = .init() - - // MARK: - UI Components - - lazy var totalRateView = RateNumberView() - - private var dateLabel: UILabel = { - let label = UILabel() - label.text = "2023.03.03" - label.font = .caption3 - label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - return label - }() - - private var userNameLabel: UILabel = { - let label = UILabel() - label.text = "hellosoongsil1234" - label.font = .caption1 - return label - }() - - private var menuNameLabel: UILabel = { - let label = UILabel() - label.text = "깐깐슈" - label.font = .caption3 - label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - return label - }() - - private let userProfileImageView: UIImageView = { - let imageView = UIImageView(image: EATSSUDesignAsset.Images.profile.image) - return imageView - }() - - private var sideButton: BaseButton = { - let button = BaseButton() -// button.setImage(EATSSUDesignAsset.Images.icInfo.image, for: .normal) - button.setTitleColor(EATSSUDesignAsset.Color.GrayScale.gray400.color, for: .normal) - button.titleLabel?.font = .caption2 - button.setTitle("신고", for: .normal) - button.configuration?.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 15) - return button - }() - - var reviewTextLabel: UILabel = { - let label = UILabel() - label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) - label.text = "여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd" - label.numberOfLines = 0 - return label - }() - - var foodImageView: UIImageView = { - let imageView = UIImageView() - imageView.contentMode = .scaleAspectFit - imageView.isHidden = true - return imageView - }() - - /// 이름 + 메뉴 - lazy var nameMenuStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [userNameLabel, menuNameLabel]) - stackView.axis = .horizontal - stackView.spacing = 8.adjusted - stackView.alignment = .center - return stackView - }() - - /// 이름 + 메뉴 + 별점 - lazy var infoStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [nameMenuStackView, totalRateView]) - stackView.axis = .vertical - stackView.spacing = 4.adjusted - stackView.alignment = .leading - return stackView - }() - - /// 프로필 + 이름 + 메뉴 + 별점 - lazy var profileStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [userProfileImageView, infoStackView]) - stackView.axis = .horizontal - stackView.spacing = 8.adjusted - stackView.alignment = .leading - return stackView - }() - - lazy var dateReportStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [sideButton, dateLabel]) - stackView.axis = .vertical - stackView.spacing = 11.adjusted - stackView.alignment = .trailing - return stackView - }() - - lazy var contentStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [reviewTextLabel, foodImageView]) - stackView.axis = .vertical - stackView.spacing = 8.adjusted - stackView.alignment = .leading - return stackView - }() - - /// other - - private let titleLabel = UILabel().then { - $0.textColor = .black - $0.font = .systemFont(ofSize: 15) - } - - private lazy var collectionView: UICollectionView = { - let layout = UICollectionViewFlowLayout() - layout.scrollDirection = .horizontal - layout.minimumLineSpacing = 2.0 - layout.minimumInteritemSpacing = 5.0 - let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) - cv.dataSource = self - cv.backgroundColor = .red - cv.showsHorizontalScrollIndicator = false - return cv - }() - - // MARK: - Functions - - private func setCollectionView() { - collectionView.register(MenuChipCollectionViewCell.self, - forCellWithReuseIdentifier: MenuChipCollectionViewCell.id) - } - - override func configureUI() { - setCollectionView() - contentView.addSubviews(profileStackView, - dateReportStackView, - collectionView, - contentStackView) - } - - override func setLayout() { - profileStackView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(5) - make.leading.equalToSuperview().offset(16) - make.height.equalTo(50) - } - - dateReportStackView.snp.makeConstraints { make in - make.top.equalTo(profileStackView) - make.trailing.equalToSuperview().inset(16) - } - - contentStackView.snp.makeConstraints { make in - make.top.equalTo(collectionView.snp.bottom) - make.horizontalEdges.bottom.equalToSuperview() - } - - foodImageView.snp.makeConstraints { make in - make.height.width.equalTo(358) - } - - sideButton.snp.makeConstraints { - $0.height.equalTo(12.adjusted) - } - - collectionView.snp.makeConstraints { - $0.top.equalTo(profileStackView.snp.bottom).offset(8) - $0.left.right.equalToSuperview() - $0.height.equalTo(22) - } - } - - override func prepareForReuse() { - super.prepareForReuse() - self.prepare(review: nil, menuChipList: []) - - sideButton.setTitle("", for: .normal) - sideButton.setImage(UIImage(), for: .normal) - foodImageView.image = UIImage() - foodImageView.isHidden = true - } - - func prepare(review: String?, menuChipList: [String]) { - self.titleLabel.text = review - self.menuChipList = menuChipList - self.collectionView.reloadData() - } - - @objc - func touchedSideButtonEvent() { - handler?() - } - -} - -extension ReviewListTableViewCell: UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return menuChipList.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MenuChipCollectionViewCell.id, for: indexPath) as! MenuChipCollectionViewCell - let menuName = self.menuChipList[indexPath.item] - cell.prepare(name: menuName) - return cell - } -} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift new file mode 100644 index 00000000..d25674fb --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift @@ -0,0 +1,15 @@ +// +// WritingReviewModalView.swift +// SnapKit +// +// Created by 최지우 on 2/2/25. +// + +import UIKit + +import EATSSUDesign + +final class WritingReviewModalView: BaseUIView { + + +} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift new file mode 100644 index 00000000..d25674fb --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift @@ -0,0 +1,15 @@ +// +// WritingReviewModalView.swift +// SnapKit +// +// Created by 최지우 on 2/2/25. +// + +import UIKit + +import EATSSUDesign + +final class WritingReviewModalView: BaseUIView { + + +} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift deleted file mode 100644 index 654b530e..00000000 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalViewController.swift +++ /dev/null @@ -1,300 +0,0 @@ -// -// WritingReviewModalViewController.swift -// EATSSU-DEV -// -// Created by 최지우 on 2/2/25. -// - -import UIKit - -import EATSSUDesign - -final class WritingReviewModalViewController: BaseViewController { - - // MARK: - Properties - - // View Properties -// private let writingReviewModalView = WritingReviewModalView() - - private var userPickedImage: UIImage? - - - - // MARK: - UI Components - - private var rateView = RateView() - private let imagePickerController = UIImagePickerController() - - private var titleLabel: UILabel = { - let label = UILabel() - label.text = "리뷰 남기기" - label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) - return label - }() - - private var questionLabel: UILabel = { - let label = UILabel() - label.text = "오늘 식사는 어떠셨나요" - label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) - return label - }() - - private let userReviewTextView: UITextView = { - let textView = UITextView() - textView.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) - textView.layer.cornerRadius = 12.adjusted - textView.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color - textView.layer.borderWidth = 1.adjusted - textView.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray200.color.cgColor - textView.textContainerInset = UIEdgeInsets(top: 12.0.adjusted, - left: 12.0.adjusted, - bottom: 12.0.adjusted, - right: 12.0.adjusted) - textView.text = "메뉴에 대한 상세한 리뷰를 작성해주세요" - textView.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color - return textView - }() - - private lazy var userReviewImageView: UIImageView = { - let imageView = UIImageView() - imageView.layer.cornerRadius = 10 // 원하는 둥근 모서리의 크기 - imageView.clipsToBounds = true // 이 속성을 true로 설정해야 둥근 모서리가 보입니다. - - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTappedimageView)) - imageView.isUserInteractionEnabled = true // 사용자 상호작용을 가능하게 설정 - imageView.addGestureRecognizer(tapGesture) - return imageView - }() - - private lazy var selectImageButton: UIButton = { - let button = UIButton() - button.setImage(EATSSUDesignAsset.Images.photoUpload.image, for: .normal) - button.addTarget(self, action: #selector(didSelectedImage), for: .touchUpInside) - return button - }() - - private let deleteMethodLabel: UILabel = { - let label = UILabel() - label.text = "이미지 클릭 시, 삭제됩니다" - label.font = .caption3 - label.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color - return label - }() - - private let maximumWordLabel: UILabel = { - let label = UILabel() - label.text = "0 / 300" - label.font = .caption2 - label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - return label - }() - - private var nextButton: UIButton = { - let button = UIButton() - button.setTitle("완료하기", for: .normal) -// button.colo - return button - }() - - override func viewDidLoad() { - super.viewDidLoad() - setDelegate() - } - - override func viewWillAppear(_: Bool) { - addKeyboardNotifications() - } - - override func viewWillDisappear(_: Bool) { - removeKeyboardNotifications() - } - - // MARK: - Functions - - override func configureUI() { - dismissKeyboard() - view.addSubviews( - titleLabel, - questionLabel, - rateView, - maximumWordLabel, - selectImageButton, - userReviewImageView, - userReviewTextView, - deleteMethodLabel, - nextButton) - } - - override func setLayout() { - titleLabel.snp.makeConstraints { make in - make.top.equalToSuperview().inset(20) - make.centerX.equalToSuperview() - } - - questionLabel.snp.makeConstraints { make in - make.top.equalTo(titleLabel.snp.bottom).offset(30) - make.centerX.equalToSuperview() - } - - rateView.snp.makeConstraints { make in - make.top.equalTo(questionLabel.snp.bottom).offset(35) - make.centerX.equalToSuperview() - make.height.equalTo(24) - } - - nextButton.snp.makeConstraints { make in - make.top.equalTo(titleLabel) - make.trailing.equalToSuperview().inset(30) - } - - - - userReviewTextView.snp.makeConstraints { make in - make.top.equalTo(rateView.snp.bottom).offset(40) - make.leading.equalToSuperview().offset(16) - make.trailing.equalToSuperview().offset(-16) - make.height.equalTo(181) - } - - maximumWordLabel.snp.makeConstraints { make in - make.top.equalTo(userReviewTextView.snp.bottom).offset(7) - make.trailing.equalTo(userReviewTextView) - } - - selectImageButton.snp.makeConstraints { - $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) - $0.leading.equalToSuperview().offset(15) - $0.width.equalTo(60) - $0.height.equalTo(60) - } - - userReviewImageView.snp.makeConstraints { - $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) - $0.leading.equalTo(selectImageButton.snp.trailing).offset(13) - $0.width.equalTo(60) - $0.height.equalTo(60) - } - - deleteMethodLabel.snp.makeConstraints { - $0.top.equalTo(selectImageButton.snp.bottom).offset(7) - $0.leading.equalTo(selectImageButton) - } - } - - override func setButtonEvent() { - nextButton.addTarget(self, action: #selector(tappedNextButton), for: .touchUpInside) - } - - @objc - func didSelectedImage() { - present(imagePickerController, animated: true, completion: nil) - } - - @objc - func didTappedimageView() { - userReviewImageView.image = nil // 이미지 삭제 - userPickedImage = nil - } - - @objc - func tappedNextButton() { - - } - - func setDelegate() { - imagePickerController.delegate = self - imagePickerController.sourceType = .photoLibrary - imagePickerController.allowsEditing = false - } - -// private func prepareForNextReview() { -// let setRateVC = SetRateViewController() -// setRateVC.dataBind(list: selectedList, -// idList: selectedIDList, -// reviewList: reviewList, -// currentPage: currentPage + 1) -// navigationController?.pushViewController(setRateVC, animated: true) -// } - -} - -// MARK: - UIImagePickerControllerDelegate - -extension WritingReviewModalViewController: UIImagePickerControllerDelegate { - func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { - if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { - userReviewImageView.image = image - userPickedImage = image - } - picker.dismiss(animated: true, completion: nil) - } -} - -// MARK: - UINavigationControllerDelegate - -extension WritingReviewModalViewController: UINavigationControllerDelegate { -// func navigationController(_: UINavigationController, willShow viewController: UIViewController, animated _: Bool) { -// if viewController == self { -// // Pop 되기 직전의 로직을 여기서 실행 -// print("Back button pressed, will pop the current view controller") -// } -// } - - // 키보드가 나타났다는 알림을 받으면 실행할 메서드 - @objc - func keyboardWillShow(_ noti: NSNotification) { - // 키보드의 높이만큼 화면을 올려준다. - if let keyboardFrame: NSValue = noti.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { - let keyboardRectangle = keyboardFrame.cgRectValue - UIView.animate( - withDuration: 0.3, - animations: { - self.view.transform = CGAffineTransform(translationX: 0, y: -keyboardRectangle.height) - self.navigationController?.isNavigationBarHidden = true - } - ) - } - } - - // 키보드가 사라졌다는 알림을 받으면 실행할 메서드 - @objc - func keyboardWillHide(_: NSNotification) { - view.transform = .identity - navigationController?.isNavigationBarHidden = false - } - - // 노티피케이션을 추가하는 메서드 - func addKeyboardNotifications() { - // 키보드가 나타날 때 앱에게 알리는 메서드 추가 - NotificationCenter.default.addObserver(self, - selector: #selector(keyboardWillShow(_:)), - name: UIResponder.keyboardWillShowNotification, - object: nil) - // 키보드가 사라질 때 앱에게 알리는 메서드 추가 - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), - name: UIResponder.keyboardWillHideNotification, - object: nil) - } - - // 노티피케이션을 제거하는 메서드 - func removeKeyboardNotifications() { - // 키보드가 나타날 때 앱에게 알리는 메서드 제거 - NotificationCenter.default.removeObserver(self, - name: UIResponder.keyboardWillShowNotification, - object: nil) - // 키보드가 사라질 때 앱에게 알리는 메서드 제거 - NotificationCenter.default.removeObserver(self, - name: UIResponder.keyboardWillHideNotification, - object: nil) - } -} - -#if DEBUG -import SwiftUI - -struct aPreview: PreviewProvider { - static var previews: some View { - WritingReviewModalViewController().toPreview() - } -} -#endif diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/Contents.json new file mode 100644 index 00000000..82381c03 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "like.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/like.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/like.svg new file mode 100644 index 00000000..6654810f --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/like.imageset/like.svg @@ -0,0 +1,3 @@ + + + diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/Contents.json new file mode 100644 index 00000000..a33af8a4 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "unlike.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/unlike.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/unlike.svg new file mode 100644 index 00000000..e20bfc29 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unlike.imageset/unlike.svg @@ -0,0 +1,3 @@ + + + From 58819a9e5e4dd0ad0b1ac8cf797efd8e5f1ef3d1 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:50:41 +0900 Subject: [PATCH 10/39] =?UTF-8?q?[#198]=20ReportVC=20FIX=EC=A3=BC=EC=84=9D?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/ViewController/ReportViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift b/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift index 1b089af1..b9104409 100644 --- a/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift @@ -37,6 +37,7 @@ final class ReportViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + // FIXME: super.viewDidLoad 메서드 내/아래 메서드에서 동일한 메서드 호출 발생 configureUI() setLayout() setScrollViewSetting() @@ -50,7 +51,7 @@ final class ReportViewController: BaseViewController { removeKeyboardNotifications() } - // MARK: - Methods + // MARK: - Functions override func configureUI() { view.addSubview(scrollView) @@ -63,10 +64,13 @@ final class ReportViewController: BaseViewController { make.edges.equalTo(scrollView.contentLayoutGuide) make.width.equalTo(scrollView.frameLayoutGuide) + // FIXME: dynamic height 적용 + // make.bottom.equalTo(scrollView.contentLayoutGuide) make.height.equalTo(800) } } + // FIXME: - 제거 필요 override func setLayout() { super.setLayout() } From 4e9d3cd6488c983d955781a0b6b76045c9ef2424 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:52:24 +0900 Subject: [PATCH 11/39] =?UTF-8?q?[#198]=20=EB=A6=AC=EB=B7=B0=EC=9E=91?= =?UTF-8?q?=EC=84=B1=EB=AA=A8=EB=8B=AC=20=EC=A0=9C=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WritingReviewModalViewController.swift | 300 ++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift diff --git a/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift new file mode 100644 index 00000000..30b34c20 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift @@ -0,0 +1,300 @@ +// +// WritingReviewModalViewController.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/2/25. +// + +import UIKit + +import EATSSUDesign + +final class WritingReviewModalViewController: BaseViewController { + + // MARK: - Properties + + // View Properties +// private let writingReviewModalView = WritingReviewModalView() + + private var userPickedImage: UIImage? + + // MARK: - UI Components + + private var rateView = RateView() + private let imagePickerController = UIImagePickerController() + + private var titleLabel: UILabel = { + let label = UILabel() + label.text = "리뷰 남기기" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + return label + }() + + private var questionLabel: UILabel = { + let label = UILabel() + label.text = "오늘 식사는 어떠셨나요" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + return label + }() + + private let userReviewTextView: UITextView = { + let textView = UITextView() + textView.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + textView.layer.cornerRadius = 12.adjusted + textView.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color + textView.layer.borderWidth = 1.adjusted + textView.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray200.color.cgColor + textView.textContainerInset = UIEdgeInsets(top: 12.0.adjusted, + left: 12.0.adjusted, + bottom: 12.0.adjusted, + right: 12.0.adjusted) + textView.text = "메뉴에 대한 상세한 리뷰를 작성해주세요" + textView.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color + return textView + }() + + private lazy var userReviewImageView: UIImageView = { + let imageView = UIImageView() + imageView.layer.cornerRadius = 10 + imageView.clipsToBounds = true + + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTappedimageView)) + imageView.isUserInteractionEnabled = true + imageView.addGestureRecognizer(tapGesture) + return imageView + }() + + private lazy var selectImageButton: UIButton = { + let button = UIButton() + button.setImage(EATSSUDesignAsset.Images.photoUpload.image, for: .normal) + button.addTarget(self, action: #selector(didSelectedImage), for: .touchUpInside) + return button + }() + + private let deleteMethodLabel: UILabel = { + let label = UILabel() + label.text = "이미지 클릭 시, 삭제됩니다" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color + return label + }() + + private let maximumWordLabel: UILabel = { + let label = UILabel() + label.text = "0 / 300" + label.font = .caption2 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + return label + }() + + private var nextButton: UIButton = { + var config = UIButton.Configuration.plain() + var container = AttributeContainer() + container.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + container.foregroundColor = EATSSUDesignAsset.Color.Main.primary.color + config.attributedTitle = AttributedString("완료하기", attributes: container) + config.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0) + let button = UIButton(configuration: config) + return button + }() + + override func viewDidLoad() { + super.viewDidLoad() + setDelegate() + } + + override func viewWillAppear(_: Bool) { + addKeyboardNotifications() + } + + override func viewWillDisappear(_: Bool) { + removeKeyboardNotifications() + } + + // MARK: - Functions + + override func configureUI() { + dismissKeyboard() + view.addSubviews( + titleLabel, + nextButton, + questionLabel, + rateView, + maximumWordLabel, + selectImageButton, + userReviewImageView, + userReviewTextView, + deleteMethodLabel) + } + + override func setLayout() { + titleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().inset(20) + make.centerX.equalToSuperview() + } + + nextButton.snp.makeConstraints { make in + make.top.equalTo(titleLabel) + make.trailing.equalToSuperview().inset(30) + } + + questionLabel.snp.makeConstraints { make in + make.top.equalTo(titleLabel.snp.bottom).offset(30) + make.centerX.equalToSuperview() + } + + rateView.snp.makeConstraints { make in + make.top.equalTo(questionLabel.snp.bottom).offset(35) + make.centerX.equalToSuperview() + make.height.equalTo(24) + } + + userReviewTextView.snp.makeConstraints { make in + make.top.equalTo(rateView.snp.bottom).offset(40) + make.leading.equalToSuperview().offset(16) + make.trailing.equalToSuperview().offset(-16) + make.height.equalTo(181) + } + + maximumWordLabel.snp.makeConstraints { make in + make.top.equalTo(userReviewTextView.snp.bottom).offset(7) + make.trailing.equalTo(userReviewTextView) + } + + selectImageButton.snp.makeConstraints { + $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) + $0.leading.equalToSuperview().offset(15) + $0.width.equalTo(60) + $0.height.equalTo(60) + } + + userReviewImageView.snp.makeConstraints { + $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) + $0.leading.equalTo(selectImageButton.snp.trailing).offset(13) + $0.width.equalTo(60) + $0.height.equalTo(60) + } + + deleteMethodLabel.snp.makeConstraints { + $0.top.equalTo(selectImageButton.snp.bottom).offset(7) + $0.leading.equalTo(selectImageButton) + } + } + + override func setButtonEvent() { + nextButton.addTarget(self, action: #selector(tappedNextButton), for: .touchUpInside) + } + + @objc + func didSelectedImage() { + present(imagePickerController, animated: true, completion: nil) + } + + @objc + func didTappedimageView() { + userReviewImageView.image = nil // 이미지 삭제 + userPickedImage = nil + } + + @objc + func tappedNextButton() { + + } + + func setDelegate() { + imagePickerController.delegate = self + imagePickerController.sourceType = .photoLibrary + imagePickerController.allowsEditing = false + } + +// private func prepareForNextReview() { +// let setRateVC = SetRateViewController() +// setRateVC.dataBind(list: selectedList, +// idList: selectedIDList, +// reviewList: reviewList, +// currentPage: currentPage + 1) +// navigationController?.pushViewController(setRateVC, animated: true) +// } + +} + +// MARK: - UIImagePickerControllerDelegate + +extension WritingReviewModalViewController: UIImagePickerControllerDelegate { + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { + if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage { + userReviewImageView.image = image + userPickedImage = image + } + picker.dismiss(animated: true, completion: nil) + } +} + +// MARK: - UINavigationControllerDelegate + +extension WritingReviewModalViewController: UINavigationControllerDelegate { +// func navigationController(_: UINavigationController, willShow viewController: UIViewController, animated _: Bool) { +// if viewController == self { +// // Pop 되기 직전의 로직을 여기서 실행 +// print("Back button pressed, will pop the current view controller") +// } +// } + + // 키보드가 나타났다는 알림을 받으면 실행할 메서드 + @objc + func keyboardWillShow(_ noti: NSNotification) { + // 키보드의 높이만큼 화면을 올려준다. + if let keyboardFrame: NSValue = noti.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { + let keyboardRectangle = keyboardFrame.cgRectValue + UIView.animate( + withDuration: 0.3, + animations: { + self.view.transform = CGAffineTransform(translationX: 0, y: -keyboardRectangle.height) + self.navigationController?.isNavigationBarHidden = true + } + ) + } + } + + // 키보드가 사라졌다는 알림을 받으면 실행할 메서드 + @objc + func keyboardWillHide(_: NSNotification) { + view.transform = .identity + navigationController?.isNavigationBarHidden = false + } + + // 노티피케이션을 추가하는 메서드 + func addKeyboardNotifications() { + // 키보드가 나타날 때 앱에게 알리는 메서드 추가 + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillShow(_:)), + name: UIResponder.keyboardWillShowNotification, + object: nil) + // 키보드가 사라질 때 앱에게 알리는 메서드 추가 + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), + name: UIResponder.keyboardWillHideNotification, + object: nil) + } + + // 노티피케이션을 제거하는 메서드 + func removeKeyboardNotifications() { + // 키보드가 나타날 때 앱에게 알리는 메서드 제거 + NotificationCenter.default.removeObserver(self, + name: UIResponder.keyboardWillShowNotification, + object: nil) + // 키보드가 사라질 때 앱에게 알리는 메서드 제거 + NotificationCenter.default.removeObserver(self, + name: UIResponder.keyboardWillHideNotification, + object: nil) + } +} + +#if DEBUG +import SwiftUI + +struct aPreview: PreviewProvider { + static var previews: some View { + WritingReviewModalViewController().toPreview() + } +} +#endif From 6841ddcba07011777f3ed2dd0659948979602abe Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:54:16 +0900 Subject: [PATCH 12/39] =?UTF-8?q?[#198]=20chip=20spacing=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=9E=84=EC=8B=9C=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=82=BD=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewListTableViewHeader.swift | 2 +- .../MainReviewView/MainReviewView.swift | 8 +------- .../Review/MainReviewView/UserReview.swift | 19 +++++++++++++++++++ .../WritingReviewModalView.swift | 15 --------------- .../Review/MainReviewViewController.swift | 2 +- 5 files changed, 22 insertions(+), 24 deletions(-) rename EATSSU/App/Sources/Presentation/Review/MainReviewView/{ => Component}/ReviewListTableViewHeader.swift (99%) delete mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift similarity index 99% rename from EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift rename to EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift index e747a3fc..e78af6ae 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/ReviewListTableViewHeader.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift @@ -16,7 +16,7 @@ final class ReviewListTableViewHeader: UITableViewHeaderFooterView { private let titleLabel: UILabel = { let label = UILabel() label.text = "리뷰" - label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 24) + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) return label }() diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift index 13950865..e3b3a8b0 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -28,12 +28,6 @@ final class MainReviewView: BaseUIView { return view }() - /// 사용자 정보 - private let profileImageView: UIImageView = { - let imageView = UIImageView(image: EATSSUDesignAsset.Images.profile.image) - return imageView - }() - /// 리뷰 리스트 lazy var tableView: UITableView = { let tableView = UITableView() @@ -45,7 +39,7 @@ final class MainReviewView: BaseUIView { }() /// 리뷰작성 - let writingReviewButton = ESButton(size: .big, title: "리뷰 작성하기") + public let writingReviewButton = ESButton(size: .big, title: "리뷰 작성하기") // MARK: - Functions diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift index 644ea395..cf960357 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/UserReview.swift @@ -6,3 +6,22 @@ // import Foundation + +struct UserReview { + let numberOfElements: Int + let hasNext: Bool + let dataList: [ReviewDataList] +} + +struct ReviewDataList: Codable { + let reviewId, writerId: Int + let isWriter: Bool + let writerNickname: String + let rating: Int + let writtenAt, content: String + let imageUrls: [String] +// let menuChipList: [String] +} + +let sampleUserReviewData: [ReviewDataList] = + [ReviewDataList(reviewId: 1, writerId: 1, isWriter: false, writerNickname: "숭실숭실", rating: 4, writtenAt: "2023.03.03", content: "고치도니", imageUrls: []),ReviewDataList(reviewId: 2, writerId: 2, isWriter: false, writerNickname: "jiwoo", rating: 2, writtenAt: "2024.1.2", content: "여기 고치돈 맛집임... 치즈가 좌아악 늘어나고 맛있음 고구마무스도 완전 많아!!!!", imageUrls: [])] diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift deleted file mode 100644 index d25674fb..00000000 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReviewModalView.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// WritingReviewModalView.swift -// SnapKit -// -// Created by 최지우 on 2/2/25. -// - -import UIKit - -import EATSSUDesign - -final class WritingReviewModalView: BaseUIView { - - -} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift index ad7c0d5c..f12fe118 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -23,7 +23,7 @@ final class MainReviewViewController: BaseViewController { super.viewDidLoad() setTableView() - self.dataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","고구마치즈돈까스", "막국수", "요구르트","김치"] + self.dataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","수육+겉절이김치참치", "온두부", "국","짜파게티"] mainReviewView.tableView.reloadData() } From 79bb96eda0d034f379164dcff46bb8889b57a252 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:54:31 +0900 Subject: [PATCH 13/39] =?UTF-8?q?[#198]=20ReactionView=20=EC=A0=9C?= =?UTF-8?q?=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ReactionView.swift | 45 ++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift index 5f983469..929e5b7e 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift @@ -5,4 +5,47 @@ // Created by 최지우 on 2/11/25. // -import Foundation +import UIKit + +import EATSSUDesign +import SnapKit + +final class ReactionView: BaseUIView { + + // MARK: - UI Components + + private let unlikeImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.like.image) + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private let likeCountLabel: UILabel = { + let label = UILabel() + label.text = "3" + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 12) + return label + }() + + lazy var stackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [unlikeImageView, likeCountLabel]) + stackView.axis = .horizontal + stackView.spacing = 3 + return stackView + }() + + // MARK: - Functions + + override func configureUI() { + addSubview(stackView) + } + + override func setLayout() { + stackView.snp.makeConstraints { make in + make.height.equalTo(20) + } + unlikeImageView.snp.makeConstraints { make in + make.width.height.equalTo(12) + } + } +} From e7ba4abea4b5cc40740276f7eb1025419777304e Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:55:16 +0900 Subject: [PATCH 14/39] =?UTF-8?q?[#198]=20MenuChip=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4=EB=B7=B0=20=EC=A0=9C=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MenuChipHorizontalScrollView.swift | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift new file mode 100644 index 00000000..c9fce2c5 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift @@ -0,0 +1,84 @@ +// +// MenuChipHorizontalScrollView.swift +// EATSSU-DEV +// +// Created by 최지우 on 1/30/25. +// + +import UIKit + +import EATSSUDesign + +class MenuChipHorizontalScrollView: BaseUIView { + + // MARK: - Properties + var menuDataSource: [String]? { + didSet { bind() } + } + + lazy var horizontalScrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.showsHorizontalScrollIndicator = false + return scrollView + }() + + private lazy var stackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = 4 + return stackView + }() + + override func configureUI() { + horizontalScrollView.addSubview(stackView) + addSubview(horizontalScrollView) + } + + override func setLayout() { + stackView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + horizontalScrollView.snp.makeConstraints { make in + make.center.width.equalToSuperview() + make.height.equalTo(stackView) + make.trailing.equalToSuperview() + } + } + + private func bind() { + menuDataSource?.forEach { menuData in + let button = createButton(menuData) + stackView.addArrangedSubview(button) + debugPrint(menuData) + } + } + + private func createButton(_ title: String) -> UIButton { + var config = UIButton.Configuration.borderedTinted() + config = configureButton(config, title) + return UIButton(configuration: config) + } + + private func configureButton(_ config: UIButton.Configuration, _ title: String) -> UIButton.Configuration { + var config = config + + let attributedString = AttributedString( + title, + attributes: AttributeContainer([ + .font: EATSSUDesignFontFamily.Pretendard.medium.font(size: 10), + .foregroundColor: EATSSUDesignAsset.Color.Main.primary.color])) + config.attributedTitle = attributedString + + config.baseBackgroundColor = EATSSUDesignAsset.Color.Main.secondary.color + config.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color + config.background.strokeWidth = 0.5 + + config.image = EATSSUDesignAsset.Images.thumbUp.image + config.imagePadding = 1 + config.cornerStyle = .capsule + config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 6, bottom: 5, trailing: 6) + + return config + } +} From 5d655b10a3ce4b1967628c7540b819171f1a6066 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 17:56:31 +0900 Subject: [PATCH 15/39] =?UTF-8?q?[#198]=20=EB=A6=AC=EB=B7=B0=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20cell=20=EC=A0=9C=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 각 컴포넌트 backgroundColor 존재(레이아웃 확인용) --- .../MenuChipCollectionViewCell.swift | 4 +- .../Component/ReviewListTableViewCell.swift | 271 ++++++++++++++++++ 2 files changed, 273 insertions(+), 2 deletions(-) rename EATSSU/App/Sources/Presentation/Review/MainReviewView/{ => Component}/MenuChipCollectionViewCell.swift (97%) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift similarity index 97% rename from EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift rename to EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift index 90c2b930..97024cba 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MenuChipCollectionViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift @@ -44,7 +44,7 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { let stackView = UIStackView(arrangedSubviews: [thumbsupImageView, menuLabel]) stackView.axis = .horizontal stackView.spacing = 1 -// stackView.backgroundColor = .green + stackView.backgroundColor = .green return stackView }() @@ -93,7 +93,7 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { private func setupDynamicLayout() { menuLabel.sizeToFit() let viewSize = menuLabel.intrinsicContentSize - let width = viewSize.width + 58 + let width = viewSize.width + 30 let height = viewSize.height + 48 menuChipView.snp.remakeConstraints { make in diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift new file mode 100644 index 00000000..ee53df82 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift @@ -0,0 +1,271 @@ +// +// ReviewListTableViewCell.swift +// EATSSU-DEV +// +// Created by 최지우 on 2/1/25. +// + +import UIKit +import SnapKit + +import EATSSUDesign + +final class ReviewListTableViewCell: BaseTableViewCell { + static let id = "ReviewListTableViewCell" + private var menuChipList = [String]() + + // MARK: - Properties + + var handler: (() -> Void)? + var reviewId: Int = .init() + var menuName: String = .init() + + // MARK: - UI Components + + lazy var totalRateView = RateNumberView() + lazy var reactionView = ReactionView() + + private var dateLabel: UILabel = { + let label = UILabel() + label.text = "2023.03.03" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color + return label + }() + + private var userNameLabel: UILabel = { + let label = UILabel() + label.text = "hellosoongsil1234" + label.font = .caption1 + return label + }() + + private var nickNameLabel: UILabel = { + let label = UILabel() + label.text = "깐깐슈" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + return label + }() + + private let userProfileImageView: UIImageView = { + let imageView = UIImageView(image: EATSSUDesignAsset.Images.profile.image) + return imageView + }() + + private var sideButton: BaseButton = { + let button = BaseButton() +// button.setImage(EATSSUDesignAsset.Images.icInfo.image, for: .normal) + button.setTitleColor(EATSSUDesignAsset.Color.GrayScale.gray400.color, for: .normal) + button.titleLabel?.font = .caption2 + button.setTitle("신고", for: .normal) + button.configuration?.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 15) + return button + }() + + var reviewTextLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + label.text = "여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd여기 계란국 맛집임... 김치볶음밥에 계란후라이 없어서 아쉽 다음에 또 먹어야지dddddfdfdfdfdfdfddfdfdfddfdfdfdfddfddfdfd" + label.numberOfLines = 0 + return label + }() + + var foodImageView: UIImageView = { + let imageView = UIImageView() + imageView.contentMode = .scaleAspectFit + imageView.isHidden = true + return imageView + }() + + /// 이름 + 닉네임 + lazy var nameMenuStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [userNameLabel, nickNameLabel]) + stackView.axis = .horizontal + stackView.spacing = 8.adjusted + stackView.alignment = .center + return stackView + }() + + /// (이름 + 닉네임) + 별점 + lazy var infoStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [nameMenuStackView, totalRateView]) + stackView.axis = .vertical + stackView.spacing = 4.adjusted + stackView.alignment = .leading + return stackView + }() + + /// 프로필 + (이름 + 닉네임 + 별점) + lazy var profileStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [userProfileImageView, infoStackView]) + stackView.axis = .horizontal + stackView.spacing = 8.adjusted + stackView.alignment = .leading + stackView.backgroundColor = .purple + return stackView + }() + + /// 작성일 + 사이드버튼 + lazy var dateReportStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [sideButton, dateLabel]) + stackView.axis = .vertical + stackView.spacing = 8.adjusted + stackView.alignment = .trailing + stackView.backgroundColor = .brown + return stackView + }() + + /// profileStackView + dateReportStackView + lazy var topStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [profileStackView, dateReportStackView]) + stackView.axis = .horizontal +// stackView.spacing = 8.adjusted + stackView.alignment = .fill + stackView.distribution = .fill + stackView.backgroundColor = .yellow + return stackView + }() + + /// 리뷰 텍스트 + 리뷰 이미지 + lazy var contentStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [reviewTextLabel, foodImageView]) + stackView.axis = .vertical + stackView.spacing = 8.adjusted + stackView.alignment = .leading + stackView.backgroundColor = .primary + return stackView + }() + + /// 추천 메뉴칩 + private lazy var menuChipCollectionView: UICollectionView = { + let layout = UICollectionViewFlowLayout() + layout.scrollDirection = .horizontal + layout.minimumLineSpacing = 50 +// layout.minimumInteritemSpacing = 60 + let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) + cv.dataSource = self + cv.backgroundColor = .red + cv.showsHorizontalScrollIndicator = false + return cv + }() + + /// 전체 cell + lazy var cellStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [ + topStackView, + menuChipCollectionView, + contentStackView, + reactionView, + dividerView] + ) + stackView.axis = .vertical + stackView.spacing = 8 + stackView.alignment = .fill + stackView.distribution = .fill + return stackView + }() + + private let dividerView: UIView = { + let view = UIView() +// view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray200.color + view.backgroundColor = .red + return view + }() + + // MARK: - Functions + + private func setCollectionView() { + menuChipCollectionView.register(MenuChipCollectionViewCell.self, + forCellWithReuseIdentifier: MenuChipCollectionViewCell.id) + } + + override func configureUI() { + setCollectionView() + contentView.addSubviews(cellStackView) + } + + override func setLayout() { +// profileStackView.snp.makeConstraints { make in +// make.top.equalToSuperview().offset(5) +// make.leading.equalToSuperview().offset(16) +// make.height.equalTo(30) +// } +// +// dateReportStackView.snp.makeConstraints { make in +// make.top.equalTo(profileStackView) +// make.trailing.equalToSuperview().inset(16) +// } + cellStackView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + topStackView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(5) + } + + menuChipCollectionView.snp.makeConstraints { make in +// make.top.equalTo(dateReportStackView.snp.bottom).offset(8) + make.horizontalEdges.equalToSuperview() + make.height.equalTo(22) + } + + contentStackView.snp.makeConstraints { make in +// make.top.equalTo(menuChipCollectionView.snp.bottom) + make.horizontalEdges.equalToSuperview() + } + + foodImageView.snp.makeConstraints { make in + make.height.width.equalTo(358) + } + + sideButton.snp.makeConstraints { make in + make.height.equalTo(12.adjusted) + } + + reactionView.snp.makeConstraints { make in + make.horizontalEdges.equalToSuperview() + make.height.equalTo(20) + } + + dividerView.snp.makeConstraints { make in + make.height.equalTo(1) + } + + } + + override func prepareForReuse() { + super.prepareForReuse() + self.prepare(review: nil, menuChipList: []) + + sideButton.setTitle("", for: .normal) + sideButton.setImage(UIImage(), for: .normal) + foodImageView.image = UIImage() + foodImageView.isHidden = true + } + + func prepare(review: String?, menuChipList: [String]) { + self.userNameLabel.text = review + self.menuChipList = menuChipList + self.menuChipCollectionView.reloadData() + } + + @objc + func touchedSideButtonEvent() { + handler?() + } + +} + +extension ReviewListTableViewCell: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return menuChipList.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MenuChipCollectionViewCell.id, for: indexPath) as! MenuChipCollectionViewCell + let menuName = self.menuChipList[indexPath.item] + cell.prepare(name: menuName) + return cell + } +} From 7ad7b0d5354f61586e37d3ac6d84d556cb6e364a Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 11 Feb 2025 18:07:04 +0900 Subject: [PATCH 16/39] =?UTF-8?q?[#198]=20=EB=AA=A8=EB=8B=AC=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=ED=95=98=EA=B8=B0=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 --- .../WritingReviewModalViewController.swift | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift index 30b34c20..d5d85420 100644 --- a/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift @@ -22,6 +22,7 @@ final class WritingReviewModalViewController: BaseViewController { private var rateView = RateView() private let imagePickerController = UIImagePickerController() + public let completeReviewButton = ESButton(size: .big, title: "완료하기") private var titleLabel: UILabel = { let label = UILabel() @@ -82,21 +83,21 @@ final class WritingReviewModalViewController: BaseViewController { private let maximumWordLabel: UILabel = { let label = UILabel() label.text = "0 / 300" - label.font = .caption2 - label.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 10) + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color return label }() - private var nextButton: UIButton = { - var config = UIButton.Configuration.plain() - var container = AttributeContainer() - container.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) - container.foregroundColor = EATSSUDesignAsset.Color.Main.primary.color - config.attributedTitle = AttributedString("완료하기", attributes: container) - config.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0) - let button = UIButton(configuration: config) - return button - }() +// private var nextButton: UIButton = { +// var config = UIButton.Configuration.plain() +// var container = AttributeContainer() +// container.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) +// container.foregroundColor = EATSSUDesignAsset.Color.Main.primary.color +// config.attributedTitle = AttributedString("완료하기", attributes: container) +// config.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 0) +// let button = UIButton(configuration: config) +// return button +// }() override func viewDidLoad() { super.viewDidLoad() @@ -117,14 +118,14 @@ final class WritingReviewModalViewController: BaseViewController { dismissKeyboard() view.addSubviews( titleLabel, - nextButton, questionLabel, rateView, maximumWordLabel, selectImageButton, userReviewImageView, userReviewTextView, - deleteMethodLabel) + deleteMethodLabel, + completeReviewButton) } override func setLayout() { @@ -132,11 +133,6 @@ final class WritingReviewModalViewController: BaseViewController { make.top.equalToSuperview().inset(20) make.centerX.equalToSuperview() } - - nextButton.snp.makeConstraints { make in - make.top.equalTo(titleLabel) - make.trailing.equalToSuperview().inset(30) - } questionLabel.snp.makeConstraints { make in make.top.equalTo(titleLabel.snp.bottom).offset(30) @@ -171,18 +167,22 @@ final class WritingReviewModalViewController: BaseViewController { userReviewImageView.snp.makeConstraints { $0.top.equalTo(maximumWordLabel.snp.bottom).offset(15) $0.leading.equalTo(selectImageButton.snp.trailing).offset(13) - $0.width.equalTo(60) - $0.height.equalTo(60) + $0.width.height.equalTo(60) } deleteMethodLabel.snp.makeConstraints { $0.top.equalTo(selectImageButton.snp.bottom).offset(7) $0.leading.equalTo(selectImageButton) } + + completeReviewButton.snp.makeConstraints { make in + make.horizontalEdges.equalToSuperview().inset(24) + make.bottom.equalToSuperview().inset(40) + } } override func setButtonEvent() { - nextButton.addTarget(self, action: #selector(tappedNextButton), for: .touchUpInside) + completeReviewButton.addTarget(self, action: #selector(tappedNextButton), for: .touchUpInside) } @objc From 38fecabdf11d7b0b27384a0fff55fed9a0846d9a Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 18 Feb 2025 17:40:28 +0900 Subject: [PATCH 17/39] =?UTF-8?q?[#198]=20feedback=20image=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WritingReview/MenuFeedbackView.swift | 8 ++++++++ .../unfilledThumbDown.imageset/Contents.json | 12 ++++++++++++ .../unfilledThumbDown.imageset/unfilledThumbDown.svg | 4 ++++ .../unfilledThumbUp.imageset/Contents.json | 12 ++++++++++++ .../unfilledThumbUp.imageset/unfilledThumbUp.svg | 4 ++++ 5 files changed, 40 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/Contents.json create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/unfilledThumbDown.svg create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/Contents.json create mode 100644 EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/unfilledThumbUp.svg diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift new file mode 100644 index 00000000..a29b9b61 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift @@ -0,0 +1,8 @@ +// +// MenuFeedbackView.swift +// EATSSU +// +// Created by 최지우 on 2/13/25. +// + +import Foundation diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/Contents.json new file mode 100644 index 00000000..a9c77015 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "unfilledThumbDown.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/unfilledThumbDown.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/unfilledThumbDown.svg new file mode 100644 index 00000000..8336cee5 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbDown.imageset/unfilledThumbDown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/Contents.json new file mode 100644 index 00000000..e8062fe4 --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "unfilledThumbUp.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/unfilledThumbUp.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/unfilledThumbUp.svg new file mode 100644 index 00000000..042ae95a --- /dev/null +++ b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/unfilledThumbUp.imageset/unfilledThumbUp.svg @@ -0,0 +1,4 @@ + + + + From 2a1984f84de9e9761404905f3e101f993f48c9ca Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 18 Feb 2025 17:41:20 +0900 Subject: [PATCH 18/39] =?UTF-8?q?[#198]=20GoogleAds=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=A3=BC=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Utility/Application/AppDelegate.swift | 10 +++++----- EATSSU/Project.swift | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/EATSSU/App/Sources/Utility/Application/AppDelegate.swift b/EATSSU/App/Sources/Utility/Application/AppDelegate.swift index ce0c6f06..4b3e1ba8 100644 --- a/EATSSU/App/Sources/Utility/Application/AppDelegate.swift +++ b/EATSSU/App/Sources/Utility/Application/AppDelegate.swift @@ -9,7 +9,7 @@ import AuthenticationServices import UIKit import Firebase -import GoogleMobileAds +//import GoogleMobileAds import KakaoSDKCommon @main @@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: - UIApplicationDelegate Methods func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - configureGoogleMobileAds() +// configureGoogleMobileAds() setupNotificationPermissions() startNetworkMonitoring() configureFirebase() @@ -41,9 +41,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: - Private Methods /// Google Mobile Ads SDK를 초기화합니다. - private func configureGoogleMobileAds() { - GADMobileAds.sharedInstance().start(completionHandler: nil) - } +// private func configureGoogleMobileAds() { +// GADMobileAds.sharedInstance().start(completionHandler: nil) +// } /// 푸시 알림 권한을 요청하고 설정을 처리합니다. private func setupNotificationPermissions() { diff --git a/EATSSU/Project.swift b/EATSSU/Project.swift index cc5f6d62..67ada4dc 100644 --- a/EATSSU/Project.swift +++ b/EATSSU/Project.swift @@ -4,7 +4,7 @@ let appInfoPlist: InfoPlist = .extendingDefault(with: [ "UILaunchStoryboardName": "LaunchScreen", "BASE_URL": "https://$(BASE_URL)", "KAKAO API KEY": "$(KAKAO_API_KEY)", - "GADApplicationIdentifier": "$(GADApplicationIdentifier)", +// "GADApplicationIdentifier": "$(GADApplicationIdentifier)", "CFBundleURLTypes": [ [ "CFBundleTypeRole": "Editor", @@ -101,7 +101,7 @@ let project = Project( .external(name: "KakaoSDKUser"), .external(name: "KakaoSDKCommon"), .external(name: "KakaoSDKTalk"), - .external(name: "GoogleMobileAds"), +// .external(name: "GoogleMobileAds"), // EATSSU 내장 라이브러리 .project(target: "EATSSUDesign", path: .relativeToRoot("../EATSSUDesign"), condition: .none), From 026796d67af1a0d3d5f0d7fd67679eb53167d2be Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 18 Feb 2025 17:42:00 +0900 Subject: [PATCH 19/39] =?UTF-8?q?[#198]=20HomeVC=20GoogleAds=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=A3=BC=EC=84=9D=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Home/ViewController/HomeViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift index 6e7477b8..65ca22a6 100644 --- a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift +++ b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift @@ -10,7 +10,7 @@ import UIKit import EATSSUDesign import FirebaseAnalytics -import GoogleMobileAds +//import GoogleMobileAds import Moya import SnapKit From d5127eef6ff86e143ef77ce10ecd657e7c74c2d9 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 18 Feb 2025 17:54:54 +0900 Subject: [PATCH 20/39] =?UTF-8?q?[#198]=20image=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Contents.json | 0 .../thumb-down.svg | 0 .../{thumb-up.imageset => filledThumbUp.imageset}/Contents.json | 0 .../{thumb-up.imageset => filledThumbUp.imageset}/thumb-up.svg | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/{thumb-down.imageset => filledThumbDown.imageset}/Contents.json (100%) rename EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/{thumb-down.imageset => filledThumbDown.imageset}/thumb-down.svg (100%) rename EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/{thumb-up.imageset => filledThumbUp.imageset}/Contents.json (100%) rename EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/{thumb-up.imageset => filledThumbUp.imageset}/thumb-up.svg (100%) diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-down.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbDown.imageset/Contents.json similarity index 100% rename from EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-down.imageset/Contents.json rename to EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbDown.imageset/Contents.json diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-down.imageset/thumb-down.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbDown.imageset/thumb-down.svg similarity index 100% rename from EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-down.imageset/thumb-down.svg rename to EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbDown.imageset/thumb-down.svg diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-up.imageset/Contents.json b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbUp.imageset/Contents.json similarity index 100% rename from EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-up.imageset/Contents.json rename to EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbUp.imageset/Contents.json diff --git a/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-up.imageset/thumb-up.svg b/EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbUp.imageset/thumb-up.svg similarity index 100% rename from EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/thumb-up.imageset/thumb-up.svg rename to EATSSUDesign/EATSSUDesign/Resources/Images.xcassets/filledThumbUp.imageset/thumb-up.svg From 6411025d510aecad3506cc85d742c86191dd7e5f Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 18 Feb 2025 19:04:32 +0900 Subject: [PATCH 21/39] =?UTF-8?q?[#198]=20MenuFeedbackView=20UI=20?= =?UTF-8?q?=EB=B0=8F=20=ED=86=A0=EA=B8=80=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MenuChipHorizontalScrollView.swift | 2 +- .../WritingReview/MenuFeedbackView.swift | 158 +++++++++++++++++- 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift index c9fce2c5..d7ffbb2b 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipHorizontalScrollView.swift @@ -74,7 +74,7 @@ class MenuChipHorizontalScrollView: BaseUIView { config.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color config.background.strokeWidth = 0.5 - config.image = EATSSUDesignAsset.Images.thumbUp.image + config.image = EATSSUDesignAsset.Images.filledThumbUp.image config.imagePadding = 1 config.cornerStyle = .capsule config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 6, bottom: 5, trailing: 6) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift index a29b9b61..3820e7d7 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/MenuFeedbackView.swift @@ -5,4 +5,160 @@ // Created by 최지우 on 2/13/25. // -import Foundation +import UIKit + +import SnapKit +import EATSSUDesign + +enum FeedbackType { + case like + case dislike + case none +} + +class MenuFeedbackView: UIView { + + // MARK: - Properties + + private var selectedFeedback: FeedbackType = .none { + didSet { + updateButtonStates() + } + } + + // MARK: - UI Components + + private let menuLabel = UILabel() + private lazy var likeButton = UIButton() + private lazy var dislikeButton = UIButton() + private lazy var buttonStackView = UIStackView() + private lazy var menuStackView = UIStackView() + + // MARK: - Functions + + override init(frame: CGRect) { + super.init(frame: frame) + + configureUI() + setLayout() + setProperties() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + + configureUI() + setLayout() + setProperties() + } + + private func updateButtonStates() { + switch selectedFeedback { + case .like: + likeButton.configuration?.image = EATSSUDesignAsset.Images.filledThumbUp.image + dislikeButton.configuration?.image = EATSSUDesignAsset.Images.unfilledThumbDown.image + + likeButton.configuration?.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color + likeButton.configuration?.background.backgroundColor = EATSSUDesignAsset.Color.Main.secondary.color + + dislikeButton.configuration?.background.strokeColor = EATSSUDesignAsset.Color.GrayScale.gray300.color + dislikeButton.configuration?.background.backgroundColor = .white + case .dislike: + likeButton.configuration?.image = EATSSUDesignAsset.Images.unfilledThumbUp.image + dislikeButton.configuration?.image = EATSSUDesignAsset.Images.filledThumbDown.image + + dislikeButton.configuration?.background.strokeColor = EATSSUDesignAsset.Color.Main.primary.color + dislikeButton.configuration?.background.backgroundColor = EATSSUDesignAsset.Color.Main.secondary.color + + likeButton.configuration?.background.strokeColor = EATSSUDesignAsset.Color.GrayScale.gray300.color + likeButton.configuration?.background.backgroundColor = .white + case .none: + likeButton.configuration?.background.backgroundColor = .white + dislikeButton.configuration?.background.backgroundColor = .white + } + } + + @objc + func likeButtonTapped() { + selectedFeedback = .like + } + + @objc + private func dislikeButtonTapped() { + selectedFeedback = .dislike + } + + public func configure(with menuName: String) { + menuLabel.text = menuName + } + +} + +extension MenuFeedbackView { + private func configureUI() { + buttonStackView.addArrangedSubviews([ + likeButton, + dislikeButton + ]) + menuStackView.addArrangedSubviews([ + menuLabel, + buttonStackView + ]) + addSubviews( + menuStackView + ) + } + + private func setLayout() { + menuStackView.snp.makeConstraints { make in + make.top.horizontalEdges.equalToSuperview() + make.height.equalTo(28) + } + [likeButton, dislikeButton].forEach { button in + button.snp.makeConstraints { make in + make.width.equalTo(58) + make.height.equalTo(28) + } + } + } + + private func setProperties() { + menuLabel.do { + $0.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + } + likeButton.do { + var config = UIButton.Configuration.plain() + config.image = EATSSUDesignAsset.Images.unfilledThumbUp.image + config.background.strokeColor = EATSSUDesignAsset.Color.GrayScale.gray300.color + config.background.strokeWidth = 1 + config.background.cornerRadius = 15 + $0.configuration = config + $0.addAction(UIAction(handler: { [weak self] _ in + self?.likeButtonTapped() + }), for: .touchUpInside) + } + dislikeButton.do { + var config = UIButton.Configuration.plain() + config.image = EATSSUDesignAsset.Images.unfilledThumbDown.image + config.background.strokeColor = EATSSUDesignAsset.Color.GrayScale.gray300.color + config.background.strokeWidth = 1 + config.background.cornerRadius = 15 + $0.configuration = config + $0.addAction(UIAction(handler: { [weak self] _ in + self?.dislikeButtonTapped() + }), for: .touchUpInside) + } + buttonStackView.do { + $0.axis = .horizontal + $0.spacing = 8 + $0.distribution = .fillEqually + $0.clipsToBounds = false + $0.isUserInteractionEnabled = true + } + menuStackView.do { + $0.axis = .horizontal + $0.spacing = 4 + $0.distribution = .fill + } + } +} From ea53cb6e290e5049bb02f815f35ae42de334a1ce Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 16:47:30 +0900 Subject: [PATCH 22/39] =?UTF-8?q?[#198]=20ChartComponentView=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 --- .../Component/ChartComponentView.swift | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift new file mode 100644 index 00000000..e52a57b3 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift @@ -0,0 +1,69 @@ +// +// ChartComponentView.swift +// EATSSU +// +// Created by 최지우 on 2/18/25. +// + +import UIKit + +import SnapKit +import EATSSUDesign + +class ChartComponentView: BaseUIView { + + private lazy var chartBarView = UIView() + + private let pointLabel: UILabel = { + let label = UILabel() + label.text = "5점" + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 12) + return label + }() + + public var chartBarBackgroundView: UIView = { + let view = UIView() + view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray200.color + view.layer.cornerRadius = 5 + return view + }() + + public var chartBarforegroundView: UIView = { + let view = UIView() + view.backgroundColor = EATSSUDesignAsset.Color.Main.primary.color + view.layer.cornerRadius = 5 + return view + }() + + private lazy var chartComponentStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [pointLabel, chartBarView]) + stackView.axis = .horizontal + stackView.spacing = 9 + return stackView + }() + + override func configureUI() { + chartBarView.addSubviews(chartBarBackgroundView, + chartBarforegroundView) + addSubviews(chartComponentStackView) + } + + override func setLayout() { + chartBarView.snp.makeConstraints { make in + make.width.equalTo(115.adjusted) + make.height.equalTo(10.adjusted) + + } + chartBarforegroundView.snp.makeConstraints { make in + make.width.equalTo(80.adjusted) + make.height.equalTo(10.adjusted) + make.top.leading.equalToSuperview() + } + chartBarBackgroundView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + chartComponentStackView.snp.makeConstraints { make in + make.top.leading.bottom.equalToSuperview() + } + } +} From 0a75f11a6c4f0d5a26b415fc09b3ca82efd7574e Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 16:48:49 +0900 Subject: [PATCH 23/39] =?UTF-8?q?[#198]=20final=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/MainReviewView/Component/ChartComponentView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift index e52a57b3..4adc399d 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit import EATSSUDesign -class ChartComponentView: BaseUIView { +final class ChartComponentView: BaseUIView { private lazy var chartBarView = UIView() From aac34e64ff6a3b1bb78237263465932b8f6615b7 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 17:53:44 +0900 Subject: [PATCH 24/39] =?UTF-8?q?[#198]=20RateNumberView=20->=20StarRating?= =?UTF-8?q?View=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eNumberView.swift => StarRatingView.swift} | 45 ++++++++++--------- 1 file changed, 25 insertions(+), 20 deletions(-) rename EATSSU/App/Sources/Presentation/Review/View/SeeReview/{RateNumberView.swift => StarRatingView.swift} (57%) diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift similarity index 57% rename from EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift rename to EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift index 17246bf5..04b327da 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift @@ -8,18 +8,28 @@ import UIKit import EATSSUDesign - import SnapKit -import Then -final class RateNumberView: BaseUIView { +final class StarRatingView: BaseUIView { + // MARK: - UI Components - let starImageView = UIImageView() - lazy var rateNumberLabel = UILabel() + private let starImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.icStarYellow.image + return imageView + }() + + private lazy var rateNumberLabel: UILabel = { + let label = UILabel() + label.text = "5" + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 40) + return label + }() + private lazy var rateNumberStackView = UIStackView(arrangedSubviews: [starImageView, rateNumberLabel]) - + // MARK: - init override init(frame: CGRect) { @@ -30,40 +40,35 @@ final class RateNumberView: BaseUIView { required init?(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } - - override func layoutSubviews() { - super.layoutSubviews() - } - + // MARK: - Functions override func configureUI() { addSubviews(rateNumberStackView) - starImageView.do { - $0.image = EATSSUDesignAsset.Images.icStarYellow.image - } rateNumberLabel.do { $0.text = "5" - $0.font = .body2 - $0.textColor = EATSSUDesignAsset.Color.Main.primary.color + $0.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 40) } rateNumberStackView.do { $0.axis = .horizontal - $0.spacing = 3 - $0.alignment = .top + $0.spacing = 8 } } override func setLayout() { starImageView.snp.makeConstraints { - $0.height.equalTo(12.adjusted) - $0.width.equalTo(12.adjusted) + $0.height.equalTo(24.adjusted) + $0.width.equalTo(24.adjusted) } rateNumberStackView.snp.makeConstraints { $0.edges.equalToSuperview() } } + + public func updateStarRating(_ rate: Double) { + rateNumberLabel.text = String(format: "%.1f", rate) + } } From 462edec95257b4898694470180e363501bf58279 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 17:54:10 +0900 Subject: [PATCH 25/39] =?UTF-8?q?[#198]=20StarRatingView=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/SeeReview/StarRatingView.swift | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift index 04b327da..71469599 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift @@ -1,5 +1,5 @@ // -// RateNumberView.swift +// StarRatingView.swift // EatSSU-iOS // // Created by 박윤빈 on 2023/06/29. @@ -20,15 +20,19 @@ final class StarRatingView: BaseUIView { return imageView }() - private lazy var rateNumberLabel: UILabel = { + private lazy var ratingLabel: UILabel = { let label = UILabel() label.text = "5" label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 40) return label }() - private lazy var rateNumberStackView = UIStackView(arrangedSubviews: [starImageView, - rateNumberLabel]) + private lazy var starRatingStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [starImageView, ratingLabel]) + stackView.axis = .horizontal + stackView.spacing = 8 + return stackView + }() // MARK: - init @@ -44,17 +48,7 @@ final class StarRatingView: BaseUIView { // MARK: - Functions override func configureUI() { - addSubviews(rateNumberStackView) - - rateNumberLabel.do { - $0.text = "5" - $0.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 40) - } - - rateNumberStackView.do { - $0.axis = .horizontal - $0.spacing = 8 - } + addSubviews(starRatingStackView) } override func setLayout() { @@ -63,12 +57,12 @@ final class StarRatingView: BaseUIView { $0.width.equalTo(24.adjusted) } - rateNumberStackView.snp.makeConstraints { + starRatingStackView.snp.makeConstraints { $0.edges.equalToSuperview() } } public func updateStarRating(_ rate: Double) { - rateNumberLabel.text = String(format: "%.1f", rate) + ratingLabel.text = String(format: "%.1f", rate) } } From 5cab3e1c17ef48dbe3392ed56d02ec5759b56af1 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 17:54:43 +0900 Subject: [PATCH 26/39] =?UTF-8?q?[#198]=20ThumbsCountView=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ThumbsCountView.swift | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ThumbsCountView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ThumbsCountView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ThumbsCountView.swift new file mode 100644 index 00000000..d05b4f3a --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ThumbsCountView.swift @@ -0,0 +1,76 @@ +// +// ThumbsCountView.swift +// EATSSU +// +// Created by 최지우 on 2/18/25. +// + +import UIKit + +import EATSSUDesign +import SnapKit + +enum ThumbType { + case up + case down +} + +final class ThumbsCountView: BaseUIView { + + // MARK: - Properties + + private let thumbType: ThumbType + + // MARK: - UI Components + + private let thumbImageView: UIImageView = { + let imageView = UIImageView() + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private let countLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.semiBold.font(size: 16) + label.text = "12" + return label + }() + + // MARK: - Functions + + init(thumbType: ThumbType) { + self.thumbType = thumbType + super.init(frame: .zero) + setThumbImage() + } + + override func configureUI() { + addSubviews(thumbImageView, + countLabel) + } + + override func setLayout() { + thumbImageView.snp.makeConstraints { make in + make.height.width.equalTo(16) + make.top.leading.equalToSuperview() + } + countLabel.snp.makeConstraints { make in + make.top.trailing.equalToSuperview() + make.leading.equalTo(thumbImageView.snp.trailing).offset(11) + } + } + + private func setThumbImage() { + switch thumbType { + case .up: + thumbImageView.image = EATSSUDesignAsset.Images.filledThumbUp.image + case .down: + thumbImageView.image = EATSSUDesignAsset.Images.filledThumbDown.image + } + } + + public func updateCount(thumbCnt: Int) { + countLabel.text = "\(thumbCnt)" + } + +} From 4905574bee180adcfef97248278d262c270bd0f2 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 17:55:48 +0900 Subject: [PATCH 27/39] =?UTF-8?q?[#198]=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainReviewView/Component/ChartComponentView.swift | 2 +- .../Component/MenuChipCollectionViewCell.swift | 2 +- .../MainReviewView/Component/ReviewListTableViewCell.swift | 2 +- .../Review/View/SeeReview/ReviewTableCell.swift | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift index 4adc399d..3deb6ed8 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift @@ -7,8 +7,8 @@ import UIKit -import SnapKit import EATSSUDesign +import SnapKit final class ChartComponentView: BaseUIView { diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift index 97024cba..133ab93c 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift @@ -24,7 +24,7 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { }() private let thumbsupImageView: UIImageView = { - let imageView = UIImageView(image: EATSSUDesignAsset.Images.thumbUp.image) + let imageView = UIImageView(image: EATSSUDesignAsset.Images.filledThumbUp.image) imageView.contentMode = .scaleAspectFit return imageView }() diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift index ee53df82..e2d58aaf 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift @@ -22,7 +22,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { // MARK: - UI Components - lazy var totalRateView = RateNumberView() + lazy var totalRateView = StarRatingView() lazy var reactionView = ReactionView() private var dateLabel: UILabel = { diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift index b9e42250..7c9e7941 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift @@ -21,9 +21,9 @@ final class ReviewTableCell: UITableViewCell { // MARK: - UI Components - lazy var totalRateView = RateNumberView() - lazy var tasteRateView = RateNumberView() - lazy var quantityRateView = RateNumberView() + lazy var totalRateView = StarRatingView() + lazy var tasteRateView = StarRatingView() + lazy var quantityRateView = StarRatingView() private let tasteLabel: UILabel = { let label = UILabel() From 9f66ce25ad0c6997b5620ae3e6bd76e3736c076e Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 18:01:43 +0900 Subject: [PATCH 28/39] =?UTF-8?q?[#198]=20=EA=B8=B0=EC=A1=B4=20RateNumberV?= =?UTF-8?q?iew=20=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component}/StarRatingView.swift | 0 .../View/SeeReview/RateNumberView.swift | 71 +++++++++++++++++++ .../View/SeeReview/ReviewTableCell.swift | 6 +- 3 files changed, 74 insertions(+), 3 deletions(-) rename EATSSU/App/Sources/Presentation/Review/{View/SeeReview => MainReviewView/Component}/StarRatingView.swift (100%) create mode 100644 EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift similarity index 100% rename from EATSSU/App/Sources/Presentation/Review/View/SeeReview/StarRatingView.swift rename to EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift new file mode 100644 index 00000000..281b9fb5 --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift @@ -0,0 +1,71 @@ +// +// RateNumberView.swift +// EATSSU +// +// Created by 최지우 on 2/19/25. +// + +import UIKit + +import EATSSUDesign + +import SnapKit +import Then + +// TODO: - 추후 제거(StarRatingView으로 리팩됨) + +final class RateNumberView: BaseUIView { + // MARK: - UI Components + + let starImageView = UIImageView() + lazy var rateNumberLabel = UILabel() + private lazy var rateNumberStackView = UIStackView(arrangedSubviews: [starImageView, + rateNumberLabel]) + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + } + + @available(*, unavailable) + required init?(coder _: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + } + + // MARK: - Functions + + override func configureUI() { + addSubviews(rateNumberStackView) + starImageView.do { + $0.image = EATSSUDesignAsset.Images.icStarYellow.image + } + + rateNumberLabel.do { + $0.text = "5" + $0.font = .body2 + $0.textColor = EATSSUDesignAsset.Color.Main.primary.color + } + + rateNumberStackView.do { + $0.axis = .horizontal + $0.spacing = 3 + $0.alignment = .top + } + } + + override func setLayout() { + starImageView.snp.makeConstraints { + $0.height.equalTo(12.adjusted) + $0.width.equalTo(12.adjusted) + } + + rateNumberStackView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } +} diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift index 7c9e7941..b9e42250 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift @@ -21,9 +21,9 @@ final class ReviewTableCell: UITableViewCell { // MARK: - UI Components - lazy var totalRateView = StarRatingView() - lazy var tasteRateView = StarRatingView() - lazy var quantityRateView = StarRatingView() + lazy var totalRateView = RateNumberView() + lazy var tasteRateView = RateNumberView() + lazy var quantityRateView = RateNumberView() private let tasteLabel: UILabel = { let label = UILabel() From 88d445cb95278067c9db9d6229434053ca803a5c Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 19:02:13 +0900 Subject: [PATCH 29/39] =?UTF-8?q?[#198]=20=EB=A9=94=EB=89=B4=EB=AA=85=20?= =?UTF-8?q?=EA=B8=B8=EC=9D=B4=EC=97=90=20=EB=94=B0=EB=A5=B8=20summaryView?= =?UTF-8?q?=20=EB=86=92=EC=9D=B4=20=EC=9C=A0=EB=8F=99=EC=A0=81=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/MainReviewView/MainReviewView.swift | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift index e3b3a8b0..ab4bfed8 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -6,8 +6,8 @@ // import UIKit -import SnapKit +import SnapKit import EATSSUDesign final class MainReviewView: BaseUIView { @@ -22,11 +22,7 @@ final class MainReviewView: BaseUIView { private let contentView = UIView() /// 리뷰 상단 summary - let summaryView: UIView = { - let view = UIView() - view.backgroundColor = .red - return view - }() + let summaryView = ReviewSummaryView() /// 리뷰 리스트 lazy var tableView: UITableView = { @@ -73,7 +69,6 @@ final class MainReviewView: BaseUIView { summaryView.snp.makeConstraints { make in make.top.equalToSuperview() make.horizontalEdges.equalToSuperview() - make.height.equalTo(200) } tableView.snp.makeConstraints { make in make.top.equalTo(summaryView.snp.bottom) From 2fd8bb9b042e7fc8aa227ef238813e62b5c69796 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Wed, 19 Feb 2025 19:03:30 +0900 Subject: [PATCH 30/39] =?UTF-8?q?[#198]=20SummaryView=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EB=B0=B0=EC=B9=98=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (레이아웃별 background 적용) --- .../Component/ReviewSummaryView.swift | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift new file mode 100644 index 00000000..0b26566e --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift @@ -0,0 +1,138 @@ +// +// ReviewSummaryView.swift +// EATSSU +// +// Created by 최지우 on 2/18/25. +// + +import UIKit + +import SnapKit +import EATSSUDesign + +final class ReviewSummaryView: BaseUIView { + + // MARK: - UI Components + + private var menuLabel: UILabel = { + let label = UILabel() + label.text = "고구마치즈돈까스+막국수+미니밥+단무지+요구르트고구마치즈돈까스+막국수+미니밥+단무지+요구르트고구마치즈돈까스+막국수+미니밥+단무지" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + label.numberOfLines = 0 + return label + }() + + // MARK: 좌측 + + private var starRatingView = StarRatingView() + private let thumbupCountView = ThumbsCountView(thumbType: .up) + private let thumbdownpCountView = ThumbsCountView(thumbType: .down) + + private lazy var thumbCountStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [thumbupCountView, thumbdownpCountView]) + stackView.axis = .horizontal + stackView.distribution = .fillEqually + stackView.spacing = 14 + stackView.backgroundColor = .purple + return stackView + }() + + private lazy var ratingSummaryStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [starRatingView, thumbCountStackView]) + stackView.axis = .vertical + stackView.spacing = 20 + stackView.backgroundColor = .gray300 + return stackView + }() + + // MARK: 우측 + + private let totalReviewTitleLabel: UILabel = { + let label = UILabel() + label.text = "총 리뷰 수" + label.font = .caption2 + label.textColor = .black + return label + }() + + private let totalReviewCountLabel: UILabel = { + let label = UILabel() + label.text = "15" + label.font = .caption1 + label.textColor = EATSSUDesignAsset.Color.Main.primary.color + label.backgroundColor = .purple + return label + }() + + private lazy var totalReviewStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [totalReviewTitleLabel, totalReviewCountLabel]) + stackView.axis = .horizontal + stackView.spacing = 4 + stackView.backgroundColor = .blue + return stackView + }() + + private let oneChartComponentView = ChartComponentView() + private let twoChartComponentView = ChartComponentView() + private let threeChartComponentView = ChartComponentView() + private let fourChartComponentView = ChartComponentView() + private let fiveChartComponentView = ChartComponentView() + + private lazy var yAxisStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [oneChartComponentView, + twoChartComponentView, + threeChartComponentView, + fourChartComponentView, + fiveChartComponentView]) + stackView.axis = .vertical + stackView.spacing = 8 + stackView.backgroundColor = .yellow + return stackView + }() + + private lazy var reviewDistributionStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [totalReviewStackView, yAxisStackView]) + stackView.axis = .vertical + stackView.spacing = 5 + return stackView + }() + + // MARK: - 좌측 + 우측 + + private lazy var ratingAndDistributionStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [ratingSummaryStackView, + reviewDistributionStackView]) + stackView.axis = .horizontal +// stackView.spacing = 44 + stackView.backgroundColor = .brown + return stackView + }() + + // MARK: - total + + private lazy var reviewSummaryStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [menuLabel, ratingAndDistributionStackView]) + stackView.axis = .vertical + stackView.spacing = 15 + stackView.backgroundColor = .orange + return stackView + }() + + // MARK: - Functions + + override func configureUI() { + addSubviews(reviewSummaryStackView) + } + + override func setLayout() { + reviewSummaryStackView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.horizontalEdges.equalToSuperview().inset(20.adjusted) + make.bottom.equalToSuperview() + } + } +} + +extension ReviewSummaryView { + +} From ba3156b15b338bcce411ff7394efeca8efbded82 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Thu, 20 Feb 2025 02:47:57 +0900 Subject: [PATCH 31/39] =?UTF-8?q?[#198]=20ReviewSummaryView=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=A0=81=EC=9A=A9=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit background 적용 --- .../Component/ChartComponentView.swift | 3 +-- .../MainReviewView/Component/ReviewSummaryView.swift | 12 ++++++++---- .../MainReviewView/Component/StarRatingView.swift | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift index 3deb6ed8..75ebb408 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ChartComponentView.swift @@ -52,7 +52,6 @@ final class ChartComponentView: BaseUIView { chartBarView.snp.makeConstraints { make in make.width.equalTo(115.adjusted) make.height.equalTo(10.adjusted) - } chartBarforegroundView.snp.makeConstraints { make in make.width.equalTo(80.adjusted) @@ -63,7 +62,7 @@ final class ChartComponentView: BaseUIView { make.edges.equalToSuperview() } chartComponentStackView.snp.makeConstraints { make in - make.top.leading.bottom.equalToSuperview() + make.edges.equalToSuperview() } } } diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift index 0b26566e..d02ae288 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift @@ -31,7 +31,6 @@ final class ReviewSummaryView: BaseUIView { private lazy var thumbCountStackView: UIStackView = { let stackView = UIStackView(arrangedSubviews: [thumbupCountView, thumbdownpCountView]) stackView.axis = .horizontal - stackView.distribution = .fillEqually stackView.spacing = 14 stackView.backgroundColor = .purple return stackView @@ -40,7 +39,8 @@ final class ReviewSummaryView: BaseUIView { private lazy var ratingSummaryStackView: UIStackView = { let stackView = UIStackView(arrangedSubviews: [starRatingView, thumbCountStackView]) stackView.axis = .vertical - stackView.spacing = 20 + stackView.alignment = .center + stackView.spacing = 15 stackView.backgroundColor = .gray300 return stackView }() @@ -51,7 +51,8 @@ final class ReviewSummaryView: BaseUIView { let label = UILabel() label.text = "총 리뷰 수" label.font = .caption2 - label.textColor = .black + label.backgroundColor = .red + label.setContentHuggingPriority(.defaultHigh, for: .horizontal) return label }() @@ -103,7 +104,6 @@ final class ReviewSummaryView: BaseUIView { let stackView = UIStackView(arrangedSubviews: [ratingSummaryStackView, reviewDistributionStackView]) stackView.axis = .horizontal -// stackView.spacing = 44 stackView.backgroundColor = .brown return stackView }() @@ -114,6 +114,7 @@ final class ReviewSummaryView: BaseUIView { let stackView = UIStackView(arrangedSubviews: [menuLabel, ratingAndDistributionStackView]) stackView.axis = .vertical stackView.spacing = 15 + stackView.alignment = .center stackView.backgroundColor = .orange return stackView }() @@ -130,6 +131,9 @@ final class ReviewSummaryView: BaseUIView { make.horizontalEdges.equalToSuperview().inset(20.adjusted) make.bottom.equalToSuperview() } + starRatingView.snp.makeConstraints { make in + make.top.equalToSuperview().offset(20.adjusted) + } } } diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift index 71469599..7e7934e2 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift @@ -22,8 +22,8 @@ final class StarRatingView: BaseUIView { private lazy var ratingLabel: UILabel = { let label = UILabel() - label.text = "5" - label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 40) + label.text = "5.0" + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 35) return label }() @@ -53,8 +53,8 @@ final class StarRatingView: BaseUIView { override func setLayout() { starImageView.snp.makeConstraints { - $0.height.equalTo(24.adjusted) - $0.width.equalTo(24.adjusted) + $0.height.equalTo(25.adjusted) + $0.width.equalTo(25.adjusted) } starRatingStackView.snp.makeConstraints { From aa103e2286386ff56f8d6d7216b52b6ed6fb2d82 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Thu, 20 Feb 2025 17:30:22 +0900 Subject: [PATCH 32/39] =?UTF-8?q?[#198]=20StarSummaryView=EB=A1=9C=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ReviewListTableViewCell.swift | 2 +- .../MainReviewView/Component/ReviewSummaryView.swift | 10 +++------- .../{StarRatingView.swift => StarSummaryView.swift} | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) rename EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/{StarRatingView.swift => StarSummaryView.swift} (95%) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift index e2d58aaf..dc46a82b 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift @@ -22,7 +22,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { // MARK: - UI Components - lazy var totalRateView = StarRatingView() + lazy var totalRateView = StarSummaryView() lazy var reactionView = ReactionView() private var dateLabel: UILabel = { diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift index d02ae288..56820ec9 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift @@ -24,7 +24,7 @@ final class ReviewSummaryView: BaseUIView { // MARK: 좌측 - private var starRatingView = StarRatingView() + private var starSummaryView = StarSummaryView() private let thumbupCountView = ThumbsCountView(thumbType: .up) private let thumbdownpCountView = ThumbsCountView(thumbType: .down) @@ -37,7 +37,7 @@ final class ReviewSummaryView: BaseUIView { }() private lazy var ratingSummaryStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [starRatingView, thumbCountStackView]) + let stackView = UIStackView(arrangedSubviews: [starSummaryView, thumbCountStackView]) stackView.axis = .vertical stackView.alignment = .center stackView.spacing = 15 @@ -131,12 +131,8 @@ final class ReviewSummaryView: BaseUIView { make.horizontalEdges.equalToSuperview().inset(20.adjusted) make.bottom.equalToSuperview() } - starRatingView.snp.makeConstraints { make in + starSummaryView.snp.makeConstraints { make in make.top.equalToSuperview().offset(20.adjusted) } } } - -extension ReviewSummaryView { - -} diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift similarity index 95% rename from EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift rename to EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift index 7e7934e2..5071d559 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift @@ -1,5 +1,5 @@ // -// StarRatingView.swift +// StarSummaryView.swift // EatSSU-iOS // // Created by 박윤빈 on 2023/06/29. @@ -10,7 +10,7 @@ import UIKit import EATSSUDesign import SnapKit -final class StarRatingView: BaseUIView { +final class StarSummaryView: BaseUIView { // MARK: - UI Components From 4c9c5aada28f0868eb01540cfb20053416c0baeb Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Thu, 20 Feb 2025 18:01:45 +0900 Subject: [PATCH 33/39] =?UTF-8?q?[#198]=20StarRatingView=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/StarRatingView.swift | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift new file mode 100644 index 00000000..3bbf714a --- /dev/null +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarRatingView.swift @@ -0,0 +1,69 @@ +// +// StarRatingView.swift +// EATSSU +// +// Created by 최지우 on 2/20/25. +// + +import UIKit + +import SnapKit +import EATSSUDesign + +final class StarRatingView: BaseUIView { + + // MARK: - Properties + + private let maxStars = 5 + + public var rating: Int = 0 { + didSet { + updateStarImages() + } + } + + // MARK: - UI Components + + private var starImageViews: [UIImageView] = [] + + // MARK: - Functions + + override init(frame: CGRect) { + super.init(frame: frame) + setupView() + } + + private func setupView() { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = 2 + stackView.alignment = .center + stackView.distribution = .fillEqually + addSubview(stackView) + + stackView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + for _ in 0.. Date: Sat, 22 Feb 2025 23:39:41 +0900 Subject: [PATCH 34/39] =?UTF-8?q?[#198]=20cell=20selection=20=EB=A7=89?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Review/MainReviewViewController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift index f12fe118..d1e1db7f 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -12,11 +12,10 @@ final class MainReviewViewController: BaseViewController { // MARK: - Properties private var dataSource = [String]() - // View Properties + // MARK: - UI Components + private let mainReviewView = MainReviewView() - // MARK: - View Life Cycle - // MARK: - Functions override func viewDidLoad() { @@ -64,6 +63,7 @@ extension MainReviewViewController: UITableViewDataSource { let cell = tableView.dequeueReusableCell(withIdentifier: ReviewListTableViewCell.id, for: indexPath) as! ReviewListTableViewCell // let row = self.dataSource[indexPath.row] + cell.selectionStyle = .none cell.prepare(review: "name: Jay", menuChipList: dataSource) return cell } From eaf21d7c1e8f4b191acaa31f82b5f8baf5423620 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 24 Feb 2025 00:23:27 +0900 Subject: [PATCH 35/39] =?UTF-8?q?[#198]=20ReviewListTableViewHeader=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EA=B9=A8=EC=A7=90=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainReviewView/Component/ReviewListTableViewHeader.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift index e78af6ae..a44c4c16 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewHeader.swift @@ -59,8 +59,8 @@ final class ReviewListTableViewHeader: UITableViewHeaderFooterView { $0.height.equalTo(90) } reviewThumbnailImageView.snp.makeConstraints { make in - make.height.width.equalTo(82) make.verticalEdges.equalToSuperview().inset(12) + make.width.equalTo(reviewThumbnailImageView.snp.height) } } } From ede59ab2dea4386e07d7add2ae71ce7eb00286e1 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 24 Feb 2025 01:22:03 +0900 Subject: [PATCH 36/39] =?UTF-8?q?[#198]=20ReactionView=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EA=B9=A8=EC=A7=90=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Review/MainReviewView/Component/ReactionView.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift index 929e5b7e..24d7f3b2 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReactionView.swift @@ -14,7 +14,7 @@ final class ReactionView: BaseUIView { // MARK: - UI Components - private let unlikeImageView: UIImageView = { + private let likeImageView: UIImageView = { let imageView = UIImageView(image: EATSSUDesignAsset.Images.like.image) imageView.contentMode = .scaleAspectFit return imageView @@ -28,7 +28,7 @@ final class ReactionView: BaseUIView { }() lazy var stackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [unlikeImageView, likeCountLabel]) + let stackView = UIStackView(arrangedSubviews: [likeImageView, likeCountLabel]) stackView.axis = .horizontal stackView.spacing = 3 return stackView @@ -44,8 +44,5 @@ final class ReactionView: BaseUIView { stackView.snp.makeConstraints { make in make.height.equalTo(20) } - unlikeImageView.snp.makeConstraints { make in - make.width.height.equalTo(12) - } } } From 10c71d7985593ae8d178b5bcf5dcc3ff1aa53d6a Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 24 Feb 2025 01:27:13 +0900 Subject: [PATCH 37/39] =?UTF-8?q?[#198]=20TopStackView=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EA=B9=A8=EC=A7=90=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ReviewListTableViewCell.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift index dc46a82b..81f5b8bd 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift @@ -6,8 +6,8 @@ // import UIKit -import SnapKit +import SnapKit import EATSSUDesign final class ReviewListTableViewCell: BaseTableViewCell { @@ -22,7 +22,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { // MARK: - UI Components - lazy var totalRateView = StarSummaryView() + lazy var starRatingView = StarRatingView() lazy var reactionView = ReactionView() private var dateLabel: UILabel = { @@ -89,7 +89,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { /// (이름 + 닉네임) + 별점 lazy var infoStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [nameMenuStackView, totalRateView]) + let stackView = UIStackView(arrangedSubviews: [nameMenuStackView, starRatingView]) stackView.axis = .vertical stackView.spacing = 4.adjusted stackView.alignment = .leading @@ -183,6 +183,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { override func configureUI() { setCollectionView() contentView.addSubviews(cellStackView) + starRatingView.rating = 4 } override func setLayout() { @@ -199,11 +200,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { cellStackView.snp.makeConstraints { make in make.edges.equalToSuperview() } - - topStackView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(5) - } - + menuChipCollectionView.snp.makeConstraints { make in // make.top.equalTo(dateReportStackView.snp.bottom).offset(8) make.horizontalEdges.equalToSuperview() From 56f95e3736fb8f0840d183906ccccd4c8e6f1fd7 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Tue, 25 Feb 2025 17:31:54 +0900 Subject: [PATCH 38/39] =?UTF-8?q?[#198]=20MenuChipCollectionViewCell=20?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=95=84=EC=9B=83=20=EA=B9=A8=EC=A7=90=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MenuChipCollectionViewCell.swift | 56 +++++++------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift index 133ab93c..48a2e164 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/MenuChipCollectionViewCell.swift @@ -34,9 +34,6 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 10) label.textColor = EATSSUDesignAsset.Color.Main.primary.color label.text = "김치볶음바바바밥" -// label.numberOfLines = 1 -// label.sizeToFit() -// label.frame.size = CGSize(width: CGFloat.greatestFiniteMagnitude, height: 22) return label }() @@ -44,6 +41,7 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { let stackView = UIStackView(arrangedSubviews: [thumbsupImageView, menuLabel]) stackView.axis = .horizontal stackView.spacing = 1 + stackView.alignment = .center stackView.backgroundColor = .green return stackView }() @@ -65,60 +63,44 @@ final class MenuChipCollectionViewCell: UICollectionViewCell { } private func setLayout() { - setupDynamicLayout() - -// menuChipStackView.snp.makeConstraints { make in -// make.edges.equalToSuperview() - -// make.verticalEdges.equalToSuperview().inset(5) -// make.horizontalEdges.equalToSuperview().inset(6) -// } -// menuChipView.snp.makeConstraints { make in -// make.edges.equalToSuperview() -// } thumbsupImageView.snp.makeConstraints { make in - make.width.height.equalTo(10) + make.width.height.equalTo(12) + } + menuLabel.snp.makeConstraints { make in + make.height.greaterThanOrEqualTo(12) + } + menuChipStackView.snp.makeConstraints { make in + make.edges.equalToSuperview().inset(5) + make.height.greaterThanOrEqualTo(12) } - } override func prepareForReuse() { super.prepareForReuse() self.prepare(name: nil) - } - func prepare(name: String?) { - self.menuLabel.text = name - setupDynamicLayout() - } + } + + func prepare(name: String?) { + self.menuLabel.text = name + setupDynamicLayout() + } + private func setupDynamicLayout() { menuLabel.sizeToFit() let viewSize = menuLabel.intrinsicContentSize let width = viewSize.width + 30 let height = viewSize.height + 48 - + menuChipView.snp.remakeConstraints { make in make.width.equalTo(width) make.height.equalTo(height) } - + menuChipStackView.snp.remakeConstraints { make in make.width.equalTo(width) make.height.equalTo(height) } - + layoutIfNeeded() } - -// private func setupDynamicLayout() { -// menuLabel.sizeToFit() -// let viewSize = menuLabel.intrinsicContentSize -// let width = viewSize.width + 58 -// let height = viewSize.height + 48 -//// menuChipStackView.frame.size = CGSize(width: width, height: height) -// menuChipStackView.frame.size = CGSize(width: width, height: height) -// menuChipView.frame.size = CGSize(width: width, height: height) -// -//// menuChipStackView.center = CGPoint(x: width / 2, y: height / 2) -// } - } From bbb49740a6a9db5a5ea2e2d0d2228fd216872ea9 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 3 Mar 2025 19:50:33 +0900 Subject: [PATCH 39/39] =?UTF-8?q?[#198]=20=EB=A0=88=EC=9D=B4=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EC=9E=84=EC=8B=9C=20=EC=88=98=EC=A0=95=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ReviewListTableViewCell.swift | 28 ++------------ .../Component/ReviewSummaryView.swift | 20 ++++++++-- .../Component/StarSummaryView.swift | 1 + .../MainReviewView/MainReviewView.swift | 37 ++++++++++++------ .../WritingReviewModalView.swift | 1 + .../Review/MainReviewViewController.swift | 34 +++++++++++++++++ .../WritingReviewModalViewController.swift | 38 ++++++++++++++++++- 7 files changed, 118 insertions(+), 41 deletions(-) diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift index 81f5b8bd..4203706c 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewListTableViewCell.swift @@ -55,10 +55,10 @@ final class ReviewListTableViewCell: BaseTableViewCell { private var sideButton: BaseButton = { let button = BaseButton() -// button.setImage(EATSSUDesignAsset.Images.icInfo.image, for: .normal) button.setTitleColor(EATSSUDesignAsset.Color.GrayScale.gray400.color, for: .normal) button.titleLabel?.font = .caption2 button.setTitle("신고", for: .normal) +// button.setImage(EATSSUDesignAsset.Images.icInfo.image, for: .normal) button.configuration?.contentInsets = .init(top: 0, leading: 0, bottom: 0, trailing: 15) return button }() @@ -120,7 +120,6 @@ final class ReviewListTableViewCell: BaseTableViewCell { lazy var topStackView: UIStackView = { let stackView = UIStackView(arrangedSubviews: [profileStackView, dateReportStackView]) stackView.axis = .horizontal -// stackView.spacing = 8.adjusted stackView.alignment = .fill stackView.distribution = .fill stackView.backgroundColor = .yellow @@ -141,7 +140,8 @@ final class ReviewListTableViewCell: BaseTableViewCell { private lazy var menuChipCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal - layout.minimumLineSpacing = 50 + // MARK: - TODO + layout.minimumLineSpacing = 4 // layout.minimumInteritemSpacing = 60 let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) cv.dataSource = self @@ -168,8 +168,7 @@ final class ReviewListTableViewCell: BaseTableViewCell { private let dividerView: UIView = { let view = UIView() -// view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray200.color - view.backgroundColor = .red + view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray200.color return view }() @@ -187,48 +186,29 @@ final class ReviewListTableViewCell: BaseTableViewCell { } override func setLayout() { -// profileStackView.snp.makeConstraints { make in -// make.top.equalToSuperview().offset(5) -// make.leading.equalToSuperview().offset(16) -// make.height.equalTo(30) -// } -// -// dateReportStackView.snp.makeConstraints { make in -// make.top.equalTo(profileStackView) -// make.trailing.equalToSuperview().inset(16) -// } cellStackView.snp.makeConstraints { make in make.edges.equalToSuperview() } - menuChipCollectionView.snp.makeConstraints { make in -// make.top.equalTo(dateReportStackView.snp.bottom).offset(8) make.horizontalEdges.equalToSuperview() make.height.equalTo(22) } - contentStackView.snp.makeConstraints { make in -// make.top.equalTo(menuChipCollectionView.snp.bottom) make.horizontalEdges.equalToSuperview() } - foodImageView.snp.makeConstraints { make in make.height.width.equalTo(358) } - sideButton.snp.makeConstraints { make in make.height.equalTo(12.adjusted) } - reactionView.snp.makeConstraints { make in make.horizontalEdges.equalToSuperview() make.height.equalTo(20) } - dividerView.snp.makeConstraints { make in make.height.equalTo(1) } - } override func prepareForReuse() { diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift index 56820ec9..d1b6e782 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/ReviewSummaryView.swift @@ -52,7 +52,7 @@ final class ReviewSummaryView: BaseUIView { label.text = "총 리뷰 수" label.font = .caption2 label.backgroundColor = .red - label.setContentHuggingPriority(.defaultHigh, for: .horizontal) +// label.setContentHuggingPriority(.defaultHigh, for: .horizontal) return label }() @@ -131,8 +131,20 @@ final class ReviewSummaryView: BaseUIView { make.horizontalEdges.equalToSuperview().inset(20.adjusted) make.bottom.equalToSuperview() } - starSummaryView.snp.makeConstraints { make in - make.top.equalToSuperview().offset(20.adjusted) - } +// starSummaryView.snp.makeConstraints { make in +// make.height.equalToSuperview().dividedBy(2.3) +// } +// reviewDistributionStackView.snp.makeConstraints { make in +// make.verticalEdges.equalToSuperview() +// } +// totalReviewStackView.snp.makeConstraints { make in +// make.top.horizontalEdges.equalToSuperview() +// make.height.equalTo(18) +// } +// yAxisStackView.snp.makeConstraints { make in +// make.top.equalTo(totalReviewStackView.snp.bottom) +// make.height.equalTo(90) +// make.bottom.horizontalEdges.equalToSuperview() +// } } } diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift index 5071d559..e87b39eb 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/Component/StarSummaryView.swift @@ -17,6 +17,7 @@ final class StarSummaryView: BaseUIView { private let starImageView: UIImageView = { let imageView = UIImageView() imageView.image = EATSSUDesignAsset.Images.icStarYellow.image + imageView.contentMode = .scaleAspectFit return imageView }() diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift index ab4bfed8..4a36894a 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/MainReviewView.swift @@ -18,8 +18,17 @@ final class MainReviewView: BaseUIView { // MARK: - UI Components - private let scrollView = UIScrollView() - private let contentView = UIView() +// private let scrollView = UIScrollView() + private let scrollView: UIScrollView = { + let sv = UIScrollView() + sv.backgroundColor = .green + return sv + }() + private let contentView: UIView = { + let cv = UIView() + cv.backgroundColor = .gray + return cv + }() /// 리뷰 상단 summary let summaryView = ReviewSummaryView() @@ -30,6 +39,7 @@ final class MainReviewView: BaseUIView { tableView.separatorStyle = .none tableView.backgroundColor = .yellow tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 100 tableView.isScrollEnabled = false return tableView }() @@ -38,6 +48,12 @@ final class MainReviewView: BaseUIView { public let writingReviewButton = ESButton(size: .big, title: "리뷰 작성하기") // MARK: - Functions + var reviewSummaryHeightConstraint: Constraint? + var tableViewHeightConstraint: Constraint? + var a: CGFloat = 1 + + + override func configureUI() { addSubviews( @@ -54,21 +70,21 @@ final class MainReviewView: BaseUIView { override func setLayout() { writingReviewButton.snp.makeConstraints { make in make.horizontalEdges.equalTo(safeAreaLayoutGuide).inset(16) - make.bottom.equalTo(safeAreaLayoutGuide) + make.bottom.equalTo(safeAreaLayoutGuide).inset(5) } scrollView.snp.makeConstraints { make in - make.top.leading.trailing.equalTo(safeAreaLayoutGuide) + make.top.horizontalEdges.equalTo(safeAreaLayoutGuide) make.bottom.equalTo(writingReviewButton.snp.top).offset(-10) } contentView.snp.makeConstraints { make in - make.edges.equalTo(scrollView.contentLayoutGuide) - make.width.equalTo(scrollView.frameLayoutGuide) - // TODO: 수정 필요 - make.height.equalTo(2000) + make.edges.equalToSuperview() + make.width.equalToSuperview() + make.height.equalToSuperview() +// make.bottom.equalTo(tableView.snp.bottom).priority(.low) +// make.height.greaterThanOrEqualTo(scrollView.snp.height) } summaryView.snp.makeConstraints { make in - make.top.equalToSuperview() - make.horizontalEdges.equalToSuperview() + make.top.horizontalEdges.equalToSuperview() } tableView.snp.makeConstraints { make in make.top.equalTo(summaryView.snp.bottom) @@ -76,7 +92,6 @@ final class MainReviewView: BaseUIView { make.bottom.equalToSuperview() } } - } #if DEBUG diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift index d25674fb..f15800ca 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewView/WritingReview/WritingReviewModalView.swift @@ -13,3 +13,4 @@ final class WritingReviewModalView: BaseUIView { } + diff --git a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift index d1e1db7f..f89b8212 100644 --- a/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/MainReviewViewController.swift @@ -24,6 +24,40 @@ final class MainReviewViewController: BaseViewController { setTableView() self.dataSource = ["고구마치즈돈까스", "막국수", "요구르트","김치","수육+겉절이김치참치", "온두부", "국","짜파게티"] mainReviewView.tableView.reloadData() +// mainReviewView.updateReviewSummaryHeight() +// mainReviewView.updateTableViewHeight() + updateReviewSummaryHeight() + updateTableViewHeight() + + } + + var a: CGFloat = 1 + + func updateReviewSummaryHeight() { + mainReviewView.summaryView.layoutIfNeeded() + let height = mainReviewView.summaryView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height + a = height + mainReviewView.reviewSummaryHeightConstraint?.update(offset: height) // 높이 업데이트 + view.layoutIfNeeded() + } + + // MARK: - 테이블뷰 높이 업데이트 +// func updateTableViewHeight() { +// mainReviewView.tableView.layoutIfNeeded() +// let height = mainReviewView.tableView.contentSize.height + a +// debugPrint("tableView height:\(mainReviewView.tableView.contentSize.height)") +// debugPrint("a: \(a)") +// mainReviewView.tableViewHeightConstraint?.update(offset: height) // 높이 업데이트 +// view.layoutIfNeeded() +// } + func updateTableViewHeight() { + DispatchQueue.main.async { + self.mainReviewView.tableView.layoutIfNeeded() + let height = self.mainReviewView.tableView.contentSize.height + debugPrint("tableView height: \(height)") + self.mainReviewView.tableViewHeightConstraint?.update(offset: height) + self.view.layoutIfNeeded() + } } override func configureUI() { diff --git a/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift index d5d85420..3217c473 100644 --- a/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/WritingReviewModalViewController.swift @@ -19,6 +19,10 @@ final class WritingReviewModalViewController: BaseViewController { private var userPickedImage: UIImage? // MARK: - UI Components + + // FIXME: - Menu Feedback View TEST + let menus = ["고구마치즈돈까스", "막국수", "단무지", "요구르트", "파전", "설렁탕"] + private var rateView = RateView() private let imagePickerController = UIImagePickerController() @@ -98,10 +102,33 @@ final class WritingReviewModalViewController: BaseViewController { // let button = UIButton(configuration: config) // return button // }() + +// lazy var sv: UIStackView = { +// let mf = MenuFeedbackView() +// mf.configure(with: "떡국") +// let sv = UIStackView(arrangedSubviews: [mf]) +// sv.axis = .vertical +// return sv +// }() + + let sv: MenuFeedbackView = { + let a = MenuFeedbackView() + a.configure(with: "고구마치즈돈까스") + return a + }() override func viewDidLoad() { super.viewDidLoad() + setDelegate() + + + +// for menu in menus { +// let menuView = MenuFeedbackView() +// menuView.configure(with: menu) +// sv.addSubview(menuView) +// } } override func viewWillAppear(_: Bool) { @@ -120,6 +147,7 @@ final class WritingReviewModalViewController: BaseViewController { titleLabel, questionLabel, rateView, + sv, maximumWordLabel, selectImageButton, userReviewImageView, @@ -144,9 +172,15 @@ final class WritingReviewModalViewController: BaseViewController { make.centerX.equalToSuperview() make.height.equalTo(24) } + + sv.snp.makeConstraints { make in + make.top.equalTo(rateView.snp.bottom).offset(40) + make.horizontalEdges.equalToSuperview().inset(48) + make.height.equalTo(28) + } userReviewTextView.snp.makeConstraints { make in - make.top.equalTo(rateView.snp.bottom).offset(40) + make.top.equalTo(sv.snp.bottom).offset(40) make.leading.equalToSuperview().offset(16) make.trailing.equalToSuperview().offset(-16) make.height.equalTo(181) @@ -192,7 +226,7 @@ final class WritingReviewModalViewController: BaseViewController { @objc func didTappedimageView() { - userReviewImageView.image = nil // 이미지 삭제 + userReviewImageView.image = nil userPickedImage = nil }