feat(main): 라이브 전체 진입을 추가한다
This commit is contained in:
@@ -3546,6 +3546,10 @@ If you block this user, the following features will be restricted.
|
||||
pick(ko: "현재 라이브", en: "Live now", ja: "現在ライブ")
|
||||
}
|
||||
|
||||
static var liveAll: String {
|
||||
pick(ko: "전체", en: "All", ja: "すべて")
|
||||
}
|
||||
|
||||
static var activeCreatorSectionTitle: String {
|
||||
pick(ko: "방금 활동한 크리에이터", en: "Recently active creators", ja: "最近活動したクリエイター")
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ struct MainHomeView: View {
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapBanner: (RecommendationBannerResponse) -> Void
|
||||
let onTapLiveAll: () -> Void
|
||||
let onTapFollowAll: (@escaping () -> Void) -> Void
|
||||
let onSelectFollowingTab: () -> Bool
|
||||
let onTapFollowingLogin: () -> Void
|
||||
@@ -71,6 +72,7 @@ struct MainHomeView: View {
|
||||
onTapCharacter: onTapCharacter,
|
||||
onTapCommunityPost: onTapCommunityPost,
|
||||
onTapBanner: onTapBanner,
|
||||
onTapLiveAll: onTapLiveAll,
|
||||
onTapFollowAll: onTapFollowAll
|
||||
)
|
||||
case .ranking:
|
||||
@@ -120,6 +122,7 @@ struct MainHomeView_Previews: PreviewProvider {
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunityPost: { _ in },
|
||||
onTapBanner: { _ in },
|
||||
onTapLiveAll: {},
|
||||
onTapFollowAll: { action in action() },
|
||||
onSelectFollowingTab: { true },
|
||||
onTapFollowingLogin: {},
|
||||
|
||||
@@ -3,6 +3,7 @@ import SwiftUI
|
||||
struct MainHomeLiveSection: View {
|
||||
let items: [HomeLiveItem]
|
||||
let onTapLive: (Int) -> Void
|
||||
let onTapAll: () -> Void
|
||||
|
||||
var body: some View {
|
||||
if !items.isEmpty {
|
||||
@@ -11,6 +12,8 @@ struct MainHomeLiveSection: View {
|
||||
ForEach(items, id: \.self) { item in
|
||||
MainHomeLiveItemView(item: item, onTapLive: onTapLive)
|
||||
}
|
||||
|
||||
MainHomeLiveAllItemView(onTapAll: onTapAll)
|
||||
}
|
||||
.padding(.horizontal, SodaSpacing.s20)
|
||||
}
|
||||
@@ -54,6 +57,27 @@ private struct MainHomeLiveItemView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private struct MainHomeLiveAllItemView: View {
|
||||
let onTapAll: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Button(action: onTapAll) {
|
||||
VStack(alignment: .center, spacing: SodaSpacing.s6) {
|
||||
Circle()
|
||||
.fill(Color.gray800)
|
||||
.frame(width: 70, height: 70)
|
||||
.overlay {
|
||||
Text(I18n.HomeRecommendation.liveAll)
|
||||
.appFont(.body4)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
.frame(width: 70, height: 102, alignment: .top)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeLiveSection_Previews: PreviewProvider {
|
||||
private static let previewImageUrl = "https://picsum.photos/500/500"
|
||||
|
||||
@@ -72,7 +96,8 @@ struct MainHomeLiveSection_Previews: PreviewProvider {
|
||||
HomeLiveItem(roomId: 1, creatorNickname: "설린", creatorProfileImage: previewImageUrl),
|
||||
HomeLiveItem(roomId: 2, creatorNickname: "크리에이터", creatorProfileImage: previewImageUrl)
|
||||
],
|
||||
onTapLive: { _ in }
|
||||
onTapLive: { _ in },
|
||||
onTapAll: {}
|
||||
)
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
|
||||
@@ -7,6 +7,7 @@ struct MainHomeRecommendationView: View {
|
||||
let onTapCharacter: (Int) -> Void
|
||||
let onTapCommunityPost: (Int) -> Void
|
||||
let onTapBanner: (RecommendationBannerResponse) -> Void
|
||||
let onTapLiveAll: () -> Void
|
||||
let onTapFollowAll: (@escaping () -> Void) -> Void
|
||||
|
||||
@StateObject private var viewModel = MainHomeRecommendationViewModel()
|
||||
@@ -25,7 +26,8 @@ struct MainHomeRecommendationView: View {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s24) {
|
||||
MainHomeLiveSection(
|
||||
items: viewModel.recommendations?.lives ?? [],
|
||||
onTapLive: onTapLive
|
||||
onTapLive: onTapLive,
|
||||
onTapAll: onTapLiveAll
|
||||
)
|
||||
|
||||
MainHomeBannerSection(
|
||||
@@ -122,6 +124,7 @@ struct MainHomeRecommendationView_Previews: PreviewProvider {
|
||||
onTapCharacter: { _ in },
|
||||
onTapCommunityPost: { _ in },
|
||||
onTapBanner: { _ in },
|
||||
onTapLiveAll: {},
|
||||
onTapFollowAll: { action in action() }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ struct MainView: View {
|
||||
onTapCharacter: handleRecommendationCreatorTap,
|
||||
onTapCommunityPost: handleRecommendationCommunityPostTap,
|
||||
onTapBanner: handleRecommendationBannerTap,
|
||||
onTapLiveAll: handleRecommendationLiveAllTap,
|
||||
onTapFollowAll: handleRecommendationFollowAllTap,
|
||||
onSelectFollowingTab: handleFollowingTabSelection,
|
||||
onTapFollowingLogin: handleFollowingLoginTap,
|
||||
@@ -483,6 +484,10 @@ struct MainView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func handleRecommendationLiveAllTap() {
|
||||
appState.setAppStep(step: .liveNowAll(onClickParticipant: handleRecommendationLiveTap))
|
||||
}
|
||||
|
||||
private func handleRecommendationCreatorTap(creatorId: Int) {
|
||||
guard creatorId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
|
||||
Reference in New Issue
Block a user