Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ”€ :: (#1285) 참여정보(ν¬λ ˆλ”§) > 데이터 없을 λ•Œ UI 처리 #1286

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
✨ :: [#1285] 데이터 없을 λ•Œ UI 처리
  • Loading branch information
KangTaeHoon committed Sep 2, 2024
commit 80540b5d0d33c583e8885ba40bf8472a37521368
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,26 @@ final class SongCreditViewController: BaseReactorViewController<SongCreditReacto
$0.clipsToBounds = true
}

private let warningView = UIView().then {
$0.isHidden = true
}

private let warningImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.image = DesignSystemAsset.LyricHighlighting.errorDark.image
}

private let warningLabel = WMLabel(
text: "μ°Έμ—¬ 정보가 μ—†μŠ΅λ‹ˆλ‹€.",
textColor: DesignSystemAsset.BlueGrayColor.blueGray200.color,
font: .t6(weight: .light),
alignment: .center,
lineHeight: UIFont.WMFontSystem.t6(weight: .light).lineHeight
).then {
$0.numberOfLines = 0
$0.preferredMaxLayoutWidth = APP_WIDTH() - 40
}

private let dimmedBackgroundView = UIView()
private var dimmedGridentLayer: DimmedGradientLayer?
private let wmNavigationbarView = WMNavigationBarView()
Expand Down Expand Up @@ -104,7 +124,14 @@ final class SongCreditViewController: BaseReactorViewController<SongCreditReacto
}

override func addView() {
view.addSubviews(backgroundImageView, dimmedBackgroundView, songCreditCollectionView, wmNavigationbarView)
view.addSubviews(
backgroundImageView,
dimmedBackgroundView,
songCreditCollectionView,
wmNavigationbarView,
warningView
)
warningView.addSubviews(warningImageView, warningLabel)
}

override func setLayout() {
Expand All @@ -126,6 +153,23 @@ final class SongCreditViewController: BaseReactorViewController<SongCreditReacto
$0.horizontalEdges.equalToSuperview()
$0.height.equalTo(48)
}

warningView.snp.makeConstraints {
$0.top.equalToSuperview().offset(APP_HEIGHT() * ((294.0 - 6.0) / 812.0))
$0.centerX.equalToSuperview()
}

warningImageView.snp.makeConstraints {
$0.top.equalToSuperview()
$0.horizontalEdges.equalToSuperview()
$0.centerX.equalToSuperview()
}

warningLabel.snp.makeConstraints {
$0.top.equalTo(warningImageView.snp.bottom).offset(-2)
$0.horizontalEdges.equalToSuperview()
$0.bottom.equalToSuperview()
}
}

override func configureNavigation() {
Expand Down Expand Up @@ -161,8 +205,10 @@ final class SongCreditViewController: BaseReactorViewController<SongCreditReacto
let sharedState = reactor.state.share()

sharedState.map(\.credits)
.skip(1)
.distinctUntilChanged()
.bind { [creditDiffableDataSource] credits in
.bind { [creditDiffableDataSource, warningView] credits in
warningView.isHidden = !credits.isEmpty
var snapshot = NSDiffableDataSourceSnapshot<SectionType, ItemType>()
snapshot.appendSections(credits.map(\.position))
credits.forEach { snapshot.appendItems($0.names, toSection: $0.position) }
Expand Down
Loading