재생 목록 상세

- 삭제 기능 추가
This commit is contained in:
Yu Sung
2024-12-10 03:44:49 +09:00
parent d03fee372a
commit 8d60e500c0
4 changed files with 115 additions and 1 deletions

View File

@@ -15,6 +15,9 @@ struct ContentPlaylistDetailView: View {
@Binding var isShowing: Bool
@Binding var reloadData: Bool
@State private var isShowPopupMenu = false
@State private var isShowDeleteConfirm = false
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 21.3) {
@@ -37,6 +40,7 @@ struct ContentPlaylistDetailView: View {
Image("ic_seemore_vertical_white")
.padding(8)
.onTapGesture {
isShowPopupMenu = true
}
}
.padding(.horizontal, 13.3)
@@ -184,6 +188,61 @@ struct ContentPlaylistDetailView: View {
.onAppear {
viewModel.playlistId = playlistId
}
if isShowPopupMenu {
ZStack {
Color.black
.opacity(0.7)
.ignoresSafeArea()
.onTapGesture { isShowPopupMenu = false }
VStack(spacing: 0) {
Spacer()
HStack(spacing: 13.3) {
Text("삭제")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
Spacer()
}
.padding(.vertical, 8)
.padding(.horizontal, 26.7)
.contentShape(Rectangle())
.onTapGesture {
isShowPopupMenu = false
isShowDeleteConfirm = true
}
.padding(24)
.background(Color.gray22)
.cornerRadius(13.3, corners: [.topLeft, .topRight])
}
}
}
if isShowDeleteConfirm {
ZStack {
Color.black
.opacity(0.7)
.ignoresSafeArea()
.onTapGesture { isShowDeleteConfirm = false }
SodaDialog(
title: "재생 목록 삭제",
desc: viewModel.response != nil ? "\(viewModel.response!.title)을 삭제하시겠습니까?" : "삭제하시겠습니까?",
confirmButtonTitle: "삭제",
confirmButtonAction: {
isShowDeleteConfirm = false
viewModel.deletePlaylist {
reloadData = true
isShowing = false
}
},
cancelButtonTitle: "취소",
cancelButtonAction: { isShowDeleteConfirm = false }
)
}
}
}
}
}