fix date view

This commit is contained in:
anlicheng 2025-02-20 16:31:05 +08:00
parent 7a1d545506
commit 3d6709c2c7

View File

@ -51,6 +51,9 @@ struct IndexView: View {
@State var dramas: [DramaItem] = []
@State var showUpdateDramas: [UpdateDramaShowItem] = []
@State var isLoading: Bool = false
//
@State private var showDateNavPopover: Bool = false
var body: some View {
VStack(alignment: .center) {
@ -78,7 +81,7 @@ struct IndexView: View {
ScrollView(.vertical, showsIndicators: false) {
LazyVStack {
ForEach(showUpdateDramas.indices, id: \.self) { index in
UpdateDramaCellView(showItem: showUpdateDramas[index])
UpdateDramaCellView(showItem: showUpdateDramas[index], showDateNavPopover: $showDateNavPopover)
}
}
@ -103,7 +106,9 @@ struct IndexView: View {
ProgressView()
}
}
.popover(isPresented: $showDateNavPopover) {
DateNavView()
}
}
.task {
let response = await API.getIndexData(as: IndexResponse.self)
@ -207,12 +212,15 @@ extension IndexView {
struct UpdateDramaCellView: View {
let showItem: UpdateDramaShowItem
@Binding var showDateNavPopover: Bool
var body: some View {
switch showItem {
case .lable(let name):
Text(name)
.onTapGesture {
showDateNavPopover = true
}
case .item(let item):
VStack(alignment: .center) {
AsyncImage(url: URL(string: item.thumb)) { image in