feat(creator): 정렬 팝업을 적용한다

This commit is contained in:
Yu Sung
2026-07-04 17:11:19 +09:00
parent c4c18341a6
commit 0dd111f5d6
10 changed files with 306 additions and 161 deletions

View File

@@ -7,7 +7,7 @@ struct CreatorChannelLiveTabView: View {
let onTapContent: (Int) -> Void
@StateObject private var viewModel = CreatorChannelLiveViewModel()
@State private var isSortSheetPresented = false
@State private var isSortPopupPresented = false
var body: some View {
content
@@ -17,12 +17,6 @@ struct CreatorChannelLiveTabView: View {
viewModel.fetchFirstPage(creatorId: creatorId)
}
}
.sheet(isPresented: $isSortSheetPresented) {
CreatorChannelSortBottomSheet(selectedSort: viewModel.selectedSort) { sort in
viewModel.selectSort(sort, creatorId: creatorId)
isSortSheetPresented = false
}
}
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1)
}
@@ -31,36 +25,65 @@ struct CreatorChannelLiveTabView: View {
if isEmptyState {
emptyStateView
} else {
CreatorChannelSortBar(
selectedSort: viewModel.selectedSort,
onTapSort: {
isSortSheetPresented = true
}
)
ZStack(alignment: .topTrailing) {
VStack(spacing: 0) {
CreatorChannelSortBar(
selectedSort: viewModel.selectedSort,
totalCount: viewModel.response?.liveReplayContentCount,
onTapSort: {
isSortPopupPresented.toggle()
}
)
LazyVStack(spacing: 0) {
CreatorChannelCurrentLiveSection(
currentLive: viewModel.response?.currentLive,
onTapLive: onTapLive
)
.padding(.top, SodaSpacing.s14)
.padding(.bottom, SodaSpacing.s12)
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)
ForEach(viewModel.liveReplayContents) { audioContent in
CreatorChannelAudioContentListItem(audioContent: audioContent) {
onTapContent(audioContent.audioContentId)
}
.onAppear {
viewModel.fetchNextPageIfNeeded(creatorId: creatorId, currentItem: audioContent)
}
}
if viewModel.isLoadingNextPage {
ProgressView()
.padding(.vertical, SodaSpacing.s20)
}
}
.padding(.bottom, isOwnCreatorChannel ? 70 : SodaSpacing.s20)
}
if viewModel.isLoadingNextPage {
ProgressView()
.padding(.vertical, SodaSpacing.s20)
if isSortPopupPresented {
Color.black
.opacity(0.001)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onTapGesture {
isSortPopupPresented = false
}
CreatorChannelSortContextPopup(selectedSort: viewModel.selectedSort) { sort in
viewModel.selectSort(sort, creatorId: creatorId)
isSortPopupPresented = false
}
.padding(.top, 52)
.padding(.trailing, SodaSpacing.s14)
.zIndex(1)
}
}
.padding(.bottom, isOwnCreatorChannel ? 70 : SodaSpacing.s20)
.frame(maxWidth: .infinity, alignment: .topTrailing)
.onChange(of: viewModel.selectedSort) { _ in
isSortPopupPresented = false
}
.onDisappear {
isSortPopupPresented = false
}
}
}
}