feat(creator): 라이브 탭 빈 상태를 추가한다
This commit is contained in:
@@ -3165,6 +3165,14 @@ If you block this user, the following features will be restricted.
|
||||
enum CreatorChannelLive {
|
||||
static var totalLabel: String { pick(ko: "전체", en: "Total", ja: "全体") }
|
||||
static var startLive: String { pick(ko: "라이브 시작하기", en: "Start live", ja: "ライブを開始") }
|
||||
static var emptyMessage: String {
|
||||
pick(
|
||||
ko: "크리에이터가 라이브를 준비중입니다.\n기대해 주세요!",
|
||||
en: "The creator is preparing a live.\nPlease stay tuned!",
|
||||
ja: "クリエイターがライブを準備中です。\nお楽しみに!"
|
||||
)
|
||||
}
|
||||
|
||||
enum Sort {
|
||||
static var latest: String { pick(ko: "최신순", en: "Latest", ja: "最新順") }
|
||||
static var popular: String { pick(ko: "인기순", en: "Popular", ja: "人気順") }
|
||||
|
||||
@@ -28,38 +28,56 @@ struct CreatorChannelLiveTabView: View {
|
||||
|
||||
private var content: some View {
|
||||
VStack(spacing: 0) {
|
||||
CreatorChannelSortBar(
|
||||
selectedSort: viewModel.selectedSort,
|
||||
onTapSort: {
|
||||
isSortSheetPresented = true
|
||||
}
|
||||
)
|
||||
|
||||
LazyVStack(spacing: 0) {
|
||||
CreatorChannelCurrentLiveSection(
|
||||
currentLive: viewModel.response?.currentLive,
|
||||
onTapLive: onTapLive
|
||||
if isEmptyState {
|
||||
emptyStateView
|
||||
} else {
|
||||
CreatorChannelSortBar(
|
||||
selectedSort: viewModel.selectedSort,
|
||||
onTapSort: {
|
||||
isSortSheetPresented = true
|
||||
}
|
||||
)
|
||||
.padding(.top, SodaSpacing.s14)
|
||||
.padding(.bottom, SodaSpacing.s12)
|
||||
|
||||
ForEach(viewModel.liveReplayContents) { audioContent in
|
||||
CreatorChannelAudioContentListItem(audioContent: audioContent) {
|
||||
onTapContent(audioContent.audioContentId)
|
||||
LazyVStack(spacing: 0) {
|
||||
CreatorChannelCurrentLiveSection(
|
||||
currentLive: viewModel.response?.currentLive,
|
||||
onTapLive: onTapLive
|
||||
)
|
||||
.padding(.top, SodaSpacing.s14)
|
||||
.padding(.bottom, SodaSpacing.s12)
|
||||
|
||||
ForEach(viewModel.liveReplayContents) { audioContent in
|
||||
CreatorChannelAudioContentListItem(audioContent: audioContent) {
|
||||
onTapContent(audioContent.audioContentId)
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.fetchNextPageIfNeeded(creatorId: creatorId, currentItem: audioContent)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.fetchNextPageIfNeeded(creatorId: creatorId, currentItem: audioContent)
|
||||
|
||||
if viewModel.isLoadingNextPage {
|
||||
ProgressView()
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isLoadingNextPage {
|
||||
ProgressView()
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
}
|
||||
.padding(.bottom, isOwnCreatorChannel ? 70 : SodaSpacing.s20)
|
||||
}
|
||||
.padding(.bottom, isOwnCreatorChannel ? 70 : SodaSpacing.s20)
|
||||
}
|
||||
}
|
||||
|
||||
private var isEmptyState: Bool {
|
||||
guard viewModel.hasLoaded, let response = viewModel.response else { return false }
|
||||
return response.currentLive == nil && response.liveReplayContentCount == 0
|
||||
}
|
||||
|
||||
private var emptyStateView: some View {
|
||||
Text(I18n.CreatorChannelLive.emptyMessage)
|
||||
.appFont(.body3)
|
||||
.foregroundColor(Color.gray500)
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
}
|
||||
}
|
||||
|
||||
struct CreatorChannelLiveTabView_Previews: PreviewProvider {
|
||||
|
||||
Reference in New Issue
Block a user