1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 13:50:32 +05:30
yattee/Shared/Documents/RecentDocumentsView.swift
2022-12-05 10:13:20 +01:00

37 lines
937 B
Swift

import Defaults
import SwiftUI
struct RecentDocumentsView: View {
var limit = 3
let model = DocumentsModel.shared
var body: some View {
LazyVStack {
if recentDocuments.isEmpty {
NoDocumentsView()
} else {
ForEach(recentDocuments, id: \.absoluteString) { url in
let video = Video.local(model.standardizedURL(url) ?? url)
PlayerQueueRow(
item: PlayerQueueItem(video)
)
.contextMenu {
VideoContextMenuView(video: video)
}
}
}
}
.padding(.horizontal, 15)
}
var recentDocuments: [URL] {
model.recentDocuments(limit)
}
}
struct RecentDocumentsView_Previews: PreviewProvider {
static var previews: some View {
RecentDocumentsView()
}
}